GitHub Action commited on
Commit
dbfc0e6
·
1 Parent(s): 5769185

Sync from GitHub: 51dbb867483d1a2553fca48afc94b526a765cd1e

Browse files
.gitattributes CHANGED
@@ -7,3 +7,9 @@
7
  *.mp4 filter=lfs diff=lfs merge=lfs -text
8
  *.webm filter=lfs diff=lfs merge=lfs -text
9
  *.pdf filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
7
  *.mp4 filter=lfs diff=lfs merge=lfs -text
8
  *.webm filter=lfs diff=lfs merge=lfs -text
9
  *.pdf filter=lfs diff=lfs merge=lfs -text
10
+ hfstudio/static/assets/hf-logo.png filter=lfs diff=lfs merge=lfs -text
11
+ hfstudio/static/assets/hf-studio-logo.png filter=lfs diff=lfs merge=lfs -text
12
+ frontend/static/assets/hf-logo.png filter=lfs diff=lfs merge=lfs -text
13
+ frontend/static/assets/hf-studio-logo.png filter=lfs diff=lfs merge=lfs -text
14
+ hfstudio/static/samples/harvard.wav filter=lfs diff=lfs merge=lfs -text
15
+ frontend/static/samples/harvard.wav filter=lfs diff=lfs merge=lfs -text
frontend/src/routes/+page.svelte CHANGED
@@ -123,7 +123,7 @@
123
  // Cloned voice
124
  const userVoice = userVoices[0];
125
  if (userVoice && userVoice.voice_url) {
126
- voiceUrl = window.location.origin + userVoice.voice_url;
127
  }
