import { w as writable, g as getContext } from './async-Mo2Ia14K.js';
import { h as head, a as attr, e as ensure_array_like, s as store_get, b as spread_props, u as unsubscribe_stores } from './index-D1Ptw7Az.js';
import { r as run } from './legacy-server-Dp_ZJqO4.js';
import { j } from './Embed-nr914GT1.js';
import { E as Es, p as pr } from './2-B89dC7Mi.js';
import { e, s } from './dev-fallback-Bc5Ork7Y.js';
import { A } from './client2-BY4wAD6N.js';
import { a } from './index5-BoOEKc6P.js';
import 'path';
import 'url';
import 'fs';
import './spring-DE8vsW2o.js';
import './exports-x88-il4G.js';

const H=()=>{const e=s?A:getContext("__svelte__");return {page:{subscribe:e.page.subscribe},navigating:{subscribe:e.navigating.subscribe},updated:e.updated}},de={subscribe(e$1){return (e?ue("page"):H().page).subscribe(e$1)}};function ue(e){try{return H()[e]}catch{throw new Error(`Cannot subscribe to '${e}' store on the server outside of a Svelte component, as it is bound to the current request via component context. This prevents state from leaking between users.For more information, see https://svelte.dev/docs/kit/state-management#avoid-shared-state-on-the-server`)}}var pe=()=>{const e=document.createElement("link");e.href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:ital,wght@0,200;0,300;0,400;0,600;0,700;0,900;1,200;1,300;1,400;1,600;1,700;1,900&display=swap",e.rel="stylesheet";const t=document.createElement("link");t.href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;600;700&display=swap",t.rel="stylesheet",document.head.appendChild(e),document.head.appendChild(t);},he=()=>{const e=document.createElement("div");return e.style.backgroundImage="linear-gradient(to top, #f9fafb, white)",e.style.border="1px solid #e5e7eb",e.style.borderRadius="0.75rem",e.style.boxShadow="0 0 10px rgba(0, 0, 0, 0.1)",e.style.color="#374151",e.style.display="flex",e.style.flexDirection="row",e.style.alignItems="center",e.style.height="40px",e.style.justifyContent="space-between",e.style.overflow="hidden",e.style.position="fixed",e.style.right=".75rem",e.style.top=".75rem",e.style.width="auto",e.style.zIndex="20",e.style.paddingLeft="1rem",e.setAttribute("id","huggingface-space-header"),window.matchMedia("(max-width: 768px)").addEventListener("change",t=>{t.matches?e.style.display="none":e.style.display="flex";}),e},me=()=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.setAttribute("xmlns:link","http://www.w3.org/1999/xlink"),e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false"),e.setAttribute("role","img"),e.setAttribute("width","1em"),e.setAttribute("height","1em"),e.setAttribute("preserveAspectRatio","xMidYMid meet"),e.setAttribute("viewBox","0 0 12 12"),e.setAttribute("fill","currentColor");const t=document.createElementNS("http://www.w3.org/2000/svg","path");return t.setAttribute("d","M0.375001 10.3828L0.375 1.61719C0.375 1.104 0.816001 0.687501 1.35938 0.687501L10.6406 0.6875C10.9017 0.6875 11.1521 0.785449 11.3367 0.959797C11.5213 1.13415 11.625 1.37062 11.625 1.61719V10.3828C11.625 10.6294 11.5213 10.8659 11.3367 11.0402C11.1521 11.2145 10.9017 11.3125 10.6406 11.3125H1.35938C0.816001 11.3125 0.375001 10.896 0.375001 10.3828ZM1.35938 10.5156H10.6406C10.7183 10.5156 10.7813 10.4561 10.7813 10.3828V4.40625H1.21875V10.3828C1.21875 10.418 1.23356 10.4518 1.25994 10.4767C1.28631 10.5017 1.32208 10.5156 1.35938 10.5156ZM4.61052 6.38251L5.9999 7.69472L7.38927 6.38251C7.44083 6.33007 7.50645 6.29173 7.57913 6.27153C7.6518 6.25134 7.72898 6.25003 7.8024 6.26776C7.87583 6.28549 7.9428 6.3216 7.99628 6.37227C8.04983 6.42295 8.08785 6.48631 8.10645 6.5557C8.12528 6.62497 8.12393 6.69773 8.10263 6.76635C8.0814 6.83497 8.0409 6.8969 7.98555 6.94564L6.29802 8.53936C6.21892 8.61399 6.11169 8.65592 5.9999 8.65592C5.8881 8.65592 5.78087 8.61399 5.70177 8.53936L4.01427 6.94564C3.95874 6.89694 3.91814 6.835 3.89676 6.76633C3.87538 6.69766 3.874 6.62483 3.89277 6.55549C3.91154 6.48615 3.94977 6.42287 4.00343 6.37233C4.05708 6.32179 4.12418 6.28585 4.19765 6.2683C4.27098 6.25054 4.34803 6.25178 4.42068 6.27188C4.49334 6.29198 4.55891 6.3302 4.61052 6.38251Z"),e.appendChild(t),e},fe=(e,t)=>{const n=document.createElement("div");return n.setAttribute("id","space-header__collapse"),n.style.display="flex",n.style.flexDirection="row",n.style.alignItems="center",n.style.justifyContent="center",n.style.fontSize="16px",n.style.paddingLeft="10px",n.style.paddingRight="10px",n.style.height="40px",n.style.cursor="pointer",n.style.color="#40546e",n.style.transitionDuration="0.1s",n.style.transitionProperty="all",n.style.transitionTimingFunction="ease-in-out",n.appendChild(me()),n.addEventListener("click",r=>{r.preventDefault(),r.stopPropagation(),t();}),n.addEventListener("mouseenter",()=>{n.style.color="#213551";}),n.addEventListener("mouseleave",()=>{n.style.color="#40546e";}),n},ge=e=>{const t=document.createElement("p");return t.style.margin="0",t.style.padding="0",t.style.color="#9ca3af",t.style.fontSize="14px",t.style.fontFamily="Source Sans Pro, sans-serif",t.style.padding="0px 6px",t.style.borderLeft="1px solid #e5e7eb",t.style.marginLeft="4px",t.textContent=(e??0).toString(),t},ye=()=>{const e=document.createElementNS("http://www.w3.org/2000/svg","svg");e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e.setAttribute("xmlns:link","http://www.w3.org/1999/xlink"),e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false"),e.setAttribute("role","img"),e.setAttribute("width","1em"),e.setAttribute("height","1em"),e.setAttribute("preserveAspectRatio","xMidYMid meet"),e.setAttribute("viewBox","0 0 32 32"),e.setAttribute("fill","#6b7280");const t=document.createElementNS("http://www.w3.org/2000/svg","path");return t.setAttribute("d","M22.45,6a5.47,5.47,0,0,1,3.91,1.64,5.7,5.7,0,0,1,0,8L16,26.13,5.64,15.64a5.7,5.7,0,0,1,0-8,5.48,5.48,0,0,1,7.82,0L16,10.24l2.53-2.58A5.44,5.44,0,0,1,22.45,6m0-2a7.47,7.47,0,0,0-5.34,2.24L16,7.36,14.89,6.24a7.49,7.49,0,0,0-10.68,0,7.72,7.72,0,0,0,0,10.82L16,29,27.79,17.06a7.72,7.72,0,0,0,0-10.82A7.49,7.49,0,0,0,22.45,4Z"),e.appendChild(t),e},_e=e=>{const t=document.createElement("a");return t.setAttribute("href",`https://huggingface.co/spaces/${e.id}`),t.setAttribute("rel","noopener noreferrer"),t.setAttribute("target","_blank"),t.style.border="1px solid #e5e7eb",t.style.borderRadius="6px",t.style.display="flex",t.style.flexDirection="row",t.style.alignItems="center",t.style.margin="0 0 0 12px",t.style.fontSize="14px",t.style.paddingLeft="4px",t.style.textDecoration="none",t.appendChild(ye()),t.appendChild(ge(e.likes)),t},we=(e,t="user")=>{const n=t==="user"?"users":"organizations",r=document.createElement("img");return r.src=`https://huggingface.co/api/${n}/${e}/avatar`,r.style.width="0.875rem",r.style.height="0.875rem",r.style.borderRadius="50%",r.style.flex="none",r.style.marginRight="0.375rem",r},be=e=>{const[t,n]=e.split("/"),r=document.createElement("a");return r.setAttribute("href",`https://huggingface.co/spaces/${e}`),r.setAttribute("rel","noopener noreferrer"),r.setAttribute("target","_blank"),r.style.color="#1f2937",r.style.textDecoration="none",r.style.fontWeight="600",r.style.fontSize="15px",r.style.lineHeight="24px",r.style.flex="none",r.style.fontFamily="IBM Plex Mono, sans-serif",r.addEventListener("mouseover",()=>{r.style.color="#2563eb";}),r.addEventListener("mouseout",()=>{r.style.color="#1f2937";}),r.textContent=n,r},ve=()=>{const e=document.createElement("div");return e.style.marginLeft=".125rem",e.style.marginRight=".125rem",e.style.color="#d1d5db",e.textContent="/",e},xe=e=>{const t=document.createElement("a");return t.setAttribute("href",`https://huggingface.co/${e}`),t.setAttribute("rel","noopener noreferrer"),t.setAttribute("target","_blank"),t.style.color="rgb(107, 114, 128)",t.style.textDecoration="none",t.style.fontWeight="400",t.style.fontSize="16px",t.style.lineHeight="24px",t.style.flex="none",t.style.fontFamily="Source Sans Pro, sans-serif",t.addEventListener("mouseover",()=>{t.style.color="#2563eb";}),t.addEventListener("mouseout",()=>{t.style.color="rgb(107, 114, 128)";}),t.textContent=e,t},Ce=e=>{const t=document.createElement("div");return t.style.display="flex",t.style.flexDirection="row",t.style.alignItems="center",t.style.justifyContent="center",t.style.borderRight="1px solid #e5e7eb",t.style.paddingRight="12px",t.style.height="40px",e.type!=="unknown"&&t.appendChild(we(e.author,e.type)),t.appendChild(xe(e.author)),t.appendChild(ve()),t.appendChild(be(e.id)),t.appendChild(_e(e)),t},Ee=e=>{const t=he(),n=()=>t.style.display="none";return t.appendChild(Ce(e)),t.appendChild(fe(e,n)),t},q=async(e,t="user")=>{const n=t==="user"?"users":"organizations";try{return (await fetch(`https://huggingface.co/api/${n}/${e}/avatar`)).ok}catch{return  false}},Ae=async e=>{try{return await(await fetch(`https://huggingface.co/api/spaces/${e}`)).json()}catch{return null}},Le=(e,t)=>{if(document.body===null)return console.error("document.body is null");document.body.appendChild(e);};async function ke(e,t){if(window===void 0)return console.error("Please run this script in a browser environment");if(Object.values(window.location?.ancestorOrigins??{0:window.document.referrer}).some(w=>new URL(w)?.origin==="https://huggingface.co"))return;pe();let r;if(typeof e=="string"){if(r=await Ae(e),r===null)return console.error("Space not found")}else r=e;const[f,h]=await Promise.all([q(r.author,"user"),q(r.author,"org")]);r.type=f?"user":h?"org":"unknown";const c=Ee(r);return Le(c),{element:c}}var Se=(e,t)=>ke(e);function He(e,t){e.component(n=>{var r;let {data:c,autoscroll:w=false,version:M="6-4-0",initial_height:O,app_mode:R=true,is_embed:g=false,theme_mode:W=null,control_page_title:T=true,container:V,space:D}=t;function Z(l){let s;const i=new URL(window.location.toString()).searchParams.get("__theme");return s=W||i||"system",s==="dark"||s==="light"?N(l,s):s=J(l),s}function J(l){const s=a();window?.matchMedia("(prefers-color-scheme: dark)")?.addEventListener("change",a);function a(){let i=window?.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light";return N(l,i),i}return s}function N(l,s){const a=g?l.parentElement:document.body,i=g?l:l.parentElement;i.style.background="var(--body-background-fill)",a.classList.add("theme-loaded"),s==="dark"?a.classList.add("dark"):a.classList.remove("dark");}let P;a&&(P=Z(document.body));let K="complete",b,z=false,A=false;({subscribe:writable({}).subscribe});let p=c.app;let L=false,I=false;Es().then(()=>{I=true;});let v;let x;async function X(l,s){if(l&&!s&&window.self===window.top){x&&(x.remove(),x=void 0);const a=await Se(l);a&&(x=a.element);}}let o=c.config,$=(()=>{if(!a)return o.root;const l=new URL(window.location.toString()),s=new URL(o.root);return new URL(s.pathname,l).toString()})();run(()=>{o?.app_id&&o.app_id;}),run(()=>{v&&L&&(v("Error","Deep link was not valid",-1,"error",10,true),L=false);}),run(()=>{A&&b.dispatchEvent(new CustomEvent("render",{bubbles:true,cancelable:false,composed:true}));}),run(()=>{p?.config&&a&&X(p?.config?.space_id,g);});let y=true,k;function ee(l){head("1gmqcbx",l,s$1=>{if(s$1.push(`<link rel="stylesheet"${attr("href",$+"/theme.css?v="+o?.theme_hash)}/> `),o?.stylesheets){s$1.push("<!--[-->"),s$1.push("<!--[-->");const a=ensure_array_like(o.stylesheets);for(let i=0,d=a.length;i<d;i++){let u=a[i];u.startsWith("http:")||u.startsWith("https:")?(s$1.push("<!--[-->"),s$1.push(`<link rel="stylesheet"${attr("href",u)}/>`)):s$1.push("<!--[!-->"),s$1.push("<!--]-->");}s$1.push("<!--]-->");}else s$1.push("<!--[!-->");s$1.push('<!--]--> <link rel="manifest" href="/manifest.json"/>');}),j(l,{display:V&&g,is_embed:g,info:false,version:M,initial_height:O,space:D,pages:o.pages,current_page:o.current_page,root:o.root,components:o.components,loaded:K==="complete",fill_width:o?.fill_width||false,get wrapper(){return b},set wrapper(s){b=s,y=false;},children:s$1=>{o?.auth_required?(s$1.push("<!--[-->"),s$1.push("<!---->"),c.Render(s$1,{auth_message:o.auth_message,root:o.root,space_id:D,app_mode:R,i18n:I?store_get(r??={},"$_",pr):a=>a}),s$1.push("<!---->")):(s$1.push("<!--[!-->"),o&&p?(s$1.push("<!--[-->"),s$1.push("<!---->"),c.Render(s$1,spread_props([{app:p},o,{fill_height:!g&&o.fill_height,theme_mode:P,control_page_title:T,target:b,autoscroll:w,footer_links:g?[]:o.footer_links,app_mode:R,version:M,search_params:store_get(r??={},"$page",de).url.searchParams,initial_layout:c.layout,get ready(){return z},set ready(a){z=a,y=false;},get render_complete(){return A},set render_complete(a){A=a,y=false;},get add_new_message(){return v},set add_new_message(a){v=a,y=false;}}])),s$1.push("<!---->")):s$1.push("<!--[!-->"),s$1.push("<!--]-->")),s$1.push("<!--]-->");},$$slots:{default:true}});}do y=true,k=n.copy(),ee(k);while(!y);n.subsume(k),r&&unsubscribe_stores(r);});}

export { He as default };
//# sourceMappingURL=_page.svelte-BkdspukR.js.map
