1import{a as e,n as t}from"./jsx-runtime-D3jfb0Ew.js";import{Et as n,Hn as r,V as i,Vt as a,d as o,gt as s,j as c,t as l,ut as u,x as d,xn as f}from"./Schema-CAUmIdFq.js";import{F as p,d as m,f as h,m as g,o as _,p as v,u as y}from"./api-contract-BBRQu6_I.js";import{c as b,o as x,s as S,t as C}from"./kvs-C_4L7zkd.js";import{t as w}from"./compiler-runtime-DPI-XUKY.js";import{r as T}from"./runtime-context-DR7xYiHc.js";import{t as E}from"./api-client-tag-CiSoiJH1.js";import"./schemas-DPk_Do7s.js";import{n as D}from"./legacy-client-types-D8gRsvnp.js";var O=w(),k=e(t(),1),A=2592e5,j=[`voices`,`list`];function M(e){return e[1]===`m`?`male`:`female`}function N(e){return{gender:M(e.model_id),image_url:`/voice-images/${e.model_id}.webp`,is_free:e.is_free??!1,lang:e.lang,model_id:g(e.model_id),name:v(e.name),sample_url:`/voice-samples/${e.model_id}.mp3`,softness:e.softness??`moderate`}}var P=y.map(N),F=d({voices:l(m)}),I={voices:[]},L=F.mapFields(n(u)),R=c([d({state:L,version:o}),L]).pipe(i(s(F),a({decode:e=>({...I,...`state`in e?e.state:e}),encode:e=>e}))),z=C({key:`voice-catalog-cache-storage`,schema:R,defaultValue:()=>I}),B=e=>{let t=e.filter(e=>!h(e.model_id||e.name));return t.length===e.length?e:t};function V(e,t){return e?.length?B(e):t.length?B(t):P}function H(e){return(e??``).trim().toLowerCase()}function U(e){return H(e.model_id||e.name)}function W(e,t){let n=H(t);return n?n===U(e)||n===H(e.name):!1}var G=f(E,e=>e.Voices.ListVoices().pipe(r(e=>e.voices.map(_.schemaInstanceToPlain)))),K=e=>({queryKey:j,queryFn:({signal:t})=>e(e=>e.Voices.ListVoices(),{signal:t}).then(e=>e.voices.map(_.schemaInstanceToPlain)),staleTime:A}),q=()=>{let e=(0,O.c)(15),t=(0,k.use)(b),n=S(z).voices,r=x(z),i=T(),a;e[0]===i?a=e[1]:(a=i.queryOptions({queryKey:j,queryFn:Y}),e[0]=i,e[1]=a);let o;e[2]===a?o=e[3]:(o={...a,staleTime:A},e[2]=a,e[3]=o);let s=p(o),c=s.data,l,u;e[4]!==t||e[5]!==c||e[6]!==r?(l=()=>{c?.length&&t.get(z).voices!==c&&r({voices:c})},u=[t,c,r],e[4]=t,e[5]=c,e[6]=r,e[7]=l,e[8]=u):(l=e[7],u=e[8]),(0,k.useEffect)(l,u);let d;e[9]!==n||e[10]!==s.data?(d=V(s.data,n),e[9]=n,e[10]=s.data,e[11]=d):d=e[11];let f=d,m;return e[12]!==f||e[13]!==s?(m={...s,data:f},e[12]=f,e[13]=s,e[14]=m):m=e[14],m};function J(e){let{audioItemLang:t,audioPreferredVoiceName:n,preferredVoiceName:r,isPremiumUser:i,voiceOptionsAll:a}=e,o=a.filter(e=>e.is_free||i),s=a.find(e=>W(e,n))??o.find(e=>W(e,r))??D;return!t||t===s.lang?s:o.find(e=>e.lang===t&&e.gender===s.gender&&e.softness===s.softness)||o.find(e=>e.lang===t&&e.gender===s.gender)||(o.find(e=>e.lang===t)??s)}function Y(){return G}export{j as a,K as i,J as n,q as r,P as t}; 2//# sourceMappingURL=voices-Clwddw2A.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.