1import{aH as P,aI as E,aJ as Ie,aK as Fe,aL as Ae,aM as ke,r as t,j as e,av as I,aN as F,aO as A,aP as Le,aQ as Te,aR as k,aS as Ue,aw as L,aT as _,aU as Me,B as y,aV as se,aW as te,aX as ie,aY as De,aZ as Oe,a_ as $e,a$ as w,b0 as Re,b1 as Ge,b2 as Be,b3 as Ke,b4 as qe,b5 as ne,b6 as re,b7 as le,b8 as Ve,b9 as ce,ba as oe,bb as de,bc as me,bd as pe,be as xe,bf as ue,bg as ge,bh as _e,bi as he,bj as be,bk as We,bl as He,bm as je,bn as fe,q as H,bo as ve,bp as G,bq as Ne,br as ye,bs as Se,bt as X,bu as Y,bv as J,bw as we,bx as ze,by as Ce,bz as Xe,bA as Ye,bB as Je,bC as Ze,bD as Qe,bE as ea,bF as aa,bG as sa,bH as ta,bI as ia,bJ as na,bK as ra,bL as la,bM as ca,bN as oa,bO as da,bP as ma,bQ as pa,bR as xa,bS as ua,bT as ga,bU as _a,bV as ha,bW as ba,bX as ja,bY as fa,bZ as va,b_ as Na,b$ as ya,c0 as Sa,c1 as wa,c2 as za,c3 as Ca,c4 as Pa,c5 as Ea,c6 as Ia,c7 as Fa,c8 as Aa,c9 as ka,ca as La,cb as Ta,cc as Ua,cd as Ma,ce as Da,ag as Oa,cf as $a,cg as Ra,ch as Ga,ci as Ba,cj as Ka,ck as qa,cl as Va,cm as Wa,cn as Ha,co as Xa,cp as Ya,cq as Ja,cr as Za,cs as Qa,ct as es,cu as as,cv as ss,cw as ts,cx as is,cy as ns,cz as rs,cA as ls,cB as cs,cC as os,cD as ds,cE as ms,cF as ps,C as xs,cG as us,cH as gs}from"./index-k8gZBZBB.js";import{T}from"./textarea-D1ajlbUD.js";import{S as M,a as D,b as O,c as $,d as R}from"./select-CH4EFsRx.js";import"./category-bundle-DW4mn4yB.js";const _s=P({method:"POST"}).handler(E("187e529cef0f3031f66cb9ad7c4e6c750801c48be9a735e8ad181bb0a481aa49")),hs=P({method:"POST"}).handler(E("1460ae44e155c8dfecd6ceee24db8a80cf69b7802860fdd62e18a67c8b6e6704")),bs=P({method:"POST"}).handler(E("8f87b9b75a7c2d7fb4abff62475835586541d2d14874a3a42e699a6f45fedd16")),js=P({method:"POST"}).handler(E("dead70b057543f333c2f7b5c04e801fa0c491907f3dbc3e60f89bcb9c171c67e")),fs=P({method:"POST"}).handler(E("3265ad4bc7d0b71fac892879d87de9a2580aefd06396a4669167b7fd68a71494")),vs=P({method:"POST"}).handler(E("becedfafb9962dc48114658bdba43d852f72733856e7d99d711b3b750735a273")),Ns=P({method:"POST"}).handler(E("70a7cf203b4794de95cf7c27fd80881c2dd37c08787ebc75fe059ee0ba5d8287")),ys=P({method:"POST"}).handler(E("d840745e32a78659650dc65d87b6fd58d92806852028942a629730b71a101fa6")),B={summarization:"@cf/meta/llama-3.2-3b-instruct",tagline:"@cf/meta/llama-3.2-3b-instruct",translation:"@cf/meta/m2m100-1.2b",textToSpeech:"@cf/deepgram/aura-1",imageCaption:"@cf/llava-hf/llava-1.5-7b-hf"},V=["@cf/black-forest-labs/flux-1-schnell","@cf/bytedance/stable-diffusion-xl-lightning","@cf/lykon/dreamshaper-8-lcm"],Ss=V[0],ws=["fal-ai/flux/schnell","fal-ai/nano-banana","openai/gpt-image-2"],Pe="fal-ai/nano-banana",zs="fal-ai/nano-banana/edit",Cs="openai/gpt-image-2",Ps=1e6;function Es(){const s=[Ie(),Fe(),Ae(),ke()],u=t.useRef(null),[x,c]=t.useState(),[o,m]=t.useState(),[l,p]=t.useState(),[g,n]=t.useState(s[0]),[f,r]=t.useState(""),[v,j]=t.useState(),[S,i]=t.useState(!1);function z(d){const h=d.target.files?.[0];if(!h)return;if(!h.type.startsWith("image/")){j(ne());return}if(h.size>Ps){j(`Image is too large (${(h.size/1024).toFixed(0)} KB). ${re()}`);return}const U=new FileReader;U.onloadend=()=>{const K=U.result;c(K),m(K.replace(/^data:image\/[^;]+;base64,/,"")),p({name:h.name,size:h.size}),r(""),j(void 0)},U.onerror=()=>j(le()),U.readAsDataURL(h)}async function a(){if(o){j(void 0),r(""),i(!0);try{const d=await ys({data:{imageBase64:o,prompt:g}});r(d.description)}catch(d){j(d instanceof Error?d.message:Ve())}finally{i(!1)}}}return e.jsxs(I,{children:[e.jsxs(F,{children:[e.jsxs(A,{className:"flex items-center gap-2",children:[e.jsx(Le,{className:"size-5 text-primary"}),Te()]}),e.jsxs(k,{children:[Ue()," ",e.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-xs",children:B.imageCaption})]})]}),e.jsx(L,{children:e.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(_,{children:Me()}),e.jsx("input",{ref:u,type:"file",accept:"image/*",className:"hidden",onChange:z}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs(y,{type:"button",variant:"outline",size:"sm",onClick:()=>u.current?.click(),children:[e.jsx(se,{className:"mr-1 size-4"}),l?te():ie()]}),l&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:[l.name," · ",(l.size/1024).toFixed(0)," KB"]}
1)]}),e.jsx("div",{className:"flex aspect-square w-full items-center justify-center overflow-hidden rounded-md border bg-muted/30",children:x?e.jsx("img",{src:x,alt:De(),className:"size-full object-cover"}):e.jsx("span",{className:"px-4 text-center text-sm text-muted-foreground",children:Oe()})})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(_,{htmlFor:"ai-caption-prompt",children:$e()}),e.jsx("div",{className:"flex flex-wrap gap-2",children:s.map(d=>{const h=g===d;return e.jsx("button",{type:"button",onClick:()=>n(d),className:h?"rounded-full border border-primary bg-primary px-3 py-1 text-xs text-primary-foreground":"rounded-full border border-border bg-muted/40 px-3 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted",children:d.length>28?`${d.slice(0,28)}â¦`:d},d)})}),e.jsx(T,{id:"ai-caption-prompt",rows:3,value:g,onChange:d=>n(d.target.value)}),e.jsx(y,{type:"button",onClick:a,disabled:S||!o||g.trim().length===0,children:S?e.jsxs(e.Fragment,{children:[e.jsx(w,{className:"mr-1 size-4 animate-spin"}),Re()]}):Ge()})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(_,{children:Be()}),e.jsx("div",{className:"min-h-[160px] rounded-md border bg-muted/30 p-4 text-sm leading-relaxed whitespace-pre-wrap",children:v?e.jsx("span",{className:"text-destructive",children:v}):S?e.jsxs("span",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(w,{className:"size-4 animate-spin"}),Ke()]}):f||e.jsx("span",{className:"text-muted-foreground",children:qe()})})]})]})]})})]})}async function Z(s,u){const x=s.startsWith("data:"),c=u??Is(s);let o=s,m=!1;if(!x)try{const p=await fetch(s,{mode:"cors"});if(!p.ok)throw new Error(`HTTP ${p.status}`);const g=await p.blob();o=URL.createObjectURL(g),m=!0}catch{window.open(s,"_blank","noopener,noreferrer");return}const l=document.createElement("a");l.href=o,l.download=c,l.rel="noopener",document.body.appendChild(l),l.click(),document.body.removeChild(l),m&&setTimeout(()=>URL.revokeObjectURL(o),1e3)}function Is(s){const u=Date.now();if(s.startsWith("data:")){const c=s.slice(5,s.indexOf(";")).split("/")[1]?.split("+")[0]??"bin";return`ai-image-${u}.${c}`}try{const c=new URL(s).pathname.split("/").pop()??"";if(c&&/\.[a-z0-9]{2,5}$/i.test(c))return c}catch{}return`ai-image-${u}.jpg`}const Ee=[{value:V[0],label:"Flux.1 Schnell",hint:"Default · 12B distilled flow transformer"},{value:V[1],label:"SDXL Lightning",hint:"Lightning-fast 1024px generations",beta:!0},{value:V[2],label:"DreamShaper 8 LCM",hint:"Photorealistic Stable Diffusion fine-tune"}],ee=Ee.map(s=>({...s,label:s.beta?`${s.label} (Beta)`:s.label}));function Fs(){const s=[{id:"astronaut-panda",label:oe(),prompt:ce()},{id:"cyberpunk-tokyo",label:me(),prompt:de()},{id:"watercolor-village",label:xe(),prompt:pe()},{id:"product-earbuds",label:ge(),prompt:ue()},{id:"pixel-dragon",label:he(),prompt:_e()}],[u,x]=t.useState(s[0].id),[c,o]=t.useState(s[0].prompt),[m,l]=t.useState(Ss),[p,g]=t.useState(),[n,f]=t.useState(),[r,v]=t.useState(!1),j=Ee.find(a=>a.value===m);function S(a){const d=s.find(h=>h.id===a);d&&(x(a),o(d.prompt))}function i(a){o(a);const d=s.find(h=>h.prompt===a);x(d?.id??null)}async function z(){f(void 0),g(void 0),v(!0);try{const a=await Ns({data:{prompt:c,model:m}});g(a.imageUrl)}catch(a){f(a instanceof Error?a.message:Ce())}finally{v(!1)}}return e.jsxs(I,{children:[e.jsxs(F,{children:[e.jsxs(A,{className:"flex items-center gap-2",children:[e.jsx(be,{className:"size-5 text-primary"}),We()]}),e.jsxs(k,{children:[He()," ",e.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-xs",children:m})," "]})]}),e.jsxs(L,{children:[e.jsxs("div",{className:"mb-4 space-y-1.5",children:[e.jsx(_,{className:"text-xs text-muted-foreground",children:je()}),e.jsxs(M,{items:ee,value:m,onValueChange:a=>{a&&l(a)},children:[e.jsx(D,{className:"w-72",size:"sm",children:e.jsx(O,{})}),e.jsx($,{children:ee.map(a=>e.jsx(R,{value:a.value,label:a.label,children:a.label},a.value))})]}),j&&e.jsx("p",{className:"text-xs text-muted-foreground",children:j.hint})]}),e.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(_,{htmlFor:"ai-cf-image-prompt",children:fe()}),e.jsx("div",{className:"flex flex-wrap gap-2",children:s.map(a=>{const d=u===a.id;return e.jsx("button",{type:"button",onClick:()=>S(a.id),className:H("rounded-full border px-3 py-1 text-xs transition-colors",d?"border-primary bg-primary text-primary-foreground":"border-border bg-muted/40 text-muted-foreground hover:bg-muted"),children:a.label},a.id)})}),e.jsx(T,{id:"ai-cf-image-prompt",rows:6,value:c,onChange:a=>i(a.target.value),placeholder:ve()}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[c.length," ",G(),u===null&&` · ${Ne()}`]}),e.jsx(y,{type:"button",onClick:z,disabled:r||c.trim().length<3,children:r?e.jsxs(e.Fragment,{children:[e.jsx(w,{className:"mr-1 size-4 animate-spin"}),ye()]}):Se()})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(_,{children:X()}),p&&!r&&e.jsxs(y,{type:"button",size:"sm",variant:"outline",onClick:()=>Z(p,`cf-${m.replace(/[@/]/g,"-")}-${Date.now()}.jpg`),children:[e.jsx(Y,{className:"mr-1 size-4"}),J()]})]}),e.jsx("div",{className:"flex aspect-square w-full items-center justify-center overflow-hidden rounded-md border bg-muted/30",children:n?e.jsx("span",{className:"px-4 text-center text-sm text-destructive",children:n}):r?e.jsx(w,{className:"size-8 animate-spin text-muted-foreground"}):p?e.jsx("img",{src:p,alt:we(),className:"size-full object-cover"}):e.jsx("span",{className:"px-4 text-center text-sm text-muted-foreground",children:ze()})})]})]})]})]})}const W=[{value:Pe,label:"Nano Banana",hint:"Google's image model · ~$0.039 / image"},{value:ws[0],label:"Flux Schnell",hint:"Fast & cheap · ~$0.003 / image"},{value:Cs,label:"GPT Image 2",hint:"OpenAI's premium model · sharp text & photoreal · slower (~30s, quality=low)"}];function As(){const s=[{id:"astronaut-panda",label:oe(),prompt:ce()},{id:"cyberpunk-tokyo",label:me(),prompt:de()},{id:"watercolor-village",label:xe(),prompt:pe()},{id:"product-earbuds",label:ge(),prompt:ue()},{id:"pixel-dragon",label:he(),prompt:_e()}],[u,x]=t.useState(s[0].id),[c,o]=t.useState(s[0].prompt),[m,l]=t.useState(Pe),[p,g]=t.useState(),[n,f]=t.useState(),[r,v]=t.useState(!1),j=W.find(a=>a.value===m);function S(a){const d=s.find(h=>h.id===a);d&&(x(a),o(d.prompt))}function i(a){o(a);const d=s.find(h=>h.prompt===a);x(d?.id??null)}async function z(){f(void 0),g(void 0),v(!0);try{const a=await js({data:{prompt:c,model:m}});g(a.imageUrl)}catch(a){f(a instanceof Error?a.message:Ce())}finally{v(!1)}}return e.jsxs(I,{children:[e.jsxs(F,{children:[e.jsxs(A,{className:"flex items-center gap-2",children:[e.jsx(Xe,{className:"size-5 text-primary"}),Ye()]}),e.jsxs(k,{children:[Je()," ",e.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-xs",children:m})," "]})]}),e.jsxs(L,{children:[e.jsxs("div",{className:"mb-4 space-y-1.5",children:[e.jsx(_,{className:"text-xs text-muted-foreground",children:je()}),e.jsxs(M,{items:W,value:m,onValueChange:a=>{a&&l(a)},children:[e.jsx(D,{className:"w-72",size:"sm",children:e.jsx(O,{})}),e.jsx($,{children:W.map(a=>e.jsx(R,{value:a.value,label:a.label,children:a.label},a.value))})]}),j&&e.jsx("p",{className:"text-xs text-muted-foreground",children:j.hint})]}),e.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(_,{htmlFor:"ai-image-prompt",children:fe()}),e.jsx("div",{className:"flex flex-wrap gap-2",children:s.map(a=>{const d=u===a.id;return e.jsx("button",{type:"button",onClick:()=>S(a.id),className:H("rounded-full border px-3 py-1 text-xs transition-colors",d?"border-primary bg-primary text-primary-foreground":"border-border bg-muted/40 text-muted-foreground hover:bg-muted"),children:a.label},a.id)})}),e.jsx(T,{id:"ai-image-prompt",rows:6,value:c,onChange:a=>i(a.target.value),placeholder:ve()}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[c.length," ",G(),u===null&&` · ${Ne()}`]}),e.jsx(y,{type:"button",onClick:z,disabled:r||c.trim().length<3,children:r?e.jsxs(e.Fragment,{children:[e.jsx(w,{className:"mr-1 size-4 animate-spin"}),ye()]}):Se()})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(_,{children:X()}),p&&!r&&e.jsxs(y,{type:"button",size:"sm",variant:"outline",onClick:()=>Z(p,`fal-${m.replace(/[/]/g,"-")}-${Date.now()}.jpg`),children:[e.jsx(Y,{className:"mr-1 size-4"}),J()]})]}),e.jsx("div",{className:"flex aspect-square w-full items-center justify-center overflow-hidden rounded-md border bg-muted/30",children:n?e.jsx("span",{className:"px-4 text-center text-sm text-destructive",children:n}):r?e.jsx(w,{className:"size-8 animate-spin text-muted-foreground"}):p?e.jsx("img",{src:p,alt:we(),className:"size-full object-cover"}):e.jsx("span",{className:"px-4 text-center text-sm text-muted-foreground",children:ze()})})]})]})]})]})}const ks=1e6;function Ls(){const s=[{id:"caricature",label:Qe(),prompt:Ze()},{id:"pixar",label:aa(),prompt:ea()},{id:"anime",label:ta(),prompt:sa()}],u=t.useRef(null),[x,c]=t.useState(),[o,m]=t.useState(),[l,p]=t.useState(),[g,n]=t.useState(s[0].id),[f,r]=t.useState(s[0].prompt),[v,j]=t.useState(),[S,i]=t.useState(),[z,a]=t.useState(!1);function d(b){const N=s.find(C=>C.id===b);N&&(n(b),r(N.prompt))}function h(b){r(b);const N=s.find(C=>C.prompt===b);n(N?.id??null)}function U(b){const N=b.target.files?.[0];if(!N)return;if(!N.type.startsWith("image/")){i(ne());return}if(N.size>ks){i(`Image is too large (${(N.size/1024).toFixed(0)} KB). ${re()}`);return}const C=new FileReader;C.onloadend=()=>{const Q=C.result;c(Q),m(Q),p({name:N.name,size:N.size}),j(void 0),i(void 0)},C.onerror=()=>
1i(le()),C.readAsDataURL(N)}async function K(){if(o){i(void 0),j(void 0),a(!0);try{const b=await fs({data:{imageBase64:o,prompt:f}});j(b.imageUrl)}catch(b){i(b instanceof Error?b.message:_a())}finally{a(!1)}}}return e.jsxs(I,{children:[e.jsxs(F,{children:[e.jsxs(A,{className:"flex items-center gap-2",children:[e.jsx(ia,{className:"size-5 text-primary"}),na()]}),e.jsxs(k,{children:[ra()," ",e.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-xs",children:zs})]})]}),e.jsx(L,{children:e.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(_,{children:la()}),e.jsx("input",{ref:u,type:"file",accept:"image/*",className:"hidden",onChange:U}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs(y,{type:"button",variant:"outline",size:"sm",onClick:()=>u.current?.click(),children:[e.jsx(se,{className:"mr-1 size-4"}),l?te():ie()]}),l&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:[l.name," · ",(l.size/1024).toFixed(0)," KB"]})]}),e.jsx("div",{className:"flex aspect-square w-full items-center justify-center overflow-hidden rounded-md border bg-muted/30",children:x?e.jsx("img",{src:x,alt:ca(),className:"size-full object-cover"}):e.jsx("span",{className:"px-4 text-center text-sm text-muted-foreground",children:oa()})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(_,{htmlFor:"ai-image-edit-prompt",children:da()}),e.jsx("div",{className:"flex flex-wrap gap-2",children:s.map(b=>{const N=g===b.id;return e.jsx("button",{type:"button",onClick:()=>d(b.id),className:H("rounded-full border px-3 py-1 text-xs transition-colors",N?"border-primary bg-primary text-primary-foreground":"border-border bg-muted/40 text-muted-foreground hover:bg-muted"),children:b.label},b.id)})}),e.jsx(T,{id:"ai-image-edit-prompt",rows:4,value:f,onChange:b=>h(b.target.value),placeholder:ma()}),e.jsx(y,{type:"button",onClick:K,disabled:z||!o||f.trim().length<5,children:z?e.jsxs(e.Fragment,{children:[e.jsx(w,{className:"mr-1 size-4 animate-spin"}),pa()]}):xa()})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(_,{children:X()}),v&&!z&&e.jsxs(y,{type:"button",size:"sm",variant:"outline",onClick:()=>Z(v,`avatar-stylized-${Date.now()}.png`),children:[e.jsx(Y,{className:"mr-1 size-4"}),J()]})]}),e.jsx("div",{className:"flex aspect-square w-full items-center justify-center overflow-hidden rounded-md border bg-muted/30",children:S?e.jsx("span",{className:"px-4 text-center text-sm text-destructive",children:S}):z?e.jsx(w,{className:"size-8 animate-spin text-muted-foreground"}):v?e.jsx("img",{src:v,alt:ua(),className:"size-full object-cover"}):e.jsx("span",{className:"px-4 text-center text-sm text-muted-foreground",children:ga()})})]})]})})]})}function Ts(){const[s,u]=t.useState(ha().trim()),[x,c]=t.useState(""),[o,m]=t.useState(),[l,p]=t.useState(!1);async function g(){m(void 0),c(""),p(!0);try{const n=await _s({data:{text:s}});c(n.summary)}catch(n){m(n instanceof Error?n.message:Ca())}finally{p(!1)}}return e.jsxs(I,{children:[e.jsxs(F,{children:[e.jsxs(A,{className:"flex items-center gap-2",children:[e.jsx(ba,{className:"size-5 text-primary"}),ja()]}),e.jsxs(k,{children:[fa()," ",e.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-xs",children:B.summarization})]})]}),e.jsx(L,{children:e.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(_,{htmlFor:"ai-summarization-input",children:va()}),e.jsx(T,{id:"ai-summarization-input",rows:10,value:s,onChange:n=>u(n.target.value),placeholder:Na()}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[s.length," ",G()]}),e.jsx(y,{type:"button",onClick:g,disabled:l||s.trim().length<50,children:l?e.jsxs(e.Fragment,{children:[e.jsx(w,{className:"mr-1 size-4 animate-spin"}),ya()]}):Sa()})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(_,{children:wa()}),e.jsx("div",{className:"min-h-[256px] rounded-md border bg-muted/30 p-4 text-sm leading-relaxed whitespace-pre-wrap",children:o?e.jsx("span",{className:"text-destructive",children:o}):x||e.jsx("span",{className:"text-muted-foreground",children:za()})})]})]})})]})}function Us(){const[s,u]=t.useState(Pa()),[x,c]=t.useState([]),[o,m]=t.useState(),[l,p]=t.useState(!1);async function g(){m(void 0),c([]),p(!0);try{const n=await bs({data:{product:s}});c(n.taglines)}catch(n){m(n instanceof Error?n.message:Ma())}finally{p(!1)}}return e.jsxs(I,{children:[e.jsxs(F,{children:[e.jsxs(A,{className:"flex items-center gap-2",children:[e.jsx(be,{className:"size-5 text-primary"}),Ea()]}),e.jsxs(k,{children:[Ia()," ",e.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-xs",children:B.tagline})]})]}),e.jsx(L,{children:e.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(_,{htmlFor:"ai-tagline-input",children:Fa()}),e.jsx(T,{id:"ai-tagline-input",rows:8,value:s,onChange:n=>u(n.target.value),placeholder:Aa()}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[s.length," ",G()]}),e.jsx(y,{type:"button",onClick:g,disabled:l||s.trim().length<10,children:l?e.jsxs(e.Fragment,{children:[e.jsx(w,{className:"mr-1 size-4 animate-spin"}),ka()]}):La()})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(_,{children:Ta()}),e.jsx("div",{className:"min-h-[208px] rounded-md border bg-muted/30 p-4 text-sm leading-relaxed",children:o?e.jsx("span",{className:"text-destructive",children:o}):x.length>0?e.jsx("ol",{className:"list-decimal space-y-2 pl-5",children:x.map(n=>e.jsx("li",{children:n},n))}):e.jsx("span",{className:"text-muted-foreground",children:Ua()})})]})]})})]})}const q=[{value:"english",label:"English"},{value:"chinese",label:"䏿 Chinese"},{value:"french",label:"Français French"},{value:"german",label:"Deutsch German"},{value:"spanish",label:"Español Spanish"},{value:"japanese",label:"æ¥æ¬èª Japanese"},{value:"korean",label:"íêµì´ Korean"},{value:"russian",label:"Ð ÑÑÑкий Russian"},{value:"portuguese",label:"Português Portuguese"},{value:"arabic",label:"Ø§ÙØ¹Ø±Ø¨ÙØ© Arabic"}];function Ms(){const[s,u]=t.useState(Da()),[x,c]=t.useState("english"),[o,m]=t.useState("chinese"),[l,p]=t.useState(""),[g,n]=t.useState(),[f,r]=t.useState(!1);function v(){c(o),m(x),u(l||s),p("")}async function j(){n(void 0),p(""),r(!0);try{const i=await hs({data:{text:s,sourceLang:x,targetLang:o}});p(i.translatedText)}catch(i){n(i instanceof Error?i.message:Qa())}finally{r(!1)}}const S=x===o;return e.jsxs(I,{children:[e.jsxs(F,{children:[e.jsxs(A,{className:"flex items-center gap-2",children:[e.jsx(Oa,{className:"size-5 text-primary"}),$a()]}),e.jsxs(k,{children:[Ra()," ",e.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-xs",children:B.translation})]})]}),e.jsxs(L,{children:[e.jsxs("div",{className:"mb-4 flex flex-wrap items-end gap-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(_,{className:"text-xs text-muted-foreground",children:Ga()}),e.jsxs(M,{items:q,value:x,onValueChange:i=>{i&&c(i)},children:[e.jsx(D,{className:"w-44",size:"sm",children:e.jsx(O,{})}),e.jsx($,{children:q.map(i=>e.jsx(R,{value:i.value,label:i.label,children:i.label},i.value))})]})]}),e.jsx(y,{type:"button",variant:"outline",size:"icon",className:"mb-0.5 shrink-0",onClick:v,"aria-label":Ka(),children:e.jsx(Ba,{className:"size-4"})}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(_,{className:"text-xs text-muted-foreground",children:qa()}),e.jsxs(M,{items:q,value:o,onValueChange:i=>{i&&m(i)},children:[e.jsx(D,{className:"w-44",size:"sm",children:e.jsx(O,{})}),e.jsx($,{children:q.map(i=>e.jsx(R,{value:i.value,label:i.label,children:i.label},i.value))})]})]})]}),e.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(_,{htmlFor:"ai-translation-input",children:Va()}),e.jsx(T,{id:"ai-translation-input",rows:6,value:s,onChange:i=>u(i.target.value),placeholder:Wa()}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[s.length," ",G()]}),e.jsx(y,{type:"button",onClick:j,disabled:f||S||s.trim().length===0,children:f?e.jsxs(e.Fragment,{children:[e.jsx(w,{className:"mr-1 size-4 animate-spin"}),Ha()]}):Xa()}),S&&e.jsx("p",{className:"text-xs text-destructive",children:Ya()})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(_,{children:Ja()}),e.jsx("div",{className:"min-h-[160px] rounded-md border bg-muted/30 p-4 text-sm leading-relaxed whitespace-pre-wrap",children:g?e.jsx("span",{className:"text-destructive",children:g}):l||e.jsx("span",{className:"text-muted-foreground",children:Za()})})]})]})]})]})}const ae=[{value:"asteria",label:"Asteria · Female (US)"},{value:"luna",label:"Luna · Female (US)"},{value:"stella",label:"Stella · Female (US)"},{value:"athena",label:"Athena · Female (UK)"},{value:"hera",label:"Hera · Female (US)"},{value:"angus",label:"Angus · Male (IE)"},{value:"arcas",label:"Arcas · Male (US)"},{value:"orion",label:"Orion · Male (US)"},{value:"orpheus",label:"Orpheus · Male (US)"},{value:"perseus",label:"Perseus · Male (US)"},{value:"helios",label:"Helios · Male (UK)"},{value:"zeus",label:"Zeus · Male (US)"}];function Ds(){const[s,u]=t.useState(es()),[x,c]=t.useState("asteria"),[o,m]=t.useState(),[l,p]=t.useState(),[g,n]=t.useState(!1);async function f(){p(void 0),m(void 0),n(!0);try{const r=await vs({data:{text:s,speaker:x}});m(r.audioUrl)}catch(r){p(r instanceof Error?r.message:ps())}finally{n(!1)}}return e.jsxs(I,{children:[e.jsxs(F,{children:[e.jsxs(A,{className:"flex items-center gap-2",children:[e.jsx(as,{className:"size-5 text-primary"}),ss()]}),e.jsxs(k,{children:[ts()," ",e.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-xs",children:B.textToSpeech})]})]}),e.jsxs(L,{children:[e.jsx("div",{className:"mb-4 flex flex-wrap items-end gap-3",children:e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(_,{className:"text-xs text-muted-foreground",children:is()}),e.jsxs(M,{items:ae,value:x,onValueChange:r=>{r&&c(r)},children:[e.jsx(D,{className:"w-56",size:"sm",children:e.jsx(O,{})}),e.jsx($,{children:ae.map(r=>e.jsx(R,{value:r.value,label:r.label,children:r.label},r.value))})]})]})}),e.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(_,{htmlFor:"ai-tts-input",children:ns()}),e.jsx(T,{id:"ai-tts-input",rows:6,value:s,onChange:r=>u(r.target.value),placeholder:rs()}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[s.length," characters · ~$",(s.length/1e3*.015).toFixed(4)," ",ls()]}),e.jsx(y,{type:"button",onClick:f,disabled:g||s.trim().length===0,children:g?e.jsxs(e.Fragment,{children:[e.jsx(w,{className:"mr-1 size-4 animate-spin"}),cs()]}):os()})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(_,{children:ds()}),e.jsx("div",{className:"flex min-h-[160px] w-full items-center justify-center rounded-md border bg-muted/30 p-4",children:l?e.jsx("span",{className:"text-center text-sm text-destructive",children:l}):g?e.jsx(w,{className:"size-8 animate-spin text-muted-foreground"}):o?e.jsx("audio",{controls:!0,src:o,className:"w-full",children:e.jsx("track",{kind:"captions"})}):e.jsx("span",{className:"text-center text-sm text-muted-foreground",children:ms()})})]})]})]})]})}function Bs(){return e.jsx(xs,{className:"py-16 px-4",children:e.jsxs("div",{className:"mx-auto max-w-5xl space-y-10 pb-16",children:[e.jsxs("div",{className:"space-y-4 text-center",children:[e.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:us()}),e.jsx("p",{className:"text-lg text-muted-foreground",children:gs()})]}),e.jsx("section",{id:"text-summarization",className:"scroll-mt-20",children:e.jsx(Ts,{})}),e.jsx("section",{id:"translation",className:"scroll-mt-20",children:e.jsx(Ms,{})}),e.jsx("section",{id:"tagline-generator",className:"scroll-mt-20",children:e.jsx(Us,{})}),e.jsx("section",{id:"text-to-speech",className:"scroll-mt-20",children:e.jsx(Ds,{})}),e.jsx("section",{id:"image-captioning",className:"scroll-mt-20",children:e.jsx(Es,{})}),e.jsx("section",{id:"image-generator-cloudflare",className:"scroll-mt-20",children:e.jsx(Fs,{})}),e.jsx("section",{id:"image-generator-fal",className:"scroll-mt-20",children:e.jsx(As,{})}),e.jsx("section",{id:"image-editing",className:"scroll-mt-20",children:e.jsx(Ls,{})})]})})}export{Bs as component};
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.