128
  } else {
129
  // Built-in voice
@@ -315,7 +315,7 @@
315
  // Check if this is a user voice (cloned voice)
316
  const userVoice = userVoices.find((v) => v.voice_name === selectedVoice);
317
  if (userVoice && userVoice.voice_url) {
318
- voiceUrl = window.location.origin + userVoice.voice_url;
319
  } else {
320
  // Check built-in voices
321
  const builtInVoice = voices.find((v) => v.name === selectedVoice);
@@ -470,7 +470,7 @@ ${clientCode}`;
470
  if (selectedVoice === 'Yours' && userVoices.length > 0) {
471
  const userVoice = userVoices[0]; // Use the first (latest) user voice
472
  if (userVoice && userVoice.voice_url) {
473
- voiceUrl = window.location.origin + userVoice.voice_url;
474
  }
475
  } else {
476
  // Check built-in voices
@@ -519,7 +519,7 @@ audio_bytes = client.text_to_speech(
519
  if (selectedVoice === 'Yours' && userVoices.length > 0) {
520
  const userVoice = userVoices[0];
521
  if (userVoice && userVoice.voice_url) {
522
- voiceUrl = window.location.origin + userVoice.voice_url;
523
  }
524
  } else {
525
  const voice = voices.find((v) => v.name === selectedVoice);
 
123
  // Cloned voice
124
  const userVoice = userVoices[0];
125
  if (userVoice && userVoice.voice_url) {
126
+ voiceUrl = userVoice.voice_url; // Use external URL directly
127
  }
128
  } else {
129
  // Built-in voice
 
315
  // Check if this is a user voice (cloned voice)
316
  const userVoice = userVoices.find((v) => v.voice_name === selectedVoice);
317
  if (userVoice && userVoice.voice_url) {
318
+ voiceUrl = userVoice.voice_url; // Use external URL directly
319
  } else {
320
  // Check built-in voices
321
  const builtInVoice = voices.find((v) => v.name === selectedVoice);
 
470
  if (selectedVoice === 'Yours' && userVoices.length > 0) {
471
  const userVoice = userVoices[0]; // Use the first (latest) user voice
472
  if (userVoice && userVoice.voice_url) {
473
+ voiceUrl = userVoice.voice_url; // Use external URL directly
474
  }
475
  } else {
476
  // Check built-in voices
 
519
  if (selectedVoice === 'Yours' && userVoices.length > 0) {
520
  const userVoice = userVoices[0];
521
  if (userVoice && userVoice.voice_url) {
522
+ voiceUrl = userVoice.voice_url; // Use external URL directly
523
  }
524
  } else {
525
  const voice = voices.find((v) => v.name === selectedVoice);
hfstudio/server.py CHANGED
@@ -41,6 +41,7 @@ from sqlalchemy.orm import Session
41
  from transformers import pipeline
42
  import soundfile as sf
43
  from pydub import AudioSegment
 
44
 
45
 
46
  class TTSRequest(BaseModel):
@@ -170,6 +171,31 @@ def cleanup_expired_voices(db: Session):
170
  return len(expired_voices)
171
 
172
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
173
  def is_running_on_spaces() -> bool:
174
  """Check if running on HuggingFace Spaces using SPACE_ID environment variable."""
175
  return bool(os.getenv("SPACE_ID"))
@@ -202,7 +228,26 @@ def generate_tts_with_client(
202
 
203
  # Use provided voice URL (works for both built-in and cloned voices)
204
  if request.voice_url:
205
- extra_body["audio_url"] = request.voice_url
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
206
 
207
  # Time the API call
208
  start_time = time.time()
@@ -1047,8 +1092,15 @@ async def upload_voice_to_server(
1047
  # Set expiration to 24 hours from now
1048
  expires_at = datetime.utcnow() + timedelta(hours=24)
1049
 
1050
- # Create direct static file URL
1051
- public_url = f"/voices/{url_id}.mp3"
 
 
 
 
 
 
 
1052
 
1053
  # Save voice info to database
1054
  voice_record = Voice(
 
41
  from transformers import pipeline
42
  import soundfile as sf
43
  from pydub import AudioSegment
44
+ from gradio_client import Client, handle_file
45
 
46
 
47
  class TTSRequest(BaseModel):
 
171
  return len(expired_voices)
172
 
173
 
174
+ def upload_voice_to_external_space(local_file_path: Path) -> str:
175
+ """Upload voice file to external Gradio space and return public URL."""
176
+ try:
177
+ print(f"Uploading voice file to external space: {local_file_path}")
178
+ client = Client("abidlabs/hfstudio-voices", download_files=False)
179
+ result = client.predict(
180
+ x=handle_file(str(local_file_path)), api_name="/predict"
181
+ )
182
+ print(f"Upload successful, received result: {result}")
183
+
184
+ # Extract the URL from the result dictionary
185
+ if isinstance(result, dict) and "url" in result:
186
+ public_url = result["url"]
187
+ print(f"Extracted public URL: {public_url}")
188
+ return public_url
189
+ else:
190
+ # Fallback: if result format is different, return as-is
191
+ print(f"Unexpected result format, returning as-is: {result}")
192
+ return str(result)
193
+
194
+ except Exception as e:
195
+ print(f"Error uploading to external space: {e}")
196
+ raise
197
+
198
+
199
  def is_running_on_spaces() -> bool:
200
  """Check if running on HuggingFace Spaces using SPACE_ID environment variable."""
201
  return bool(os.getenv("SPACE_ID"))
 
228
 
229
  # Use provided voice URL (works for both built-in and cloned voices)
230
  if request.voice_url:
231
+ # Check if this is a local voice file (self-referential URL that would cause deadlock)
232
+ if request.voice_url.startswith("/voices/"):
233
+ # For local voice files, we need to convert them to external URLs
234
+ # to avoid the deadlock where the server can't serve the file while processing TTS
235
+ local_file_path = voices_dir / request.voice_url.replace("/voices/", "")
236
+ if local_file_path.exists():
237
+ try:
238
+ # Upload to external Gradio space to get a public URL
239
+ external_url = upload_voice_to_external_space(local_file_path)
240
+ extra_body["audio_url"] = external_url
241
+ print(f"Using external space URL for voice: {external_url}")
242
+ except Exception as e:
243
+ print(f"Failed to upload voice to external space: {e}")
244
+ # Skip voice URL to avoid deadlock
245
+ print("WARNING: Skipping voice URL to avoid server deadlock")
246
+ else:
247
+ print(f"Local voice file not found: {local_file_path}")
248
+ else:
249
+ # External URL, use as-is
250
+ extra_body["audio_url"] = request.voice_url
251
 
252
  # Time the API call
253
  start_time = time.time()
 
1092
  # Set expiration to 24 hours from now
1093
  expires_at = datetime.utcnow() + timedelta(hours=24)
1094
 
1095
+ # Upload to external Gradio space to get a public URL (avoids deadlock)
1096
+ try:
1097
+ external_url = upload_voice_to_external_space(file_path)
1098
+ public_url = external_url
1099
+ print(f"Voice uploaded to external space: {external_url}")
1100
+ except Exception as e:
1101
+ print(f"Failed to upload to external space, using local URL: {e}")
1102
+ # Fallback to local URL (may cause deadlock but better than failing)
1103
+ public_url = f"/voices/{url_id}.mp3"
1104
 
1105
  # Save voice info to database
1106
  voice_record = Voice(
hfstudio/static/_app/immutable/chunks/D0F9faoj.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{s as e}from"./D2RBa_m5.js";const r=()=>{const s=e;return{page:{subscribe:s.page.subscribe},navigating:{subscribe:s.navigating.subscribe},updated:s.updated}},b={subscribe(s){return r().page.subscribe(s)}};export{b as p};
hfstudio/static/_app/immutable/chunks/D2RBa_m5.js ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ var St=Object.defineProperty;var kt=(e,t,n)=>t in e?St(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var R=(e,t,n)=>kt(e,typeof t!="symbol"?t+"":t,n);import{S as Et,U as At,$ as Rt,a0 as Tt,a1 as It,a2 as Ut,a3 as Lt,a4 as $t,G as ve,a5 as xt,V as be,n as ge,s as Ct}from"./TRxHAhOH.js";class Ze extends Et{constructor(n){if(!n||!n.target&&!n.$$inline)throw new Error("'target' is a required option");super();R(this,"$$prop_def");R(this,"$$events_def");R(this,"$$slot_def")}$destroy(){super.$destroy(),this.$destroy=()=>{console.warn("Component was already destroyed")}}$capture_state(){}$inject_state(){}}class Pt extends Ze{}const Ot=Object.freeze(Object.defineProperty({__proto__:null,SvelteComponent:Ze,SvelteComponentTyped:Pt,afterUpdate:At,beforeUpdate:Rt,createEventDispatcher:Tt,getAllContexts:It,getContext:Ut,hasContext:Lt,onDestroy:$t,onMount:ve,setContext:xt,tick:be},Symbol.toStringTag,{value:"Module"}));class ie{constructor(t,n){this.status=t,typeof n=="string"?this.body={message:n}:n?this.body=n:this.body={message:`Error: ${t}`}}toString(){return JSON.stringify(this.body)}}class Re{constructor(t,n){this.status=t,this.location=n}}class Te extends Error{constructor(t,n,r){super(r),this.status=t,this.text=n}}new URL("sveltekit-internal://");function Nt(e,t){return e==="/"||t==="ignore"?e:t==="never"?e.endsWith("/")?e.slice(0,-1):e:t==="always"&&!e.endsWith("/")?e+"/":e}function jt(e){return e.split("%25").map(decodeURI).join("%25")}function Dt(e){for(const t in e)e[t]=decodeURIComponent(e[t]);return e}function me({href:e}){return e.split("#")[0]}function Bt(e,t,n,r=!1){const a=new URL(e);Object.defineProperty(a,"searchParams",{value:new Proxy(a.searchParams,{get(i,o){if(o==="get"||o==="getAll"||o==="has")return l=>(n(l),i[o](l));t();const c=Reflect.get(i,o);return typeof c=="function"?c.bind(i):c}}),enumerable:!0,configurable:!0});const s=["href","pathname","search","toString","toJSON"];r&&s.push("hash");for(const i of s)Object.defineProperty(a,i,{get(){return t(),e[i]},enumerable:!0,configurable:!0});return a}function Ft(...e){let t=5381;for(const n of e)if(typeof n=="string"){let r=n.length;for(;r;)t=t*33^n.charCodeAt(--r)}else if(ArrayBuffer.isView(n)){const r=new Uint8Array(n.buffer,n.byteOffset,n.byteLength);let a=r.length;for(;a;)t=t*33^r[--a]}else throw new TypeError("value must be a string or TypedArray");return(t>>>0).toString(36)}new TextEncoder;const Vt=new TextDecoder;function Mt(e){const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}const qt=window.fetch;window.fetch=(e,t)=>((e instanceof Request?e.method:(t==null?void 0:t.method)||"GET")!=="GET"&&Y.delete(Ie(e)),qt(e,t));const Y=new Map;function Gt(e,t){const n=Ie(e,t),r=document.querySelector(n);if(r!=null&&r.textContent){r.remove();let{body:a,...s}=JSON.parse(r.textContent);const i=r.getAttribute("data-ttl");return i&&Y.set(n,{body:a,init:s,ttl:1e3*Number(i)}),r.getAttribute("data-b64")!==null&&(a=Mt(a)),Promise.resolve(new Response(a,s))}return window.fetch(e,t)}function Yt(e,t,n){if(Y.size>0){const r=Ie(e,n),a=Y.get(r);if(a){if(performance.now()<a.ttl&&["default","force-cache","only-if-cached",void 0].includes(n==null?void 0:n.cache))return new Response(a.body,a.init);Y.delete(r)}}return window.fetch(t,n)}function Ie(e,t){let r=`script[data-sveltekit-fetched][data-url=${JSON.stringify(e instanceof Request?e.url:e)}]`;if(t!=null&&t.headers||t!=null&&t.body){const a=[];t.headers&&a.push([...new Headers(t.headers)].join(",")),t.body&&(typeof t.body=="string"||ArrayBuffer.isView(t.body))&&a.push(t.body),r+=`[data-hash="${Ft(...a)}"]`}return r}const Ht=/^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/;function Kt(e){const t=[];return{pattern:e==="/"?/^\/$/:new RegExp(`^${Wt(e).map(r=>{const a=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(r);if(a)return t.push({name:a[1],matcher:a[2],optional:!1,rest:!0,chained:!0}),"(?:/([^]*))?";const s=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(r);if(s)return t.push({name:s[1],matcher:s[2],optional:!0,rest:!1,chained:!0}),"(?:/([^/]+))?";if(!r)return;const i=r.split(/\[(.+?)\](?!\])/);return"/"+i.map((c,l)=>{if(l%2){if(c.startsWith("x+"))return _e(String.fromCharCode(parseInt(c.slice(2),16)));if(c.startsWith("u+"))return _e(String.fromCharCode(...c.slice(2).split("-").map(u=>parseInt(u,16))));const d=Ht.exec(c),[,h,y,f,p]=d;return t.push({name:f,matcher:p,optional:!!h,rest:!!y,chained:y?l===1&&i[0]==="":!1}),y?"([^]*?)":h?"([^/]*)?":"([^/]+?)"}return _e(c)}).join("")}).join("")}/?$`),params:t}}function zt(e){return e!==""&&!/^\([^)]+\)$/.test(e)}function Wt(e){return e.slice(1).split("/").filter(zt)}function Jt(e,t,n){const r={},a=e.slice(1),s=a.filter(o=>o!==void 0);let i=0;for(let o=0;o<t.length;o+=1){const c=t[o];let l=a[o-i];if(c.chained&&c.rest&&i&&(l=a.slice(o-i,o+1).filter(d=>d).join("/"),i=0),l===void 0){c.rest&&(r[c.name]="");continue}if(!c.matcher||n[c.matcher](l)){r[c.name]=l;const d=t[o+1],h=a[o+1];d&&!d.rest&&d.optional&&h&&c.chained&&(i=0),!d&&!h&&Object.keys(r).length===s.length&&(i=0);continue}if(c.optional&&c.chained){i++;continue}return}if(!i)return r}function _e(e){return e.normalize().replace(/[[\]]/g,"\\$&").replace(/%/g,"%25").replace(/\//g,"%2[Ff]").replace(/\?/g,"%3[Ff]").replace(/#/g,"%23").replace(/[.*+?^${}()|\\]/g,"\\$&")}function Xt({nodes:e,server_loads:t,dictionary:n,matchers:r}){const a=new Set(t);return Object.entries(n).map(([o,[c,l,d]])=>{const{pattern:h,params:y}=Kt(o),f={id:o,exec:p=>{const u=h.exec(p);if(u)return Jt(u,y,r)},errors:[1,...d||[]].map(p=>e[p]),layouts:[0,...l||[]].map(i),leaf:s(c)};return f.errors.length=f.layouts.length=Math.max(f.errors.length,f.layouts.length),f});function s(o){const c=o<0;return c&&(o=~o),[c,e[o]]}function i(o){return o===void 0?o:[a.has(o),e[o]]}}function Qe(e,t=JSON.parse){try{return t(sessionStorage[e])}catch{}}function Fe(e,t,n=JSON.stringify){const r=n(t);try{sessionStorage[e]=r}catch{}}const D=[];function Ue(e,t=ge){let n;const r=new Set;function a(o){if(Ct(e,o)&&(e=o,n)){const c=!D.length;for(const l of r)l[1](),D.push(l,e);if(c){for(let l=0;l<D.length;l+=2)D[l][0](D[l+1]);D.length=0}}}function s(o){a(o(e))}function i(o,c=ge){const l=[o,c];return r.add(l),r.size===1&&(n=t(a,s)||ge),o(e),()=>{r.delete(l),r.size===0&&n&&(n(),n=null)}}return{set:a,update:s,subscribe:i}}var Je;const $=((Je=globalThis.__sveltekit_1ui4hh5)==null?void 0:Je.base)??"";var Xe;const Zt=((Xe=globalThis.__sveltekit_1ui4hh5)==null?void 0:Xe.assets)??$??"",Qt="1761297735189",et="sveltekit:snapshot",tt="sveltekit:scroll",nt="sveltekit:states",en="sveltekit:pageurl",F="sveltekit:history",z="sveltekit:navigation",O={tap:1,hover:2,viewport:3,eager:4,off:-1,false:-1},ce=location.origin;function at(e){if(e instanceof URL)return e;let t=document.baseURI;if(!t){const n=document.getElementsByTagName("base");t=n.length?n[0].href:document.URL}return new URL(e,t)}function le(){return{x:pageXOffset,y:pageYOffset}}function B(e,t){return e.getAttribute(`data-sveltekit-${t}`)}const Ve={...O,"":O.hover};function rt(e){let t=e.assignedSlot??e.parentNode;return(t==null?void 0:t.nodeType)===11&&(t=t.host),t}function ot(e,t){for(;e&&e!==t;){if(e.nodeName.toUpperCase()==="A"&&e.hasAttribute("href"))return e;e=rt(e)}}function Se(e,t,n){let r;try{if(r=new URL(e instanceof SVGAElement?e.href.baseVal:e.href,document.baseURI),n&&r.hash.match(/^#[^/]/)){const o=location.hash.split("#")[1]||"/";r.hash=`#${o}${r.hash}`}}catch{}const a=e instanceof SVGAElement?e.target.baseVal:e.target,s=!r||!!a||fe(r,t,n)||(e.getAttribute("rel")||"").split(/\s+/).includes("external"),i=(r==null?void 0:r.origin)===ce&&e.hasAttribute("download");return{url:r,external:s,target:a,download:i}}function Q(e){let t=null,n=null,r=null,a=null,s=null,i=null,o=e;for(;o&&o!==document.documentElement;)r===null&&(r=B(o,"preload-code")),a===null&&(a=B(o,"preload-data")),t===null&&(t=B(o,"keepfocus")),n===null&&(n=B(o,"noscroll")),s===null&&(s=B(o,"reload")),i===null&&(i=B(o,"replacestate")),o=rt(o);function c(l){switch(l){case"":case"true":return!0;case"off":case"false":return!1;default:return}}return{preload_code:Ve[r??"off"],preload_data:Ve[a??"off"],keepfocus:c(t),noscroll:c(n),reload:c(s),replace_state:c(i)}}function Me(e){const t=Ue(e);let n=!0;function r(){n=!0,t.update(i=>i)}function a(i){n=!1,t.set(i)}function s(i){let o;return t.subscribe(c=>{(o===void 0||n&&c!==o)&&i(o=c)})}return{notify:r,set:a,subscribe:s}}const st={v:()=>{}};function tn(){const{set:e,subscribe:t}=Ue(!1);let n;async function r(){clearTimeout(n);try{const a=await fetch(`${Zt}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(!a.ok)return!1;const i=(await a.json()).version!==Qt;return i&&(e(!0),st.v(),clearTimeout(n)),i}catch{return!1}}return{subscribe:t,check:r}}function fe(e,t,n){return e.origin!==ce||!e.pathname.startsWith(t)?!0:n?!(e.pathname===t+"/"||e.pathname===t+"/index.html"||e.protocol==="file:"&&e.pathname.replace(/\/[^/]+\.html?$/,"")===t):!1}function qn(e){}function nn(e){const t=rn(e),n=new ArrayBuffer(t.length),r=new DataView(n);for(let a=0;a<n.byteLength;a++)r.setUint8(a,t.charCodeAt(a));return n}const an="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function rn(e){e.length%4===0&&(e=e.replace(/==?$/,""));let t="",n=0,r=0;for(let a=0;a<e.length;a++)n<<=6,n|=an.indexOf(e[a]),r+=6,r===24&&(t+=String.fromCharCode((n&16711680)>>16),t+=String.fromCharCode((n&65280)>>8),t+=String.fromCharCode(n&255),n=r=0);return r===12?(n>>=4,t+=String.fromCharCode(n)):r===18&&(n>>=2,t+=String.fromCharCode((n&65280)>>8),t+=String.fromCharCode(n&255)),t}const on=-1,sn=-2,cn=-3,ln=-4,fn=-5,un=-6;function dn(e,t){if(typeof e=="number")return a(e,!0);if(!Array.isArray(e)||e.length===0)throw new Error("Invalid input");const n=e,r=Array(n.length);function a(s,i=!1){if(s===on)return;if(s===cn)return NaN;if(s===ln)return 1/0;if(s===fn)return-1/0;if(s===un)return-0;if(i||typeof s!="number")throw new Error("Invalid input");if(s in r)return r[s];const o=n[s];if(!o||typeof o!="object")r[s]=o;else if(Array.isArray(o))if(typeof o[0]=="string"){const c=o[0],l=t==null?void 0:t[c];if(l)return r[s]=l(a(o[1]));switch(c){case"Date":r[s]=new Date(o[1]);break;case"Set":const d=new Set;r[s]=d;for(let f=1;f<o.length;f+=1)d.add(a(o[f]));break;case"Map":const h=new Map;r[s]=h;for(let f=1;f<o.length;f+=2)h.set(a(o[f]),a(o[f+1]));break;case"RegExp":r[s]=new RegExp(o[1],o[2]);break;case"Object":r[s]=Object(o[1]);break;case"BigInt":r[s]=BigInt(o[1]);break;case"null":const y=Object.create(null);r[s]=y;for(let f=1;f<o.length;f+=2)y[o[f]]=a(o[f+1]);break;case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"BigInt64Array":case"BigUint64Array":{const f=globalThis[c],p=new f(a(o[1]));r[s]=o[2]!==void 0?p.subarray(o[2],o[3]):p;break}case"ArrayBuffer":{const f=o[1],p=nn(f);r[s]=p;break}case"Temporal.Duration":case"Temporal.Instant":case"Temporal.PlainDate":case"Temporal.PlainTime":case"Temporal.PlainDateTime":case"Temporal.PlainMonthDay":case"Temporal.PlainYearMonth":case"Temporal.ZonedDateTime":{const f=c.slice(9);r[s]=Temporal[f].from(o[1]);break}case"URL":{const f=new URL(o[1]);r[s]=f;break}case"URLSearchParams":{const f=new URLSearchParams(o[1]);r[s]=f;break}default:throw new Error(`Unknown type ${c}`)}}else{const c=new Array(o.length);r[s]=c;for(let l=0;l<o.length;l+=1){const d=o[l];d!==sn&&(c[l]=a(d))}}else{const c={};r[s]=c;for(const l in o){if(l==="__proto__")throw new Error("Cannot parse an object with a `__proto__` property");const d=o[l];c[l]=a(d)}}return r[s]}return a(0)}const it=new Set(["load","prerender","csr","ssr","trailingSlash","config"]);[...it];const hn=new Set([...it]);[...hn];function pn(e){return e.filter(t=>t!=null)}const gn="x-sveltekit-invalidated",mn="x-sveltekit-trailing-slash";function ee(e){return e instanceof ie||e instanceof Te?e.status:500}function _n(e){return e instanceof Te?e.text:"Internal Error"}let T,W,we;const wn=ve.toString().includes("$$")||/function \w+\(\) \{\}/.test(ve.toString());wn?(T={data:{},form:null,error:null,params:{},route:{id:null},state:{},status:-1,url:new URL("https://example.com")},W={current:null},we={current:!1}):(T=new class{constructor(){R(this,"data",$state.raw({}));R(this,"form",$state.raw(null));R(this,"error",$state.raw(null));R(this,"params",$state.raw({}));R(this,"route",$state.raw({id:null}));R(this,"state",$state.raw({}));R(this,"status",$state.raw(-1));R(this,"url",$state.raw(new URL("https://example.com")))}},W=new class{constructor(){R(this,"current",$state.raw(null))}},we=new class{constructor(){R(this,"current",$state.raw(!1))}},st.v=()=>we.current=!0);function yn(e){Object.assign(T,e)}const vn="/__data.json",bn=".html__data.json";function Sn(e){return e.endsWith(".html")?e.replace(/\.html$/,bn):e.replace(/\/$/,"")+vn}const qe={spanContext(){return kn},setAttribute(){return this},setAttributes(){return this},addEvent(){return this},setStatus(){return this},updateName(){return this},end(){return this},isRecording(){return!1},recordException(){return this},addLink(){return this},addLinks(){return this}},kn={traceId:"",spanId:"",traceFlags:0},{tick:En}=Ot,An=new Set(["icon","shortcut icon","apple-touch-icon"]),j=Qe(tt)??{},J=Qe(et)??{},C={url:Me({}),page:Me({}),navigating:Ue(null),updated:tn()};function Le(e){j[e]=le()}function Rn(e,t){let n=e+1;for(;j[n];)delete j[n],n+=1;for(n=t+1;J[n];)delete J[n],n+=1}function q(e,t=!1){return t?location.replace(e.href):location.href=e.href,new Promise(()=>{})}async function ct(){if("serviceWorker"in navigator){const e=await navigator.serviceWorker.getRegistration($||"/");e&&await e.update()}}function Ge(){}let $e,ke,te,x,Ee,k;const ne=[],ae=[];let U=null;const Z=new Map,lt=new Set,Tn=new Set,H=new Set;let b={branch:[],error:null,url:null},xe=!1,re=!1,Ye=!0,X=!1,G=!1,ft=!1,Ce=!1,ut,A,L,N;const K=new Set,He=new Map;async function Kn(e,t,n){var s,i,o,c,l;(s=globalThis.__sveltekit_1ui4hh5)!=null&&s.data&&globalThis.__sveltekit_1ui4hh5.data,document.URL!==location.href&&(location.href=location.href),k=e,await((o=(i=e.hooks).init)==null?void 0:o.call(i)),$e=Xt(e),x=document.documentElement,Ee=t,ke=e.nodes[0],te=e.nodes[1],ke(),te(),A=(c=history.state)==null?void 0:c[F],L=(l=history.state)==null?void 0:l[z],A||(A=L=Date.now(),history.replaceState({...history.state,[F]:A,[z]:L},""));const r=j[A];function a(){r&&(history.scrollRestoration="manual",scrollTo(r.x,r.y))}n?(a(),await Dn(Ee,n)):(await V({type:"enter",url:at(k.hash?Fn(new URL(location.href)):location.href),replace_state:!0}),a()),jn()}function In(){ne.length=0,Ce=!1}function dt(e){ae.some(t=>t==null?void 0:t.snapshot)&&(J[e]=ae.map(t=>{var n;return(n=t==null?void 0:t.snapshot)==null?void 0:n.capture()}))}function ht(e){var t;(t=J[e])==null||t.forEach((n,r)=>{var a,s;(s=(a=ae[r])==null?void 0:a.snapshot)==null||s.restore(n)})}function Ke(){Le(A),Fe(tt,j),dt(L),Fe(et,J)}async function Un(e,t,n,r){let a;t.invalidateAll&&(U=null),await V({type:"goto",url:at(e),keepfocus:t.keepFocus,noscroll:t.noScroll,replace_state:t.replaceState,state:t.state,redirect_count:n,nav_token:r,accept:()=>{t.invalidateAll&&(Ce=!0,a=[...He.keys()]),t.invalidate&&t.invalidate.forEach(Nn)}}),t.invalidateAll&&be().then(be).then(()=>{He.forEach(({resource:s},i)=>{var o;a!=null&&a.includes(i)&&((o=s.refresh)==null||o.call(s))})})}async function Ln(e){if(e.id!==(U==null?void 0:U.id)){const t={};K.add(t),U={id:e.id,token:t,promise:mt({...e,preload:t}).then(n=>(K.delete(t),n.type==="loaded"&&n.state.error&&(U=null),n))}}return U.promise}async function ye(e){var n;const t=(n=await de(e,!1))==null?void 0:n.route;t&&await Promise.all([...t.layouts,t.leaf].map(r=>r==null?void 0:r[1]()))}function pt(e,t,n){var a;b=e.state;const r=document.querySelector("style[data-sveltekit]");if(r&&r.remove(),Object.assign(T,e.props.page),ut=new k.root({target:t,props:{...e.props,stores:C,components:ae},hydrate:n,sync:!1}),ht(L),n){const s={from:null,to:{params:b.params,route:{id:((a=b.route)==null?void 0:a.id)??null},url:new URL(location.href)},willUnload:!1,type:"enter",complete:Promise.resolve()};H.forEach(i=>i(s))}re=!0}function oe({url:e,params:t,branch:n,status:r,error:a,route:s,form:i}){let o="never";if($&&(e.pathname===$||e.pathname===$+"/"))o="always";else for(const f of n)(f==null?void 0:f.slash)!==void 0&&(o=f.slash);e.pathname=Nt(e.pathname,o),e.search=e.search;const c={type:"loaded",state:{url:e,params:t,branch:n,error:a,route:s},props:{constructors:pn(n).map(f=>f.node.component),page:je(T)}};i!==void 0&&(c.props.form=i);let l={},d=!T,h=0;for(let f=0;f<Math.max(n.length,b.branch.length);f+=1){const p=n[f],u=b.branch[f];(p==null?void 0:p.data)!==(u==null?void 0:u.data)&&(d=!0),p&&(l={...l,...p.data},d&&(c.props[`data_${h}`]=l),h+=1)}return(!b.url||e.href!==b.url.href||b.error!==a||i!==void 0&&i!==T.form||d)&&(c.props.page={error:a,params:t,route:{id:(s==null?void 0:s.id)??null},state:{},status:r,url:new URL(e),form:i??null,data:d?l:T.data}),c}async function Pe({loader:e,parent:t,url:n,params:r,route:a,server_data_node:s}){var d,h,y;let i=null,o=!0;const c={dependencies:new Set,params:new Set,parent:!1,route:!1,url:!1,search_params:new Set},l=await e();if((d=l.universal)!=null&&d.load){let f=function(...u){for(const g of u){const{href:_}=new URL(g,n);c.dependencies.add(_)}};const p={tracing:{enabled:!1,root:qe,current:qe},route:new Proxy(a,{get:(u,g)=>(o&&(c.route=!0),u[g])}),params:new Proxy(r,{get:(u,g)=>(o&&c.params.add(g),u[g])}),data:(s==null?void 0:s.data)??null,url:Bt(n,()=>{o&&(c.url=!0)},u=>{o&&c.search_params.add(u)},k.hash),async fetch(u,g){u instanceof Request&&(g={body:u.method==="GET"||u.method==="HEAD"?void 0:await u.blob(),cache:u.cache,credentials:u.credentials,headers:[...u.headers].length>0?u==null?void 0:u.headers:void 0,integrity:u.integrity,keepalive:u.keepalive,method:u.method,mode:u.mode,redirect:u.redirect,referrer:u.referrer,referrerPolicy:u.referrerPolicy,signal:u.signal,...g});const{resolved:_,promise:I}=gt(u,g,n);return o&&f(_.href),I},setHeaders:()=>{},depends:f,parent(){return o&&(c.parent=!0),t()},untrack(u){o=!1;try{return u()}finally{o=!0}}};i=await l.universal.load.call(null,p)??null}return{node:l,loader:e,server:s,universal:(h=l.universal)!=null&&h.load?{type:"data",data:i,uses:c}:null,data:i??(s==null?void 0:s.data)??null,slash:((y=l.universal)==null?void 0:y.trailingSlash)??(s==null?void 0:s.slash)}}function gt(e,t,n){let r=e instanceof Request?e.url:e;const a=new URL(r,n);a.origin===n.origin&&(r=a.href.slice(n.origin.length));const s=re?Yt(r,a.href,t):Gt(r,t);return{resolved:a,promise:s}}function ze(e,t,n,r,a,s){if(Ce)return!0;if(!a)return!1;if(a.parent&&e||a.route&&t||a.url&&n)return!0;for(const i of a.search_params)if(r.has(i))return!0;for(const i of a.params)if(s[i]!==b.params[i])return!0;for(const i of a.dependencies)if(ne.some(o=>o(new URL(i))))return!0;return!1}function Oe(e,t){return(e==null?void 0:e.type)==="data"?e:(e==null?void 0:e.type)==="skip"?t??null:null}function $n(e,t){if(!e)return new Set(t.searchParams.keys());const n=new Set([...e.searchParams.keys(),...t.searchParams.keys()]);for(const r of n){const a=e.searchParams.getAll(r),s=t.searchParams.getAll(r);a.every(i=>s.includes(i))&&s.every(i=>a.includes(i))&&n.delete(r)}return n}function We({error:e,url:t,route:n,params:r}){return{type:"loaded",state:{error:e,url:t,route:n,params:r,branch:[]},props:{page:je(T),constructors:[]}}}async function mt({id:e,invalidating:t,url:n,params:r,route:a,preload:s}){if((U==null?void 0:U.id)===e)return K.delete(U.token),U.promise;const{errors:i,layouts:o,leaf:c}=a,l=[...o,c];i.forEach(w=>w==null?void 0:w().catch(()=>{})),l.forEach(w=>w==null?void 0:w[1]().catch(()=>{}));let d=null;const h=b.url?e!==se(b.url):!1,y=b.route?a.id!==b.route.id:!1,f=$n(b.url,n);let p=!1;const u=l.map((w,m)=>{var P;const v=b.branch[m],S=!!(w!=null&&w[0])&&((v==null?void 0:v.loader)!==w[1]||ze(p,y,h,f,(P=v.server)==null?void 0:P.uses,r));return S&&(p=!0),S});if(u.some(Boolean)){try{d=await yt(n,u)}catch(w){const m=await M(w,{url:n,params:r,route:{id:e}});return K.has(s)?We({error:m,url:n,params:r,route:a}):ue({status:ee(w),error:m,url:n,route:a})}if(d.type==="redirect")return d}const g=d==null?void 0:d.nodes;let _=!1;const I=l.map(async(w,m)=>{var he;if(!w)return;const v=b.branch[m],S=g==null?void 0:g[m];if((!S||S.type==="skip")&&w[1]===(v==null?void 0:v.loader)&&!ze(_,y,h,f,(he=v.universal)==null?void 0:he.uses,r))return v;if(_=!0,(S==null?void 0:S.type)==="error")throw S;return Pe({loader:w[1],url:n,params:r,route:a,parent:async()=>{var Be;const De={};for(let pe=0;pe<m;pe+=1)Object.assign(De,(Be=await I[pe])==null?void 0:Be.data);return De},server_data_node:Oe(S===void 0&&w[0]?{type:"skip"}:S??null,w[0]?v==null?void 0:v.server:void 0)})});for(const w of I)w.catch(()=>{});const E=[];for(let w=0;w<l.length;w+=1)if(l[w])try{E.push(await I[w])}catch(m){if(m instanceof Re)return{type:"redirect",location:m.location};if(K.has(s))return We({error:await M(m,{params:r,url:n,route:{id:a.id}}),url:n,params:r,route:a});let v=ee(m),S;if(g!=null&&g.includes(m))v=m.status??v,S=m.error;else if(m instanceof ie)S=m.body;else{if(await C.updated.check())return await ct(),await q(n);S=await M(m,{params:r,url:n,route:{id:a.id}})}const P=await xn(w,E,i);return P?oe({url:n,params:r,branch:E.slice(0,P.idx).concat(P.node),status:v,error:S,route:a}):await wt(n,{id:a.id},S,v)}else E.push(void 0);return oe({url:n,params:r,branch:E,status:200,error:null,route:a,form:t?void 0:null})}async function xn(e,t,n){for(;e--;)if(n[e]){let r=e;for(;!t[r];)r-=1;try{return{idx:r+1,node:{node:await n[e](),loader:n[e],data:{},server:null,universal:null}}}catch{continue}}}async function ue({status:e,error:t,url:n,route:r}){const a={};let s=null;if(k.server_loads[0]===0)try{const o=await yt(n,[!0]);if(o.type!=="data"||o.nodes[0]&&o.nodes[0].type!=="data")throw 0;s=o.nodes[0]??null}catch{(n.origin!==ce||n.pathname!==location.pathname||xe)&&await q(n)}try{const o=await Pe({loader:ke,url:n,params:a,route:r,parent:()=>Promise.resolve({}),server_data_node:Oe(s)}),c={node:await te(),loader:te,universal:null,server:null,data:null};return oe({url:n,params:a,branch:[o,c],status:e,error:t,route:null})}catch(o){if(o instanceof Re)return Un(new URL(o.location,location.href),{},0);throw o}}async function Cn(e){const t=e.href;if(Z.has(t))return Z.get(t);let n;try{const r=(async()=>{let a=await k.hooks.reroute({url:new URL(e),fetch:async(s,i)=>gt(s,i,e).promise})??e;if(typeof a=="string"){const s=new URL(e);k.hash?s.hash=a:s.pathname=a,a=s}return a})();Z.set(t,r),n=await r}catch{Z.delete(t);return}return n}async function de(e,t){if(e&&!fe(e,$,k.hash)){const n=await Cn(e);if(!n)return;const r=Pn(n);for(const a of $e){const s=a.exec(r);if(s)return{id:se(e),invalidating:t,route:a,params:Dt(s),url:e}}}}function Pn(e){return jt(k.hash?e.hash.replace(/^#/,"").replace(/[?#].+/,""):e.pathname.slice($.length))||"/"}function se(e){return(k.hash?e.hash.replace(/^#/,""):e.pathname)+e.search}function _t({url:e,type:t,intent:n,delta:r,event:a}){let s=!1;const i=Ne(b,n,e,t);r!==void 0&&(i.navigation.delta=r),a!==void 0&&(i.navigation.event=a);const o={...i.navigation,cancel:()=>{s=!0,i.reject(new Error("navigation cancelled"))}};return X||lt.forEach(c=>c(o)),s?null:i}async function V({type:e,url:t,popped:n,keepfocus:r,noscroll:a,replace_state:s,state:i={},redirect_count:o=0,nav_token:c={},accept:l=Ge,block:d=Ge,event:h}){const y=N;N=c;const f=await de(t,!1),p=e==="enter"?Ne(b,f,t,e):_t({url:t,type:e,delta:n==null?void 0:n.delta,intent:f,event:h});if(!p){d(),N===c&&(N=y);return}const u=A,g=L;l(),X=!0,re&&p.navigation.type!=="enter"&&C.navigating.set(W.current=p.navigation);let _=f&&await mt(f);if(!_){if(fe(t,$,k.hash))return await q(t,s);_=await wt(t,{id:null},await M(new Te(404,"Not Found",`Not found: ${t.pathname}`),{url:t,params:{},route:{id:null}}),404,s)}if(t=(f==null?void 0:f.url)||t,N!==c)return p.reject(new Error("navigation aborted")),!1;if(_.type==="redirect"){if(o<20){await V({type:e,url:new URL(_.location,t),popped:n,keepfocus:r,noscroll:a,replace_state:s,state:i,redirect_count:o+1,nav_token:c}),p.fulfil(void 0);return}_=await ue({status:500,error:await M(new Error("Redirect loop"),{url:t,params:{},route:{id:null}}),url:t,route:{id:null}})}else _.props.page.status>=400&&await C.updated.check()&&(await ct(),await q(t,s));if(In(),Le(u),dt(g),_.props.page.url.pathname!==t.pathname&&(t.pathname=_.props.page.url.pathname),i=n?n.state:i,!n){const m=s?0:1,v={[F]:A+=m,[z]:L+=m,[nt]:i};(s?history.replaceState:history.pushState).call(history,v,"",t),s||Rn(A,L)}if(U=null,_.props.page.state=i,re){const m=(await Promise.all(Array.from(Tn,v=>v(p.navigation)))).filter(v=>typeof v=="function");if(m.length>0){let v=function(){m.forEach(S=>{H.delete(S)})};m.push(v),m.forEach(S=>{H.add(S)})}b=_.state,_.props.page&&(_.props.page.url=t),ut.$set(_.props),yn(_.props.page),ft=!0}else pt(_,Ee,!1);const{activeElement:I}=document;await En();let E=n?n.scroll:a?le():null;if(Ye){const m=t.hash&&document.getElementById(bt(t));if(E)scrollTo(E.x,E.y);else if(m){m.scrollIntoView();const{top:v,left:S}=m.getBoundingClientRect();E={x:pageXOffset+S,y:pageYOffset+v}}else scrollTo(0,0)}const w=document.activeElement!==I&&document.activeElement!==document.body;!r&&!w&&Bn(t,E),Ye=!0,_.props.page&&Object.assign(T,_.props.page),X=!1,e==="popstate"&&ht(L),p.fulfil(void 0),H.forEach(m=>m(p.navigation)),C.navigating.set(W.current=null)}async function wt(e,t,n,r,a){return e.origin===ce&&e.pathname===location.pathname&&!xe?await ue({status:r,error:n,url:e,route:t}):await q(e,a)}function On(){let e,t,n;x.addEventListener("mousemove",o=>{const c=o.target;clearTimeout(e),e=setTimeout(()=>{s(c,O.hover)},20)});function r(o){o.defaultPrevented||s(o.composedPath()[0],O.tap)}x.addEventListener("mousedown",r),x.addEventListener("touchstart",r,{passive:!0});const a=new IntersectionObserver(o=>{for(const c of o)c.isIntersecting&&(ye(new URL(c.target.href)),a.unobserve(c.target))},{threshold:0});async function s(o,c){const l=ot(o,x),d=l===t&&c>=n;if(!l||d)return;const{url:h,external:y,download:f}=Se(l,$,k.hash);if(y||f)return;const p=Q(l),u=h&&se(b.url)===se(h);if(!(p.reload||u))if(c<=p.preload_data){t=l,n=O.tap;const g=await de(h,!1);if(!g)return;Ln(g)}else c<=p.preload_code&&(t=l,n=c,ye(h))}function i(){a.disconnect();for(const o of x.querySelectorAll("a")){const{url:c,external:l,download:d}=Se(o,$,k.hash);if(l||d)continue;const h=Q(o);h.reload||(h.preload_code===O.viewport&&a.observe(o),h.preload_code===O.eager&&ye(c))}}H.add(i),i()}function M(e,t){if(e instanceof ie)return e.body;const n=ee(e),r=_n(e);return k.hooks.handleError({error:e,event:t,status:n,message:r})??{message:r}}function Nn(e){if(typeof e=="function")ne.push(e);else{const{href:t}=new URL(e,location.href);ne.push(n=>n.href===t)}}function jn(){var t;history.scrollRestoration="manual",addEventListener("beforeunload",n=>{let r=!1;if(Ke(),!X){const a=Ne(b,void 0,null,"leave"),s={...a.navigation,cancel:()=>{r=!0,a.reject(new Error("navigation cancelled"))}};lt.forEach(i=>i(s))}r?(n.preventDefault(),n.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&Ke()}),(t=navigator.connection)!=null&&t.saveData||On(),x.addEventListener("click",async n=>{if(n.button||n.which!==1||n.metaKey||n.ctrlKey||n.shiftKey||n.altKey||n.defaultPrevented)return;const r=ot(n.composedPath()[0],x);if(!r)return;const{url:a,external:s,target:i,download:o}=Se(r,$,k.hash);if(!a)return;if(i==="_parent"||i==="_top"){if(window.parent!==window)return}else if(i&&i!=="_self")return;const c=Q(r);if(!(r instanceof SVGAElement)&&a.protocol!==location.protocol&&!(a.protocol==="https:"||a.protocol==="http:")||o)return;const[d,h]=(k.hash?a.hash.replace(/^#/,""):a.href).split("#"),y=d===me(location);if(s||c.reload&&(!y||!h)){_t({url:a,type:"link",event:n})?X=!0:n.preventDefault();return}if(h!==void 0&&y){const[,f]=b.url.href.split("#");if(f===h){if(n.preventDefault(),h===""||h==="top"&&r.ownerDocument.getElementById("top")===null)scrollTo({top:0});else{const p=r.ownerDocument.getElementById(decodeURIComponent(h));p&&(p.scrollIntoView(),p.focus())}return}if(G=!0,Le(A),e(a),!c.replace_state)return;G=!1}n.preventDefault(),await new Promise(f=>{requestAnimationFrame(()=>{setTimeout(f,0)}),setTimeout(f,100)}),await V({type:"link",url:a,keepfocus:c.keepfocus,noscroll:c.noscroll,replace_state:c.replace_state??a.href===location.href,event:n})}),x.addEventListener("submit",n=>{if(n.defaultPrevented)return;const r=HTMLFormElement.prototype.cloneNode.call(n.target),a=n.submitter;if(((a==null?void 0:a.formTarget)||r.target)==="_blank"||((a==null?void 0:a.formMethod)||r.method)!=="get")return;const o=new URL((a==null?void 0:a.hasAttribute("formaction"))&&(a==null?void 0:a.formAction)||r.action);if(fe(o,$,!1))return;const c=n.target,l=Q(c);if(l.reload)return;n.preventDefault(),n.stopPropagation();const d=new FormData(c,a);o.search=new URLSearchParams(d).toString(),V({type:"form",url:o,keepfocus:l.keepfocus,noscroll:l.noscroll,replace_state:l.replace_state??o.href===location.href,event:n})}),addEventListener("popstate",async n=>{var r;if(!Ae){if((r=n.state)!=null&&r[F]){const a=n.state[F];if(N={},a===A)return;const s=j[a],i=n.state[nt]??{},o=new URL(n.state[en]??location.href),c=n.state[z],l=b.url?me(location)===me(b.url):!1;if(c===L&&(ft||l)){i!==T.state&&(T.state=i),e(o),j[A]=le(),s&&scrollTo(s.x,s.y),A=a;return}const h=a-A;await V({type:"popstate",url:o,popped:{state:i,scroll:s,delta:h},accept:()=>{A=a,L=c},block:()=>{history.go(-h)},nav_token:N,event:n})}else if(!G){const a=new URL(location.href);e(a),k.hash&&location.reload()}}}),addEventListener("hashchange",()=>{G&&(G=!1,history.replaceState({...history.state,[F]:++A,[z]:L},"",location.href))});for(const n of document.querySelectorAll("link"))An.has(n.rel)&&(n.href=n.href);addEventListener("pageshow",n=>{n.persisted&&C.navigating.set(W.current=null)});function e(n){b.url=T.url=n,C.page.set(je(T)),C.page.notify()}}async function Dn(e,{status:t=200,error:n,node_ids:r,params:a,route:s,server_route:i,data:o,form:c}){xe=!0;const l=new URL(location.href);let d;({params:a={},route:s={id:null}}=await de(l,!1)||{}),d=$e.find(({id:f})=>f===s.id);let h,y=!0;try{const f=r.map(async(u,g)=>{const _=o[g];return _!=null&&_.uses&&(_.uses=vt(_.uses)),Pe({loader:k.nodes[u],url:l,params:a,route:s,parent:async()=>{const I={};for(let E=0;E<g;E+=1)Object.assign(I,(await f[E]).data);return I},server_data_node:Oe(_)})}),p=await Promise.all(f);if(d){const u=d.layouts;for(let g=0;g<u.length;g++)u[g]||p.splice(g,0,void 0)}h=oe({url:l,params:a,branch:p,status:t,error:n,form:c,route:d??null})}catch(f){if(f instanceof Re){await q(new URL(f.location,location.href));return}h=await ue({status:ee(f),error:await M(f,{url:l,params:a,route:s}),url:l,route:s}),e.textContent="",y=!1}h.props.page&&(h.props.page.state={}),pt(h,e,y)}async function yt(e,t){var s;const n=new URL(e);n.pathname=Sn(e.pathname),e.pathname.endsWith("/")&&n.searchParams.append(mn,"1"),n.searchParams.append(gn,t.map(i=>i?"1":"0").join(""));const r=window.fetch,a=await r(n.href,{});if(!a.ok){let i;throw(s=a.headers.get("content-type"))!=null&&s.includes("application/json")?i=await a.json():a.status===404?i="Not Found":a.status===500&&(i="Internal Error"),new ie(a.status,i)}return new Promise(async i=>{var h;const o=new Map,c=a.body.getReader();function l(y){return dn(y,{...k.decoders,Promise:f=>new Promise((p,u)=>{o.set(f,{fulfil:p,reject:u})})})}let d="";for(;;){const{done:y,value:f}=await c.read();if(y&&!d)break;for(d+=!f&&d?`
2
+ `:Vt.decode(f,{stream:!0});;){const p=d.indexOf(`
3
+ `);if(p===-1)break;const u=JSON.parse(d.slice(0,p));if(d=d.slice(p+1),u.type==="redirect")return i(u);if(u.type==="data")(h=u.nodes)==null||h.forEach(g=>{(g==null?void 0:g.type)==="data"&&(g.uses=vt(g.uses),g.data=l(g.data))}),i(u);else if(u.type==="chunk"){const{id:g,data:_,error:I}=u,E=o.get(g);o.delete(g),I?E.reject(l(I)):E.fulfil(l(_))}}}})}function vt(e){return{dependencies:new Set((e==null?void 0:e.dependencies)??[]),params:new Set((e==null?void 0:e.params)??[]),parent:!!(e!=null&&e.parent),route:!!(e!=null&&e.route),url:!!(e!=null&&e.url),search_params:new Set((e==null?void 0:e.search_params)??[])}}let Ae=!1;function Bn(e,t=null){const n=document.querySelector("[autofocus]");if(n)n.focus();else{const r=bt(e);if(r&&document.getElementById(r)){const{x:s,y:i}=t??le();setTimeout(()=>{const o=history.state;Ae=!0,location.replace(`#${r}`),k.hash&&location.replace(e.hash),history.replaceState(o,"",e.hash),scrollTo(s,i),Ae=!1})}else{const s=document.body,i=s.getAttribute("tabindex");s.tabIndex=-1,s.focus({preventScroll:!0,focusVisible:!1}),i!==null?s.setAttribute("tabindex",i):s.removeAttribute("tabindex")}const a=getSelection();if(a&&a.type!=="None"){const s=[];for(let i=0;i<a.rangeCount;i+=1)s.push(a.getRangeAt(i));setTimeout(()=>{if(a.rangeCount===s.length){for(let i=0;i<a.rangeCount;i+=1){const o=s[i],c=a.getRangeAt(i);if(o.commonAncestorContainer!==c.commonAncestorContainer||o.startContainer!==c.startContainer||o.endContainer!==c.endContainer||o.startOffset!==c.startOffset||o.endOffset!==c.endOffset)return}a.removeAllRanges()}})}}}function Ne(e,t,n,r){var c,l;let a,s;const i=new Promise((d,h)=>{a=d,s=h});return i.catch(()=>{}),{navigation:{from:{params:e.params,route:{id:((c=e.route)==null?void 0:c.id)??null},url:e.url},to:n&&{params:(t==null?void 0:t.params)??null,route:{id:((l=t==null?void 0:t.route)==null?void 0:l.id)??null},url:n},willUnload:!t,type:r,complete:i},fulfil:a,reject:s}}function je(e){return{data:e.data,error:e.error,form:e.form,params:e.params,route:e.route,state:e.state,status:e.status,url:e.url}}function Fn(e){const t=new URL(e);return t.hash=decodeURIComponent(e.hash),t}function bt(e){let t;if(k.hash){const[,,n]=e.hash.split("#",3);t=n??""}else t=e.hash.slice(1);return decodeURIComponent(t)}export{Kn as a,qn as l,C as s};
hfstudio/static/_app/immutable/entry/app.sWLR58JY.js ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../nodes/0.aAt9IeXZ.js","../chunks/TRxHAhOH.js","../chunks/IHki7fMi.js","../chunks/D0F9faoj.js","../chunks/D2RBa_m5.js","../chunks/Bv5vELPx.js","../chunks/nn-QVLrM.js","../chunks/BhRpzVYR.js","../assets/0.B_i4o2sT.css","../nodes/1.DGNb_QvY.js","../nodes/2.1j9YdqU7.js","../chunks/DUd0gdPo.js","../chunks/BNlacN_j.js","../chunks/gtFtmmyB.js","../assets/2.CdRym-eY.css","../nodes/3.CLzJht-f.js","../assets/3.BNkL3CE9.css","../nodes/4.Cz7uudur.js"])))=>i.map(i=>d[i]);
2
+ import{S as C,i as U,s as q,d,w as h,x as g,N as O,K as S,b as v,h as B,M as w,k as W,U as z,G,V as K,W as y,v as P,A as R,y as L,z as D,p as T,Q as p,e as Q,f as F,j as H,T as V,a as J,g as X,t as Y}from"../chunks/TRxHAhOH.js";import"../chunks/IHki7fMi.js";const Z="modulepreload",M=function(o,e){return new URL(o,e).href},I={},A=function(e,n,i){let r=Promise.resolve();if(n&&n.length>0){const t=document.getElementsByTagName("link"),s=document.querySelector("meta[property=csp-nonce]"),a=(s==null?void 0:s.nonce)||(s==null?void 0:s.getAttribute("nonce"));r=Promise.allSettled(n.map(f=>{if(f=M(f,i),f in I)return;I[f]=!0;const l=f.endsWith(".css"),_=l?'[rel="stylesheet"]':"";if(!!i)for(let k=t.length-1;k>=0;k--){const E=t[k];if(E.href===f&&(!l||E.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${f}"]${_}`))return;const m=document.createElement("link");if(m.rel=l?"stylesheet":Z,l||(m.as="script"),m.crossOrigin="",m.href=f,a&&m.setAttribute("nonce",a),document.head.appendChild(m),l)return new Promise((k,E)=>{m.addEventListener("load",k),m.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${f}`)))})}))}function u(t){const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=t,window.dispatchEvent(s),!s.defaultPrevented)throw t}return r.then(t=>{for(const s of t||[])s.status==="rejected"&&u(s.reason);return e().catch(u)})},ae={};function $(o){let e,n,i;var r=o[2][0];function u(t,s){return{props:{data:t[4],form:t[3],params:t[1].params}}}return r&&(e=y(r,u(o)),o[12](e)),{c(){e&&R(e.$$.fragment),n=w()},l(t){e&&D(e.$$.fragment,t),n=w()},m(t,s){e&&L(e,t,s),v(t,n,s),i=!0},p(t,s){if(s&4&&r!==(r=t[2][0])){if(e){O();const a=e;h(a.$$.fragment,1,0,()=>{P(a,1)}),S()}r?(e=y(r,u(t)),t[12](e),R(e.$$.fragment),g(e.$$.fragment,1),L(e,n.parentNode,n)):e=null}else if(r){const a={};s&16&&(a.data=t[4]),s&8&&(a.form=t[3]),s&2&&(a.params=t[1].params),e.$set(a)}},i(t){i||(e&&g(e.$$.fragment,t),i=!0)},o(t){e&&h(e.$$.fragment,t),i=!1},d(t){t&&d(n),o[12](null),e&&P(e,t)}}}function x(o){let e,n,i;var r=o[2][0];function u(t,s){return{props:{data:t[4],params:t[1].params,$$slots:{default:[ee]},$$scope:{ctx:t}}}}return r&&(e=y(r,u(o)),o[11](e)),{c(){e&&R(e.$$.fragment),n=w()},l(t){e&&D(e.$$.fragment,t),n=w()},m(t,s){e&&L(e,t,s),v(t,n,s),i=!0},p(t,s){if(s&4&&r!==(r=t[2][0])){if(e){O();const a=e;h(a.$$.fragment,1,0,()=>{P(a,1)}),S()}r?(e=y(r,u(t)),t[11](e),R(e.$$.fragment),g(e.$$.fragment,1),L(e,n.parentNode,n)):e=null}else if(r){const a={};s&16&&(a.data=t[4]),s&2&&(a.params=t[1].params),s&8239&&(a.$$scope={dirty:s,ctx:t}),e.$set(a)}},i(t){i||(e&&g(e.$$.fragment,t),i=!0)},o(t){e&&h(e.$$.fragment,t),i=!1},d(t){t&&d(n),o[11](null),e&&P(e,t)}}}function ee(o){let e,n,i;var r=o[2][1];function u(t,s){return{props:{data:t[5],form:t[3],params:t[1].params}}}return r&&(e=y(r,u(o)),o[10](e)),{c(){e&&R(e.$$.fragment),n=w()},l(t){e&&D(e.$$.fragment,t),n=w()},m(t,s){e&&L(e,t,s),v(t,n,s),i=!0},p(t,s){if(s&4&&r!==(r=t[2][1])){if(e){O();const a=e;h(a.$$.fragment,1,0,()=>{P(a,1)}),S()}r?(e=y(r,u(t)),t[10](e),R(e.$$.fragment),g(e.$$.fragment,1),L(e,n.parentNode,n)):e=null}else if(r){const a={};s&32&&(a.data=t[5]),s&8&&(a.form=t[3]),s&2&&(a.params=t[1].params),e.$set(a)}},i(t){i||(e&&g(e.$$.fragment,t),i=!0)},o(t){e&&h(e.$$.fragment,t),i=!1},d(t){t&&d(n),o[10](null),e&&P(e,t)}}}function N(o){let e,n=o[7]&&j(o);return{c(){e=H("div"),n&&n.c(),this.h()},l(i){e=Q(i,"DIV",{id:!0,"aria-live":!0,"aria-atomic":!0,style:!0});var r=F(e);n&&n.l(r),r.forEach(d),this.h()},h(){T(e,"id","svelte-announcer"),T(e,"aria-live","assertive"),T(e,"aria-atomic","true"),p(e,"position","absolute"),p(e,"left","0"),p(e,"top","0"),p(e,"clip","rect(0 0 0 0)"),p(e,"clip-path","inset(50%)"),p(e,"overflow","hidden"),p(e,"white-space","nowrap"),p(e,"width","1px"),p(e,"height","1px")},m(i,r){v(i,e,r),n&&n.m(e,null)},p(i,r){i[7]?n?n.p(i,r):(n=j(i),n.c(),n.m(e,null)):n&&(n.d(1),n=null)},d(i){i&&d(e),n&&n.d()}}}function j(o){let e;return{c(){e=Y(o[8])},l(n){e=X(n,o[8])},m(n,i){v(n,e,i)},p(n,i){i&256&&J(e,n[8])},d(n){n&&d(e)}}}function te(o){let e,n,i,r,u;const t=[x,$],s=[];function a(l,_){return l[2][1]?0:1}e=a(o),n=s[e]=t[e](o);let f=o[6]&&N(o);return{c(){n.c(),i=W(),f&&f.c(),r=w()},l(l){n.l(l),i=B(l),f&&f.l(l),r=w()},m(l,_){s[e].m(l,_),v(l,i,_),f&&f.m(l,_),v(l,r,_),u=!0},p(l,[_]){let b=e;e=a(l),e===b?s[e].p(l,_):(O(),h(s[b],1,1,()=>{s[b]=null}),S(),n=s[e],n?n.p(l,_):(n=s[e]=t[e](l),n.c()),g(n,1),n.m(i.parentNode,i)),l[6]?f?f.p(l,_):(f=N(l),f.c(),f.m(r.parentNode,r)):f&&(f.d(1),f=null)},i(l){u||(g(n),u=!0)},o(l){h(n),u=!1},d(l){l&&(d(i),d(r)),s[e].d(l),f&&f.d(l)}}}function ne(o,e,n){let{stores:i}=e,{page:r}=e,{constructors:u}=e,{components:t=[]}=e,{form:s}=e,{data_0:a=null}=e,{data_1:f=null}=e;z(i.page.notify);let l=!1,_=!1,b=null;G(()=>{const c=i.page.subscribe(()=>{l&&(n(7,_=!0),K().then(()=>{n(8,b=document.title||"untitled page")}))});return n(6,l=!0),c});function m(c){V[c?"unshift":"push"](()=>{t[1]=c,n(0,t)})}function k(c){V[c?"unshift":"push"](()=>{t[0]=c,n(0,t)})}function E(c){V[c?"unshift":"push"](()=>{t[0]=c,n(0,t)})}return o.$$set=c=>{"stores"in c&&n(9,i=c.stores),"page"in c&&n(1,r=c.page),"constructors"in c&&n(2,u=c.constructors),"components"in c&&n(0,t=c.components),"form"in c&&n(3,s=c.form),"data_0"in c&&n(4,a=c.data_0),"data_1"in c&&n(5,f=c.data_1)},o.$$.update=()=>{o.$$.dirty&514&&i.page.set(r)},[t,r,u,s,a,f,l,_,b,i,m,k,E]}class le extends C{constructor(e){super(),U(this,e,ne,te,q,{stores:9,page:1,constructors:2,components:0,form:3,data_0:4,data_1:5})}}const fe=[()=>A(()=>import("../nodes/0.aAt9IeXZ.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8]),import.meta.url),()=>A(()=>import("../nodes/1.DGNb_QvY.js"),__vite__mapDeps([9,1,2,3,4]),import.meta.url),()=>A(()=>import("../nodes/2.1j9YdqU7.js"),__vite__mapDeps([10,1,11,7,2,12,13,14]),import.meta.url),()=>A(()=>import("../nodes/3.CLzJht-f.js"),__vite__mapDeps([15,1,11,7,2,5,13,16]),import.meta.url),()=>A(()=>import("../nodes/4.Cz7uudur.js"),__vite__mapDeps([17,1,7,2,12,6,13]),import.meta.url)],ce=[],ue={"/":[2],"/code-recorder":[3],"/voice-cloning":[4]},se={handleError:({error:o})=>{console.error(o)},reroute:()=>{},transport:{}},ie=Object.fromEntries(Object.entries(se.transport).map(([o,e])=>[o,e.decode])),_e=!1,me=(o,e)=>ie[o](e);export{me as decode,ie as decoders,ue as dictionary,_e as hash,se as hooks,ae as matchers,fe as nodes,le as root,ce as server_loads};
hfstudio/static/_app/immutable/entry/start.BHLoO44v.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{l as o,a as r}from"../chunks/D2RBa_m5.js";export{o as load_css,r as start};
hfstudio/static/_app/immutable/nodes/0.aAt9IeXZ.js ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ import{S as at,i as ot,s as rt,C as it,d as E,v as Qe,w as Be,x as Pe,p as s,D as ut,E as ct,F as dt,b as _e,c as e,y as Xe,e as a,f as R,r as p,h as u,z as Ze,j as o,k as c,A as $e,l as ft,G as pt,H as ht,I as et,m as xe,a as mt,g as gt,t as xt}from"../chunks/TRxHAhOH.js";import"../chunks/IHki7fMi.js";import{p as _t}from"../chunks/D0F9faoj.js";import{N as bt}from"../chunks/Bv5vELPx.js";import{M as vt}from"../chunks/nn-QVLrM.js";function tt(f){let r,n,d,H="Sign In with HuggingFace Token",z,t,g,A="<strong>Manual Token Entry:</strong> Please enter your HuggingFace token.",q,_,C=`1. Go to <a href="https://huggingface.co/settings/tokens" target="_blank" class="underline text-blue-600">HuggingFace Settings</a><br/>
2
+ 2. Create a new token with &quot;Inference API&quot; permissions<br/>
3
+ 3. Copy and paste it below`,M,Y,b,B,K="HuggingFace Token",G,x,P,D,I,O,l="Cancel",w,h,S="Sign In",V,L,T=f[5]&&nt(),y=f[4]&&st(f);return{c(){r=o("div"),n=o("div"),d=o("h2"),d.textContent=H,z=c(),t=o("div"),g=o("p"),g.innerHTML=A,q=c(),_=o("p"),_.innerHTML=C,M=c(),T&&T.c(),Y=c(),b=o("div"),B=o("label"),B.textContent=K,G=c(),x=o("input"),P=c(),y&&y.c(),D=c(),I=o("div"),O=o("button"),O.textContent=l,w=c(),h=o("button"),h.textContent=S,this.h()},l(v){r=a(v,"DIV",{class:!0});var J=R(r);n=a(J,"DIV",{class:!0});var F=R(n);d=a(F,"H2",{class:!0,"data-svelte-h":!0}),p(d)!=="svelte-1t0ehet"&&(d.textContent=H),z=u(F),t=a(F,"DIV",{class:!0});var U=R(t);g=a(U,"P",{class:!0,"data-svelte-h":!0}),p(g)!=="svelte-344vn4"&&(g.innerHTML=A),q=u(U),_=a(U,"P",{class:!0,"data-svelte-h":!0}),p(_)!=="svelte-orsfwv"&&(_.innerHTML=C),M=u(U),T&&T.l(U),U.forEach(E),Y=u(F),b=a(F,"DIV",{class:!0});var Q=R(b);B=a(Q,"LABEL",{for:!0,class:!0,"data-svelte-h":!0}),p(B)!=="svelte-vtbmxo"&&(B.textContent=K),G=u(Q),x=a(Q,"INPUT",{id:!0,type:!0,placeholder:!0,class:!0}),P=u(Q),y&&y.l(Q),Q.forEach(E),D=u(F),I=a(F,"DIV",{class:!0});var X=R(I);O=a(X,"BUTTON",{class:!0,"data-svelte-h":!0}),p(O)!=="svelte-csk0rj"&&(O.textContent=l),w=u(X),h=a(X,"BUTTON",{class:!0,"data-svelte-h":!0}),p(h)!=="svelte-1nxas5u"&&(h.textContent=S),X.forEach(E),F.forEach(E),J.forEach(E),this.h()},h(){s(d,"class","text-xl font-semibold mb-4"),s(g,"class","text-blue-800 mb-2"),s(_,"class","text-blue-700"),s(t,"class","mb-4 p-3 bg-blue-50 rounded-md text-sm"),s(B,"for","token"),s(B,"class","block text-sm font-medium text-gray-700 mb-2"),s(x,"id","token"),s(x,"type","password"),s(x,"placeholder","hf_..."),s(x,"class","w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-orange-500 focus:border-transparent"),s(b,"class","mb-4"),s(O,"class","px-4 py-2 text-gray-600 hover:text-gray-800 transition-colors"),s(h,"class","px-4 py-2 bg-orange-500 text-white rounded-md hover:bg-orange-600 transition-colors"),s(I,"class","flex justify-end gap-3"),s(n,"class","bg-white rounded-lg p-6 max-w-md w-full mx-4 shadow-xl"),s(r,"class","fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50")},m(v,J){_e(v,r,J),e(r,n),e(n,d),e(n,z),e(n,t),e(t,g),e(t,q),e(t,_),e(t,M),T&&T.m(t,null),e(n,Y),e(n,b),e(b,B),e(b,G),e(b,x),et(x,f[3]),e(b,P),y&&y.m(b,null),e(n,D),e(n,I),e(I,O),e(I,w),e(I,h),V||(L=[xe(x,"input",f[13]),xe(x,"keydown",f[14]),xe(O,"click",f[9]),xe(h,"click",f[10])],V=!0)},p(v,J){v[5]?T||(T=nt(),T.c(),T.m(t,null)):T&&(T.d(1),T=null),J&8&&x.value!==v[3]&&et(x,v[3]),v[4]?y?y.p(v,J):(y=st(v),y.c(),y.m(b,null)):y&&(y.d(1),y=null)},d(v){v&&E(r),T&&T.d(),y&&y.d(),V=!1,ht(L)}}}function nt(f){let r,n=`<strong>Tip:</strong> You can also run <code>huggingface-cli login</code> in your terminal
4
+ to automatically use your local token.`;return{c(){r=o("p"),r.innerHTML=n,this.h()},l(d){r=a(d,"P",{class:!0,"data-svelte-h":!0}),p(r)!=="svelte-xrut8w"&&(r.innerHTML=n),this.h()},h(){s(r,"class","text-blue-600 mt-2")},m(d,H){_e(d,r,H)},d(d){d&&E(r)}}}function st(f){let r,n;return{c(){r=o("p"),n=xt(f[4]),this.h()},l(d){r=a(d,"P",{class:!0});var H=R(r);n=gt(H,f[4]),H.forEach(E),this.h()},h(){s(r,"class","text-red-600 text-sm mt-1")},m(d,H){_e(d,r,H),e(r,n)},p(d,H){H&16&&mt(n,d[4])},d(d){d&&E(r)}}}function wt(f){let r,n,d,H='<div class="flex items-center gap-3"><img src="/assets/hf-studio-logo.png" alt="HF Logo" class="w-8 h-8"/> <h1 class="text-xl font-semibold">HFStudio<sup class="text-xs text-gray-500 ml-1">BETA</sup></h1></div>',z,t,g,A="Audio",q,_,C,M="🎙️",Y,b,B="Text to Speech",K,G,x,P,D,I,O="Voice Cloning",l,w,h,S="<span>🎧</span> <span>Speech to Text</span>",V,L,T="<span>🎼</span> <span>Sound Effects</span>",y,v,J="<span>🎸</span> <span>Music Generation</span>",F,U,Q="<span>🔊</span> <span>Audio Enhancement</span>",X,fe,Oe="Image",be,Z,Ve="<span>🎨</span> <span>Text to Image</span>",ve,$,je="<span>🖼️</span> <span>Image to Image</span>",we,ee,Fe="<span>✂️</span> <span>Remove Background</span>",Te,te,Re="<span>🔍</span> <span>Upscale Image</span>",ye,ne,ze="<span>🎭</span> <span>Face Swap</span>",Ce,se,qe="<span>📝</span> <span>Image to Text</span>",Le,pe,Ge="Video",ke,le,De="<span>🎬</span> <span>Text to Video</span>",Ie,ae,Je="<span>🎞️</span> <span>Image to Video</span>",He,oe,We="<span>✨</span> <span>Video Enhancement</span>",Me,re,Ye="<span>🎤</span> <span>Lip Sync</span>",Ne,ie,Ke="<span>🗣️</span> <span>Video Dubbing</span>",Ee,ue,ce,Se,Ue,de;P=new vt({props:{size:16}}),ce=new bt({props:{isLoggedIn:f[0],username:f[1],handleAuthAction:f[8],flashButton:f[6],pageTitle:lt(f[7].url.pathname)}});const Ae=f[12].default,j=it(Ae,f,f[11],null);let N=f[2]&&tt(f);return{c(){r=o("div"),n=o("aside"),d=o("div"),d.innerHTML=H,z=c(),t=o("nav"),g=o("div"),g.textContent=A,q=c(),_=o("a"),C=o("span"),C.textContent=M,Y=c(),b=o("span"),b.textContent=B,G=c(),x=o("a"),$e(P.$$.fragment),D=c(),I=o("span"),I.textContent=O,w=c(),h=o("button"),h.innerHTML=S,V=c(),L=o("button"),L.innerHTML=T,y=c(),v=o("button"),v.innerHTML=J,F=c(),U=o("button"),U.innerHTML=Q,X=c(),fe=o("div"),fe.textContent=Oe,be=c(),Z=o("button"),Z.innerHTML=Ve,ve=c(),$=o("button"),$.innerHTML=je,we=c(),ee=o("button"),ee.innerHTML=Fe,Te=c(),te=o("button"),te.innerHTML=Re,ye=c(),ne=o("button"),ne.innerHTML=ze,Ce=c(),se=o("button"),se.innerHTML=qe,Le=c(),pe=o("div"),pe.textContent=Ge,ke=c(),le=o("button"),le.innerHTML=De,Ie=c(),ae=o("button"),ae.innerHTML=Je,He=c(),oe=o("button"),oe.innerHTML=We,Me=c(),re=o("button"),re.innerHTML=Ye,Ne=c(),ie=o("button"),ie.innerHTML=Ke,Ee=c(),ue=o("main"),$e(ce.$$.fragment),Se=c(),j&&j.c(),Ue=c(),N&&N.c(),this.h()},l(m){r=a(m,"DIV",{class:!0});var k=R(r);n=a(k,"ASIDE",{class:!0});var W=R(n);d=a(W,"DIV",{class:!0,"data-svelte-h":!0}),p(d)!=="svelte-xzbt87"&&(d.innerHTML=H),z=u(W),t=a(W,"NAV",{class:!0});var i=R(t);g=a(i,"DIV",{class:!0,"data-svelte-h":!0}),p(g)!=="svelte-52jqai"&&(g.textContent=A),q=u(i),_=a(i,"A",{href:!0,class:!0});var he=R(_);C=a(he,"SPAN",{"data-svelte-h":!0}),p(C)!=="svelte-1yx42xi"&&(C.textContent=M),Y=u(he),b=a(he,"SPAN",{"data-svelte-h":!0}),p(b)!=="svelte-2j89jk"&&(b.textContent=B),he.forEach(E),G=u(i),x=a(i,"A",{href:!0,class:!0});var me=R(x);Ze(P.$$.fragment,me),D=u(me),I=a(me,"SPAN",{"data-svelte-h":!0}),p(I)!=="svelte-10pmll2"&&(I.textContent=O),me.forEach(E),w=u(i),h=a(i,"BUTTON",{class:!0,"data-svelte-h":!0}),p(h)!=="svelte-wf0x5d"&&(h.innerHTML=S),V=u(i),L=a(i,"BUTTON",{class:!0,"data-svelte-h":!0}),p(L)!=="svelte-x7bha3"&&(L.innerHTML=T),y=u(i),v=a(i,"BUTTON",{class:!0,"data-svelte-h":!0}),p(v)!=="svelte-1tyblmt"&&(v.innerHTML=J),F=u(i),U=a(i,"BUTTON",{class:!0,"data-svelte-h":!0}),p(U)!=="svelte-1emrjb3"&&(U.innerHTML=Q),X=u(i),fe=a(i,"DIV",{class:!0,"data-svelte-h":!0}),p(fe)!=="svelte-1pmjg3x"&&(fe.textContent=Oe),be=u(i),Z=a(i,"BUTTON",{class:!0,"data-svelte-h":!0}),p(Z)!=="svelte-11wbuiv"&&(Z.innerHTML=Ve),ve=u(i),$=a(i,"BUTTON",{class:!0,"data-svelte-h":!0}),p($)!=="svelte-ol2yvl"&&($.innerHTML=je),we=u(i),ee=a(i,"BUTTON",{class:!0,"data-svelte-h":!0}),p(ee)!=="svelte-ttigif"&&(ee.innerHTML=Fe),Te=u(i),te=a(i,"BUTTON",{class:!0,"data-svelte-h":!0}),p(te)!=="svelte-ixgtu4"&&(te.innerHTML=Re),ye=u(i),ne=a(i,"BUTTON",{class:!0,"data-svelte-h":!0}),p(ne)!=="svelte-r2ax5z"&&(ne.innerHTML=ze),Ce=u(i),se=a(i,"BUTTON",{class:!0,"data-svelte-h":!0}),p(se)!=="svelte-n9rt3x"&&(se.innerHTML=qe),Le=u(i),pe=a(i,"DIV",{class:!0,"data-svelte-h":!0}),p(pe)!=="svelte-1gfxetb"&&(pe.textContent=Ge),ke=u(i),le=a(i,"BUTTON",{class:!0,"data-svelte-h":!0}),p(le)!=="svelte-gox1rd"&&(le.innerHTML=De),Ie=u(i),ae=a(i,"BUTTON",{class:!0,"data-svelte-h":!0}),p(ae)!=="svelte-13pimzy"&&(ae.innerHTML=Je),He=u(i),oe=a(i,"BUTTON",{class:!0,"data-svelte-h":!0}),p(oe)!=="svelte-c86wph"&&(oe.innerHTML=We),Me=u(i),re=a(i,"BUTTON",{class:!0,"data-svelte-h":!0}),p(re)!=="svelte-wkify0"&&(re.innerHTML=Ye),Ne=u(i),ie=a(i,"BUTTON",{class:!0,"data-svelte-h":!0}),p(ie)!=="svelte-10ou061"&&(ie.innerHTML=Ke),i.forEach(E),W.forEach(E),Ee=u(k),ue=a(k,"MAIN",{class:!0});var ge=R(ue);Ze(ce.$$.fragment,ge),Se=u(ge),j&&j.l(ge),ge.forEach(E),Ue=u(k),N&&N.l(k),k.forEach(E),this.h()},h(){s(d,"class","px-4 py-4 border-b border-gray-200 min-h-[73px] flex items-center"),s(g,"class","mt-2 mb-1 px-2 text-xs font-medium text-gray-500 uppercase"),s(_,"href","/"),s(_,"class",K="w-full flex items-center gap-2 px-2 py-1.5 rounded-md hover:bg-gray-100 transition-colors text-left "+(f[7].url.pathname==="/"?"bg-gray-100":"")),s(x,"href","/voice-cloning"),s(x,"class",l="w-full flex items-center gap-2 px-2 py-1.5 rounded-md hover:bg-gray-100 transition-colors text-left "+(f[7].url.pathname==="/voice-cloning"?"bg-gray-100":"")),s(h,"class","w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left opacity-40 cursor-not-allowed"),h.disabled=!0,s(L,"class","w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left opacity-40 cursor-not-allowed"),L.disabled=!0,s(v,"class","w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left opacity-40 cursor-not-allowed"),v.disabled=!0,s(U,"class","w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left opacity-40 cursor-not-allowed"),U.disabled=!0,s(fe,"class","mt-4 mb-1 px-2 text-xs font-medium text-gray-500 uppercase"),s(Z,"class","w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left opacity-40 cursor-not-allowed"),Z.disabled=!0,s($,"class","w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left opacity-40 cursor-not-allowed"),$.disabled=!0,s(ee,"class","w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left opacity-40 cursor-not-allowed"),ee.disabled=!0,s(te,"class","w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left opacity-40 cursor-not-allowed"),te.disabled=!0,s(ne,"class","w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left opacity-40 cursor-not-allowed"),ne.disabled=!0,s(se,"class","w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left opacity-40 cursor-not-allowed"),se.disabled=!0,s(pe,"class","mt-4 mb-1 px-2 text-xs font-medium text-gray-500 uppercase"),s(le,"class","w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left opacity-40 cursor-not-allowed"),le.disabled=!0,s(ae,"class","w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left opacity-40 cursor-not-allowed"),ae.disabled=!0,s(oe,"class","w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left opacity-40 cursor-not-allowed"),oe.disabled=!0,s(re,"class","w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left opacity-40 cursor-not-allowed"),re.disabled=!0,s(ie,"class","w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left opacity-40 cursor-not-allowed"),ie.disabled=!0,s(t,"class","p-2 text-sm flex-1"),s(n,"class","w-56 border-r border-gray-200 bg-white flex-shrink-0 flex flex-col h-full relative "),s(ue,"class","flex-1 overflow-auto"),s(r,"class","flex h-screen bg-white")},m(m,k){_e(m,r,k),e(r,n),e(n,d),e(n,z),e(n,t),e(t,g),e(t,q),e(t,_),e(_,C),e(_,Y),e(_,b),e(t,G),e(t,x),Xe(P,x,null),e(x,D),e(x,I),e(t,w),e(t,h),e(t,V),e(t,L),e(t,y),e(t,v),e(t,F),e(t,U),e(t,X),e(t,fe),e(t,be),e(t,Z),e(t,ve),e(t,$),e(t,we),e(t,ee),e(t,Te),e(t,te),e(t,ye),e(t,ne),e(t,Ce),e(t,se),e(t,Le),e(t,pe),e(t,ke),e(t,le),e(t,Ie),e(t,ae),e(t,He),e(t,oe),e(t,Me),e(t,re),e(t,Ne),e(t,ie),e(r,Ee),e(r,ue),Xe(ce,ue,null),e(ue,Se),j&&j.m(ue,null),e(r,Ue),N&&N.m(r,null),de=!0},p(m,[k]){(!de||k&128&&K!==(K="w-full flex items-center gap-2 px-2 py-1.5 rounded-md hover:bg-gray-100 transition-colors text-left "+(m[7].url.pathname==="/"?"bg-gray-100":"")))&&s(_,"class",K),(!de||k&128&&l!==(l="w-full flex items-center gap-2 px-2 py-1.5 rounded-md hover:bg-gray-100 transition-colors text-left "+(m[7].url.pathname==="/voice-cloning"?"bg-gray-100":"")))&&s(x,"class",l);const W={};k&1&&(W.isLoggedIn=m[0]),k&2&&(W.username=m[1]),k&64&&(W.flashButton=m[6]),k&128&&(W.pageTitle=lt(m[7].url.pathname)),ce.$set(W),j&&j.p&&(!de||k&2048)&&ut(j,Ae,m,m[11],de?dt(Ae,m[11],k,null):ct(m[11]),null),m[2]?N?N.p(m,k):(N=tt(m),N.c(),N.m(r,null)):N&&(N.d(1),N=null)},i(m){de||(Pe(P.$$.fragment,m),Pe(ce.$$.fragment,m),Pe(j,m),de=!0)},o(m){Be(P.$$.fragment,m),Be(ce.$$.fragment,m),Be(j,m),de=!1},d(m){m&&E(r),Qe(P),Qe(ce),j&&j.d(m),N&&N.d()}}}function lt(f){switch(f){case"/":return"Text to Speech Playground";case"/voice-cloning":return"Voice Cloning Playground";default:return"HFStudio"}}function Tt(f,r,n){let d;ft(f,_t,l=>n(7,d=l));let{$$slots:H={},$$scope:z}=r,t={authenticated:!1},g=!1,A="";function q(l){if(t=l,n(0,g=(l==null?void 0:l.authenticated)||!1),l!=null&&l.authenticated&&(l!=null&&l.user_info)){const w=l.user_info,h=w.name||w.fullname||w.login||w.username||"User";n(1,A=h.split(" ")[0])}}typeof window<"u"&&(window.__INITIAL_USER__?(console.log("Found initial user data:",window.__INITIAL_USER__),q(window.__INITIAL_USER__)):(console.log("No initial user data found, listening for event"),window.addEventListener("initial-user-loaded",l=>{console.log("Received initial user event:",l.detail),q(l.detail)})));let _=!1,C="",M="",Y=!1,b=!1,B=!1;pt(()=>(window.addEventListener("show-login-prompt",()=>{g||(n(6,b=!0),setTimeout(()=>{n(6,b=!1)},1600))}),K().then(()=>{!window.__INITIAL_USER__&&!(t!=null&&t.authenticated)&&(console.log("No server data available, checking auth status via API"),G())}),document.addEventListener("visibilitychange",()=>{document.hidden||G()}),()=>{}));async function K(){try{B=(await(await fetch("/api/status")).json()).is_spaces||!1}catch(l){console.error("Error checking Spaces status:",l),B=!1}}async function G(){if(!(t!=null&&t.authenticated&&g))try{const l=await fetch("/api/auth/user",{credentials:"include"});if(l.ok){const w=await l.json();if(w.authenticated){n(0,g=!0);const h=w.user_info,S=h.name||h.fullname||h.login||h.username||"User";n(1,A=S.split(" ")[0])}else n(0,g=!1),n(1,A="")}else n(0,g=!1),n(1,A="")}catch{n(0,g=!1),n(1,A="")}}async function x(){if(g){try{await fetch("/api/auth/logout",{method:"POST",credentials:"include"})}catch(l){console.error("Logout error:",l)}sessionStorage.removeItem("oauth_state"),n(0,g=!1),n(1,A=""),window.location.reload()}else try{const w=await(await fetch("/api/auth/oauth-config")).json(),h=w.scopes||"inference-api";let S=window.location.origin+"/auth/callback";window.location.hostname==="localhost"&&window.location.port==="11111"&&(S="http://localhost:7860/auth/callback");const V=window.location.pathname,L=`https://huggingface.co/oauth/authorize?client_id=${w.client_id}&redirect_uri=${encodeURIComponent(S)}&scope=${encodeURIComponent(h)}&response_type=code&state=${encodeURIComponent(V)}`;window.location.href=L}catch{n(2,_=!0),n(3,C=""),n(4,M="")}}function P(){n(2,_=!1),n(3,C=""),n(4,M="")}async function D(){if(!C.trim()){n(4,M="Please enter a token");return}if(!C.startsWith("hf_")){n(4,M='Token should start with "hf_"');return}try{const l=await fetch("https://huggingface.co/api/whoami-v2",{headers:{Authorization:`Bearer ${C.trim()}`}});if(l.ok){const w=await l.json(),h=C.trim();try{const S=await fetch("/api/auth/manual-token",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({token:h})});if(S.ok){const V=await S.json();n(0,g=!0);const L=V.user_info,T=L.name||L.fullname||L.login||L.username||"User";n(1,A=T.split(" ")[0]),P()}else{const V=await S.json();n(4,M=V.detail||"Token validation failed")}}catch{n(4,M="Failed to validate token. Please try again.")}}else n(4,M=`Invalid token (${l.status}). Please check your token and try again.`)}catch{n(4,M="Error validating token. Please try again.")}}function I(){C=this.value,n(3,C)}const O=l=>l.key==="Enter"&&D();return f.$$set=l=>{"$$scope"in l&&n(11,z=l.$$scope)},[g,A,_,C,M,Y,b,d,x,P,D,z,H,I,O]}class Ht extends at{constructor(r){super(),ot(this,r,Tt,wt,rt,{})}}export{Ht as component};
hfstudio/static/_app/immutable/nodes/1.DGNb_QvY.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{S as x,i as S,s as j,n as u,d as c,a as h,b as _,c as d,e as v,f as g,g as b,h as k,j as E,t as $,k as q,l as y}from"../chunks/TRxHAhOH.js";import"../chunks/IHki7fMi.js";import{p as C}from"../chunks/D0F9faoj.js";function H(p){var f;let a,s=p[0].status+"",r,n,o,i=((f=p[0].error)==null?void 0:f.message)+"",m;return{c(){a=E("h1"),r=$(s),n=q(),o=E("p"),m=$(i)},l(e){a=v(e,"H1",{});var t=g(a);r=b(t,s),t.forEach(c),n=k(e),o=v(e,"P",{});var l=g(o);m=b(l,i),l.forEach(c)},m(e,t){_(e,a,t),d(a,r),_(e,n,t),_(e,o,t),d(o,m)},p(e,[t]){var l;t&1&&s!==(s=e[0].status+"")&&h(r,s),t&1&&i!==(i=((l=e[0].error)==null?void 0:l.message)+"")&&h(m,i)},i:u,o:u,d(e){e&&(c(a),c(n),c(o))}}}function P(p,a,s){let r;return y(p,C,n=>s(0,r=n)),[r]}class B extends x{constructor(a){super(),S(this,a,P,H,j,{})}}export{B as component};
hfstudio/static/_app/immutable/nodes/2.1j9YdqU7.js ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import{S as gs,i as _s,s as Ol,u as cr,v as fe,w as T,x as k,y as pe,z as he,A as me,B as Qr,C as vs,D as ys,E as ws,F as xs,d as c,J as bs,H as ml,a as et,I as dl,K as dt,p as o,b as A,c as n,m as L,L as ks,h as _,e as u,f as p,r as W,g as Y,M as Ht,k as b,j as d,t as q,G as Es,N as ft,n as Nt,O as dr,P as fr,Q as ur,R as Wr,T as Ts,q as Zr}from"../chunks/TRxHAhOH.js";import{C as ir,g as Cs,P as Mt,D as $s}from"../chunks/DUd0gdPo.js";import{I as Is,g as Ds,a as Vs,e as Sl}from"../chunks/BhRpzVYR.js";import"../chunks/IHki7fMi.js";import{S as Ls,L as Ps,A as Ms,X as Ns}from"../chunks/BNlacN_j.js";import{P as pl,a as Al}from"../chunks/gtFtmmyB.js";function Hs(s){let e;const t=s[2].default,l=vs(t,s,s[3],null);return{c(){l&&l.c()},l(r){l&&l.l(r)},m(r,a){l&&l.m(r,a),e=!0},p(r,a){l&&l.p&&(!e||a&8)&&ys(l,t,r,r[3],e?xs(t,r[3],a,null):ws(r[3]),null)},i(r){e||(k(l,r),e=!0)},o(r){T(l,r),e=!1},d(r){l&&l.d(r)}}}function js(s){let e,t;const l=[{name:"chevron-down"},s[1],{iconNode:s[0]}];let r={$$slots:{default:[Hs]},$$scope:{ctx:s}};for(let a=0;a<l.length;a+=1)r=cr(r,l[a]);return e=new Is({props:r}),{c(){me(e.$$.fragment)},l(a){he(e.$$.fragment,a)},m(a,i){pe(e,a,i),t=!0},p(a,[i]){const h=i&3?Ds(l,[l[0],i&2&&Vs(a[1]),i&1&&{iconNode:a[0]}]):{};i&8&&(h.$$scope={dirty:i,ctx:a}),e.$set(h)},i(a){t||(k(e.$$.fragment,a),t=!0)},o(a){T(e.$$.fragment,a),t=!1},d(a){fe(e,a)}}}function Os(s,e,t){let{$$slots:l={},$$scope:r}=e;const a=[["path",{d:"m6 9 6 6 6-6"}]];return s.$$set=i=>{t(1,e=cr(cr({},e),Qr(i))),"$$scope"in i&&t(3,r=i.$$scope)},e=Qr(e),[a,e,l,r]}class Ss extends gs{constructor(e){super(),_s(this,e,Os,js,Ol,{})}}const{document:es}=Cs;function ts(s,e,t){const l=s.slice();return l[75]=e[t],l}function ls(s,e,t){const l=s.slice();return l[75]=e[t],l}function As(s){let e,t,l;return e=new pl({props:{size:16}}),{c(){me(e.$$.fragment),t=q(`
2
+ Generate speech`)},l(r){he(e.$$.fragment,r),t=Y(r,`
3
+ Generate speech`)},m(r,a){pe(e,r,a),A(r,t,a),l=!0},i(r){l||(k(e.$$.fragment,r),l=!0)},o(r){T(e.$$.fragment,r),l=!1},d(r){r&&c(t),fe(e,r)}}}function Us(s){let e,t,l;return e=new Ps({props:{size:16,class:"animate-spin"}}),{c(){me(e.$$.fragment),t=q(`
4
+ Generating...`)},l(r){he(e.$$.fragment,r),t=Y(r,`
5
+ Generating...`)},m(r,a){pe(e,r,a),A(r,t,a),l=!0},i(r){l||(k(e.$$.fragment,r),l=!0)},o(r){T(e.$$.fragment,r),l=!1},d(r){r&&c(t),fe(e,r)}}}function rs(s){let e=s[75].name+"",t,l,r=s[75].badge&&zs(s);return{c(){t=q(e),r&&r.c(),l=Ht()},l(a){t=Y(a,e),r&&r.l(a),l=Ht()},m(a,i){A(a,t,i),r&&r.m(a,i),A(a,l,i)},p(a,i){a[75].badge&&r.p(a,i)},d(a){a&&(c(t),c(l)),r&&r.d(a)}}}function zs(s){let e,t,l,r=s[75].badge+"",a,i;return{c(){e=q(" "),t=d("span"),l=q("("),a=q(r),i=q(")"),this.h()},l(h){e=Y(h," "),t=u(h,"SPAN",{class:!0});var g=p(t);l=Y(g,"("),a=Y(g,r),i=Y(g,")"),g.forEach(c),this.h()},h(){o(t,"class","text-sm text-gray-500")},m(h,g){A(h,e,g),A(h,t,g),n(t,l),n(t,a),n(t,i)},p:Nt,d(h){h&&(c(e),c(t))}}}function ss(s){let e,t=s[75].name===s[2]&&rs(s);return{c(){t&&t.c(),e=Ht()},l(l){t&&t.l(l),e=Ht()},m(l,r){t&&t.m(l,r),A(l,e,r)},p(l,r){l[75].name===l[2]?t?t.p(l,r):(t=rs(l),t.c(),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},d(l){l&&c(e),t&&t.d(l)}}}function ns(s){let e,t=Sl(s[25]),l=[];for(let r=0;r<t.length;r+=1)l[r]=os(ts(s,t,r));return{c(){e=d("div");for(let r=0;r<l.length;r+=1)l[r].c();this.h()},l(r){e=u(r,"DIV",{class:!0});var a=p(e);for(let i=0;i<l.length;i+=1)l[i].l(a);a.forEach(c),this.h()},h(){o(e,"class","absolute top-full left-0 right-0 border border-gray-200 border-t-0 bg-white shadow-lg rounded-b-lg overflow-hidden z-20")},m(r,a){A(r,e,a);for(let i=0;i<l.length;i+=1)l[i]&&l[i].m(e,null)},p(r,a){if(a[0]&33554692){t=Sl(r[25]);let i;for(i=0;i<t.length;i+=1){const h=ts(r,t,i);l[i]?l[i].p(h,a):(l[i]=os(h),l[i].c(),l[i].m(e,null))}for(;i<l.length;i+=1)l[i].d(1);l.length=t.length}},d(r){r&&c(e),bs(l,r)}}}function Bs(s){let e,t,l,r=s[75].badge+"",a,i;return{c(){e=q(" "),t=d("span"),l=q("("),a=q(r),i=q(")"),this.h()},l(h){e=Y(h," "),t=u(h,"SPAN",{class:!0});var g=p(t);l=Y(g,"("),a=Y(g,r),i=Y(g,")"),g.forEach(c),this.h()},h(){o(t,"class","text-sm text-gray-500")},m(h,g){A(h,e,g),A(h,t,g),n(t,l),n(t,a),n(t,i)},p:Nt,d(h){h&&(c(e),c(t))}}}function os(s){let e,t=s[75].name+"",l,r,a,i,h,g=s[75].badge&&Bs(s);function E(){return s[43](s[75])}return{c(){e=d("button"),l=q(t),g&&g.c(),r=b(),this.h()},l(y){e=u(y,"BUTTON",{class:!0});var v=p(e);l=Y(v,t),g&&g.l(v),r=_(v),v.forEach(c),this.h()},h(){o(e,"class",a="w-full px-3 py-2.5 text-left transition-colors text-sm "+(s[75].disabled?"opacity-50 cursor-not-allowed":"hover:bg-gray-50")+" "+(s[75].name===s[2]?"bg-gray-100":"")),e.disabled=s[75].disabled},m(y,v){A(y,e,v),n(e,l),g&&g.m(e,null),n(e,r),i||(h=L(e,"click",E),i=!0)},p(y,v){s=y,s[75].badge&&g.p(s,v),v[0]&4&&a!==(a="w-full px-3 py-2.5 text-left transition-colors text-sm "+(s[75].disabled?"opacity-50 cursor-not-allowed":"hover:bg-gray-50")+" "+(s[75].name===s[2]?"bg-gray-100":""))&&o(e,"class",a)},d(y){y&&c(e),g&&g.d(),i=!1,h()}}}function Rs(s){let e,t;return e=new pl({props:{size:10,class:"text-gray-600"}}),{c(){me(e.$$.fragment)},l(l){he(e.$$.fragment,l)},m(l,r){pe(e,l,r),t=!0},i(l){t||(k(e.$$.fragment,l),t=!0)},o(l){T(e.$$.fragment,l),t=!1},d(l){fe(e,l)}}}function Gs(s){let e,t;return e=new Al({props:{size:10,class:"text-gray-600"}}),{c(){me(e.$$.fragment)},l(l){he(e.$$.fragment,l)},m(l,r){pe(e,l,r),t=!0},i(l){t||(k(e.$$.fragment,l),t=!0)},o(l){T(e.$$.fragment,l),t=!1},d(l){fe(e,l)}}}function Fs(s){let e,t;return e=new pl({props:{size:10,class:"text-gray-600"}}),{c(){me(e.$$.fragment)},l(l){he(e.$$.fragment,l)},m(l,r){pe(e,l,r),t=!0},i(l){t||(k(e.$$.fragment,l),t=!0)},o(l){T(e.$$.fragment,l),t=!1},d(l){fe(e,l)}}}function Ys(s){let e,t;return e=new Al({props:{size:10,class:"text-gray-600"}}),{c(){me(e.$$.fragment)},l(l){he(e.$$.fragment,l)},m(l,r){pe(e,l,r),t=!0},i(l){t||(k(e.$$.fragment,l),t=!0)},o(l){T(e.$$.fragment,l),t=!1},d(l){fe(e,l)}}}function qs(s){let e,t;return e=new pl({props:{size:10,class:"text-gray-600"}}),{c(){me(e.$$.fragment)},l(l){he(e.$$.fragment,l)},m(l,r){pe(e,l,r),t=!0},i(l){t||(k(e.$$.fragment,l),t=!0)},o(l){T(e.$$.fragment,l),t=!1},d(l){fe(e,l)}}}function Ks(s){let e,t;return e=new Al({props:{size:10,class:"text-gray-600"}}),{c(){me(e.$$.fragment)},l(l){he(e.$$.fragment,l)},m(l,r){pe(e,l,r),t=!0},i(l){t||(k(e.$$.fragment,l),t=!0)},o(l){T(e.$$.fragment,l),t=!1},d(l){fe(e,l)}}}function Js(s){let e,t='<div class="flex items-center justify-between mb-1"><div class="flex items-center gap-2"><div class="w-6 h-6 bg-gradient-to-br from-purple-400 to-pink-500 rounded-full flex items-center justify-center text-white text-xs font-semibold">🎤</div> <span class="text-xs font-medium text-purple-900">Clone your voice</span></div> <div class="w-5 h-5 flex items-center justify-center"><svg class="w-3 h-3 text-purple-600" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"></path></svg></div></div>';return{c(){e=d("a"),e.innerHTML=t,this.h()},l(l){e=u(l,"A",{href:!0,class:!0,"data-svelte-h":!0}),W(e)!=="svelte-aczm6q"&&(e.innerHTML=t),this.h()},h(){o(e,"href","/voice-cloning"),o(e,"class","p-3 border border-purple-200 rounded-lg transition-colors text-left hover:bg-purple-50 bg-purple-25")},m(l,r){A(l,e,r)},p:Nt,i:Nt,o:Nt,d(l){l&&c(e)}}}function Xs(s){let e,t,l,r='<div class="w-6 h-6 bg-gradient-to-br from-purple-400 to-pink-500 rounded-full flex items-center justify-center text-white text-xs">🎤</div> <span class="text-xs font-medium">Your cloned voice</span>',a,i,h,g,E,y,v,$;const G=[Ws,Qs],J=[];function U(w,C){return w[17]==="Yours"?0:1}return h=U(s),g=J[h]=G[h](s),{c(){e=d("button"),t=d("div"),l=d("div"),l.innerHTML=r,a=b(),i=d("button"),g.c(),this.h()},l(w){e=u(w,"BUTTON",{class:!0});var C=p(e);t=u(C,"DIV",{class:!0});var I=p(t);l=u(I,"DIV",{class:!0,"data-svelte-h":!0}),W(l)!=="svelte-1ixcco1"&&(l.innerHTML=r),a=_(I),i=u(I,"BUTTON",{class:!0,title:!0});var X=p(i);g.l(X),X.forEach(c),I.forEach(c),C.forEach(c),this.h()},h(){o(l,"class","flex items-center gap-2"),o(i,"class","p-1 rounded-full hover:bg-gray-200 transition-colors w-5 h-5 flex items-center justify-center"),o(i,"title","Play sample"),o(t,"class","flex items-center justify-between mb-1"),o(e,"class",E="p-3 border rounded-lg transition-colors text-left hover:bg-gray-50 "+(s[1]==="Yours"?"border-purple-400 bg-purple-50":"border-gray-200"))},m(w,C){A(w,e,C),n(e,t),n(t,l),n(t,a),n(t,i),J[h].m(i,null),y=!0,v||($=[L(i,"click",s[50]),L(e,"click",s[51])],v=!0)},p(w,C){let I=h;h=U(w),h!==I&&(ft(),T(J[I],1,1,()=>{J[I]=null}),dt(),g=J[h],g||(g=J[h]=G[h](w),g.c()),k(g,1),g.m(i,null)),(!y||C[0]&2&&E!==(E="p-3 border rounded-lg transition-colors text-left hover:bg-gray-50 "+(w[1]==="Yours"?"border-purple-400 bg-purple-50":"border-gray-200")))&&o(e,"class",E)},i(w){y||(k(g),y=!0)},o(w){T(g),y=!1},d(w){w&&c(e),J[h].d(),v=!1,ml($)}}}function Qs(s){let e,t;return e=new pl({props:{size:10,class:"text-gray-600"}}),{c(){me(e.$$.fragment)},l(l){he(e.$$.fragment,l)},m(l,r){pe(e,l,r),t=!0},i(l){t||(k(e.$$.fragment,l),t=!0)},o(l){T(e.$$.fragment,l),t=!1},d(l){fe(e,l)}}}function Ws(s){let e,t;return e=new Al({props:{size:10,class:"text-gray-600"}}),{c(){me(e.$$.fragment)},l(l){he(e.$$.fragment,l)},m(l,r){pe(e,l,r),t=!0},i(l){t||(k(e.$$.fragment,l),t=!0)},o(l){T(e.$$.fragment,l),t=!1},d(l){fe(e,l)}}}function as(s){let e,t,l='<svg class="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path></svg>',r,a,i='Hugging Face <span class="bg-gradient-to-r from-purple-500 via-pink-500 via-green-500 to-blue-500 bg-clip-text text-transparent font-bold">PRO</span>',h,g,E=`Sign in to with your Hugging Face <a href="https://huggingface.co/pro" target="_blank" class="text-amber-600 hover:text-amber-700 underline font-medium">PRO account</a> to get started with $2 of free API credits per month. You can add a billing method for
6
+ additional pay-as-you-go usage ⤴`,y,v;return{c(){e=d("div"),t=d("button"),t.innerHTML=l,r=b(),a=d("p"),a.innerHTML=i,h=b(),g=d("p"),g.innerHTML=E,this.h()},l($){e=u($,"DIV",{class:!0});var G=p(e);t=u(G,"BUTTON",{class:!0,"aria-label":!0,"data-svelte-h":!0}),W(t)!=="svelte-9gdgq5"&&(t.innerHTML=l),r=_(G),a=u(G,"P",{class:!0,"data-svelte-h":!0}),W(a)!=="svelte-1q58z3k"&&(a.innerHTML=i),h=_(G),g=u(G,"P",{class:!0,"data-svelte-h":!0}),W(g)!=="svelte-dysk74"&&(g.innerHTML=E),G.forEach(c),this.h()},h(){o(t,"class","absolute top-2 right-2 text-gray-400 hover:text-gray-600 transition-colors"),o(t,"aria-label","Dismiss"),o(a,"class","text-sm font-medium text-gray-700 mb-1 pr-4"),o(g,"class","text-sm text-gray-600 pr-4"),o(e,"class","mb-4 px-3 py-2 bg-gradient-to-r from-amber-50 to-orange-50 rounded-lg border border-amber-200 relative")},m($,G){A($,e,G),n(e,t),n(e,r),n(e,a),n(e,h),n(e,g),y||(v=L(t,"click",s[54]),y=!0)},p:Nt,d($){$&&c(e),y=!1,v()}}}function is(s){let e,t,l,r=Mt.highlight(s[23],Mt.languages.bash,"bash")+"";return{c(){e=d("pre"),t=d("code"),l=new fr(!1),this.h()},l(a){e=u(a,"PRE",{class:!0});var i=p(e);t=u(i,"CODE",{class:!0});var h=p(t);l=dr(h,!1),h.forEach(c),i.forEach(c),this.h()},h(){l.a=null,o(t,"class","language-bash"),o(e,"class","p-3 overflow-x-auto bg-gray-50 text-xs")},m(a,i){A(a,e,i),n(e,t),l.m(r,t)},p(a,i){i[0]&8388608&&r!==(r=Mt.highlight(a[23],Mt.languages.bash,"bash")+"")&&l.p(r)},d(a){a&&c(e)}}}function cs(s){let e,t,l,r=Mt.highlight(s[24],Mt.languages.python,"python")+"";return{c(){e=d("pre"),t=d("code"),l=new fr(!1),this.h()},l(a){e=u(a,"PRE",{class:!0});var i=p(e);t=u(i,"CODE",{class:!0});var h=p(t);l=dr(h,!1),h.forEach(c),i.forEach(c),this.h()},h(){l.a=null,o(t,"class","language-python"),o(e,"class","p-3 overflow-x-auto bg-gray-50 text-xs")},m(a,i){A(a,e,i),n(e,t),l.m(r,t)},p(a,i){i[0]&16777216&&r!==(r=Mt.highlight(a[24],Mt.languages.python,"python")+"")&&l.p(r)},d(a){a&&c(e)}}}function us(s){let e,t,l,r,a,i,h="Generated Audio",g,E,y,v,$,G="Download",J,U,w,C,I,X,z,ae,Z,D,te,be=fl(s[14])+"",B,M,V,N,F,le,De,K,ee,ge=fl(s[13])+"",Ne,ve,He,je,tt,xe,Ve=fl(s[14])+"",Ke,Oe,se,pt,ht,H=s[11]>0&&s[6]!=="local"&&ds(s);U=new $s({props:{size:12,class:"text-green-600"}});const Le=[en,Zs],_e=[];function Be(P,j){return P[12]?0:1}F=Be(s),le=_e[F]=Le[F](s);let ne=s[10]&&fs(s);return{c(){e=d("div"),t=d("div"),l=d("div"),r=d("div"),a=b(),i=d("span"),i.textContent=h,g=b(),H&&H.c(),E=b(),y=d("div"),v=d("button"),$=d("span"),$.textContent=G,J=b(),me(U.$$.fragment),w=b(),C=d("div"),I=d("div"),X=d("h4"),z=q(s[15]),ae=b(),Z=d("p"),D=q(s[1]),te=q(" • "),B=q(be),M=b(),V=d("div"),N=d("button"),le.c(),De=b(),K=d("div"),ee=d("span"),Ne=q(ge),ve=b(),He=d("div"),je=d("div"),tt=b(),xe=d("span"),Ke=q(Ve),Oe=b(),ne&&ne.c(),this.h()},l(P){e=u(P,"DIV",{class:!0});var j=p(e);t=u(j,"DIV",{class:!0});var re=p(t);l=u(re,"DIV",{class:!0});var ie=p(l);r=u(ie,"DIV",{class:!0}),p(r).forEach(c),a=_(ie),i=u(ie,"SPAN",{class:!0,"data-svelte-h":!0}),W(i)!=="svelte-1hz7jl7"&&(i.textContent=h),g=_(ie),H&&H.l(ie),ie.forEach(c),E=_(re),y=u(re,"DIV",{class:!0});var lt=p(y);v=u(lt,"BUTTON",{class:!0,title:!0});var Je=p(v);$=u(Je,"SPAN",{class:!0,"data-svelte-h":!0}),W($)!=="svelte-kkuif9"&&($.textContent=G),J=_(Je),he(U.$$.fragment,Je),Je.forEach(c),lt.forEach(c),re.forEach(c),w=_(j),C=u(j,"DIV",{class:!0});var ye=p(C);I=u(ye,"DIV",{class:!0});var $e=p(I);X=u($e,"H4",{class:!0});var Re=p(X);z=Y(Re,s[15]),Re.forEach(c),ae=_($e),Z=u($e,"P",{class:!0});var rt=p(Z);D=Y(rt,s[1]),te=Y(rt," • "),B=Y(rt,be),rt.forEach(c),$e.forEach(c),M=_(ye),V=u(ye,"DIV",{class:!0});var Xe=p(V);N=u(Xe,"BUTTON",{class:!0});var Pe=p(N);le.l(Pe),Pe.forEach(c),De=_(Xe),K=u(Xe,"DIV",{class:!0});var ce=p(K);ee=u(ce,"SPAN",{class:!0});var ke=p(ee);Ne=Y(ke,ge),ke.forEach(c),ve=_(ce),He=u(ce,"DIV",{class:!0});var st=p(He);je=u(st,"DIV",{class:!0,style:!0}),p(je).forEach(c),st.forEach(c),tt=_(ce),xe=u(ce,"SPAN",{class:!0});var mt=p(xe);Ke=Y(mt,Ve),mt.forEach(c),ce.forEach(c),Xe.forEach(c),Oe=_(ye),ne&&ne.l(ye),ye.forEach(c),j.forEach(c),this.h()},h(){o(r,"class","w-1.5 h-1.5 bg-green-500 rounded-full"),o(i,"class","text-xs font-medium text-green-900"),o(l,"class","flex items-center gap-2"),o($,"class","text-xs text-green-700"),o(v,"class","flex items-center gap-1 px-2 py-1 hover:bg-green-100 rounded transition-colors"),o(v,"title","Download audio"),o(y,"class","flex items-center gap-1"),o(t,"class","flex items-center justify-between px-3 py-2 bg-green-50 border-b border-green-200"),o(X,"class","font-medium text-gray-900 text-xs"),o(Z,"class","text-xs text-gray-500"),o(I,"class","mb-3"),o(N,"class","w-6 h-6 bg-black rounded-full flex items-center justify-center hover:bg-gray-800 transition-colors flex-shrink-0"),o(ee,"class","text-xs text-gray-500 font-mono"),o(je,"class","h-full bg-gradient-to-r from-amber-400 to-orange-500 rounded-full transition-all"),ur(je,"width",s[13]/s[14]*100+"%"),o(He,"class","flex-1 h-1 bg-gray-200 rounded-full cursor-pointer"),o(xe,"class","text-xs text-gray-500 font-mono"),o(K,"class","flex-1 flex items-center gap-1"),o(V,"class","flex items-center gap-2"),o(C,"class","p-3"),o(e,"class","bg-white rounded-lg border border-gray-200 overflow-hidden mt-4")},m(P,j){A(P,e,j),n(e,t),n(t,l),n(l,r),n(l,a),n(l,i),n(l,g),H&&H.m(l,null),n(t,E),n(t,y),n(y,v),n(v,$),n(v,J),pe(U,v,null),n(e,w),n(e,C),n(C,I),n(I,X),n(X,z),n(I,ae),n(I,Z),n(Z,D),n(Z,te),n(Z,B),n(C,M),n(C,V),n(V,N),_e[F].m(N,null),n(V,De),n(V,K),n(K,ee),n(ee,Ne),n(K,ve),n(K,He),n(He,je),n(K,tt),n(K,xe),n(xe,Ke),n(C,Oe),ne&&ne.m(C,null),se=!0,pt||(ht=[L(v,"click",s[32]),L(N,"click",s[27])],pt=!0)},p(P,j){P[11]>0&&P[6]!=="local"?H?H.p(P,j):(H=ds(P),H.c(),H.m(l,null)):H&&(H.d(1),H=null),(!se||j[0]&32768)&&et(z,P[15]),(!se||j[0]&2)&&et(D,P[1]),(!se||j[0]&16384)&&be!==(be=fl(P[14])+"")&&et(B,be);let re=F;F=Be(P),F!==re&&(ft(),T(_e[re],1,1,()=>{_e[re]=null}),dt(),le=_e[F],le||(le=_e[F]=Le[F](P),le.c()),k(le,1),le.m(N,null)),(!se||j[0]&8192)&&ge!==(ge=fl(P[13])+"")&&et(Ne,ge),(!se||j[0]&24576)&&ur(je,"width",P[13]/P[14]*100+"%"),(!se||j[0]&16384)&&Ve!==(Ve=fl(P[14])+"")&&et(Ke,Ve),P[10]?ne?ne.p(P,j):(ne=fs(P),ne.c(),ne.m(C,null)):ne&&(ne.d(1),ne=null)},i(P){se||(k(U.$$.fragment,P),k(le),se=!0)},o(P){T(U.$$.fragment,P),T(le),se=!1},d(P){P&&c(e),H&&H.d(),fe(U),_e[F].d(),ne&&ne.d(),pt=!1,ml(ht)}}}function ds(s){let e,t,l=s[11].toFixed(1)+"",r,a;return{c(){e=d("span"),t=q("(took "),r=q(l),a=q("s)"),this.h()},l(i){e=u(i,"SPAN",{class:!0});var h=p(e);t=Y(h,"(took "),r=Y(h,l),a=Y(h,"s)"),h.forEach(c),this.h()},h(){o(e,"class","text-xs text-green-700")},m(i,h){A(i,e,h),n(e,t),n(e,r),n(e,a)},p(i,h){h[0]&2048&&l!==(l=i[11].toFixed(1)+"")&&et(r,l)},d(i){i&&c(e)}}}function Zs(s){let e,t;return e=new pl({props:{size:10,class:"text-white ml-0.5"}}),{c(){me(e.$$.fragment)},l(l){he(e.$$.fragment,l)},m(l,r){pe(e,l,r),t=!0},i(l){t||(k(e.$$.fragment,l),t=!0)},o(l){T(e.$$.fragment,l),t=!1},d(l){fe(e,l)}}}function en(s){let e;return{c(){e=d("div"),this.h()},l(t){e=u(t,"DIV",{class:!0}),p(e).forEach(c),this.h()},h(){o(e,"class","pause-filled text-white text-xs svelte-13ak1iw")},m(t,l){A(t,e,l)},i:Nt,o:Nt,d(t){t&&c(e)}}}function fs(s){let e,t,l,r;return{c(){e=d("audio"),this.h()},l(a){e=u(a,"AUDIO",{src:!0,style:!0}),p(e).forEach(c),this.h()},h(){Zr(e.src,t=s[10])||o(e,"src",t),ur(e,"display","none")},m(a,i){A(a,e,i),s[59](e),l||(r=[L(e,"loadedmetadata",s[28]),L(e,"timeupdate",s[29]),L(e,"play",s[30]),L(e,"pause",s[31])],l=!0)},p(a,i){i[0]&1024&&!Zr(e.src,t=a[10])&&o(e,"src",t)},d(a){a&&c(e),s[59](null),l=!1,ml(r)}}}function ps(s){let e,t,l,r,a,i,h,g,E,y,v,$,G="An error occurred while processing your request",J,U,w,C,I,X,z,ae,Z="Close",D,te,be;i=new Ms({props:{size:20,class:"text-red-600"}}),w=new Ns({props:{size:20,class:"text-gray-500"}});let B=s[20]&&hs(s);return{c(){e=d("div"),t=d("div"),l=d("div"),r=d("div"),a=d("div"),me(i.$$.fragment),h=b(),g=d("div"),E=d("h3"),y=q(s[19]),v=b(),$=d("p"),$.textContent=G,J=b(),U=d("button"),me(w.$$.fragment),C=b(),I=d("div"),B&&B.c(),X=b(),z=d("div"),ae=d("button"),ae.textContent=Z,this.h()},l(M){e=u(M,"DIV",{class:!0});var V=p(e);t=u(V,"DIV",{class:!0});var N=p(t);l=u(N,"DIV",{class:!0});var F=p(l);r=u(F,"DIV",{class:!0});var le=p(r);a=u(le,"DIV",{class:!0});var De=p(a);he(i.$$.fragment,De),De.forEach(c),h=_(le),g=u(le,"DIV",{class:!0});var K=p(g);E=u(K,"H3",{class:!0});var ee=p(E);y=Y(ee,s[19]),ee.forEach(c),v=_(K),$=u(K,"P",{class:!0,"data-svelte-h":!0}),W($)!=="svelte-1l3zl3"&&($.textContent=G),K.forEach(c),le.forEach(c),J=_(F),U=u(F,"BUTTON",{class:!0,title:!0});var ge=p(U);he(w.$$.fragment,ge),ge.forEach(c),F.forEach(c),C=_(N),I=u(N,"DIV",{class:!0});var Ne=p(I);B&&B.l(Ne),Ne.forEach(c),X=_(N),z=u(N,"DIV",{class:!0});var ve=p(z);ae=u(ve,"BUTTON",{class:!0,"data-svelte-h":!0}),W(ae)!=="svelte-4sxk6g"&&(ae.textContent=Z),ve.forEach(c),N.forEach(c),V.forEach(c),this.h()},h(){o(a,"class","w-10 h-10 bg-red-100 rounded-full flex items-center justify-center flex-shrink-0"),o(E,"class","text-lg font-semibold text-gray-900 truncate"),o($,"class","text-sm text-gray-600"),o(g,"class","min-w-0"),o(r,"class","flex items-center gap-3 min-w-0"),o(U,"class","p-2 hover:bg-red-100 rounded-full transition-colors flex-shrink-0"),o(U,"title","Close"),o(l,"class","flex items-center justify-between p-6 border-b border-gray-200 bg-red-50 flex-shrink-0"),o(I,"class","p-6 overflow-y-auto flex-1 min-h-0"),o(ae,"class","px-6 py-2 bg-red-600 text-white rounded-lg hover:bg-red-700 transition-colors"),o(z,"class","flex items-center justify-end gap-3 p-6 border-t border-gray-200 bg-gray-50 flex-shrink-0"),o(t,"class","bg-white rounded-xl shadow-2xl max-w-2xl w-full max-h-[80vh] flex flex-col"),o(e,"class","fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4")},m(M,V){A(M,e,V),n(e,t),n(t,l),n(l,r),n(r,a),pe(i,a,null),n(r,h),n(r,g),n(g,E),n(E,y),n(g,v),n(g,$),n(l,J),n(l,U),pe(w,U,null),n(t,C),n(t,I),B&&B.m(I,null),n(t,X),n(t,z),n(z,ae),D=!0,te||(be=[L(U,"click",s[36]),L(ae,"click",s[36])],te=!0)},p(M,V){(!D||V[0]&524288)&&et(y,M[19]),M[20]?B?B.p(M,V):(B=hs(M),B.c(),B.m(I,null)):B&&(B.d(1),B=null)},i(M){D||(k(i.$$.fragment,M),k(w.$$.fragment,M),D=!0)},o(M){T(i.$$.fragment,M),T(w.$$.fragment,M),D=!1},d(M){M&&c(e),fe(i),fe(w),B&&B.d(),te=!1,ml(be)}}}function hs(s){let e,t,l="Error Details:",r,a,i;function h(y,v){return v[0]&1048576&&(i=null),i==null&&(i=!!y[20].includes("exceeded your monthly included credits")),i?ln:tn}let g=h(s,[-1,-1,-1]),E=g(s);return{c(){e=d("div"),t=d("h4"),t.textContent=l,r=b(),a=d("pre"),E.c(),this.h()},l(y){e=u(y,"DIV",{class:!0});var v=p(e);t=u(v,"H4",{class:!0,"data-svelte-h":!0}),W(t)!=="svelte-3lmggt"&&(t.textContent=l),r=_(v),a=u(v,"PRE",{class:!0});var $=p(a);E.l($),$.forEach(c),v.forEach(c),this.h()},h(){o(t,"class","text-sm font-medium text-gray-900 mb-2"),o(a,"class","text-xs text-gray-700 whitespace-pre-wrap font-mono leading-relaxed break-words"),o(e,"class","bg-gray-50 rounded-lg p-4 border")},m(y,v){A(y,e,v),n(e,t),n(e,r),n(e,a),E.m(a,null)},p(y,v){g===(g=h(y,v))&&E?E.p(y,v):(E.d(1),E=g(y),E&&(E.c(),E.m(a,null)))},d(y){y&&c(e),E.d()}}}function tn(s){let e;return{c(){e=q(s[20])},l(t){e=Y(t,s[20])},m(t,l){A(t,e,l)},p(t,l){l[0]&1048576&&et(e,t[20])},d(t){t&&c(e)}}}function ln(s){let e,t=s[20].replace("Subscribe to PRO",'<a href="https://huggingface.co/settings/billing" target="_blank" class="text-amber-600 hover:text-amber-700 underline font-medium">Subscribe to PRO</a>')+"",l;return{c(){e=new fr(!1),l=Ht(),this.h()},l(r){e=dr(r,!1),l=Ht(),this.h()},h(){e.a=l},m(r,a){e.m(t,r,a),A(r,l,a)},p(r,a){a[0]&1048576&&t!==(t=r[20].replace("Subscribe to PRO",'<a href="https://huggingface.co/settings/billing" target="_blank" class="text-amber-600 hover:text-amber-700 underline font-medium">Subscribe to PRO</a>')+"")&&e.p(t)},d(r){r&&(c(l),e.d())}}}function ms(s){let e,t;return{c(){e=d("div"),t=q(s[22]),this.h()},l(l){e=u(l,"DIV",{class:!0});var r=p(e);t=Y(r,s[22]),r.forEach(c),this.h()},h(){o(e,"class","fixed bottom-4 right-4 px-4 py-2 bg-gray-900 text-white rounded-lg shadow-lg z-50 animate-fade-in svelte-13ak1iw")},m(l,r){A(l,e,r),n(e,t)},p(l,r){r[0]&4194304&&et(t,l[22])},d(l){l&&c(e)}}}function rn(s){let e,t,l,r,a,i,h,g="Text to speak",E,y,v,$,G,J,U=s[0].length.toLocaleString()+"",w,C,I,X,z,ae,Z,D,te,be,B,M,V,N,F,le="Model",De,K,ee,ge,Ne,ve,He,je,tt,xe,Ve='~$0.025 per generation • <a href="https://huggingface.co/settings/billing" target="_blank" class="text-amber-600 hover:text-amber-700 underline">Billing ⤴</a>',Ke,Oe,se,pt="Voice",ht,H,Le,_e,Be,ne='<div class="w-6 h-6 bg-gradient-to-br from-amber-400 to-orange-500 rounded-full flex items-center justify-center text-white text-xs font-semibold">A</div> <span class="text-sm font-medium">Andrew</span>',P,j,re,ie,lt,Je,ye,$e,Re,rt='<div class="w-6 h-6 bg-gradient-to-br from-amber-400 to-orange-500 rounded-full flex items-center justify-center text-white text-xs font-semibold">L</div> <span class="text-sm font-medium">Lily</span>',Xe,Pe,ce,ke,st,mt,Qe,We,nt,gl='<div class="w-6 h-6 bg-gradient-to-br from-amber-400 to-orange-500 rounded-full flex items-center justify-center text-white text-xs font-semibold">P</div> <span class="text-sm font-medium">Pirate</span>',hl,Fe,Se,m,Q,oe,R,O,S,Me,ot,jt,pr='<label for="exaggeration-slider" class="text-sm font-medium text-gray-900">Exaggeration</label>',Ul,Ae,zl,Ot,hr="<span>None</span> <span>More</span>",Bl,at,St,mr='<label for="temperature-slider" class="text-sm font-medium text-gray-900">Stability</label>',Rl,Ue,Gl,At,gr="<span>More stable</span> <span>More variable</span>",Fl,el,ze,_l,Ut,_r='<h3 class="text-lg font-semibold text-gray-900 mb-1">Results &amp; Live Documentation</h3> <p class="text-sm text-gray-600">The code below will update as you adjust the UI ✨</p>',Yl,gt,_t,bt,ql,bl,Kl,vt,Jl,vl,Xl,yt,it,zt,Ql,Bt,br="Copy all",Wl,wt,vr='<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" class="text-amber-700"><path d="M12 2L2 7l10 5 10-5-10-5z"></path><path d="M2 17l10 5 10-5"></path><path d="M2 12l10 5 10-5"></path></svg> <span class="ml-1 text-xs font-medium text-amber-700">Deploy as Space</span>',Zl,Ye,xt,kt,Rt,yr='<span class="text-xs font-medium text-blue-900">Install in Terminal</span>',er,Et,Gt,tr,Ft,wr=s[7],lr,Tt,Ct,Yt,xr='<span class="text-xs font-medium text-amber-900">Python Code</span> <span class="text-xs bg-amber-100 text-amber-700 px-1.5 py-0.5 rounded">Live</span>',rr,$t,qt,sr,Kt,kr=s[7],nr,yl,tl,ll,Ge,or,Er;v=new Ls({props:{size:16}});const Tr=[Us,As],Jt=[];function Cr(f,x){return f[9]?0:1}D=Cr(s),te=Jt[D]=Tr[D](s);let rl=Sl(s[25]),we=[];for(let f=0;f<rl.length;f+=1)we[f]=ss(ls(s,rl,f));ve=new Ss({props:{size:14,class:"text-gray-500 transition-transform "+(s[8]?"rotate-180":"")}});let Ee=s[8]&&ns(s);const $r=[Gs,Rs],Xt=[];function Ir(f,x){return f[17]==="Andrew"?0:1}re=Ir(s),ie=Xt[re]=$r[re](s);const Dr=[Ys,Fs],Qt=[];function Vr(f,x){return f[17]==="Lily"?0:1}ce=Vr(s),ke=Qt[ce]=Dr[ce](s);const Lr=[Ks,qs],Wt=[];function Pr(f,x){return f[17]==="Pirate"?0:1}Se=Pr(s),m=Wt[Se]=Lr[Se](s);const Mr=[Xs,Js],It=[];function Nr(f,x){return f[5].length>0?0:1}R=Nr(s),O=It[R]=Mr[R](s);let Te=s[21]&&as(s);zt=new ir({props:{size:12,class:"text-gray-600"}}),Gt=new ir({props:{size:12,class:"text-blue-600"}});let ct=is(s);qt=new ir({props:{size:12,class:"text-amber-600"}});let ut=cs(s),ue=s[10]&&us(s),de=s[18]&&ps(s),Ce=s[22]&&ms(s);return{c(){e=b(),t=d("div"),l=d("div"),r=d("div"),a=d("div"),i=d("div"),h=d("span"),h.textContent=g,E=b(),y=d("button"),me(v.$$.fragment),$=b(),G=d("div"),J=d("span"),w=q(U),C=q(" / 1,000 characters"),I=b(),X=d("div"),z=d("textarea"),ae=b(),Z=d("button"),te.c(),B=b(),M=d("div"),V=d("div"),N=d("div"),F=d("h3"),F.textContent=le,De=b(),K=d("div"),ee=d("button"),ge=d("span");for(let f=0;f<we.length;f+=1)we[f].c();Ne=b(),me(ve.$$.fragment),je=b(),Ee&&Ee.c(),tt=b(),xe=d("div"),xe.innerHTML=Ve,Ke=b(),Oe=d("div"),se=d("h3"),se.textContent=pt,ht=b(),H=d("div"),Le=d("button"),_e=d("div"),Be=d("div"),Be.innerHTML=ne,P=b(),j=d("button"),ie.c(),Je=b(),ye=d("button"),$e=d("div"),Re=d("div"),Re.innerHTML=rt,Xe=b(),Pe=d("button"),ke.c(),mt=b(),Qe=d("button"),We=d("div"),nt=d("div"),nt.innerHTML=gl,hl=b(),Fe=d("button"),m.c(),oe=b(),O.c(),S=b(),Me=d("div"),ot=d("div"),jt=d("div"),jt.innerHTML=pr,Ul=b(),Ae=d("input"),zl=b(),Ot=d("div"),Ot.innerHTML=hr,Bl=b(),at=d("div"),St=d("div"),St.innerHTML=mr,Rl=b(),Ue=d("input"),Gl=b(),At=d("div"),At.innerHTML=gr,Fl=b(),el=d("div"),ze=d("div"),Te&&Te.c(),_l=b(),Ut=d("div"),Ut.innerHTML=_r,Yl=b(),gt=d("div"),_t=d("div"),bt=d("button"),ql=q("API"),Kl=b(),vt=d("button"),Jl=q("Local"),Xl=b(),yt=d("div"),it=d("button"),me(zt.$$.fragment),Ql=b(),Bt=d("span"),Bt.textContent=br,Wl=b(),wt=d("button"),wt.innerHTML=vr,Zl=b(),Ye=d("div"),xt=d("div"),kt=d("div"),Rt=d("div"),Rt.innerHTML=yr,er=b(),Et=d("button"),me(Gt.$$.fragment),tr=b(),Ft=d("div"),ct.c(),lr=b(),Tt=d("div"),Ct=d("div"),Yt=d("div"),Yt.innerHTML=xr,rr=b(),$t=d("button"),me(qt.$$.fragment),sr=b(),Kt=d("div"),ut.c(),nr=b(),ue&&ue.c(),yl=b(),de&&de.c(),tl=b(),Ce&&Ce.c(),ll=Ht(),this.h()},l(f){ks("svelte-y100ki",es.head).forEach(c),e=_(f),t=u(f,"DIV",{class:!0,role:!0,tabindex:!0});var qe=p(t);l=u(qe,"DIV",{class:!0});var Zt=p(l);r=u(Zt,"DIV",{class:!0});var Dt=p(r);a=u(Dt,"DIV",{class:!0});var Ze=p(a);i=u(Ze,"DIV",{class:!0});var Vt=p(i);h=u(Vt,"SPAN",{class:!0,"data-svelte-h":!0}),W(h)!=="svelte-1da1nvl"&&(h.textContent=g),E=_(Vt),y=u(Vt,"BUTTON",{class:!0,title:!0});var sl=p(y);he(v.$$.fragment,sl),sl.forEach(c),Vt.forEach(c),$=_(Ze),G=u(Ze,"DIV",{class:!0});var Ie=p(G);J=u(Ie,"SPAN",{class:!0});var nl=p(J);w=Y(nl,U),C=Y(nl," / 1,000 characters"),nl.forEach(c),Ie.forEach(c),I=_(Ze),X=u(Ze,"DIV",{class:!0});var wl=p(X);z=u(wl,"TEXTAREA",{maxlength:!0,class:!0,placeholder:!0}),p(z).forEach(c),ae=_(wl),Z=u(wl,"BUTTON",{class:!0});var Hr=p(Z);te.l(Hr),Hr.forEach(c),wl.forEach(c),Ze.forEach(c),B=_(Dt),M=u(Dt,"DIV",{class:!0});var jr=p(M);V=u(jr,"DIV",{class:!0});var ol=p(V);N=u(ol,"DIV",{class:!0});var al=p(N);F=u(al,"H3",{class:!0,"data-svelte-h":!0}),W(F)!=="svelte-x9l5tw"&&(F.textContent=le),De=_(al),K=u(al,"DIV",{class:!0});var xl=p(K);ee=u(xl,"BUTTON",{class:!0});var kl=p(ee);ge=u(kl,"SPAN",{});var Or=p(ge);for(let ar=0;ar<we.length;ar+=1)we[ar].l(Or);Or.forEach(c),Ne=_(kl),he(ve.$$.fragment,kl),kl.forEach(c),je=_(xl),Ee&&Ee.l(xl),xl.forEach(c),tt=_(al),xe=u(al,"DIV",{class:!0,"data-svelte-h":!0}),W(xe)!=="svelte-m7murz"&&(xe.innerHTML=Ve),al.forEach(c),Ke=_(ol),Oe=u(ol,"DIV",{});var El=p(Oe);se=u(El,"H3",{class:!0,"data-svelte-h":!0}),W(se)!=="svelte-1pzzi7j"&&(se.textContent=pt),ht=_(El),H=u(El,"DIV",{class:!0});var Lt=p(H);Le=u(Lt,"BUTTON",{class:!0});var Sr=p(Le);_e=u(Sr,"DIV",{class:!0});var Tl=p(_e);Be=u(Tl,"DIV",{class:!0,"data-svelte-h":!0}),W(Be)!=="svelte-qsi6ww"&&(Be.innerHTML=ne),P=_(Tl),j=u(Tl,"BUTTON",{class:!0,title:!0});var Ar=p(j);ie.l(Ar),Ar.forEach(c),Tl.forEach(c),Sr.forEach(c),Je=_(Lt),ye=u(Lt,"BUTTON",{class:!0});var Ur=p(ye);$e=u(Ur,"DIV",{class:!0});var Cl=p($e);Re=u(Cl,"DIV",{class:!0,"data-svelte-h":!0}),W(Re)!=="svelte-1c7qu8y"&&(Re.innerHTML=rt),Xe=_(Cl),Pe=u(Cl,"BUTTON",{class:!0,title:!0});var zr=p(Pe);ke.l(zr),zr.forEach(c),Cl.forEach(c),Ur.forEach(c),mt=_(Lt),Qe=u(Lt,"BUTTON",{class:!0});var Br=p(Qe);We=u(Br,"DIV",{class:!0});var $l=p(We);nt=u($l,"DIV",{class:!0,"data-svelte-h":!0}),W(nt)!=="svelte-1o6w87n"&&(nt.innerHTML=gl),hl=_($l),Fe=u($l,"BUTTON",{class:!0,title:!0});var Rr=p(Fe);m.l(Rr),Rr.forEach(c),$l.forEach(c),Br.forEach(c),oe=_(Lt),O.l(Lt),Lt.forEach(c),El.forEach(c),S=_(ol),Me=u(ol,"DIV",{class:!0});var Il=p(Me);ot=u(Il,"DIV",{});var il=p(ot);jt=u(il,"DIV",{class:!0,"data-svelte-h":!0}),W(jt)!=="svelte-1n9m3ma"&&(jt.innerHTML=pr),Ul=_(il),Ae=u(il,"INPUT",{id:!0,type:!0,min:!0,max:!0,step:!0,class:!0}),zl=_(il),Ot=u(il,"DIV",{class:!0,"data-svelte-h":!0}),W(Ot)!=="svelte-y6blve"&&(Ot.innerHTML=hr),il.forEach(c),Bl=_(Il),at=u(Il,"DIV",{});var cl=p(at);St=u(cl,"DIV",{class:!0,"data-svelte-h":!0}),W(St)!=="svelte-pmq2mj"&&(St.innerHTML=mr),Rl=_(cl),Ue=u(cl,"INPUT",{id:!0,type:!0,min:!0,max:!0,step:!0,class:!0}),Gl=_(cl),At=u(cl,"DIV",{class:!0,"data-svelte-h":!0}),W(At)!=="svelte-17pelb8"&&(At.innerHTML=gr),cl.forEach(c),Il.forEach(c),ol.forEach(c),jr.forEach(c),Dt.forEach(c),Fl=_(Zt),el=u(Zt,"DIV",{class:!0});var Gr=p(el);ze=u(Gr,"DIV",{class:!0});var Pt=p(ze);Te&&Te.l(Pt),_l=_(Pt),Ut=u(Pt,"DIV",{class:!0,"data-svelte-h":!0}),W(Ut)!=="svelte-jb3ali"&&(Ut.innerHTML=_r),Yl=_(Pt),gt=u(Pt,"DIV",{class:!0});var Dl=p(gt);_t=u(Dl,"DIV",{class:!0});var Vl=p(_t);bt=u(Vl,"BUTTON",{class:!0});var Fr=p(bt);ql=Y(Fr,"API"),Fr.forEach(c),Kl=_(Vl),vt=u(Vl,"BUTTON",{class:!0});var Yr=p(vt);Jl=Y(Yr,"Local"),Yr.forEach(c),Vl.forEach(c),Xl=_(Dl),yt=u(Dl,"DIV",{class:!0});var Ll=p(yt);it=u(Ll,"BUTTON",{class:!0});var Pl=p(it);he(zt.$$.fragment,Pl),Ql=_(Pl),Bt=u(Pl,"SPAN",{class:!0,"data-svelte-h":!0}),W(Bt)!=="svelte-1horous"&&(Bt.textContent=br),Pl.forEach(c),Wl=_(Ll),wt=u(Ll,"BUTTON",{class:!0,"data-svelte-h":!0}),W(wt)!=="svelte-1u9xuv8"&&(wt.innerHTML=vr),Ll.forEach(c),Dl.forEach(c),Zl=_(Pt),Ye=u(Pt,"DIV",{class:!0});var ul=p(Ye);xt=u(ul,"DIV",{class:!0});var Ml=p(xt);kt=u(Ml,"DIV",{class:!0});var Nl=p(kt);Rt=u(Nl,"DIV",{class:!0,"data-svelte-h":!0}),W(Rt)!=="svelte-1eboucz"&&(Rt.innerHTML=yr),er=_(Nl),Et=u(Nl,"BUTTON",{class:!0,title:!0});var qr=p(Et);he(Gt.$$.fragment,qr),qr.forEach(c),Nl.forEach(c),tr=_(Ml),Ft=u(Ml,"DIV",{class:!0});var Kr=p(Ft);ct.l(Kr),Kr.forEach(c),Ml.forEach(c),lr=_(ul),Tt=u(ul,"DIV",{class:!0});var Hl=p(Tt);Ct=u(Hl,"DIV",{class:!0});var jl=p(Ct);Yt=u(jl,"DIV",{class:!0,"data-svelte-h":!0}),W(Yt)!=="svelte-w4xfzx"&&(Yt.innerHTML=xr),rr=_(jl),$t=u(jl,"BUTTON",{class:!0,title:!0});var Jr=p($t);he(qt.$$.fragment,Jr),Jr.forEach(c),jl.forEach(c),sr=_(Hl),Kt=u(Hl,"DIV",{class:!0});var Xr=p(Kt);ut.l(Xr),Xr.forEach(c),Hl.forEach(c),nr=_(ul),ue&&ue.l(ul),ul.forEach(c),Pt.forEach(c),Gr.forEach(c),Zt.forEach(c),qe.forEach(c),yl=_(f),de&&de.l(f),tl=_(f),Ce&&Ce.l(f),ll=Ht(),this.h()},h(){es.title="Text to Speech - HFStudio",o(h,"class","text-sm text-gray-400"),o(y,"class","text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-lg transition-colors"),o(y,"title","Refresh with famous book opening"),o(i,"class","absolute top-3 left-3 flex items-center gap-2 z-10"),o(J,"class","text-sm text-gray-400"),o(G,"class","absolute top-3 right-3 flex items-center gap-2 z-10"),o(z,"maxlength","1000"),o(z,"class","w-full h-96 pt-10 px-6 pb-16 bg-white resize-none border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-amber-400 focus:border-transparent text-gray-900 text-lg leading-relaxed"),o(z,"placeholder","Type the text you'd like to convert to spoken audio here..."),z.autofocus=!0,Z.disabled=be=s[9]||!s[0].trim(),o(Z,"class","absolute bottom-4 right-4 px-5 py-2.5 bg-gradient-to-r from-amber-400 to-orange-500 text-white rounded-lg font-medium hover:from-amber-500 hover:to-orange-600 disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center gap-1.5 shadow-sm text-base"),o(X,"class","relative"),o(a,"class","relative mb-4"),o(F,"class","text-sm font-medium text-gray-900 mb-2"),o(ee,"class",He="w-full p-3 border bg-white text-sm focus:outline-none focus:ring-2 focus:ring-amber-400 focus:border-transparent shadow-sm text-left flex items-center justify-between "+(s[8]?"rounded-t-lg border-b-0 border-black":"rounded-lg border-black")),o(K,"class","relative"),o(xe,"class","mt-1.5 text-xs text-gray-500 text-right"),o(N,"class","model-dropdown"),o(se,"class","text-sm font-medium text-gray-900 mb-2"),o(Be,"class","flex items-center gap-2"),o(j,"class","p-1 rounded-full hover:bg-gray-200 transition-colors w-5 h-5 flex items-center justify-center"),o(j,"title","Play sample"),o(_e,"class","flex items-center justify-between mb-1"),o(Le,"class",lt="p-3 border rounded-lg transition-colors text-left hover:bg-gray-50 "+(s[1]==="Andrew"?"border-black":"border-gray-200")),o(Re,"class","flex items-center gap-2"),o(Pe,"class","p-1 rounded-full hover:bg-gray-200 transition-colors w-5 h-5 flex items-center justify-center"),o(Pe,"title","Play sample"),o($e,"class","flex items-center justify-between mb-1"),o(ye,"class",st="p-3 border rounded-lg transition-colors text-left hover:bg-gray-50 "+(s[1]==="Lily"?"border-black":"border-gray-200")),o(nt,"class","flex items-center gap-2"),o(Fe,"class","p-1 rounded-full hover:bg-gray-200 transition-colors w-5 h-5 flex items-center justify-center"),o(Fe,"title","Play sample"),o(We,"class","flex items-center justify-between mb-1"),o(Qe,"class",Q="p-3 border rounded-lg transition-colors text-left hover:bg-gray-50 "+(s[1]==="Pirate"?"border-black":"border-gray-200")),o(H,"class","grid grid-cols-2 gap-2"),o(jt,"class","mb-1"),o(Ae,"id","exaggeration-slider"),o(Ae,"type","range"),o(Ae,"min","0"),o(Ae,"max","1"),o(Ae,"step","0.01"),o(Ae,"class","w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer slider-hf"),o(Ot,"class","flex justify-between text-xs text-gray-400 mt-1"),o(St,"class","mb-1"),o(Ue,"id","temperature-slider"),o(Ue,"type","range"),o(Ue,"min","0"),o(Ue,"max","1"),o(Ue,"step","0.01"),o(Ue,"class","w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer slider-hf"),o(At,"class","flex justify-between text-xs text-gray-400 mt-1"),o(Me,"class","space-y-3"),o(V,"class","grid grid-cols-1 lg:grid-cols-[1fr_1.4fr_1fr] gap-6"),o(M,"class","p-4 border border-gray-200 rounded-lg bg-white mb-6"),o(r,"class","flex-1 flex flex-col p-6"),o(Ut,"class","mb-4"),o(bt,"class",bl="px-2 py-1 text-xs font-medium rounded transition-colors "+(s[6]==="api"?"bg-white shadow-sm":"text-gray-600")),o(vt,"class",vl="px-2 py-1 text-xs font-medium rounded transition-colors "+(s[6]==="local"?"bg-white shadow-sm":"text-gray-600")),o(_t,"class","flex items-center bg-gray-100 rounded-md p-0.5"),o(Bt,"class","ml-1 text-xs font-medium text-gray-600"),o(it,"class","flex items-center bg-gray-100 hover:bg-gray-200 rounded-md px-2 py-1 transition-colors"),o(wt,"class","flex items-center bg-amber-100 hover:bg-amber-200 rounded-md px-2 py-1 transition-colors"),o(yt,"class","flex items-center gap-2"),o(gt,"class","flex items-center justify-between mb-4"),o(Rt,"class","flex items-center gap-2"),o(Et,"class","p-1 hover:bg-blue-100 rounded transition-colors"),o(Et,"title","Copy setup code"),o(kt,"class","flex items-center justify-between px-3 py-2 bg-blue-50 border-b border-blue-200"),o(Ft,"class","relative"),o(xt,"class","bg-white rounded-lg border border-gray-200 overflow-hidden"),o(Yt,"class","flex items-center gap-2"),o($t,"class","p-1 hover:bg-amber-100 rounded transition-colors"),o($t,"title","Copy Python code"),o(Ct,"class","flex items-center justify-between px-3 py-2 bg-amber-50 border-b border-amber-200"),o(Kt,"class","relative"),o(Tt,"class","bg-white rounded-lg border border-gray-200 overflow-hidden"),o(Ye,"class","space-y-4"),o(ze,"class","p-4 h-full overflow-y-auto"),o(el,"class","w-96 border-l border-gray-200 bg-white h-full overflow-hidden"),o(l,"class","flex-1 flex"),o(t,"class","flex flex-col h-full"),o(t,"role","main"),o(t,"tabindex","-1")},m(f,x){A(f,e,x),A(f,t,x),n(t,l),n(l,r),n(r,a),n(a,i),n(i,h),n(i,E),n(i,y),pe(v,y,null),n(a,$),n(a,G),n(G,J),n(J,w),n(J,C),n(a,I),n(a,X),n(X,z),dl(z,s[0]),n(X,ae),n(X,Z),Jt[D].m(Z,null),n(r,B),n(r,M),n(M,V),n(V,N),n(N,F),n(N,De),n(N,K),n(K,ee),n(ee,ge);for(let qe=0;qe<we.length;qe+=1)we[qe]&&we[qe].m(ge,null);n(ee,Ne),pe(ve,ee,null),n(K,je),Ee&&Ee.m(K,null),n(N,tt),n(N,xe),n(V,Ke),n(V,Oe),n(Oe,se),n(Oe,ht),n(Oe,H),n(H,Le),n(Le,_e),n(_e,Be),n(_e,P),n(_e,j),Xt[re].m(j,null),n(H,Je),n(H,ye),n(ye,$e),n($e,Re),n($e,Xe),n($e,Pe),Qt[ce].m(Pe,null),n(H,mt),n(H,Qe),n(Qe,We),n(We,nt),n(We,hl),n(We,Fe),Wt[Se].m(Fe,null),n(H,oe),It[R].m(H,null),n(V,S),n(V,Me),n(Me,ot),n(ot,jt),n(ot,Ul),n(ot,Ae),dl(Ae,s[3]),n(ot,zl),n(ot,Ot),n(Me,Bl),n(Me,at),n(at,St),n(at,Rl),n(at,Ue),dl(Ue,s[4]),n(at,Gl),n(at,At),n(l,Fl),n(l,el),n(el,ze),Te&&Te.m(ze,null),n(ze,_l),n(ze,Ut),n(ze,Yl),n(ze,gt),n(gt,_t),n(_t,bt),n(bt,ql),n(_t,Kl),n(_t,vt),n(vt,Jl),n(gt,Xl),n(gt,yt),n(yt,it),pe(zt,it,null),n(it,Ql),n(it,Bt),n(yt,Wl),n(yt,wt),n(ze,Zl),n(ze,Ye),n(Ye,xt),n(xt,kt),n(kt,Rt),n(kt,er),n(kt,Et),pe(Gt,Et,null),n(xt,tr),n(xt,Ft),ct.m(Ft,null),n(Ye,lr),n(Ye,Tt),n(Tt,Ct),n(Ct,Yt),n(Ct,rr),n(Ct,$t),pe(qt,$t,null),n(Tt,sr),n(Tt,Kt),ut.m(Kt,null),n(Ye,nr),ue&&ue.m(Ye,null),A(f,yl,x),de&&de.m(f,x),A(f,tl,x),Ce&&Ce.m(f,x),A(f,ll,x),Ge=!0,z.focus(),or||(Er=[L(y,"click",s[37]),L(z,"input",s[41]),L(z,"keydown",s[34]),L(Z,"click",s[26]),L(ee,"click",s[42]),L(j,"click",s[44]),L(Le,"click",s[45]),L(Pe,"click",s[46]),L(ye,"click",s[47]),L(Fe,"click",s[48]),L(Qe,"click",s[49]),L(Ae,"change",s[52]),L(Ae,"input",s[52]),L(Ue,"change",s[53]),L(Ue,"input",s[53]),L(bt,"click",s[55]),L(vt,"click",s[56]),L(it,"click",s[40]),L(wt,"click",s[39]),L(Et,"click",s[57]),L($t,"click",s[58]),L(t,"click",s[35]),L(t,"keydown",s[34])],or=!0)},p(f,x){(!Ge||x[0]&1)&&U!==(U=f[0].length.toLocaleString()+"")&&et(w,U),x[0]&1&&dl(z,f[0]);let qe=D;if(D=Cr(f),D!==qe&&(ft(),T(Jt[qe],1,1,()=>{Jt[qe]=null}),dt(),te=Jt[D],te||(te=Jt[D]=Tr[D](f),te.c()),k(te,1),te.m(Z,null)),(!Ge||x[0]&513&&be!==(be=f[9]||!f[0].trim()))&&(Z.disabled=be),x[0]&33554436){rl=Sl(f[25]);let Ie;for(Ie=0;Ie<rl.length;Ie+=1){const nl=ls(f,rl,Ie);we[Ie]?we[Ie].p(nl,x):(we[Ie]=ss(nl),we[Ie].c(),we[Ie].m(ge,null))}for(;Ie<we.length;Ie+=1)we[Ie].d(1);we.length=rl.length}const Zt={};x[0]&256&&(Zt.class="text-gray-500 transition-transform "+(f[8]?"rotate-180":"")),ve.$set(Zt),(!Ge||x[0]&256&&He!==(He="w-full p-3 border bg-white text-sm focus:outline-none focus:ring-2 focus:ring-amber-400 focus:border-transparent shadow-sm text-left flex items-center justify-between "+(f[8]?"rounded-t-lg border-b-0 border-black":"rounded-lg border-black")))&&o(ee,"class",He),f[8]?Ee?Ee.p(f,x):(Ee=ns(f),Ee.c(),Ee.m(K,null)):Ee&&(Ee.d(1),Ee=null);let Dt=re;re=Ir(f),re!==Dt&&(ft(),T(Xt[Dt],1,1,()=>{Xt[Dt]=null}),dt(),ie=Xt[re],ie||(ie=Xt[re]=$r[re](f),ie.c()),k(ie,1),ie.m(j,null)),(!Ge||x[0]&2&&lt!==(lt="p-3 border rounded-lg transition-colors text-left hover:bg-gray-50 "+(f[1]==="Andrew"?"border-black":"border-gray-200")))&&o(Le,"class",lt);let Ze=ce;ce=Vr(f),ce!==Ze&&(ft(),T(Qt[Ze],1,1,()=>{Qt[Ze]=null}),dt(),ke=Qt[ce],ke||(ke=Qt[ce]=Dr[ce](f),ke.c()),k(ke,1),ke.m(Pe,null)),(!Ge||x[0]&2&&st!==(st="p-3 border rounded-lg transition-colors text-left hover:bg-gray-50 "+(f[1]==="Lily"?"border-black":"border-gray-200")))&&o(ye,"class",st);let Vt=Se;Se=Pr(f),Se!==Vt&&(ft(),T(Wt[Vt],1,1,()=>{Wt[Vt]=null}),dt(),m=Wt[Se],m||(m=Wt[Se]=Lr[Se](f),m.c()),k(m,1),m.m(Fe,null)),(!Ge||x[0]&2&&Q!==(Q="p-3 border rounded-lg transition-colors text-left hover:bg-gray-50 "+(f[1]==="Pirate"?"border-black":"border-gray-200")))&&o(Qe,"class",Q);let sl=R;R=Nr(f),R===sl?It[R].p(f,x):(ft(),T(It[sl],1,1,()=>{It[sl]=null}),dt(),O=It[R],O?O.p(f,x):(O=It[R]=Mr[R](f),O.c()),k(O,1),O.m(H,null)),x[0]&8&&dl(Ae,f[3]),x[0]&16&&dl(Ue,f[4]),f[21]?Te?Te.p(f,x):(Te=as(f),Te.c(),Te.m(ze,_l)):Te&&(Te.d(1),Te=null),(!Ge||x[0]&64&&bl!==(bl="px-2 py-1 text-xs font-medium rounded transition-colors "+(f[6]==="api"?"bg-white shadow-sm":"text-gray-600")))&&o(bt,"class",bl),(!Ge||x[0]&64&&vl!==(vl="px-2 py-1 text-xs font-medium rounded transition-colors "+(f[6]==="local"?"bg-white shadow-sm":"text-gray-600")))&&o(vt,"class",vl),x[0]&128&&Ol(wr,wr=f[7])?(ct.d(1),ct=is(f),ct.c(),ct.m(Ft,null)):ct.p(f,x),x[0]&128&&Ol(kr,kr=f[7])?(ut.d(1),ut=cs(f),ut.c(),ut.m(Kt,null)):ut.p(f,x),f[10]?ue?(ue.p(f,x),x[0]&1024&&k(ue,1)):(ue=us(f),ue.c(),k(ue,1),ue.m(Ye,null)):ue&&(ft(),T(ue,1,1,()=>{ue=null}),dt()),f[18]?de?(de.p(f,x),x[0]&262144&&k(de,1)):(de=ps(f),de.c(),k(de,1),de.m(tl.parentNode,tl)):de&&(ft(),T(de,1,1,()=>{de=null}),dt()),f[22]?Ce?Ce.p(f,x):(Ce=ms(f),Ce.c(),Ce.m(ll.parentNode,ll)):Ce&&(Ce.d(1),Ce=null)},i(f){Ge||(k(v.$$.fragment,f),k(te),k(ve.$$.fragment,f),k(ie),k(ke),k(m),k(O),k(zt.$$.fragment,f),k(Gt.$$.fragment,f),k(qt.$$.fragment,f),k(ue),k(de),Ge=!0)},o(f){T(v.$$.fragment,f),T(te),T(ve.$$.fragment,f),T(ie),T(ke),T(m),T(O),T(zt.$$.fragment,f),T(Gt.$$.fragment,f),T(qt.$$.fragment,f),T(ue),T(de),Ge=!1},d(f){f&&(c(e),c(t),c(yl),c(tl),c(ll)),fe(v),Jt[D].d(),bs(we,f),fe(ve),Ee&&Ee.d(),Xt[re].d(),Qt[ce].d(),Wt[Se].d(),It[R].d(),Te&&Te.d(),fe(zt),fe(Gt),ct.d(f),fe(qt),ut.d(f),ue&&ue.d(),de&&de.d(f),Ce&&Ce.d(f),or=!1,ml(Er)}}}function fl(s){const e=Math.floor(s/60),t=Math.floor(s%60);return`${e}:${t.toString().padStart(2,"0")}`}function sn(s,e,t){let l="In a hole in the ground, there lived a hobbit. Not a nasty, dirty, wet hole, filled with the ends of worms and an oozy smell, nor yet a dry, bare, sandy hole with nothing in it to sit down on or to eat: it was a hobbit-hole, and that means comfort.",r="Andrew",a="Chatterbox",i=!1,h=!1,g=null,E=0,y=.25,v=.7,$=!1,G=0,J=0,U="",w=null,C=null,I=null,X=!1,z="",ae="",Z=0,D=[],te=!1,be=!1,B=null,M="api",V="",N="",F=0;const le=["It was the best of times, it was the worst of times. It was the age of wisdom, it was the age of foolishness.","It is a truth universally acknowledged, that a single man in possession of a good fortune, must be in want of a wife.","All happy families are alike; each unhappy family is unhappy in its own way.","In a hole in the ground, there lived a hobbit. Not a nasty, dirty, wet hole, filled with the ends of worms and an oozy smell, nor yet a dry, bare, sandy hole with nothing in it to sit down on or to eat: it was a hobbit-hole, and that means comfort."];let De=0;const K=[{id:"chatterbox",name:"Chatterbox",badge:"recommended"},{id:"kokoro",name:"Kokoro",badge:"coming soon",disabled:!0}],ee=[{id:"andrew",name:"Andrew",description:"Older British man who speaks clearly and warmly.",sample:"/voices/andrew.mp3",preview_url:"https://huggingface.co/spaces/abidlabs/hfstudio/resolve/main/frontend/static/voices/andrew.mp3"},{id:"lily",name:"Lily",description:"Friendly, conversational tone of a woman in her 30s",sample:"/voices/lily.mp3",preview_url:"https://huggingface.co/spaces/abidlabs/hfstudio/resolve/main/frontend/static/voices/lily.mp3"},{id:"pirate",name:"Pirate",description:"Young male pirate-y voice that speaks gruffly and with excitement",sample:"/voices/pirate.mp3",preview_url:"https://huggingface.co/spaces/abidlabs/hfstudio/resolve/main/frontend/static/voices/pirate.mp3"},{id:"fairy",name:"Fairy",description:"High and airy female voice that bursts with excitement",sample:"/voices/fairy.mp3",preview_url:"https://huggingface.co/spaces/abidlabs/hfstudio/resolve/main/frontend/static/voices/fairy.mp3"}];async function ge(){if(!l.trim())return;if(!(await fetch("/api/auth/user",{credentials:"include"})).ok){t(21,be=!0);return}t(9,h=!0),t(10,g=null),t(13,G=0),t(12,$=!1),t(15,U=l.length>30?l.substring(0,30)+"...":l);try{let Q=null;if(r==="Yours"&&D.length>0){const S=D[0];S&&S.voice_url&&(Q=S.voice_url)}else{const S=ee.find(Me=>Me.name===r);S&&S.preview_url&&(Q=S.preview_url)}const oe={text:l,voice_id:r.toLowerCase(),model_id:a.toLowerCase(),mode:"api",parameters:{exaggeration:y,temperature:v},voice_url:Q},R=await fetch("/api/tts/generate",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(oe)});if(!R.ok){const S=await R.text();throw new Error(`HTTP error! status: ${R.status}, body: ${S}`)}const O=await R.json();if(O.success&&O.audio_url)t(10,g=O.audio_url),t(11,E=O.generation_time||0),await H(oe,O),setTimeout(()=>{w&&w.play().catch(()=>{})},100);else{const S=O.error||"Unknown error occurred";se("Generation Failed",S),t(10,g=null)}}catch{se("Network Error","Failed to connect to the server. Please check your connection and try again."),t(10,g=null)}finally{t(9,h=!1)}}function Ne(){w&&($?w.pause():w.play())}function ve(){w&&t(14,J=w.duration)}function He(){w&&t(13,G=w.currentTime)}function je(){t(12,$=!0)}function tt(){t(12,$=!1)}function xe(){if(g){const m=document.createElement("a");m.href=g,m.download="speech.wav",m.click()}}function Ve(m,Q){if(Q.stopPropagation(),I===m.name)C&&(C.pause(),C.currentTime=0),t(17,I=null);else{C&&C.pause(),t(17,I=m.name);const oe=m.sample||"/samples/harvard.wav";C?C.src=oe:(C=new Audio(oe),C.addEventListener("ended",()=>{t(17,I=null)})),C.play().catch(R=>{t(17,I=null)})}}function Ke(m){m.key==="Enter"&&!m.shiftKey&&(m.preventDefault(),ge()),m.key==="Escape"&&t(8,i=!1)}function Oe(m){m.target.closest(".model-dropdown")||t(8,i=!1),m.target.closest(".voice-dropdown")}function se(m,Q=""){t(19,z=m),t(20,ae=Q),t(18,X=!0)}function pt(){t(18,X=!1),t(19,z=""),t(20,ae="")}function ht(){De=(De+1)%le.length,t(0,l=le[De])}async function H(m,Q){try{let oe=null;const R=D.find(S=>S.voice_name===r);if(R&&R.voice_url)oe=R.voice_url;else{const S=ee.find(Me=>Me.name===r);S&&S.preview_url&&(oe=S.preview_url)}const O=`audio_bytes = client.text_to_speech(
7
+ "${m.text.replace(/"/g,'\\"')}",
8
+ extra_body={
9
+ "exaggeration": ${m.parameters.exaggeration},
10
+ "temperature": ${m.parameters.temperature}${oe?`,
11
+ "audio_url": "${oe}"`:""}
12
+ }
13
+ )`;await fetch("/api/history/save",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({code:O,result_type:"audio",result_data:{url:Q.audio_url,title:U,type:"audio"},entry_type:"generation"})}),await Le()}catch(oe){console.error("Error saving to history:",oe)}}async function Le(){try{const m=await fetch("/api/history/load",{method:"GET",credentials:"include"});m.ok&&(Z=(await m.json()).entries.filter(R=>R.entry_type==="generation").length)}catch(m){console.error("Error loading history count:",m),Z=0}}async function _e(){try{te=!0;const m=await fetch("/api/voice/user-voices",{method:"GET",credentials:"include"});if(m.ok){const Q=await m.json();t(5,D=Q.voices||[])}else t(5,D=[])}catch(m){console.error("Error loading user voices:",m),t(5,D=[])}finally{te=!1}}function Be(){return M==="local"?`pip install huggingface-hub hfstudio uv
14
+ hfstudio start ${a.toLowerCase()} --port 7861`:"pip install huggingface-hub"}function ne(){return M==="local"?'client = InferenceClient(base_url="http://localhost:7861/api/v1")':`client = InferenceClient(
15
+ api_key="YOUR_HF_TOKEN", # Get your token from https://huggingface.co/settings/tokens
16
+ model="${a.toLowerCase()==="chatterbox"?"ResembleAI/chatterbox":a.toLowerCase()}",
17
+ )`}function P(){let m=null;if(r==="Yours"&&D.length>0){const O=D[0];O&&O.voice_url&&(m=O.voice_url)}else{const O=ee.find(S=>S.name===r);O&&O.preview_url&&(m=O.preview_url)}const Q=l||"Hello, this is a sample text.";return`${`from huggingface_hub import InferenceClient
18
+
19
+ ${ne()}`}
20
+
21
+ audio_bytes = client.text_to_speech(
22
+ "${Q.replace(/"/g,'\\"')}",
23
+ extra_body={
24
+ "exaggeration": ${y},
25
+ "temperature": ${v}${m?`,
26
+ "audio_url": "${m}"`:""}
27
+ }
28
+ )`}function j(m,Q="Copied to clipboard!"){navigator.clipboard.writeText(m).then(()=>{t(22,B=Q),setTimeout(()=>{t(22,B=null)},2e3)})}function re(){let m=null;if(r==="Yours"&&D.length>0){const S=D[0];S&&S.voice_url&&(m=S.voice_url)}else{const S=ee.find(Me=>Me.name===r);S&&S.preview_url&&(m=S.preview_url)}const Q=`from huggingface_hub import InferenceClient
29
+ import gradio as gr
30
+ import os
31
+
32
+ client = InferenceClient(api_key=os.getenv("HF_TOKEN"))
33
+
34
+ def generate_speech(text):
35
+ if not text.strip():
36
+ return None
37
+
38
+ try:
39
+ audio_bytes = client.text_to_speech(
40
+ text,
41
+ extra_body={
42
+ "exaggeration": ${y},
43
+ "temperature": ${v},
44
+ ${m?`"audio_url": "${m}",`:""}
45
+ }
46
+ )
47
+ return audio_bytes
48
+ except Exception as e:
49
+ raise gr.Error(f"Error generating speech: {str(e)}")
50
+
51
+ # Create the Gradio interface
52
+ with gr.Blocks(title="Text to Speech") as demo:
53
+ gr.Markdown("# Text to Speech")
54
+ gr.Markdown("Convert text to speech using the Chatterbox model.")
55
+
56
+ with gr.Row():
57
+ with gr.Column():
58
+ text_input = gr.Textbox(
59
+ label="Text to convert to speech",
60
+ placeholder="${l.replace(/"/g,'\\"').substring(0,100)}...",
61
+ lines=5,
62
+ value="${l.replace(/"/g,'\\"')}"
63
+ )
64
+ generate_btn = gr.Button("Generate Speech", variant="primary")
65
+
66
+ with gr.Column():
67
+ audio_output = gr.Audio(label="Generated Speech")
68
+
69
+ generate_btn.click(
70
+ fn=generate_speech,
71
+ inputs=[text_input],
72
+ outputs=[audio_output]
73
+ )
74
+
75
+ if __name__ == "__main__":
76
+ demo.launch()`,oe=`huggingface_hub
77
+ gradio`,R="https://huggingface.co/new-space",O=new URLSearchParams({name:`text-to-speech-${r.toLowerCase()}-${Date.now()}`,sdk:"gradio","files[0][path]":"app.py","files[0][content]":Q,"files[1][path]":"requirements.txt","files[1][content]":oe});window.open(`${R}?${O.toString()}`,"_blank")}function ie(){const m=[];if(V){const R=V.includes("pip install")||V.includes("hfstudio start")?"bash":"";m.push(`## Setup (Run in Terminal)
78
+
79
+ \`\`\`${R}
80
+ ${V}
81
+ \`\`\``)}N&&m.push(`## Python Code
82
+
83
+ \`\`\`python
84
+ ${N}
85
+ \`\`\``);const Q=m.join(`
86
+
87
+ `);j(Q,"All code copied as Markdown!")}Es(async()=>{await Le(),await _e()});function lt(){l=this.value,t(0,l)}const Je=()=>t(8,i=!i),ye=m=>{m.disabled||(t(2,a=m.name),t(8,i=!1))},$e=m=>Ve({name:"Andrew",sample:"/voices/andrew.mp3"},m),Re=()=>t(1,r="Andrew"),rt=m=>Ve({name:"Lily",sample:"/voices/lily.mp3"},m),Xe=()=>t(1,r="Lily"),Pe=m=>Ve({name:"Pirate",sample:"/voices/pirate.mp3"},m),ce=()=>t(1,r="Pirate"),ke=m=>Ve({name:"Yours",sample:D[0].voice_url},m),st=()=>t(1,r="Yours");function mt(){y=Wr(this.value),t(3,y)}function Qe(){v=Wr(this.value),t(4,v)}const We=()=>t(21,be=!1),nt=()=>t(6,M="api"),gl=()=>t(6,M="local"),hl=()=>j(V),Fe=()=>j(N);function Se(m){Ts[m?"unshift":"push"](()=>{w=m,t(16,w)})}return s.$$.update=()=>{s.$$.dirty[0]&255&&(t(23,V=Be()),t(24,N=P()),t(7,F++,F))},[l,r,a,y,v,D,M,F,i,h,g,E,$,G,J,U,w,I,X,z,ae,be,B,V,N,K,ge,Ne,ve,He,je,tt,xe,Ve,Ke,Oe,pt,ht,j,re,ie,lt,Je,ye,$e,Re,rt,Xe,Pe,ce,ke,st,mt,Qe,We,nt,gl,hl,Fe,Se]}class fn extends gs{constructor(e){super(),_s(this,e,sn,rn,Ol,{},null,[-1,-1,-1])}}export{fn as component};
hfstudio/static/_app/version.json CHANGED
@@ -1 +1 @@
1
- {"version":"1761295579154"}
 
1
+ {"version":"1761297735189"}
hfstudio/static/index.html CHANGED
@@ -6,25 +6,25 @@
6
  <meta name="viewport" content="width=device-width, initial-scale=1" />
7
  <title>HFStudio - Text to Speech</title>
8
 
9
- <link rel="modulepreload" href="/_app/immutable/entry/start.6R3nY2mE.js">
10
- <link rel="modulepreload" href="/_app/immutable/chunks/-00l7SVl.js">
11
  <link rel="modulepreload" href="/_app/immutable/chunks/TRxHAhOH.js">
12
- <link rel="modulepreload" href="/_app/immutable/entry/app.C5Z-huiY.js">
13
  <link rel="modulepreload" href="/_app/immutable/chunks/IHki7fMi.js">
14
  </head>
15
  <body data-sveltekit-preload-data="hover">
16
  <div style="display: contents">
17
  <script>
18
  {
19
- __sveltekit_1nascwh = {
20
  base: ""
21
  };
22
 
23
  const element = document.currentScript.parentElement;
24
 
25
  Promise.all([
26
- import("/_app/immutable/entry/start.6R3nY2mE.js"),
27
- import("/_app/immutable/entry/app.C5Z-huiY.js")
28
  ]).then(([kit, app]) => {
29
  kit.start(app, element);
30
  });
 
6
  <meta name="viewport" content="width=device-width, initial-scale=1" />
7
  <title>HFStudio - Text to Speech</title>
8
 
9
+ <link rel="modulepreload" href="/_app/immutable/entry/start.BHLoO44v.js">
10
+ <link rel="modulepreload" href="/_app/immutable/chunks/D2RBa_m5.js">
11
  <link rel="modulepreload" href="/_app/immutable/chunks/TRxHAhOH.js">
12
+ <link rel="modulepreload" href="/_app/immutable/entry/app.sWLR58JY.js">
13
  <link rel="modulepreload" href="/_app/immutable/chunks/IHki7fMi.js">
14
  </head>
15
  <body data-sveltekit-preload-data="hover">
16
  <div style="display: contents">
17
  <script>
18
  {
19
+ __sveltekit_1ui4hh5 = {
20
  base: ""
21
  };
22
 
23
  const element = document.currentScript.parentElement;
24
 
25
  Promise.all([
26
+ import("/_app/immutable/entry/start.BHLoO44v.js"),
27
+ import("/_app/immutable/entry/app.sWLR58JY.js")
28
  ]).then(([kit, app]) => {
29
  kit.start(app, element);
30
  });