kwabs22 commited on
Commit
200369d
1 Parent(s): 2134de6

Test basic api use

Browse files
assets/__vite-browser-external-XPXQPciS.js ADDED
@@ -0,0 +1 @@
 
 
1
+ const e={};export{e as default};
assets/index-nhhIhy04.js ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ var wt=Object.defineProperty;var yt=(e,t,n)=>t in e?wt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ne=(e,t,n)=>(yt(e,typeof t!="symbol"?t+"":t,n),n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))s(r);new MutationObserver(r=>{for(const o of r)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&s(i)}).observe(document,{childList:!0,subtree:!0});function n(r){const o={};return r.integrity&&(o.integrity=r.integrity),r.referrerPolicy&&(o.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?o.credentials="include":r.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function s(r){if(r.ep)return;r.ep=!0;const o=n(r);fetch(r.href,o)}})();function Q(){}function it(e){return e()}function Ge(){return Object.create(null)}function ce(e){e.forEach(it)}function at(e){return typeof e=="function"}function Ue(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}function vt(e){return Object.keys(e).length===0}function L(e,t){e.appendChild(t)}function A(e,t,n){e.insertBefore(t,n||null)}function C(e){e.parentNode&&e.parentNode.removeChild(e)}function B(e){return document.createElement(e)}function J(e){return document.createTextNode(e)}function M(){return J(" ")}function bt(){return J("")}function me(e,t,n,s){return e.addEventListener(t,n,s),()=>e.removeEventListener(t,n,s)}function ae(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function $t(e){return Array.from(e.childNodes)}function le(e,t){t=""+t,e.data!==t&&(e.data=t)}function pe(e,t){e.value=t??""}let Ie;function ue(e){Ie=e}const te=[],We=[];let ne=[];const Ve=[],St=Promise.resolve();let Pe=!1;function Et(){Pe||(Pe=!0,St.then(lt))}function Ce(e){ne.push(e)}const ke=new Set;let ee=0;function lt(){if(ee!==0)return;const e=Ie;do{try{for(;ee<te.length;){const t=te[ee];ee++,ue(t),Ot(t.$$)}}catch(t){throw te.length=0,ee=0,t}for(ue(null),te.length=0,ee=0;We.length;)We.pop()();for(let t=0;t<ne.length;t+=1){const n=ne[t];ke.has(n)||(ke.add(n),n())}ne.length=0}while(te.length);for(;Ve.length;)Ve.pop()();Pe=!1,ke.clear(),ue(e)}function Ot(e){if(e.fragment!==null){e.update(),ce(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(Ce)}}function Nt(e){const t=[],n=[];ne.forEach(s=>e.indexOf(s)===-1?t.push(s):n.push(s)),n.forEach(s=>s()),ne=t}const he=new Set;let kt;function je(e,t){e&&e.i&&(he.delete(e),e.i(t))}function He(e,t,n,s){if(e&&e.o){if(he.has(e))return;he.add(e),kt.c.push(()=>{he.delete(e),s&&(n&&e.d(1),s())}),e.o(t)}else s&&s()}function Ke(e){e&&e.c()}function Ae(e,t,n){const{fragment:s,after_update:r}=e.$$;s&&s.m(t,n),Ce(()=>{const o=e.$$.on_mount.map(it).filter(at);e.$$.on_destroy?e.$$.on_destroy.push(...o):ce(o),e.$$.on_mount=[]}),r.forEach(Ce)}function Te(e,t){const n=e.$$;n.fragment!==null&&(Nt(n.after_update),ce(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function qt(e,t){e.$$.dirty[0]===-1&&(te.push(e),Et(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function Re(e,t,n,s,r,o,i=null,a=[-1]){const p=Ie;ue(e);const l=e.$$={fragment:null,ctx:[],props:o,update:Q,not_equal:r,bound:Ge(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(p?p.$$.context:[])),callbacks:Ge(),dirty:a,skip_bound:!1,root:t.target||p.$$.root};i&&i(l.root);let u=!1;if(l.ctx=n?n(e,t.props||{},(f,d,...h)=>{const $=h.length?h[0]:d;return l.ctx&&r(l.ctx[f],l.ctx[f]=$)&&(!l.skip_bound&&l.bound[f]&&l.bound[f]($),u&&qt(e,f)),d}):[],l.update(),u=!0,ce(l.before_update),l.fragment=s?s(l.ctx):!1,t.target){if(t.hydrate){const f=$t(t.target);l.fragment&&l.fragment.l(f),f.forEach(C)}else l.fragment&&l.fragment.c();t.intro&&je(e.$$.fragment),Ae(e,t.target,t.anchor),lt()}ue(p)}class Fe{constructor(){Ne(this,"$$");Ne(this,"$$set")}$destroy(){Te(this,1),this.$destroy=Q}$on(t,n){if(!at(n))return Q;const s=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return s.push(n),()=>{const r=s.indexOf(n);r!==-1&&s.splice(r,1)}}$set(t){this.$$set&&!vt(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const Dt="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Dt);const Lt="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20aria-hidden='true'%20role='img'%20class='iconify%20iconify--logos'%20width='26.6'%20height='32'%20preserveAspectRatio='xMidYMid%20meet'%20viewBox='0%200%20256%20308'%3e%3cpath%20fill='%23FF3E00'%20d='M239.682%2040.707C211.113-.182%20154.69-12.301%20113.895%2013.69L42.247%2059.356a82.198%2082.198%200%200%200-37.135%2055.056a86.566%2086.566%200%200%200%208.536%2055.576a82.425%2082.425%200%200%200-12.296%2030.719a87.596%2087.596%200%200%200%2014.964%2066.244c28.574%2040.893%2084.997%2053.007%20125.787%2027.016l71.648-45.664a82.182%2082.182%200%200%200%2037.135-55.057a86.601%2086.601%200%200%200-8.53-55.577a82.409%2082.409%200%200%200%2012.29-30.718a87.573%2087.573%200%200%200-14.963-66.244'%3e%3c/path%3e%3cpath%20fill='%23FFF'%20d='M106.889%20270.841c-23.102%206.007-47.497-3.036-61.103-22.648a52.685%2052.685%200%200%201-9.003-39.85a49.978%2049.978%200%200%201%201.713-6.693l1.35-4.115l3.671%202.697a92.447%2092.447%200%200%200%2028.036%2014.007l2.663.808l-.245%202.659a16.067%2016.067%200%200%200%202.89%2010.656a17.143%2017.143%200%200%200%2018.397%206.828a15.786%2015.786%200%200%200%204.403-1.935l71.67-45.672a14.922%2014.922%200%200%200%206.734-9.977a15.923%2015.923%200%200%200-2.713-12.011a17.156%2017.156%200%200%200-18.404-6.832a15.78%2015.78%200%200%200-4.396%201.933l-27.35%2017.434a52.298%2052.298%200%200%201-14.553%206.391c-23.101%206.007-47.497-3.036-61.101-22.649a52.681%2052.681%200%200%201-9.004-39.849a49.428%2049.428%200%200%201%2022.34-33.114l71.664-45.677a52.218%2052.218%200%200%201%2014.563-6.398c23.101-6.007%2047.497%203.036%2061.101%2022.648a52.685%2052.685%200%200%201%209.004%2039.85a50.559%2050.559%200%200%201-1.713%206.692l-1.35%204.116l-3.67-2.693a92.373%2092.373%200%200%200-28.037-14.013l-2.664-.809l.246-2.658a16.099%2016.099%200%200%200-2.89-10.656a17.143%2017.143%200%200%200-18.398-6.828a15.786%2015.786%200%200%200-4.402%201.935l-71.67%2045.674a14.898%2014.898%200%200%200-6.73%209.975a15.9%2015.9%200%200%200%202.709%2012.012a17.156%2017.156%200%200%200%2018.404%206.832a15.841%2015.841%200%200%200%204.402-1.935l27.345-17.427a52.147%2052.147%200%200%201%2014.552-6.397c23.101-6.006%2047.497%203.037%2061.102%2022.65a52.681%2052.681%200%200%201%209.003%2039.848a49.453%2049.453%200%200%201-22.34%2033.12l-71.664%2045.673a52.218%2052.218%200%200%201-14.563%206.398'%3e%3c/path%3e%3c/svg%3e",Pt="/vite.svg";function Ct(e){let t,n,s,r,o;return{c(){t=B("button"),n=J("count is "),s=J(e[0])},m(i,a){A(i,t,a),L(t,n),L(t,s),r||(o=me(t,"click",e[1]),r=!0)},p(i,[a]){a&1&&le(s,i[0])},i:Q,o:Q,d(i){i&&C(t),r=!1,o()}}}function jt(e,t,n){let s=0;return[s,()=>{n(0,s+=1)}]}class At extends Fe{constructor(t){super(),Re(this,t,jt,Ct,Ue,{})}}const Tt="modulepreload",xt=function(e){return"/"+e},Qe={},Ye=function(t,n,s){let r=Promise.resolve();if(n&&n.length>0){const o=document.getElementsByTagName("link");r=Promise.all(n.map(i=>{if(i=xt(i),i in Qe)return;Qe[i]=!0;const a=i.endsWith(".css"),p=a?'[rel="stylesheet"]':"";if(!!s)for(let f=o.length-1;f>=0;f--){const d=o[f];if(d.href===i&&(!a||d.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${i}"]${p}`))return;const u=document.createElement("link");if(u.rel=a?"stylesheet":Tt,a||(u.as="script",u.crossOrigin=""),u.href=i,document.head.appendChild(u),a)return new Promise((f,d)=>{u.addEventListener("load",f),u.addEventListener("error",()=>d(new Error(`Unable to preload CSS for ${i}`)))})}))}return r.then(()=>t()).catch(o=>{const i=new Event("vite:preloadError",{cancelable:!0});if(i.payload=o,window.dispatchEvent(i),!i.defaultPrevented)throw o})};var qe=new Intl.Collator(0,{numeric:1}).compare;function Xe(e,t,n){return e=e.split("."),t=t.split("."),qe(e[0],t[0])||qe(e[1],t[1])||(t[2]=t.slice(2).join("."),n=/[.-]/.test(e[2]=e.slice(2).join(".")),n==/[.-]/.test(t[2])?qe(e[2],t[2]):n?-1:1)}function ut(e,t,n){return t.startsWith("http://")||t.startsWith("https://")?n?e:t:e+t}function De(e){if(e.startsWith("http")){const{protocol:t,host:n}=new URL(e);return n.endsWith("hf.space")?{ws_protocol:"wss",host:n,http_protocol:t}:{ws_protocol:t==="https:"?"wss":"ws",http_protocol:t,host:n}}else if(e.startsWith("file:"))return{ws_protocol:"ws",http_protocol:"http:",host:"lite.local"};return{ws_protocol:"wss",http_protocol:"https:",host:e}}const ct=/^[^\/]*\/[^\/]*$/,Bt=/.*hf\.space\/{0,1}$/;async function Ut(e,t){const n={};t&&(n.Authorization=`Bearer ${t}`);const s=e.trim();if(ct.test(s))try{const r=await fetch(`https://huggingface.co/api/spaces/${s}/host`,{headers:n});if(r.status!==200)throw new Error("Space metadata could not be loaded.");const o=(await r.json()).host;return{space_id:e,...De(o)}}catch(r){throw new Error("Space metadata could not be loaded."+r.message)}if(Bt.test(s)){const{ws_protocol:r,http_protocol:o,host:i}=De(s);return{space_id:i.replace(".hf.space",""),ws_protocol:r,http_protocol:o,host:i}}return{space_id:!1,...De(s)}}function It(e){let t={};return e.forEach(({api_name:n},s)=>{n&&(t[n]=s)}),t}const Rt=/^(?=[^]*\b[dD]iscussions{0,1}\b)(?=[^]*\b[dD]isabled\b)[^]*$/;async function Ze(e){try{const n=(await fetch(`https://huggingface.co/api/spaces/${e}/discussions`,{method:"HEAD"})).headers.get("x-error-message");return!(n&&Rt.test(n))}catch{return!1}}function ie(e,t,n){if(e==null)return null;if(Array.isArray(e)){const s=[];for(const r of e)r==null?s.push(null):s.push(ie(r,t,n));return s}return e.is_stream?n==null?new _e({...e,url:t+"/stream/"+e.path}):new _e({...e,url:"/proxy="+n+"stream/"+e.path}):new _e({...e,url:zt(e.path,t,n)})}function Ft(e){try{const t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"}catch{return!1}}function zt(e,t,n){return e==null?n?`/proxy=${n}file=`:`${t}/file=`:Ft(e)?e:n?`/proxy=${n}file=${e}`:`${t}/file=${e}`}class _e{constructor({path:t,url:n,orig_name:s,size:r,blob:o,is_stream:i,mime_type:a,alt_text:p}){this.path=t,this.url=n,this.orig_name=s,this.size=r,this.blob=n?void 0:o,this.is_stream=i,this.mime_type=a,this.alt_text=p}}const ft="This application is too busy. Keep trying!",Y="Connection errored out.";let dt;function Jt(e,t){return{post_data:n,upload_files:s,client:r,handle_blob:o};async function n(i,a,p){const l={"Content-Type":"application/json"};p&&(l.Authorization=`Bearer ${p}`);try{var u=await e(i,{method:"POST",body:JSON.stringify(a),headers:l})}catch{return[{error:Y},500]}let f,d;try{f=await u.json(),d=u.status}catch(h){f={error:`Could not parse server response: ${h}`},d=500}return[f,d]}async function s(i,a,p,l){const u={};p&&(u.Authorization=`Bearer ${p}`);const f=1e3,d=[];for(let $=0;$<a.length;$+=f){const O=a.slice($,$+f),y=new FormData;O.forEach(_=>{y.append("files",_)});try{const _=l?`${i}/upload?upload_id=${l}`:`${i}/upload`;var h=await e(_,{method:"POST",body:y,headers:u})}catch{return{error:Y}}const g=await h.json();d.push(...g)}return{files:d}}async function r(i,a={normalise_files:!0}){return new Promise(async p=>{const{status_callback:l,hf_token:u,normalise_files:f}=a,d={predict:gt,submit:Je,view_api:Me,component_server:ht},h=f??!0;if((typeof window>"u"||!("WebSocket"in window))&&!global.Websocket){const w=await Ye(()=>import("./wrapper-6f348d45-9VzsDyGv.js"),__vite__mapDeps([0,1]));dt=(await Ye(()=>import("./__vite-browser-external-XPXQPciS.js"),__vite__mapDeps([]))).Blob,global.WebSocket=w.WebSocket}const{ws_protocol:$,http_protocol:O,host:y,space_id:g}=await Ut(i,u),_=Math.random().toString(36).substring(2),we={};let ye=!1,X={},se=null;const V={},ve=new Set;let v,fe={},be=!1;u&&g&&(be=await Wt(g,u));async function ze(w){if(v=w,fe=It((w==null?void 0:w.dependencies)||[]),v.auth_required)return{config:v,...d};try{re=await Me(v)}catch(T){console.error(`Could not get api details: ${T.message}`)}return{config:v,...d}}let re;async function pt(w){if(l&&l(w),w.status==="running")try{v=await st(e,`${O}//${y}`,u);const T=await ze(v);p(T)}catch(T){console.error(T),l&&l({status:"error",message:"Could not load this space.",load_status:"error",detail:"NOT_FOUND"})}}try{v=await st(e,`${O}//${y}`,u);const w=await ze(v);p(w)}catch(w){console.error(w),g?Be(g,ct.test(g)?"space_name":"subdomain",pt):l&&l({status:"error",message:"Could not load this space.",load_status:"error",detail:"NOT_FOUND"})}function gt(w,T,U){let N=!1,c=!1,P;if(typeof w=="number")P=v.dependencies[w];else{const q=w.replace(/^\//,"");P=v.dependencies[fe[q]]}if(P.types.continuous)throw new Error("Cannot call predict on this function as it may run forever. Use submit instead");return new Promise((q,R)=>{const H=Je(w,T,U);let m;H.on("data",F=>{c&&(H.destroy(),q(F)),N=!0,m=F}).on("status",F=>{F.stage==="error"&&R(F),F.stage==="complete"&&(c=!0,N&&(H.destroy(),q(m)))})})}function Je(w,T,U,N=null){let c,P;if(typeof w=="number")c=w,P=re.unnamed_endpoints[c];else{const j=w.replace(/^\//,"");c=fe[j],P=re.named_endpoints[w.trim()]}if(typeof c!="number")throw new Error("There is no endpoint matching that name of fn_index matching that number.");let q,R,H=v.protocol??"ws";const m=typeof w=="number"?"/predict":w;let F,G=null,I=!1;const oe={};let K="";typeof window<"u"&&(K=new URLSearchParams(window.location.search).toString()),o(`${v.root}`,T,P,u).then(j=>{if(F={data:j||[],event_data:U,fn_index:c,trigger_id:N},Vt(c,v))b({type:"status",endpoint:m,stage:"pending",queue:!1,fn_index:c,time:new Date}),n(`${v.root}/run${m.startsWith("/")?m:`/${m}`}${K?"?"+K:""}`,{...F,session_hash:_},u).then(([k,D])=>{const W=h?ge(k.data,P,v.root,v.root_url):k.data;D==200?(b({type:"data",endpoint:m,fn_index:c,data:W,time:new Date}),b({type:"status",endpoint:m,fn_index:c,stage:"complete",eta:k.average_duration,queue:!1,time:new Date})):b({type:"status",stage:"error",endpoint:m,fn_index:c,message:k.error,queue:!1,time:new Date})}).catch(k=>{b({type:"status",stage:"error",message:k.message,endpoint:m,fn_index:c,queue:!1,time:new Date})});else if(H=="ws"){b({type:"status",stage:"pending",queue:!0,endpoint:m,fn_index:c,time:new Date});let k=new URL(`${$}://${ut(y,v.path,!0)}
2
+ /queue/join${K?"?"+K:""}`);be&&k.searchParams.set("__sign",be),q=new WebSocket(k),q.onclose=D=>{D.wasClean||b({type:"status",stage:"error",broken:!0,message:Y,queue:!0,endpoint:m,fn_index:c,time:new Date})},q.onmessage=function(D){const W=JSON.parse(D.data),{type:x,status:S,data:E}=Le(W,we[c]);if(x==="update"&&S&&!I)b({type:"status",endpoint:m,fn_index:c,time:new Date,...S}),S.stage==="error"&&q.close();else if(x==="hash"){q.send(JSON.stringify({fn_index:c,session_hash:_}));return}else x==="data"?q.send(JSON.stringify({...F,session_hash:_})):x==="complete"?I=S:x==="log"?b({type:"log",log:E.log,level:E.level,endpoint:m,fn_index:c}):x==="generating"&&b({type:"status",time:new Date,...S,stage:S==null?void 0:S.stage,queue:!0,endpoint:m,fn_index:c});E&&(b({type:"data",time:new Date,data:h?ge(E.data,P,v.root,v.root_url):E.data,endpoint:m,fn_index:c}),I&&(b({type:"status",time:new Date,...I,stage:S==null?void 0:S.stage,queue:!0,endpoint:m,fn_index:c}),q.close()))},Xe(v.version||"2.0.0","3.6")<0&&addEventListener("open",()=>q.send(JSON.stringify({hash:_})))}else if(H=="sse"){b({type:"status",stage:"pending",queue:!0,endpoint:m,fn_index:c,time:new Date});var z=new URLSearchParams({fn_index:c.toString(),session_hash:_}).toString();let k=new URL(`${v.root}/queue/join?${K?K+"&":""}${z}`);R=t(k),R.onmessage=async function(D){const W=JSON.parse(D.data),{type:x,status:S,data:E}=Le(W,we[c]);if(x==="update"&&S&&!I)b({type:"status",endpoint:m,fn_index:c,time:new Date,...S}),S.stage==="error"&&R.close();else if(x==="data"){G=W.event_id;let[Z,_t]=await n(`${v.root}/queue/data`,{...F,session_hash:_,event_id:G},u);_t!==200&&(b({type:"status",stage:"error",message:Y,queue:!0,endpoint:m,fn_index:c,time:new Date}),R.close())}else x==="complete"?I=S:x==="log"?b({type:"log",log:E.log,level:E.level,endpoint:m,fn_index:c}):x==="generating"&&b({type:"status",time:new Date,...S,stage:S==null?void 0:S.stage,queue:!0,endpoint:m,fn_index:c});E&&(b({type:"data",time:new Date,data:h?ge(E.data,P,v.root,v.root_url):E.data,endpoint:m,fn_index:c}),I&&(b({type:"status",time:new Date,...I,stage:S==null?void 0:S.stage,queue:!0,endpoint:m,fn_index:c}),R.close()))}}else H=="sse_v1"&&(b({type:"status",stage:"pending",queue:!0,endpoint:m,fn_index:c,time:new Date}),n(`${v.root}/queue/join?${K}`,{...F,session_hash:_},u).then(([k,D])=>{if(D===503)b({type:"status",stage:"error",message:ft,queue:!0,endpoint:m,fn_index:c,time:new Date});else if(D!==200)b({type:"status",stage:"error",message:Y,queue:!0,endpoint:m,fn_index:c,time:new Date});else{G=k.event_id;let W=async function(x){try{const{type:S,status:E,data:Z}=Le(x,we[c]);if(S=="heartbeat")return;if(S==="update"&&E&&!I)b({type:"status",endpoint:m,fn_index:c,time:new Date,...E});else if(S==="complete")I=E;else if(S=="unexpected_error")console.error("Unexpected error",E==null?void 0:E.message),b({type:"status",stage:"error",message:(E==null?void 0:E.message)||"An Unexpected Error Occurred!",queue:!0,endpoint:m,fn_index:c,time:new Date});else if(S==="log"){b({type:"log",log:Z.log,level:Z.level,endpoint:m,fn_index:c});return}else S==="generating"&&b({type:"status",time:new Date,...E,stage:E==null?void 0:E.stage,queue:!0,endpoint:m,fn_index:c});Z&&(b({type:"data",time:new Date,data:h?ge(Z.data,P,v.root,v.root_url):Z.data,endpoint:m,fn_index:c}),I&&b({type:"status",time:new Date,...I,stage:E==null?void 0:E.stage,queue:!0,endpoint:m,fn_index:c})),((E==null?void 0:E.stage)==="complete"||(E==null?void 0:E.stage)==="error")&&V[G]&&delete V[G]}catch(S){console.error("Unexpected client exception",S),b({type:"status",stage:"error",message:"An Unexpected Error Occurred!",queue:!0,endpoint:m,fn_index:c,time:new Date}),$e()}};G in X&&(X[G].forEach(x=>W(x)),delete X[G]),V[G]=W,ve.add(G),ye||mt()}}))});function b(j){const k=oe[j.type]||[];k==null||k.forEach(D=>D(j))}function Se(j,z){const k=oe,D=k[j]||[];return k[j]=D,D==null||D.push(z),{on:Se,off:de,cancel:Ee,destroy:Oe}}function de(j,z){const k=oe;let D=k[j]||[];return D=D==null?void 0:D.filter(W=>W!==z),k[j]=D,{on:Se,off:de,cancel:Ee,destroy:Oe}}async function Ee(){const j={stage:"complete",queue:!1,time:new Date};I=j,b({...j,type:"status",endpoint:m,fn_index:c});let z={};H==="ws"?(q&&q.readyState===0?q.addEventListener("open",()=>{q.close()}):q.close(),z={fn_index:c,session_hash:_}):(R.close(),z={event_id:G});try{await e(`${v.root}/reset`,{headers:{"Content-Type":"application/json"},method:"POST",body:JSON.stringify(z)})}catch{console.warn("The `/reset` endpoint could not be called. Subsequent endpoint results may be unreliable.")}}function Oe(){for(const j in oe)oe[j].forEach(z=>{de(j,z)})}return{on:Se,off:de,cancel:Ee,destroy:Oe}}function mt(){ye=!0;let w=new URLSearchParams({session_hash:_}).toString(),T=new URL(`${v.root}/queue/data?${w}`);se=t(T),se.onmessage=async function(U){let N=JSON.parse(U.data);const c=N.event_id;if(!c)await Promise.all(Object.keys(V).map(P=>V[P](N)));else if(V[c]){N.msg==="process_completed"&&(ve.delete(c),ve.size===0&&$e());let P=V[c];window.setTimeout(P,0,N)}else X[c]||(X[c]=[]),X[c].push(N)},se.onerror=async function(U){await Promise.all(Object.keys(V).map(N=>V[N]({msg:"unexpected_error",message:Y}))),$e()}}function $e(){ye=!1,se==null||se.close()}async function ht(w,T,U){var N;const c={"Content-Type":"application/json"};u&&(c.Authorization=`Bearer ${u}`);let P,q=v.components.find(m=>m.id===w);(N=q==null?void 0:q.props)!=null&&N.root_url?P=q.props.root_url:P=v.root;const R=await e(`${P}/component_server/`,{method:"POST",body:JSON.stringify({data:U,component_id:w,fn_name:T,session_hash:_}),headers:c});if(!R.ok)throw new Error("Could not connect to component server: "+R.statusText);return await R.json()}async function Me(w){if(re)return re;const T={"Content-Type":"application/json"};u&&(T.Authorization=`Bearer ${u}`);let U;if(Xe(w.version||"2.0.0","3.30")<0?U=await e("https://gradio-space-api-fetcher-v2.hf.space/api",{method:"POST",body:JSON.stringify({serialize:!1,config:JSON.stringify(w)}),headers:T}):U=await e(`${w.root}/info`,{headers:T}),!U.ok)throw new Error(Y);let N=await U.json();return"api"in N&&(N=N.api),N.named_endpoints["/predict"]&&!N.unnamed_endpoints[0]&&(N.unnamed_endpoints[0]=N.named_endpoints["/predict"]),Gt(N,w,fe)}})}async function o(i,a,p,l){const u=await xe(a,void 0,[],!0,p);return Promise.all(u.map(async({path:f,blob:d,type:h})=>{if(d){const $=(await s(i,[d],l)).files[0];return{path:f,file_url:$,type:h,name:d==null?void 0:d.name}}return{path:f,type:h}})).then(f=>(f.forEach(({path:d,file_url:h,type:$,name:O})=>{if($==="Gallery")nt(a,h,d);else if(h){const y=new _e({path:h,orig_name:O});nt(a,y,d)}}),a))}}const{post_data:en,upload_files:tn,client:Mt,handle_blob:nn}=Jt(fetch,(...e)=>new EventSource(...e));function ge(e,t,n,s){return e.map((r,o)=>{var i,a,p,l;return((a=(i=t==null?void 0:t.returns)==null?void 0:i[o])==null?void 0:a.component)==="File"?ie(r,n,s):((l=(p=t==null?void 0:t.returns)==null?void 0:p[o])==null?void 0:l.component)==="Gallery"?r.map(u=>Array.isArray(u)?[ie(u[0],n,s),u[1]]:[ie(u,n,s),null]):typeof r=="object"&&r.path?ie(r,n,s):r})}function et(e,t,n,s){switch(e.type){case"string":return"string";case"boolean":return"boolean";case"number":return"number"}if(n==="JSONSerializable"||n==="StringSerializable")return"any";if(n==="ListStringSerializable")return"string[]";if(t==="Image")return s==="parameter"?"Blob | File | Buffer":"string";if(n==="FileSerializable")return(e==null?void 0:e.type)==="array"?s==="parameter"?"(Blob | File | Buffer)[]":"{ name: string; data: string; size?: number; is_file?: boolean; orig_name?: string}[]":s==="parameter"?"Blob | File | Buffer":"{ name: string; data: string; size?: number; is_file?: boolean; orig_name?: string}";if(n==="GallerySerializable")return s==="parameter"?"[(Blob | File | Buffer), (string | null)][]":"[{ name: string; data: string; size?: number; is_file?: boolean; orig_name?: string}, (string | null))][]"}function tt(e,t){return t==="GallerySerializable"?"array of [file, label] tuples":t==="ListStringSerializable"?"array of strings":t==="FileSerializable"?"array of files or single file":e.description}function Gt(e,t,n){const s={named_endpoints:{},unnamed_endpoints:{}};for(const r in e){const o=e[r];for(const i in o){const a=t.dependencies[i]?i:n[i.replace("/","")],p=o[i];s[r][i]={},s[r][i].parameters={},s[r][i].returns={},s[r][i].type=t.dependencies[a].types,s[r][i].parameters=p.parameters.map(({label:l,component:u,type:f,serializer:d})=>({label:l,component:u,type:et(f,u,d,"parameter"),description:tt(f,d)})),s[r][i].returns=p.returns.map(({label:l,component:u,type:f,serializer:d})=>({label:l,component:u,type:et(f,u,d,"return"),description:tt(f,d)}))}}return s}async function Wt(e,t){try{return(await(await fetch(`https://huggingface.co/api/spaces/${e}/jwt`,{headers:{Authorization:`Bearer ${t}`}})).json()).token||!1}catch(n){return console.error(n),!1}}function nt(e,t,n){for(;n.length>1;)e=e[n.shift()];e[n.shift()]=t}async function xe(e,t=void 0,n=[],s=!1,r=void 0){if(Array.isArray(e)){let o=[];return await Promise.all(e.map(async(i,a)=>{var p;let l=n.slice();l.push(a);const u=await xe(e[a],s?((p=r==null?void 0:r.parameters[a])==null?void 0:p.component)||void 0:t,l,!1,r);o=o.concat(u)})),o}else{if(globalThis.Buffer&&e instanceof globalThis.Buffer)return[{path:n,blob:t==="Image"?!1:new dt([e]),type:t}];if(typeof e=="object"){let o=[];for(let i in e)if(e.hasOwnProperty(i)){let a=n.slice();a.push(i),o=o.concat(await xe(e[i],void 0,a,!1,r))}return o}}return[]}function Vt(e,t){var n,s,r,o;return!(((s=(n=t==null?void 0:t.dependencies)==null?void 0:n[e])==null?void 0:s.queue)===null?t.enable_queue:(o=(r=t==null?void 0:t.dependencies)==null?void 0:r[e])!=null&&o.queue)||!1}async function st(e,t,n){const s={};if(n&&(s.Authorization=`Bearer ${n}`),typeof window<"u"&&window.gradio_config&&location.origin!=="http://localhost:9876"&&!window.gradio_config.dev_mode){const r=window.gradio_config.root,o=window.gradio_config;return o.root=ut(t,o.root,!1),{...o,path:r}}else if(t){let r=await e(`${t}/config`,{headers:s});if(r.status===200){const o=await r.json();return o.path=o.path??"",o.root=t,o}throw new Error("Could not get config.")}throw new Error("No config or app endpoint found")}async function Be(e,t,n){let s=t==="subdomain"?`https://huggingface.co/api/spaces/by-subdomain/${e}`:`https://huggingface.co/api/spaces/${e}`,r,o;try{if(r=await fetch(s),o=r.status,o!==200)throw new Error;r=await r.json()}catch{n({status:"error",load_status:"error",message:"Could not get space status",detail:"NOT_FOUND"});return}if(!r||o!==200)return;const{runtime:{stage:i},id:a}=r;switch(i){case"STOPPED":case"SLEEPING":n({status:"sleeping",load_status:"pending",message:"Space is asleep. Waking it up...",detail:i}),setTimeout(()=>{Be(e,t,n)},1e3);break;case"PAUSED":n({status:"paused",load_status:"error",message:"This space has been paused by the author. If you would like to try this demo, consider duplicating the space.",detail:i,discussions_enabled:await Ze(a)});break;case"RUNNING":case"RUNNING_BUILDING":n({status:"running",load_status:"complete",message:"",detail:i});break;case"BUILDING":n({status:"building",load_status:"pending",message:"Space is building...",detail:i}),setTimeout(()=>{Be(e,t,n)},1e3);break;default:n({status:"space_error",load_status:"error",message:"This space is experiencing an issue.",detail:i,discussions_enabled:await Ze(a)});break}}function Le(e,t){switch(e.msg){case"send_data":return{type:"data"};case"send_hash":return{type:"hash"};case"queue_full":return{type:"update",status:{queue:!0,message:ft,stage:"error",code:e.code,success:e.success}};case"heartbeat":return{type:"heartbeat"};case"unexpected_error":return{type:"unexpected_error",status:{queue:!0,message:e.message,stage:"error",success:!1}};case"estimation":return{type:"update",status:{queue:!0,stage:t||"pending",code:e.code,size:e.queue_size,position:e.rank,eta:e.rank_eta,success:e.success}};case"progress":return{type:"update",status:{queue:!0,stage:"pending",code:e.code,progress_data:e.progress_data,success:e.success}};case"log":return{type:"log",data:e};case"process_generating":return{type:"generating",status:{queue:!0,message:e.success?null:e.output.error,stage:e.success?"generating":"error",code:e.code,progress_data:e.progress_data,eta:e.average_duration},data:e.success?e.output:null};case"process_completed":return"error"in e.output?{type:"update",status:{queue:!0,message:e.output.error,stage:"error",code:e.code,success:e.success}}:{type:"complete",status:{queue:!0,message:e.success?void 0:e.output.error,stage:e.success?"complete":"error",code:e.code,progress_data:e.progress_data},data:e.success?e.output:null};case"process_starts":return{type:"update",status:{queue:!0,stage:"pending",code:e.code,size:e.rank,position:0,success:e.success,eta:e.eta}}}return{type:"none",status:{stage:"error",queue:!0}}}function rt(e){let t,n,s=e[1].matching_letters+"",r,o,i=JSON.stringify(e[1].exact_letters)+"",a,p,l,u,f=JSON.stringify(e[0].data)+"",d;return{c(){t=B("p"),n=J("Matching Letters: "),r=J(s),o=J(" - "),a=J(i),p=M(),l=B("p"),u=J("Result: "),d=J(f)},m(h,$){A(h,t,$),L(t,n),L(t,r),L(t,o),L(t,a),A(h,p,$),A(h,l,$),L(l,u),L(l,d)},p(h,$){$&2&&s!==(s=h[1].matching_letters+"")&&le(r,s),$&2&&i!==(i=JSON.stringify(h[1].exact_letters)+"")&&le(a,i),$&1&&f!==(f=JSON.stringify(h[0].data)+"")&&le(d,f)},d(h){h&&(C(t),C(p),C(l))}}}function ot(e){let t,n,s=e[2].message+"",r;return{c(){t=B("p"),n=J("Error: "),r=J(s)},m(o,i){A(o,t,i),L(t,n),L(t,r)},p(o,i){i&4&&s!==(s=o[2].message+"")&&le(r,s)},d(o){o&&C(t)}}}function Ht(e){let t,n,s,r,o,i,a,p,l,u,f,d,h,$,O=e[0]&&rt(e),y=e[2]&&ot(e);return{c(){t=B("div"),t.innerHTML="<h1>Gradio Client Test</h1>",n=M(),s=B("h3"),s.textContent="Spelling based comparison interface through api test - (22/01/2023 - may break after due changes to underlying space - https://huggingface.co/spaces/KwabsHug/Language-Learn-Idea)",r=M(),o=B("input"),i=M(),a=B("input"),p=M(),l=B("button"),l.textContent="Predict",u=M(),O&&O.c(),f=M(),y&&y.c(),d=bt(),ae(o,"type","text"),ae(a,"type","text")},m(g,_){A(g,t,_),A(g,n,_),A(g,s,_),A(g,r,_),A(g,o,_),pe(o,e[3]),A(g,i,_),A(g,a,_),pe(a,e[4]),A(g,p,_),A(g,l,_),A(g,u,_),O&&O.m(g,_),A(g,f,_),y&&y.m(g,_),A(g,d,_),h||($=[me(o,"input",e[6]),me(a,"input",e[7]),me(l,"click",e[5])],h=!0)},p(g,[_]){_&8&&o.value!==g[3]&&pe(o,g[3]),_&16&&a.value!==g[4]&&pe(a,g[4]),g[0]?O?O.p(g,_):(O=rt(g),O.c(),O.m(f.parentNode,f)):O&&(O.d(1),O=null),g[2]?y?y.p(g,_):(y=ot(g),y.c(),y.m(d.parentNode,d)):y&&(y.d(1),y=null)},i:Q,o:Q,d(g){g&&(C(t),C(n),C(s),C(r),C(o),C(i),C(a),C(p),C(l),C(u),C(f),C(d)),O&&O.d(g),y&&y.d(g),h=!1,ce($)}}}function Kt(e,t,n){let s,r,o,i="hello",a="world";async function p(){const f=await Mt("https://kwabshug-language-learn-idea.hf.space/--replicas/m8usa/");try{n(0,s=await f.predict("/predict_2",[i,a]))}catch(d){n(2,o=d)}console.log(s.data),n(1,r=JSON.parse(String(s.data).replace(/'/g,'"')))}function l(){i=this.value,n(3,i)}function u(){a=this.value,n(4,a)}return[s,r,o,i,a,p,l,u]}class Qt extends Fe{constructor(t){super(),Re(this,t,Kt,Ht,Ue,{})}}function Yt(e){let t,n,s,r,o,i,a,p,l,u,f,d,h,$,O;return o=new Qt({}),u=new At({}),{c(){t=B("main"),n=B("div"),n.innerHTML=`<a href="https://vitejs.dev" target="_blank" rel="noreferrer"><img src="${Pt}" class="logo svelte-1fm2ok" alt="Vite Logo"/></a> <a href="https://svelte.dev" target="_blank" rel="noreferrer"><img src="${Lt}" class="logo svelte svelte-1fm2ok" alt="Svelte Logo"/></a>`,s=M(),r=B("div"),Ke(o.$$.fragment),i=M(),a=B("h1"),a.textContent="Vite + Svelte",p=M(),l=B("div"),Ke(u.$$.fragment),f=M(),d=B("p"),d.innerHTML='Check out <a href="https://github.com/sveltejs/kit#readme" target="_blank" rel="noreferrer">SvelteKit</a>, the official Svelte app framework powered by Vite!',h=M(),$=B("p"),$.textContent="Click on the Vite and Svelte logos to learn more",ae(r,"class","my-edits svelte-1fm2ok"),ae(l,"class","card"),ae($,"class","read-the-docs svelte-1fm2ok")},m(y,g){A(y,t,g),L(t,n),L(t,s),L(t,r),Ae(o,r,null),L(t,i),L(t,a),L(t,p),L(t,l),Ae(u,l,null),L(t,f),L(t,d),L(t,h),L(t,$),O=!0},p:Q,i(y){O||(je(o.$$.fragment,y),je(u.$$.fragment,y),O=!0)},o(y){He(o.$$.fragment,y),He(u.$$.fragment,y),O=!1},d(y){y&&C(t),Te(o),Te(u)}}}class Xt extends Fe{constructor(t){super(),Re(this,t,null,Yt,Ue,{})}}new Xt({target:document.getElementById("app")});
3
+ function __vite__mapDeps(indexes) {
4
+ if (!__vite__mapDeps.viteFileDeps) {
5
+ __vite__mapDeps.viteFileDeps = ["assets/wrapper-6f348d45-9VzsDyGv.js","assets/__vite-browser-external-XPXQPciS.js"]
6
+ }
7
+ return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
8
+ }
assets/index-pIgnnrnI.css ADDED
@@ -0,0 +1 @@
 
 
1
+ :root{font-family:Inter,system-ui,Avenir,Helvetica,Arial,sans-serif;line-height:1.5;font-weight:400;color-scheme:light dark;color:#ffffffde;background-color:#242424;font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}a{font-weight:500;color:#646cff;text-decoration:inherit}a:hover{color:#535bf2}body{margin:0;display:flex;place-items:center;min-width:320px;min-height:100vh}h1{font-size:3.2em;line-height:1.1}.card{padding:2em}#app{max-width:1280px;margin:0 auto;padding:2rem;text-align:center}button{border-radius:8px;border:1px solid transparent;padding:.6em 1.2em;font-size:1em;font-weight:500;font-family:inherit;background-color:#1a1a1a;cursor:pointer;transition:border-color .25s}button:hover{border-color:#646cff}button:focus,button:focus-visible{outline:4px auto -webkit-focus-ring-color}@media (prefers-color-scheme: light){:root{color:#213547;background-color:#fff}a:hover{color:#747bff}button{background-color:#f9f9f9}}.logo.svelte-1fm2ok{height:6em;padding:1.5em;will-change:filter;transition:filter .3s}.logo.svelte-1fm2ok:hover{filter:drop-shadow(0 0 2em #646cffaa)}.logo.svelte.svelte-1fm2ok:hover{filter:drop-shadow(0 0 2em #ff3e00aa)}.read-the-docs.svelte-1fm2ok{color:#888}.my-edits.svelte-1fm2ok{border:rgb(171,156,156) solid 3px}
assets/wrapper-6f348d45-9VzsDyGv.js ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ import S from"./__vite-browser-external-XPXQPciS.js";var Qe={};function z(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function yt(s){if(s.__esModule)return s;var e=s.default;if(typeof e=="function"){var t=function r(){if(this instanceof r){var i=[null];i.push.apply(i,arguments);var n=Function.bind.apply(e,i);return new n}return e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(s).forEach(function(r){var i=Object.getOwnPropertyDescriptor(s,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return s[r]}})}),t}const{Duplex:vt}=S;function Oe(s){s.emit("close")}function St(){!this.destroyed&&this._writableState.finished&&this.destroy()}function Je(s){this.removeListener("error",Je),this.destroy(),this.listenerCount("error")===0&&this.emit("error",s)}function Et(s,e){let t=!0;const r=new vt({...e,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return s.on("message",function(n,o){const l=!o&&r._readableState.objectMode?n.toString():n;r.push(l)||s.pause()}),s.once("error",function(n){r.destroyed||(t=!1,r.destroy(n))}),s.once("close",function(){r.destroyed||r.push(null)}),r._destroy=function(i,n){if(s.readyState===s.CLOSED){n(i),process.nextTick(Oe,r);return}let o=!1;s.once("error",function(f){o=!0,n(f)}),s.once("close",function(){o||n(i),process.nextTick(Oe,r)}),t&&s.terminate()},r._final=function(i){if(s.readyState===s.CONNECTING){s.once("open",function(){r._final(i)});return}s._socket!==null&&(s._socket._writableState.finished?(i(),r._readableState.endEmitted&&r.destroy()):(s._socket.once("finish",function(){i()}),s.close()))},r._read=function(){s.isPaused&&s.resume()},r._write=function(i,n,o){if(s.readyState===s.CONNECTING){s.once("open",function(){r._write(i,n,o)});return}s.send(i,o)},r.on("end",St),r.on("error",Je),r}var bt=Et;const Hs=z(bt);var te={exports:{}},U={BINARY_TYPES:["nodebuffer","arraybuffer","fragments"],EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}},xt,kt;const{EMPTY_BUFFER:wt}=U,Se=Buffer[Symbol.species];function Ot(s,e){if(s.length===0)return wt;if(s.length===1)return s[0];const t=Buffer.allocUnsafe(e);let r=0;for(let i=0;i<s.length;i++){const n=s[i];t.set(n,r),r+=n.length}return r<e?new Se(t.buffer,t.byteOffset,r):t}function et(s,e,t,r,i){for(let n=0;n<i;n++)t[r+n]=s[n]^e[n&3]}function tt(s,e){for(let t=0;t<s.length;t++)s[t]^=e[t&3]}function Ct(s){return s.length===s.buffer.byteLength?s.buffer:s.buffer.slice(s.byteOffset,s.byteOffset+s.length)}function Ee(s){if(Ee.readOnly=!0,Buffer.isBuffer(s))return s;let e;return s instanceof ArrayBuffer?e=new Se(s):ArrayBuffer.isView(s)?e=new Se(s.buffer,s.byteOffset,s.byteLength):(e=Buffer.from(s),Ee.readOnly=!1),e}te.exports={concat:Ot,mask:et,toArrayBuffer:Ct,toBuffer:Ee,unmask:tt};if(!Qe.WS_NO_BUFFER_UTIL)try{const s=require("bufferutil");kt=te.exports.mask=function(e,t,r,i,n){n<48?et(e,t,r,i,n):s.mask(e,t,r,i,n)},xt=te.exports.unmask=function(e,t){e.length<32?tt(e,t):s.unmask(e,t)}}catch{}var ne=te.exports;const Ce=Symbol("kDone"),ue=Symbol("kRun");let Tt=class{constructor(e){this[Ce]=()=>{this.pending--,this[ue]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[ue]()}[ue](){if(this.pending!==this.concurrency&&this.jobs.length){const e=this.jobs.shift();this.pending++,e(this[Ce])}}};var Lt=Tt;const W=S,Te=ne,Nt=Lt,{kStatusCode:st}=U,Pt=Buffer[Symbol.species],Rt=Buffer.from([0,0,255,255]),se=Symbol("permessage-deflate"),w=Symbol("total-length"),V=Symbol("callback"),C=Symbol("buffers"),J=Symbol("error");let K,Ut=class{constructor(e,t,r){if(this._maxPayload=r|0,this._options=e||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._isServer=!!t,this._deflate=null,this._inflate=null,this.params=null,!K){const i=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;K=new Nt(i)}}static get extensionName(){return"permessage-deflate"}offer(){const e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){const e=this._deflate[V];this._deflate.close(),this._deflate=null,e&&e(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){const t=this._options,r=e.find(i=>!(t.serverNoContextTakeover===!1&&i.server_no_context_takeover||i.server_max_window_bits&&(t.serverMaxWindowBits===!1||typeof t.serverMaxWindowBits=="number"&&t.serverMaxWindowBits>i.server_max_window_bits)||typeof t.clientMaxWindowBits=="number"&&!i.client_max_window_bits));if(!r)throw new Error("None of the extension offers can be accepted");return t.serverNoContextTakeover&&(r.server_no_context_takeover=!0),t.clientNoContextTakeover&&(r.client_no_context_takeover=!0),typeof t.serverMaxWindowBits=="number"&&(r.server_max_window_bits=t.serverMaxWindowBits),typeof t.clientMaxWindowBits=="number"?r.client_max_window_bits=t.clientMaxWindowBits:(r.client_max_window_bits===!0||t.clientMaxWindowBits===!1)&&delete r.client_max_window_bits,r}acceptAsClient(e){const t=e[0];if(this._options.clientNoContextTakeover===!1&&t.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!t.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(t.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&t.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return t}normalizeParams(e){return e.forEach(t=>{Object.keys(t).forEach(r=>{let i=t[r];if(i.length>1)throw new Error(`Parameter "${r}" must have only a single value`);if(i=i[0],r==="client_max_window_bits"){if(i!==!0){const n=+i;if(!Number.isInteger(n)||n<8||n>15)throw new TypeError(`Invalid value for parameter "${r}": ${i}`);i=n}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${r}": ${i}`)}else if(r==="server_max_window_bits"){const n=+i;if(!Number.isInteger(n)||n<8||n>15)throw new TypeError(`Invalid value for parameter "${r}": ${i}`);i=n}else if(r==="client_no_context_takeover"||r==="server_no_context_takeover"){if(i!==!0)throw new TypeError(`Invalid value for parameter "${r}": ${i}`)}else throw new Error(`Unknown parameter "${r}"`);t[r]=i})}),e}decompress(e,t,r){K.add(i=>{this._decompress(e,t,(n,o)=>{i(),r(n,o)})})}compress(e,t,r){K.add(i=>{this._compress(e,t,(n,o)=>{i(),r(n,o)})})}_decompress(e,t,r){const i=this._isServer?"client":"server";if(!this._inflate){const n=`${i}_max_window_bits`,o=typeof this.params[n]!="number"?W.Z_DEFAULT_WINDOWBITS:this.params[n];this._inflate=W.createInflateRaw({...this._options.zlibInflateOptions,windowBits:o}),this._inflate[se]=this,this._inflate[w]=0,this._inflate[C]=[],this._inflate.on("error",$t),this._inflate.on("data",rt)}this._inflate[V]=r,this._inflate.write(e),t&&this._inflate.write(Rt),this._inflate.flush(()=>{const n=this._inflate[J];if(n){this._inflate.close(),this._inflate=null,r(n);return}const o=Te.concat(this._inflate[C],this._inflate[w]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[w]=0,this._inflate[C]=[],t&&this.params[`${i}_no_context_takeover`]&&this._inflate.reset()),r(null,o)})}_compress(e,t,r){const i=this._isServer?"server":"client";if(!this._deflate){const n=`${i}_max_window_bits`,o=typeof this.params[n]!="number"?W.Z_DEFAULT_WINDOWBITS:this.params[n];this._deflate=W.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:o}),this._deflate[w]=0,this._deflate[C]=[],this._deflate.on("data",Bt)}this._deflate[V]=r,this._deflate.write(e),this._deflate.flush(W.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let n=Te.concat(this._deflate[C],this._deflate[w]);t&&(n=new Pt(n.buffer,n.byteOffset,n.length-4)),this._deflate[V]=null,this._deflate[w]=0,this._deflate[C]=[],t&&this.params[`${i}_no_context_takeover`]&&this._deflate.reset(),r(null,n)})}};var oe=Ut;function Bt(s){this[C].push(s),this[w]+=s.length}function rt(s){if(this[w]+=s.length,this[se]._maxPayload<1||this[w]<=this[se]._maxPayload){this[C].push(s);return}this[J]=new RangeError("Max payload size exceeded"),this[J].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[J][st]=1009,this.removeListener("data",rt),this.reset()}function $t(s){this[se]._inflate=null,s[st]=1007,this[V](s)}var re={exports:{}};const Mt={},It=Object.freeze(Object.defineProperty({__proto__:null,default:Mt},Symbol.toStringTag,{value:"Module"})),Dt=yt(It);var Le;const{isUtf8:Ne}=S,Wt=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function At(s){return s>=1e3&&s<=1014&&s!==1004&&s!==1005&&s!==1006||s>=3e3&&s<=4999}function be(s){const e=s.length;let t=0;for(;t<e;)if(!(s[t]&128))t++;else if((s[t]&224)===192){if(t+1===e||(s[t+1]&192)!==128||(s[t]&254)===192)return!1;t+=2}else if((s[t]&240)===224){if(t+2>=e||(s[t+1]&192)!==128||(s[t+2]&192)!==128||s[t]===224&&(s[t+1]&224)===128||s[t]===237&&(s[t+1]&224)===160)return!1;t+=3}else if((s[t]&248)===240){if(t+3>=e||(s[t+1]&192)!==128||(s[t+2]&192)!==128||(s[t+3]&192)!==128||s[t]===240&&(s[t+1]&240)===128||s[t]===244&&s[t+1]>143||s[t]>244)return!1;t+=4}else return!1;return!0}re.exports={isValidStatusCode:At,isValidUTF8:be,tokenChars:Wt};if(Ne)Le=re.exports.isValidUTF8=function(s){return s.length<24?be(s):Ne(s)};else if(!Qe.WS_NO_UTF_8_VALIDATE)try{const s=Dt;Le=re.exports.isValidUTF8=function(e){return e.length<32?be(e):s(e)}}catch{}var ae=re.exports;const{Writable:Ft}=S,Pe=oe,{BINARY_TYPES:jt,EMPTY_BUFFER:Re,kStatusCode:Gt,kWebSocket:Vt}=U,{concat:de,toArrayBuffer:Ht,unmask:zt}=ne,{isValidStatusCode:Yt,isValidUTF8:Ue}=ae,X=Buffer[Symbol.species],A=0,Be=1,$e=2,Me=3,_e=4,qt=5;let Kt=class extends Ft{constructor(e={}){super(),this._binaryType=e.binaryType||jt[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[Vt]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._state=A,this._loop=!1}_write(e,t,r){if(this._opcode===8&&this._state==A)return r();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(r)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){const r=this._buffers[0];return this._buffers[0]=new X(r.buffer,r.byteOffset+e,r.length-e),new X(r.buffer,r.byteOffset,e)}const t=Buffer.allocUnsafe(e);do{const r=this._buffers[0],i=t.length-e;e>=r.length?t.set(this._buffers.shift(),i):(t.set(new Uint8Array(r.buffer,r.byteOffset,e),i),this._buffers[0]=new X(r.buffer,r.byteOffset+e,r.length-e)),e-=r.length}while(e>0);return t}startLoop(e){let t;this._loop=!0;do switch(this._state){case A:t=this.getInfo();break;case Be:t=this.getPayloadLength16();break;case $e:t=this.getPayloadLength64();break;case Me:this.getMask();break;case _e:t=this.getData(e);break;default:this._loop=!1;return}while(this._loop);e(t)}getInfo(){if(this._bufferedBytes<2){this._loop=!1;return}const e=this.consume(2);if(e[0]&48)return this._loop=!1,g(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");const t=(e[0]&64)===64;if(t&&!this._extensions[Pe.extensionName])return this._loop=!1,g(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(this._fin=(e[0]&128)===128,this._opcode=e[0]&15,this._payloadLength=e[1]&127,this._opcode===0){if(t)return this._loop=!1,g(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(!this._fragmented)return this._loop=!1,g(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented)return this._loop=!1,g(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");this._compressed=t}else if(this._opcode>7&&this._opcode<11){if(!this._fin)return this._loop=!1,g(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");if(t)return this._loop=!1,g(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1)return this._loop=!1,g(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH")}else return this._loop=!1,g(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(e[1]&128)===128,this._isServer){if(!this._masked)return this._loop=!1,g(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK")}else if(this._masked)return this._loop=!1,g(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");if(this._payloadLength===126)this._state=Be;else if(this._payloadLength===127)this._state=$e;else return this.haveLength()}getPayloadLength16(){if(this._bufferedBytes<2){this._loop=!1;return}return this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength()}getPayloadLength64(){if(this._bufferedBytes<8){this._loop=!1;return}const e=this.consume(8),t=e.readUInt32BE(0);return t>Math.pow(2,21)-1?(this._loop=!1,g(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH")):(this._payloadLength=t*Math.pow(2,32)+e.readUInt32BE(4),this.haveLength())}haveLength(){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0))return this._loop=!1,g(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");this._masked?this._state=Me:this._state=_e}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=_e}getData(e){let t=Re;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}t=this.consume(this._payloadLength),this._masked&&this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3]&&zt(t,this._mask)}if(this._opcode>7)return this.controlMessage(t);if(this._compressed){this._state=qt,this.decompress(t,e);return}return t.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(t)),this.dataMessage()}decompress(e,t){this._extensions[Pe.extensionName].decompress(e,this._fin,(i,n)=>{if(i)return t(i);if(n.length){if(this._messageLength+=n.length,this._messageLength>this._maxPayload&&this._maxPayload>0)return t(g(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"));this._fragments.push(n)}const o=this.dataMessage();if(o)return t(o);this.startLoop(t)})}dataMessage(){if(this._fin){const e=this._messageLength,t=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let r;this._binaryType==="nodebuffer"?r=de(t,e):this._binaryType==="arraybuffer"?r=Ht(de(t,e)):r=t,this.emit("message",r,!0)}else{const r=de(t,e);if(!this._skipUTF8Validation&&!Ue(r))return this._loop=!1,g(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");this.emit("message",r,!1)}}this._state=A}controlMessage(e){if(this._opcode===8)if(this._loop=!1,e.length===0)this.emit("conclude",1005,Re),this.end();else{const t=e.readUInt16BE(0);if(!Yt(t))return g(RangeError,`invalid status code ${t}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");const r=new X(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!Ue(r))return g(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");this.emit("conclude",t,r),this.end()}else this._opcode===9?this.emit("ping",e):this.emit("pong",e);this._state=A}};var it=Kt;function g(s,e,t,r,i){const n=new s(t?`Invalid WebSocket frame: ${e}`:e);return Error.captureStackTrace(n,g),n.code=i,n[Gt]=r,n}const Ks=z(it),{randomFillSync:Xt}=S,Ie=oe,{EMPTY_BUFFER:Zt}=U,{isValidStatusCode:Qt}=ae,{mask:De,toBuffer:M}=ne,x=Symbol("kByteLength"),Jt=Buffer.alloc(4);let es=class P{constructor(e,t,r){this._extensions=t||{},r&&(this._generateMask=r,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._deflating=!1,this._queue=[]}static frame(e,t){let r,i=!1,n=2,o=!1;t.mask&&(r=t.maskBuffer||Jt,t.generateMask?t.generateMask(r):Xt(r,0,4),o=(r[0]|r[1]|r[2]|r[3])===0,n=6);let l;typeof e=="string"?(!t.mask||o)&&t[x]!==void 0?l=t[x]:(e=Buffer.from(e),l=e.length):(l=e.length,i=t.mask&&t.readOnly&&!o);let f=l;l>=65536?(n+=8,f=127):l>125&&(n+=2,f=126);const a=Buffer.allocUnsafe(i?l+n:n);return a[0]=t.fin?t.opcode|128:t.opcode,t.rsv1&&(a[0]|=64),a[1]=f,f===126?a.writeUInt16BE(l,2):f===127&&(a[2]=a[3]=0,a.writeUIntBE(l,4,6)),t.mask?(a[1]|=128,a[n-4]=r[0],a[n-3]=r[1],a[n-2]=r[2],a[n-1]=r[3],o?[a,e]:i?(De(e,r,a,n,l),[a]):(De(e,r,e,0,l),[a,e])):[a,e]}close(e,t,r,i){let n;if(e===void 0)n=Zt;else{if(typeof e!="number"||!Qt(e))throw new TypeError("First argument must be a valid error code number");if(t===void 0||!t.length)n=Buffer.allocUnsafe(2),n.writeUInt16BE(e,0);else{const l=Buffer.byteLength(t);if(l>123)throw new RangeError("The message must not be greater than 123 bytes");n=Buffer.allocUnsafe(2+l),n.writeUInt16BE(e,0),typeof t=="string"?n.write(t,2):n.set(t,2)}}const o={[x]:n.length,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._deflating?this.enqueue([this.dispatch,n,!1,o,i]):this.sendFrame(P.frame(n,o),i)}ping(e,t,r){let i,n;if(typeof e=="string"?(i=Buffer.byteLength(e),n=!1):(e=M(e),i=e.length,n=M.readOnly),i>125)throw new RangeError("The data size must not be greater than 125 bytes");const o={[x]:i,fin:!0,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:9,readOnly:n,rsv1:!1};this._deflating?this.enqueue([this.dispatch,e,!1,o,r]):this.sendFrame(P.frame(e,o),r)}pong(e,t,r){let i,n;if(typeof e=="string"?(i=Buffer.byteLength(e),n=!1):(e=M(e),i=e.length,n=M.readOnly),i>125)throw new RangeError("The data size must not be greater than 125 bytes");const o={[x]:i,fin:!0,generateMask:this._generateMask,mask:t,maskBuffer:this._maskBuffer,opcode:10,readOnly:n,rsv1:!1};this._deflating?this.enqueue([this.dispatch,e,!1,o,r]):this.sendFrame(P.frame(e,o),r)}send(e,t,r){const i=this._extensions[Ie.extensionName];let n=t.binary?2:1,o=t.compress,l,f;if(typeof e=="string"?(l=Buffer.byteLength(e),f=!1):(e=M(e),l=e.length,f=M.readOnly),this._firstFragment?(this._firstFragment=!1,o&&i&&i.params[i._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(o=l>=i._threshold),this._compress=o):(o=!1,n=0),t.fin&&(this._firstFragment=!0),i){const a={[x]:l,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:n,readOnly:f,rsv1:o};this._deflating?this.enqueue([this.dispatch,e,this._compress,a,r]):this.dispatch(e,this._compress,a,r)}else this.sendFrame(P.frame(e,{[x]:l,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:n,readOnly:f,rsv1:!1}),r)}dispatch(e,t,r,i){if(!t){this.sendFrame(P.frame(e,r),i);return}const n=this._extensions[Ie.extensionName];this._bufferedBytes+=r[x],this._deflating=!0,n.compress(e,r.fin,(o,l)=>{if(this._socket.destroyed){const f=new Error("The socket was closed while data was being compressed");typeof i=="function"&&i(f);for(let a=0;a<this._queue.length;a++){const c=this._queue[a],h=c[c.length-1];typeof h=="function"&&h(f)}return}this._bufferedBytes-=r[x],this._deflating=!1,r.readOnly=!1,this.sendFrame(P.frame(l,r),i),this.dequeue()})}dequeue(){for(;!this._deflating&&this._queue.length;){const e=this._queue.shift();this._bufferedBytes-=e[3][x],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][x],this._queue.push(e)}sendFrame(e,t){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],t),this._socket.uncork()):this._socket.write(e[0],t)}};var nt=es;const Xs=z(nt),{kForOnEventAttribute:F,kListener:pe}=U,We=Symbol("kCode"),Ae=Symbol("kData"),Fe=Symbol("kError"),je=Symbol("kMessage"),Ge=Symbol("kReason"),I=Symbol("kTarget"),Ve=Symbol("kType"),He=Symbol("kWasClean");class B{constructor(e){this[I]=null,this[Ve]=e}get target(){return this[I]}get type(){return this[Ve]}}Object.defineProperty(B.prototype,"target",{enumerable:!0});Object.defineProperty(B.prototype,"type",{enumerable:!0});class Y extends B{constructor(e,t={}){super(e),this[We]=t.code===void 0?0:t.code,this[Ge]=t.reason===void 0?"":t.reason,this[He]=t.wasClean===void 0?!1:t.wasClean}get code(){return this[We]}get reason(){return this[Ge]}get wasClean(){return this[He]}}Object.defineProperty(Y.prototype,"code",{enumerable:!0});Object.defineProperty(Y.prototype,"reason",{enumerable:!0});Object.defineProperty(Y.prototype,"wasClean",{enumerable:!0});class le extends B{constructor(e,t={}){super(e),this[Fe]=t.error===void 0?null:t.error,this[je]=t.message===void 0?"":t.message}get error(){return this[Fe]}get message(){return this[je]}}Object.defineProperty(le.prototype,"error",{enumerable:!0});Object.defineProperty(le.prototype,"message",{enumerable:!0});class xe extends B{constructor(e,t={}){super(e),this[Ae]=t.data===void 0?null:t.data}get data(){return this[Ae]}}Object.defineProperty(xe.prototype,"data",{enumerable:!0});const ts={addEventListener(s,e,t={}){for(const i of this.listeners(s))if(!t[F]&&i[pe]===e&&!i[F])return;let r;if(s==="message")r=function(n,o){const l=new xe("message",{data:o?n:n.toString()});l[I]=this,Z(e,this,l)};else if(s==="close")r=function(n,o){const l=new Y("close",{code:n,reason:o.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});l[I]=this,Z(e,this,l)};else if(s==="error")r=function(n){const o=new le("error",{error:n,message:n.message});o[I]=this,Z(e,this,o)};else if(s==="open")r=function(){const n=new B("open");n[I]=this,Z(e,this,n)};else return;r[F]=!!t[F],r[pe]=e,t.once?this.once(s,r):this.on(s,r)},removeEventListener(s,e){for(const t of this.listeners(s))if(t[pe]===e&&!t[F]){this.removeListener(s,t);break}}};var ss={CloseEvent:Y,ErrorEvent:le,Event:B,EventTarget:ts,MessageEvent:xe};function Z(s,e,t){typeof s=="object"&&s.handleEvent?s.handleEvent.call(s,t):s.call(e,t)}const{tokenChars:j}=ae;function k(s,e,t){s[e]===void 0?s[e]=[t]:s[e].push(t)}function rs(s){const e=Object.create(null);let t=Object.create(null),r=!1,i=!1,n=!1,o,l,f=-1,a=-1,c=-1,h=0;for(;h<s.length;h++)if(a=s.charCodeAt(h),o===void 0)if(c===-1&&j[a]===1)f===-1&&(f=h);else if(h!==0&&(a===32||a===9))c===-1&&f!==-1&&(c=h);else if(a===59||a===44){if(f===-1)throw new SyntaxError(`Unexpected character at index ${h}`);c===-1&&(c=h);const v=s.slice(f,c);a===44?(k(e,v,t),t=Object.create(null)):o=v,f=c=-1}else throw new SyntaxError(`Unexpected character at index ${h}`);else if(l===void 0)if(c===-1&&j[a]===1)f===-1&&(f=h);else if(a===32||a===9)c===-1&&f!==-1&&(c=h);else if(a===59||a===44){if(f===-1)throw new SyntaxError(`Unexpected character at index ${h}`);c===-1&&(c=h),k(t,s.slice(f,c),!0),a===44&&(k(e,o,t),t=Object.create(null),o=void 0),f=c=-1}else if(a===61&&f!==-1&&c===-1)l=s.slice(f,h),f=c=-1;else throw new SyntaxError(`Unexpected character at index ${h}`);else if(i){if(j[a]!==1)throw new SyntaxError(`Unexpected character at index ${h}`);f===-1?f=h:r||(r=!0),i=!1}else if(n)if(j[a]===1)f===-1&&(f=h);else if(a===34&&f!==-1)n=!1,c=h;else if(a===92)i=!0;else throw new SyntaxError(`Unexpected character at index ${h}`);else if(a===34&&s.charCodeAt(h-1)===61)n=!0;else if(c===-1&&j[a]===1)f===-1&&(f=h);else if(f!==-1&&(a===32||a===9))c===-1&&(c=h);else if(a===59||a===44){if(f===-1)throw new SyntaxError(`Unexpected character at index ${h}`);c===-1&&(c=h);let v=s.slice(f,c);r&&(v=v.replace(/\\/g,""),r=!1),k(t,l,v),a===44&&(k(e,o,t),t=Object.create(null),o=void 0),l=void 0,f=c=-1}else throw new SyntaxError(`Unexpected character at index ${h}`);if(f===-1||n||a===32||a===9)throw new SyntaxError("Unexpected end of input");c===-1&&(c=h);const p=s.slice(f,c);return o===void 0?k(e,p,t):(l===void 0?k(t,p,!0):r?k(t,l,p.replace(/\\/g,"")):k(t,l,p),k(e,o,t)),e}function is(s){return Object.keys(s).map(e=>{let t=s[e];return Array.isArray(t)||(t=[t]),t.map(r=>[e].concat(Object.keys(r).map(i=>{let n=r[i];return Array.isArray(n)||(n=[n]),n.map(o=>o===!0?i:`${i}=${o}`).join("; ")})).join("; ")).join(", ")}).join(", ")}var ot={format:is,parse:rs};const ns=S,os=S,as=S,at=S,ls=S,{randomBytes:fs,createHash:hs}=S,{URL:me}=S,T=oe,cs=it,us=nt,{BINARY_TYPES:ze,EMPTY_BUFFER:Q,GUID:ds,kForOnEventAttribute:ge,kListener:_s,kStatusCode:ps,kWebSocket:y,NOOP:lt}=U,{EventTarget:{addEventListener:ms,removeEventListener:gs}}=ss,{format:ys,parse:vs}=ot,{toBuffer:Ss}=ne,Es=30*1e3,ft=Symbol("kAborted"),ye=[8,13],O=["CONNECTING","OPEN","CLOSING","CLOSED"],bs=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;let m=class d extends ns{constructor(e,t,r){super(),this._binaryType=ze[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=Q,this._closeTimer=null,this._extensions={},this._paused=!1,this._protocol="",this._readyState=d.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,e!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,t===void 0?t=[]:Array.isArray(t)||(typeof t=="object"&&t!==null?(r=t,t=[]):t=[t]),ct(this,e,t,r)):this._isServer=!0}get binaryType(){return this._binaryType}set binaryType(e){ze.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(e,t,r){const i=new cs({binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:r.maxPayload,skipUTF8Validation:r.skipUTF8Validation});this._sender=new us(e,this._extensions,r.generateMask),this._receiver=i,this._socket=e,i[y]=this,e[y]=this,i.on("conclude",ws),i.on("drain",Os),i.on("error",Cs),i.on("message",Ts),i.on("ping",Ls),i.on("pong",Ns),e.setTimeout(0),e.setNoDelay(),t.length>0&&e.unshift(t),e.on("close",dt),e.on("data",fe),e.on("end",_t),e.on("error",pt),this._readyState=d.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=d.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[T.extensionName]&&this._extensions[T.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=d.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,t){if(this.readyState!==d.CLOSED){if(this.readyState===d.CONNECTING){b(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===d.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=d.CLOSING,this._sender.close(e,t,!this._isServer,r=>{r||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),this._closeTimer=setTimeout(this._socket.destroy.bind(this._socket),Es)}}pause(){this.readyState===d.CONNECTING||this.readyState===d.CLOSED||(this._paused=!0,this._socket.pause())}ping(e,t,r){if(this.readyState===d.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(r=e,e=t=void 0):typeof t=="function"&&(r=t,t=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==d.OPEN){ve(this,e,r);return}t===void 0&&(t=!this._isServer),this._sender.ping(e||Q,t,r)}pong(e,t,r){if(this.readyState===d.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(r=e,e=t=void 0):typeof t=="function"&&(r=t,t=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==d.OPEN){ve(this,e,r);return}t===void 0&&(t=!this._isServer),this._sender.pong(e||Q,t,r)}resume(){this.readyState===d.CONNECTING||this.readyState===d.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,t,r){if(this.readyState===d.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"&&(r=t,t={}),typeof e=="number"&&(e=e.toString()),this.readyState!==d.OPEN){ve(this,e,r);return}const i={binary:typeof e!="string",mask:!this._isServer,compress:!0,fin:!0,...t};this._extensions[T.extensionName]||(i.compress=!1),this._sender.send(e||Q,i,r)}terminate(){if(this.readyState!==d.CLOSED){if(this.readyState===d.CONNECTING){b(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=d.CLOSING,this._socket.destroy())}}};Object.defineProperty(m,"CONNECTING",{enumerable:!0,value:O.indexOf("CONNECTING")});Object.defineProperty(m.prototype,"CONNECTING",{enumerable:!0,value:O.indexOf("CONNECTING")});Object.defineProperty(m,"OPEN",{enumerable:!0,value:O.indexOf("OPEN")});Object.defineProperty(m.prototype,"OPEN",{enumerable:!0,value:O.indexOf("OPEN")});Object.defineProperty(m,"CLOSING",{enumerable:!0,value:O.indexOf("CLOSING")});Object.defineProperty(m.prototype,"CLOSING",{enumerable:!0,value:O.indexOf("CLOSING")});Object.defineProperty(m,"CLOSED",{enumerable:!0,value:O.indexOf("CLOSED")});Object.defineProperty(m.prototype,"CLOSED",{enumerable:!0,value:O.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(s=>{Object.defineProperty(m.prototype,s,{enumerable:!0})});["open","error","close","message"].forEach(s=>{Object.defineProperty(m.prototype,`on${s}`,{enumerable:!0,get(){for(const e of this.listeners(s))if(e[ge])return e[_s];return null},set(e){for(const t of this.listeners(s))if(t[ge]){this.removeListener(s,t);break}typeof e=="function"&&this.addEventListener(s,e,{[ge]:!0})}})});m.prototype.addEventListener=ms;m.prototype.removeEventListener=gs;var ht=m;function ct(s,e,t,r){const i={protocolVersion:ye[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...r,createConnection:void 0,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(!ye.includes(i.protocolVersion))throw new RangeError(`Unsupported protocol version: ${i.protocolVersion} (supported versions: ${ye.join(", ")})`);let n;if(e instanceof me)n=e,s._url=e.href;else{try{n=new me(e)}catch{throw new SyntaxError(`Invalid URL: ${e}`)}s._url=e}const o=n.protocol==="wss:",l=n.protocol==="ws+unix:";let f;if(n.protocol!=="ws:"&&!o&&!l?f=`The URL's protocol must be one of "ws:", "wss:", or "ws+unix:"`:l&&!n.pathname?f="The URL's pathname is empty":n.hash&&(f="The URL contains a fragment identifier"),f){const u=new SyntaxError(f);if(s._redirects===0)throw u;ee(s,u);return}const a=o?443:80,c=fs(16).toString("base64"),h=o?os.request:as.request,p=new Set;let v;if(i.createConnection=o?ks:xs,i.defaultPort=i.defaultPort||a,i.port=n.port||a,i.host=n.hostname.startsWith("[")?n.hostname.slice(1,-1):n.hostname,i.headers={...i.headers,"Sec-WebSocket-Version":i.protocolVersion,"Sec-WebSocket-Key":c,Connection:"Upgrade",Upgrade:"websocket"},i.path=n.pathname+n.search,i.timeout=i.handshakeTimeout,i.perMessageDeflate&&(v=new T(i.perMessageDeflate!==!0?i.perMessageDeflate:{},!1,i.maxPayload),i.headers["Sec-WebSocket-Extensions"]=ys({[T.extensionName]:v.offer()})),t.length){for(const u of t){if(typeof u!="string"||!bs.test(u)||p.has(u))throw new SyntaxError("An invalid or duplicated subprotocol was specified");p.add(u)}i.headers["Sec-WebSocket-Protocol"]=t.join(",")}if(i.origin&&(i.protocolVersion<13?i.headers["Sec-WebSocket-Origin"]=i.origin:i.headers.Origin=i.origin),(n.username||n.password)&&(i.auth=`${n.username}:${n.password}`),l){const u=i.path.split(":");i.socketPath=u[0],i.path=u[1]}let _;if(i.followRedirects){if(s._redirects===0){s._originalIpc=l,s._originalSecure=o,s._originalHostOrSocketPath=l?i.socketPath:n.host;const u=r&&r.headers;if(r={...r,headers:{}},u)for(const[E,$]of Object.entries(u))r.headers[E.toLowerCase()]=$}else if(s.listenerCount("redirect")===0){const u=l?s._originalIpc?i.socketPath===s._originalHostOrSocketPath:!1:s._originalIpc?!1:n.host===s._originalHostOrSocketPath;(!u||s._originalSecure&&!o)&&(delete i.headers.authorization,delete i.headers.cookie,u||delete i.headers.host,i.auth=void 0)}i.auth&&!r.headers.authorization&&(r.headers.authorization="Basic "+Buffer.from(i.auth).toString("base64")),_=s._req=h(i),s._redirects&&s.emit("redirect",s.url,_)}else _=s._req=h(i);i.timeout&&_.on("timeout",()=>{b(s,_,"Opening handshake has timed out")}),_.on("error",u=>{_===null||_[ft]||(_=s._req=null,ee(s,u))}),_.on("response",u=>{const E=u.headers.location,$=u.statusCode;if(E&&i.followRedirects&&$>=300&&$<400){if(++s._redirects>i.maxRedirects){b(s,_,"Maximum redirects exceeded");return}_.abort();let q;try{q=new me(E,e)}catch{const L=new SyntaxError(`Invalid URL: ${E}`);ee(s,L);return}ct(s,q,t,r)}else s.emit("unexpected-response",_,u)||b(s,_,`Unexpected server response: ${u.statusCode}`)}),_.on("upgrade",(u,E,$)=>{if(s.emit("upgrade",u),s.readyState!==m.CONNECTING)return;if(_=s._req=null,u.headers.upgrade.toLowerCase()!=="websocket"){b(s,E,"Invalid Upgrade header");return}const q=hs("sha1").update(c+ds).digest("base64");if(u.headers["sec-websocket-accept"]!==q){b(s,E,"Invalid Sec-WebSocket-Accept header");return}const D=u.headers["sec-websocket-protocol"];let L;if(D!==void 0?p.size?p.has(D)||(L="Server sent an invalid subprotocol"):L="Server sent a subprotocol but none was requested":p.size&&(L="Server sent no subprotocol"),L){b(s,E,L);return}D&&(s._protocol=D);const ke=u.headers["sec-websocket-extensions"];if(ke!==void 0){if(!v){b(s,E,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let he;try{he=vs(ke)}catch{b(s,E,"Invalid Sec-WebSocket-Extensions header");return}const we=Object.keys(he);if(we.length!==1||we[0]!==T.extensionName){b(s,E,"Server indicated an extension that was not requested");return}try{v.accept(he[T.extensionName])}catch{b(s,E,"Invalid Sec-WebSocket-Extensions header");return}s._extensions[T.extensionName]=v}s.setSocket(E,$,{generateMask:i.generateMask,maxPayload:i.maxPayload,skipUTF8Validation:i.skipUTF8Validation})}),i.finishRequest?i.finishRequest(_,s):_.end()}function ee(s,e){s._readyState=m.CLOSING,s.emit("error",e),s.emitClose()}function xs(s){return s.path=s.socketPath,at.connect(s)}function ks(s){return s.path=void 0,!s.servername&&s.servername!==""&&(s.servername=at.isIP(s.host)?"":s.host),ls.connect(s)}function b(s,e,t){s._readyState=m.CLOSING;const r=new Error(t);Error.captureStackTrace(r,b),e.setHeader?(e[ft]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(ee,s,r)):(e.destroy(r),e.once("error",s.emit.bind(s,"error")),e.once("close",s.emitClose.bind(s)))}function ve(s,e,t){if(e){const r=Ss(e).length;s._socket?s._sender._bufferedBytes+=r:s._bufferedAmount+=r}if(t){const r=new Error(`WebSocket is not open: readyState ${s.readyState} (${O[s.readyState]})`);process.nextTick(t,r)}}function ws(s,e){const t=this[y];t._closeFrameReceived=!0,t._closeMessage=e,t._closeCode=s,t._socket[y]!==void 0&&(t._socket.removeListener("data",fe),process.nextTick(ut,t._socket),s===1005?t.close():t.close(s,e))}function Os(){const s=this[y];s.isPaused||s._socket.resume()}function Cs(s){const e=this[y];e._socket[y]!==void 0&&(e._socket.removeListener("data",fe),process.nextTick(ut,e._socket),e.close(s[ps])),e.emit("error",s)}function Ye(){this[y].emitClose()}function Ts(s,e){this[y].emit("message",s,e)}function Ls(s){const e=this[y];e.pong(s,!e._isServer,lt),e.emit("ping",s)}function Ns(s){this[y].emit("pong",s)}function ut(s){s.resume()}function dt(){const s=this[y];this.removeListener("close",dt),this.removeListener("data",fe),this.removeListener("end",_t),s._readyState=m.CLOSING;let e;!this._readableState.endEmitted&&!s._closeFrameReceived&&!s._receiver._writableState.errorEmitted&&(e=s._socket.read())!==null&&s._receiver.write(e),s._receiver.end(),this[y]=void 0,clearTimeout(s._closeTimer),s._receiver._writableState.finished||s._receiver._writableState.errorEmitted?s.emitClose():(s._receiver.on("error",Ye),s._receiver.on("finish",Ye))}function fe(s){this[y]._receiver.write(s)||this.pause()}function _t(){const s=this[y];s._readyState=m.CLOSING,s._receiver.end(),this.end()}function pt(){const s=this[y];this.removeListener("error",pt),this.on("error",lt),s&&(s._readyState=m.CLOSING,this.destroy())}const Zs=z(ht),{tokenChars:Ps}=ae;function Rs(s){const e=new Set;let t=-1,r=-1,i=0;for(i;i<s.length;i++){const o=s.charCodeAt(i);if(r===-1&&Ps[o]===1)t===-1&&(t=i);else if(i!==0&&(o===32||o===9))r===-1&&t!==-1&&(r=i);else if(o===44){if(t===-1)throw new SyntaxError(`Unexpected character at index ${i}`);r===-1&&(r=i);const l=s.slice(t,r);if(e.has(l))throw new SyntaxError(`The "${l}" subprotocol is duplicated`);e.add(l),t=r=-1}else throw new SyntaxError(`Unexpected character at index ${i}`)}if(t===-1||r!==-1)throw new SyntaxError("Unexpected end of input");const n=s.slice(t,i);if(e.has(n))throw new SyntaxError(`The "${n}" subprotocol is duplicated`);return e.add(n),e}var Us={parse:Rs};const Bs=S,ie=S,{createHash:$s}=S,qe=ot,N=oe,Ms=Us,Is=ht,{GUID:Ds,kWebSocket:Ws}=U,As=/^[+/0-9A-Za-z]{22}==$/,Ke=0,Xe=1,mt=2;class Fs extends Bs{constructor(e,t){if(super(),e={maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:Is,...e},e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(e.port!=null?(this._server=ie.createServer((r,i)=>{const n=ie.STATUS_CODES[426];i.writeHead(426,{"Content-Length":n.length,"Content-Type":"text/plain"}),i.end(n)}),this._server.listen(e.port,e.host,e.backlog,t)):e.server&&(this._server=e.server),this._server){const r=this.emit.bind(this,"connection");this._removeListeners=Gs(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(i,n,o)=>{this.handleUpgrade(i,n,o,r)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=Ke}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(e){if(this._state===mt){e&&this.once("close",()=>{e(new Error("The server is not running"))}),process.nextTick(G,this);return}if(e&&this.once("close",e),this._state!==Xe)if(this._state=Xe,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(G,this):process.nextTick(G,this);else{const t=this._server;this._removeListeners(),this._removeListeners=this._server=null,t.close(()=>{G(this)})}}shouldHandle(e){if(this.options.path){const t=e.url.indexOf("?");if((t!==-1?e.url.slice(0,t):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,t,r,i){t.on("error",Ze);const n=e.headers["sec-websocket-key"],o=+e.headers["sec-websocket-version"];if(e.method!=="GET"){R(this,e,t,405,"Invalid HTTP method");return}if(e.headers.upgrade.toLowerCase()!=="websocket"){R(this,e,t,400,"Invalid Upgrade header");return}if(!n||!As.test(n)){R(this,e,t,400,"Missing or invalid Sec-WebSocket-Key header");return}if(o!==8&&o!==13){R(this,e,t,400,"Missing or invalid Sec-WebSocket-Version header");return}if(!this.shouldHandle(e)){H(t,400);return}const l=e.headers["sec-websocket-protocol"];let f=new Set;if(l!==void 0)try{f=Ms.parse(l)}catch{R(this,e,t,400,"Invalid Sec-WebSocket-Protocol header");return}const a=e.headers["sec-websocket-extensions"],c={};if(this.options.perMessageDeflate&&a!==void 0){const h=new N(this.options.perMessageDeflate,!0,this.options.maxPayload);try{const p=qe.parse(a);p[N.extensionName]&&(h.accept(p[N.extensionName]),c[N.extensionName]=h)}catch{R(this,e,t,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){const h={origin:e.headers[`${o===8?"sec-websocket-origin":"origin"}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(h,(p,v,_,u)=>{if(!p)return H(t,v||401,_,u);this.completeUpgrade(c,n,f,e,t,r,i)});return}if(!this.options.verifyClient(h))return H(t,401)}this.completeUpgrade(c,n,f,e,t,r,i)}completeUpgrade(e,t,r,i,n,o,l){if(!n.readable||!n.writable)return n.destroy();if(n[Ws])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>Ke)return H(n,503);const a=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${$s("sha1").update(t+Ds).digest("base64")}`],c=new this.options.WebSocket(null);if(r.size){const h=this.options.handleProtocols?this.options.handleProtocols(r,i):r.values().next().value;h&&(a.push(`Sec-WebSocket-Protocol: ${h}`),c._protocol=h)}if(e[N.extensionName]){const h=e[N.extensionName].params,p=qe.format({[N.extensionName]:[h]});a.push(`Sec-WebSocket-Extensions: ${p}`),c._extensions=e}this.emit("headers",a,i),n.write(a.concat(`\r
2
+ `).join(`\r
3
+ `)),n.removeListener("error",Ze),c.setSocket(n,o,{maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(c),c.on("close",()=>{this.clients.delete(c),this._shouldEmitClose&&!this.clients.size&&process.nextTick(G,this)})),l(c,i)}}var js=Fs;function Gs(s,e){for(const t of Object.keys(e))s.on(t,e[t]);return function(){for(const r of Object.keys(e))s.removeListener(r,e[r])}}function G(s){s._state=mt,s.emit("close")}function Ze(){this.destroy()}function H(s,e,t,r){t=t||ie.STATUS_CODES[e],r={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(t),...r},s.once("finish",s.destroy),s.end(`HTTP/1.1 ${e} ${ie.STATUS_CODES[e]}\r
4
+ `+Object.keys(r).map(i=>`${i}: ${r[i]}`).join(`\r
5
+ `)+`\r
6
+ \r
7
+ `+t)}function R(s,e,t,r,i){if(s.listenerCount("wsClientError")){const n=new Error(i);Error.captureStackTrace(n,R),s.emit("wsClientError",n,t,e)}else H(t,r,i)}const Qs=z(js);export{Ks as Receiver,Xs as Sender,Zs as WebSocket,Qs as WebSocketServer,Hs as createWebSocketStream,Zs as default};
index.html CHANGED
@@ -1,19 +1,14 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
  </html>
 
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>Vite + Svelte</title>
8
+ <script type="module" crossorigin src="/assets/index-nhhIhy04.js"></script>
9
+ <link rel="stylesheet" crossorigin href="/assets/index-pIgnnrnI.css">
10
+ </head>
11
+ <body>
12
+ <div id="app"></div>
13
+ </body>
 
 
 
 
 
14
  </html>
style.css DELETED
@@ -1,28 +0,0 @@
1
- body {
2
- padding: 2rem;
3
- font-family: -apple-system, BlinkMacSystemFont, "Arial", sans-serif;
4
- }
5
-
6
- h1 {
7
- font-size: 16px;
8
- margin-top: 0;
9
- }
10
-
11
- p {
12
- color: rgb(107, 114, 128);
13
- font-size: 15px;
14
- margin-bottom: 10px;
15
- margin-top: 5px;
16
- }
17
-
18
- .card {
19
- max-width: 620px;
20
- margin: 0 auto;
21
- padding: 16px;
22
- border: 1px solid lightgray;
23
- border-radius: 16px;
24
- }
25
-
26
- .card p:last-child {
27
- margin-bottom: 0;
28
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vite.svg ADDED