PageSourceSearch

https://www.imgtovid.ai/_next/static/chunks/4721-c8340651d5757dc7.js

js imgtovid.ai collected 2026-10-05 02:00:27 UTC 44,436 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4721],{28199:function(e,t,i){i.d(t,{A:function(){return l},I:function(){return n}});var r=i(57437),a=i(2265);let o=(0,a.createContext)(null);function n(e){let{children:t}=e,[i,n]=(0,a.useState)(null),l=(0,a.useCallback)((e,t)=>{n(i=>t?e:i===e?null:i)},[]),s=(0,a.useMemo)(()=>({openId:i,setOpenId:n,registerOpen:l}),[i,l]);return(0,r.jsx)(o.Provider,{value:s,children:t})}function l(e){let t=(0,a.useId)(),i=e||t,r=(0,a.useContext)(o);return r?{selectId:i,open:r.openId===i,onOpenChange:e=>r.registerOpen(i,e)}:{open:void 0,onOpenChange:void 0,selectId:i}}},92022:function(e,t,i){i.d(t,{Z:function(){return h}});var r=i(57437),a=i(2265),o=i(90928),n=i(75186),l=i(65732),s=i(38482),d=i(84011);async function c(e){return new Promise((t,i)=>{let r=new FileReader;r.onload=()=>t(r.result),r.onerror=i,r.readAsDataURL(e)})}async function u(e){return new Promise((t,i)=>{let r=document.createElement("video");r.muted=!0,r.playsInline=!0,r.preload="auto","string"==typeof e&&(r.crossOrigin="anonymous");let a=null,o=()=>{a&&URL.revokeObjectURL(a)},n=e=>{o(),i(e??Error("Failed to capture video poster"))};r.onloadeddata=()=>{r.currentTime=.01},r.onseeked=()=>{try{let e=r.videoWidth,i=r.videoHeight;if(!e||!i){n();return}let a=document.createElement("canvas");a.width=e,a.height=i;let l=a.getContext("2d");if(!l){n();return}l.drawImage(r,0,0,e,i);let s=a.toDataURL("image/jpeg",.82);o(),t(s)}catch(e){n(e)}},r.onerror=()=>n(),e instanceof File?(a=URL.createObjectURL(e),r.src=a):r.src=e})}async function m(e){let t=await (0,s.w)(e);t||(t=e);let i=await c(t),r="image/jpeg"===t.type?"jpeg":"png",{url:a}=await l.Z.post("/cdn/upload-image",{imageSource:i,imageType:r});return a||null}async function v(e,t){let i;try{i=await u(e)}catch{}let r=await c(e),a=e.type.split("/")[1]||"mp4",{url:o}=await l.Z.post("/video/upload/binary",{videoSource:r,videoType:a});return o&&i&&(null==t||t(o,i)),o||null}function p(e){let{label:t,url:i,kind:o="image",disabled:n,uploading:l,onPick:s,onActivate:d,onClear:c,accept:m="image/*",title:v,previewUrl:p}=e,h=(0,a.useRef)(null),[x,g]=(0,a.useState)(null),[f,b]=(0,a.useState)(!1),w=!!i,_="video"===o?p||x:null,y=w&&"video"===o&&(!!_||f&&!!i);(0,a.useEffect)(()=>{if("video"!==o||!i||p){g(null),b(!1);return}let e=!1;return g(null),b(!1),u(i).then(t=>{e||g(t)}).catch(()=>{e||b(!0)}),()=>{e=!0}},[o,i,p]);let j="image"===o?i:"video"===o?_:void 0;return(0,r.jsxs)(r.Fragment,{children:["function"==typeof s&&(0,r.jsx)("input",{ref:h,type:"file",accept:m,hidden:!0,onChange:e=>{var t;let i=null===(t=e.target.files)||void 0===t?void 0:t[0];i&&s(i),e.target.value=""}}),(0,r.jsxs)("button",{type:"button",disabled:n||l||!("function"==typeof s||"function"==typeof d),"aria-label":t,title:v||t,onClick:()=>{var e;if(d){d();return}"function"==typeof s&&(null===(e=h.current)||void 0===e||e.click())},className:`group/tile relative flex h-[60px] w-[56px] shrink-0 flex-col items-center justify-center overflow-hidden rounded-[10px] border-[1.5px] border-dashed transition-colors disabled:opacity-50 ${w?"border-[color-mix(in_oklch,var(--itv-accent-bright)_50%,var(--itv-border))] bg-[color-mix(in_oklch,var(--itv-accent)_10%,var(--itv-surface-2))]":"border-[color-mix(in_oklch,var(--itv-accent-bright)_38%,var(--itv-border))] bg-[color-mix(in_oklch,var(--itv-accent)_5%,var(--itv-surface-2))] hover:border-[color-mix(in_oklch,var(--itv-accent-bright)_55%,var(--itv-border))] hover:bg-[color-mix(in_oklch,var(--itv-accent)_9%,var(--itv-surface-2))]"}`,style:j?{backgroundImage:`url(${j})`,backgroundSize:"cover",backgroundPosition:"center"}:void 0,children:[w&&"video"===o&&!_&&f&&i&&!l&&(0,r.jsx)("video",{src:i,muted:!0,playsInline:!0,preload:"metadata",className:"pointer-events-none absolute inset-0 h-full w-full object-cover","aria-hidden":!0}),!w&&"image"===o&&(0,r.jsx)("svg",{className:"h-5 w-5 text-itv-accent-bright opacity-90",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:(0,r.jsx)("path",{d:"M12 5v14M5 12h14"})}),!w&&"audio"===o&&(0,r.jsxs)("svg",{className:"h-5 w-5 text-itv-accent-bright opacity-90",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75","aria-hidden":"true",children:[(0,r.jsx)("polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5"}),(0,r.jsx)("path",{d:"M15.54 8.46a5 5 0 010 7.07"})]}),!w&&"video"===o&&(0,r.jsxs)("svg",{className:"h-5 w-5 text-itv-accent-bright opacity-90",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75","aria-hidden":"true",children:[(0,r.jsx)("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}
1),(0,r.jsx)("path",{d:"M10 9l6 3-6 3V9z",fill:"currentColor",stroke:"none"})]}),w&&"audio"===o&&(0,r.jsx)("span",{className:"text-[10px] font-semibold text-itv-accent-bright",children:"OK"}),l&&(0,r.jsx)("span",{className:"absolute inset-0 grid place-items-center bg-[color-mix(in_oklch,var(--itv-bg)_50%,transparent)] text-[10px] text-itv-fg",children:"…"}),(0,r.jsx)("span",{className:`absolute inset-x-0 bottom-0 truncate px-0.5 py-0.5 text-center text-[9px] font-medium leading-none ${w&&("image"===o||y)?"bg-[color-mix(in_oklch,var(--itv-bg)_55%,transparent)] text-itv-fg":"text-itv-muted"}`,children:t}),w&&c&&(0,r.jsx)("span",{role:"button",tabIndex:0,"aria-label":"Remove",className:"absolute right-0.5 top-0.5 grid h-4 w-4 place-items-center rounded-full bg-[color-mix(in_oklch,var(--itv-bg)_70%,transparent)] text-[10px] text-itv-fg opacity-0 transition-opacity group-hover/tile:opacity-100",onClick:e=>{e.stopPropagation(),c()},onKeyDown:e=>{"Enter"===e.key&&(e.stopPropagation(),c())},children:"\xd7"})]})]})}function h(e){let{model:t,form:i,setForm:s,mediaShell:u,disabled:h,includeSingleImage:x=!0,mode:g}=e,f=(0,o.useTranslations)("CreateStudio"),[b,w]=(0,a.useState)(null),[_,y]=(0,a.useState)({}),[j,k]=(0,a.useState)(null),N="avatar"===g,C="number"==typeof t.maxVideoDuration?t.maxVideoDuration:void 0,S="function"==typeof f.has&&f.has("slotUnsupported")?f("slotUnsupported"):"Not supported by this model",I=e=>null!=u[e],L=e=>h||"disabled"===u[e],F=I("firstFrame"),E=I("lastFrame"),A=t.allow_images_count||t.allow_upload_image_num||4,U=I("images"),q=x&&I("image"),P=I("video"),R=I("videos"),M=I("audio");if(!F&&!U&&!q&&!P&&!R&&!M)return null;let K=(e,t)=>y(i=>({...i,[e]:t})),Z=e=>y(t=>{if(!t[e])return t;let i={...t};return delete i[e],i}),V=async(e,t)=>{try{w(e),await t()}catch(e){console.error(e),n.Am.error(f("uploadFailed"))}finally{w(null)}},$=(e,t)=>{h||k({type:e,slot:t})},W=(e,i)=>{if("first"===e)s(e=>({...e,firstFrameImage:i}));else if("last"===e)s(e=>({...e,lastFrameImage:i}));else if("single"===e)s(e=>({...e,selectedImages:[i]}));else if("images"===e)s(e=>({...e,selectedImages:[...e.selectedImages,i].slice(0,A)}));else if(e.startsWith("img-")){let t=Number(e.slice(4));s(e=>{let r=[...e.selectedImages];return r[t]=i,{...e,selectedImages:r}})}else if("video"===e)s(e=>({...e,videoUrl:i}));else if("videos"===e){let e=t.allow_videos_count||2;s(t=>({...t,videoUrls:[...t.videoUrls,i].slice(0,e)}))}else if(e.startsWith("vid-")){let t=Number(e.slice(4));s(e=>{let r=[...e.videoUrls];return r[t]=i,{...e,videoUrls:r}})}else"audio"===e&&s(e=>({...e,audioUrl:i,...N?{duration:5}:{}}))},D=async e=>{if(!j)return;let t=e[0];t&&await V(j.slot,async()=>{if("image"===j.type){let e=await m(t);e&&W(j.slot,e);return}if("video"===j.type){let e=await v(t,K);e&&W(j.slot,e);return}if(N){let e=URL.createObjectURL(t);try{let i=await new Promise((t,i)=>{let r=document.createElement("audio");r.preload="metadata",r.onloadedmetadata=()=>t(Number.isFinite(r.duration)?r.duration:0),r.onerror=()=>i(Error("duration")),r.src=e});if(i<3){n.Am.error("Audio must be at least 3 seconds");return}let r=await c(t),a=t.type.split("/")[1]||"mpeg",{url:o}=await l.Z.post("/cdn/upload-voice",{audioSource:r,audioType:a});o&&s(e=>({...e,audioUrl:o,duration:Math.max(3,Math.ceil(i))}))}finally{URL.revokeObjectURL(e)}return}let e=await c(t),i=t.type.split("/")[1]||"mpeg",{url:r}=await l.Z.post("/cdn/upload-voice",{audioSource:e,audioType:i});r&&s(e=>({...e,audioUrl:r}))})};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex shrink-0 items-start gap-1.5","data-od-id":"gen-media-slots",children:[F&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(p,{label:"avatar"===g?f("slotAvatar"):f("slotStart"),url:i.firstFrameImage||void 0,disabled:L("firstFrame"),uploading:"first"===b,onActivate:L("firstFrame")?void 0:()=>$("image","first"),onClear:L("firstFrame")?void 0:()=>s(e=>({...e,firstFrameImage:""})),title:L("firstFrame")?S:void 0}),E&&(0,r.jsx)(p,{label:f("slotEnd"),url:i.lastFrameImage||void 0,disabled:L("lastFrame"),uploading:"last"===b,onActivate:L("lastFrame")?void 0:()=>$("image","last"),onClear:L("lastFrame")?void 0:()=>s(e=>({...e,lastFrameImage:""})),title:L("lastFrame")?S:void 0})]}),q&&(0,r.jsx)(p,{label:f("slotImage"),url:i.selectedImages[0],disabled:L("image"),uploading:"single"===b,onActivate:L("image")?void 0:()=>$("image","single"),onClear:L("image")?void 0:()=>s(e=>({...e,selectedImages:[]})),title:L("image")?S:void 0}),U&&i.selectedImages.map((e,t)=>(0,r.jsx)(p,{label:`${t+1}`,url:e,disabled:L("images"),uploading:b===`img-${t}`,onActivate:L("images")?void 0:()=>$("image",`img-${t}`),onClear:L("images")?void 0:()=>s(e=>({...e,selectedImages:e.selectedImages.filter((e,i)=>i!==t)})),title:L("images")?S:void 0},`${e}-${t}`)),U&&(L("images")?0===i.selectedImages.length:i.selectedImages.length<A)&&(0,r.jsx)(p,{label:f("slotImage"),disabled:L("images"),uploading:"images"===b,onActivate:L("images")?void 0:()=>$("image","images"),title:L("images")?S:void 0}),P&&(0,r.jsx)(p,{kind:"video",label:f("slotVideo"),url:i.videoUrl||void 0,previewUrl:i.videoUrl?_[i.videoUrl]:void 0,accept:"video/*",disabled:L("video"),uploading:"video"===b,onActivate:L("video")?void 0:()=>$("video","video"),onClear:i.videoUrl&&!L("video")?()=>{Z(i.videoUrl),s(e=>({...e,videoUrl:""}))}:void 0,title:L("video")?S:void 0}),R&&(0,r.jsxs)(r.Fragment,{children:[i.videoUrls.map((e,t)=>(0,r.jsx)(p,{kind:"video",label:`V${t+1}`,url:e,previewUrl:_[e],disabled:L("videos"),onActivate:L("videos")?void 0:()=>$("video",`vid-${t}`),onClear:L("videos")?void 0:()=>{Z(e),s(e=>({...e,videoUrls:e.videoUrls.filter((e,i)=>i!==t)}))},title:L("videos")?S:void 0},`${e}-${t}`)),(L("videos")?0===i.videoUrls.length:i.videoUrls.length<(t.allow_videos_count||2))&&(0,r.jsx)(p,{kind:"video",label:f("slotVideo"),accept:"video/*",disabled:L("videos"),uploading:"videos"===b,onActivate:L("videos")?void 0:()=>$("video","videos"),title:L("videos")?S:void 0})]}),M&&(0,r.jsx)(p,{kind:"audio",label:f("slotAudio"),url:i.audioUrl||void 0,accept:"audio/*,.mp3,.wav,.m4a,.aac,.ogg",disabled:L("audio"),uploading:"audio"===b,onActivate:L("audio")?void 0:()=>$("audio","audio"),onClear:i.audioUrl&&!L("audio")?()=>s(e=>({...e,audioUrl:"",...N?{duration:5}:{}})):void 0,title:L("audio")?S:void 0})]}),j?(0,r.jsx)(d.c,{open:!0,type:j.type,disabled:h,onClose:()=>k(null),onSelect:e=>{if(j){if("video"===j.type&&C&&null!=e.duration&&e.duration>C)return n.Am.error(`Video duration is ${e.duration}s, maximum allowed is ${C}s`),!1;if("audio"===j.type&&N)return null!=e.duration&&e.duration<3?(n.Am.error("Audio must be at least 3 seconds"),!1):void s(t=>({...t,audioUrl:e.url,duration:Math.max(3,Math.ceil(e.duration??3))}));"video"===j.type&&e.thumbnailUrl&&K(e.url,e.thumbnailUrl),W(j.slot,e.url)}},onUploadFiles:D}):null]})}},9944:function(e,t,i){i.d(t,{a:function(){return n}});var r=i(57437),a=i(98617),o=i(94508);function n(e){let{className:t,iconOnly:i=!1}=e;return(0,r.jsxs)("span",{className:(0,o.cn)("inline-flex shrink-0 items-center text-itv-accent-bright",i?"justify-center":["gap-0.5 rounded-full border px-1.5 py-px","border-[color-mix(in_oklch,var(--itv-accent-bright)_42%,var(--itv-border))]","bg-[linear-gradient(135deg,color-mix(in_oklch,var(--itv-accent)_22%,transparent),color-mix(in_oklch,var(--itv-accent-deep)_18%,transparent))]","font-mono text-[9px] font-semibold uppercase tracking-[0.08em]"],t),title:"Members only",children:[(0,r.jsx)(a.Z,{className:i?"h-3 w-3":"h-2.5 w-2.5",strokeWidth:2.25,"aria-hidden":!0}),i?null:"Members"]})}},84665:function(e,t,i){i.d(t,{Z:function(){return l}});var r=i(57437);i(2265);var a=i(70491),o=i(94508),n=i(28199);function l(e){var t;let{className:i="",triggerClassName:l,label:s,options:d,value:c,onChange:u,ariaLabel:m,title:v,leading:p,size:h="default",contentWidth:x="max-content",showChevron:g=!0,selectId:f,side:b="top"}=e,{open:w,onOpenChange:_}=(0,n.A)(f),y=d.find(e=>e.id===c),j="string"==typeof s||"number"==typeof s?String(s):(null==y?void 0:y.label)||"",k=d.filter(e=>!e.disabled).map(e=>({value:e.id,label:e.label,suffix:e.trailing})),N=k.some(e=>e.value===c)&&c?c:(null===(t=k[0])||void 0===t?void 0:t.value)||"";return N&&0!==k.length?"compact"===h?(0,r.jsx)("div",{className:`inline-flex min-w-0 items-center ${i}`,children:(0,r.jsx)(a.Z,{value:N,onValueChange:u,options:k,placeholder:j,ariaLabel:m||j,title:v||m,variant:"itv",side:b,align:"start",leading:p,showChevron:g,showCheck:!1,open:w,onOpenChange:_,contentWidth:x,className:l||"h-auto min-w-0 border-transparent bg-transparent px-2 py-1 text-[12px] font-normal text-itv-fg hover:border-transparent hover:bg-[color-mix(in_oklch,var(--itv-surface-2)_90%,transparent)] hover:text-itv-fg"})}):(0,r.jsx)("div",{className:(0,o.cn)("inline-flex max-w-[220px] min-w-0 items-center rounded-[calc(var(--itv-radius)-2px)] border border-solid border-itv-border bg-itv-surface-2 transition-colors","hover:[border-color:color-mix(in_oklch,var(--itv-accent-bright)_35%,var(--itv-border))] hover:bg-[color-mix(in_oklch,var(--itv-surface)_92%,var(--itv-surface-2))]",i),children:(0,r.jsx)(a.Z,{value:N,onValueChange:u,options:k,placeholder:j,ariaLabel:m||j,title:v||m,variant:"itv",side:b,align:"start",leading:p,showChevron:g,showCheck:!1,open:w,onOpenChange:_,contentWidth:x,className:l||"w-full max-w-full justify-between border-0 bg-transparent text-itv-fg shadow-none hover:border-0 hover:bg-transparent hover:text-itv-fg"})}):(0,r.jsxs)("span",{className:`inline-flex max-w-full items-center gap-1.5 rounded-itv border border-itv-border px-2.5 py-1.5 text-[13px] text-itv-muted ${i}`,children:[p,(0,r.jsx)("span",{className:"truncate",children:j||"—"})]})}},66381:function(e,t,i){i.d(t,{H:function(){return m},Z:function(){return u}});var r=i(57437);i(2265);var a=i(90928),o=i(94508),n=i(80957),l=i(87633);function s(e){let{ratio:t,active:i}=e;return(0,r.jsx)("span",{className:(0,o.cn)("block shrink-0 rounded-[2px] border",{"16:9":"h-3.5 w-6","21:9":"h-3 w-7","4:3":"h-4 w-5","1:1":"h-4 w-4","3:4":"h-5 w-3.5","9:16":"h-5 w-3"}[t]||"h-4 w-4",i?"border-itv-accent-bright bg-[color-mix(in_oklch,var(--itv-accent)_25%,transparent)]":"border-itv-muted bg-transparent"),"aria-hidden":!0})}function d(e){let{selected:t,disabled:i,onClick:a,children:n,aspectVisual:l,ratio:d}=e;return(0,r.jsx)("button",{type:"button",disabled:i,className:(0,o.cn)("inline-flex items-center justify-center gap-1.5 rounded-[calc(var(--itv-radius)-2px)] border px-2.5 py-1.5 text-[12px] font-medium tabular-nums transition-colors",l&&"min-w-[48px] flex-col gap-1 px-2 py-1.5",i&&"cursor-not-allowed opacity-40 hover:bg-transparent",t&&!i?"border-[color-mix(in_oklch,var(--itv-accent-bright)_40%,var(--itv-border))] bg-[color-mix(in_oklch,var(--itv-accent)_18%,transparent)] text-itv-accent-bright":i?"border-itv-border bg-[color-mix(in_oklch,var(--itv-border)_30%,transparent)] text-itv-muted":"border-itv-border bg-[color-mix(in_oklch,var(--itv-border)_30%,transparent)] text-itv-fg hover:bg-[color-mix(in_oklch,var(--itv-accent)_10%,transparent)]"),"aria-pressed":t,"aria-disabled":i||void 0,onClick:a,children:l&&d?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(s,{ratio:d,active:t}),(0,r.jsx)("span",{children:n})]}):n})}function c(e){let{label:t,options:i,value:a,onChange:n,aspectVisual:l,layout:s,disabledIds:c}=e;if(0===i.length)return null;let u=(0,r.jsx)("div",{className:(0,o.cn)("flex flex-wrap gap-1.5","rows"===s?"justify-start min-[420px]:justify-end":"justify-start"),children:i.map(e=>(0,r.jsx)(d,{selected:e.id===a,disabled:null==c?void 0:c.has(e.id),onClick:()=>n(e.id),aspectVisual:l,ratio:e.id,children:e.label},e.id))});return"rows"===s?(0,r.jsxs)("div",{className:"flex flex-col gap-2 min-[420px]:flex-row min-[420px]:items-center min-[420px]:justify-between min-[420px]:gap-3",children:[(0,r.jsx)("span",{className:"shrink-0 text-[13px] font-medium text-itv-muted",children:t}),u]}):(0,r.jsxs)("div",{className:"flex flex-col items-start gap-2",children:[(0,r.jsx)("span",{className:"text-[11px] font-medium uppercase tracking-[0.06em] text-itv-muted",children:t}),u]})}function u(e){let{model:t,form:i,setForm:s,fields:d,layout:u="stack"}=e,m=(0,a.useTranslations)("CreateStudio"),v=(t.allow_aspect_ratio||[]).map(e=>({id:e,label:e})),p=(t.duration||[]).map(e=>({id:String(e),label:`${e}s`})),h=(t.allow_quality||[]).map(e=>({id:e,label:e})),x=(t.allow_resolution||[]).map(e=>({id:e,label:e})),g=(t.allow_num_images||[]).map(e=>({id:String(e),label:String(e)})),f=(0,l.Nh)(d,"aspect_ratio"),b=(0,l.Nh)(d,"duration"),w="number"==typeof t.maxOutputPlusInputDurationSec?t.maxOutputPlusInputDurationSec:void 0,_=null!=w?new Set(p.filter(e=>(0,n.FF)(Number(e.id),i.referenceVideoDuration,w)).map(e=>e.id)):void 0,y=(0,l.Nh)(d,"quality"),j=(0,l.Nh)(d,"resolution"),k=(0,l.Nh)(d,"num_images");return f||b||y||j||k?(0,r.jsxs)("div",{className:(0,o.cn)("flex w-full flex-col","rows"===u?"ga
1p-3.5":"items-start gap-4"),children:[f&&(0,r.jsx)(c,{label:m("paramAspect"),options:v,value:i.aspectRatio,onChange:e=>s(t=>({...t,aspectRatio:e})),aspectVisual:!0,layout:u}),b&&(0,r.jsxs)("div",{className:"flex w-full flex-col gap-1",children:[(0,r.jsx)(c,{label:m("paramDuration"),options:p,value:String(i.duration),onChange:e=>s(t=>({...t,duration:Number(e)})),layout:u,disabledIds:_}),(null==_?void 0:_.has(String(i.duration)))&&null!=w&&(0,r.jsxs)("p",{className:"text-[11px] leading-snug text-red-400",children:["Upload video duration + output duration cannot exceed ",w,"s."]})]}),y&&(0,r.jsx)(c,{label:m("paramQuality"),options:h,value:i.quality,onChange:e=>s(t=>({...t,quality:e})),layout:u}),j&&(0,r.jsx)(c,{label:m("paramResolution"),options:x,value:i.resolution,onChange:e=>s(t=>({...t,resolution:e})),layout:u}),k&&(0,r.jsx)(c,{label:m("numImages"),options:g,value:String(i.numImages),onChange:e=>s(t=>({...t,numImages:Number(e)})),layout:u})]}):null}function m(e,t,i){let r=[];return(0,l.Nh)(i,"aspect_ratio")&&t.aspectRatio&&r.push(t.aspectRatio),(0,l.Nh)(i,"duration")&&t.duration&&r.push(`${t.duration}s`),(0,l.Nh)(i,"quality")&&t.quality&&r.push(t.quality),(0,l.Nh)(i,"resolution")&&t.resolution&&r.push(t.resolution),(0,l.Nh)(i,"num_images")&&t.numImages&&r.push(String(t.numImages)),r}},89838:function(e,t,i){i.d(t,{M:function(){return f},Z:function(){return j}});var r=i(57437),a=i(2265),o=i(54887),n=i(90928),l=i(41871),s=i(9944),d=i(18592),c=i(1828),u=i(46198),m=i(66381),v=i(87633),p=i(94508),h=i(8578),x=i(13435);let g=["seed","generate_audio","custom_props"];function f(e){return e.some(e=>g.includes(e.id))}function b(e){let{selected:t,children:i,onClick:a}=e;return(0,r.jsx)("button",{type:"button",className:(0,p.cn)("flex w-full items-center justify-between gap-2 rounded-[calc(var(--itv-radius)-2px)] border px-3.5 py-2.5 text-left text-[13px] font-medium transition-colors",t?"border-[color-mix(in_oklch,var(--itv-accent-bright)_36%,var(--itv-border))] bg-[color-mix(in_oklch,var(--itv-accent)_16%,transparent)] text-itv-accent-bright":"border-transparent bg-transparent text-itv-fg hover:bg-[color-mix(in_oklch,var(--itv-accent)_10%,transparent)]"),"aria-pressed":t,onClick:a,children:i})}function w(e){let{children:t}=e;return(0,r.jsx)("span",{className:"mb-2 block font-mono text-[10px] font-semibold uppercase tracking-[0.08em] text-itv-muted",children:t})}function _(e){let{children:t}=e;return(0,r.jsx)("div",{className:"flex w-full flex-col gap-1",children:t})}function y(e){let{model:t,form:i,setForm:a,advancedFields:o,dense:l}=e,s=(0,n.useTranslations)("CreateStudio"),d=l?"flex items-center justify-between gap-3 py-2.5":"flex items-center justify-between gap-3 border-b border-[color-mix(in_oklch,var(--itv-border)_55%,transparent)] py-2.5";return(0,r.jsxs)("div",{className:(0,p.cn)(l&&"flex flex-col gap-0.5"),children:[(0,v.Nh)(o,"seed")&&(0,r.jsxs)("div",{className:d,children:[(0,r.jsx)("span",{className:"shrink-0 text-[13px] font-medium text-itv-muted",children:s("seed")}),(0,r.jsx)("input",{type:"number",className:"w-[112px] rounded-[calc(var(--itv-radius)-2px)] border border-itv-border bg-itv-surface-2 px-2.5 py-1.5 text-right text-[13px] tabular-nums text-itv-fg outline-none focus:border-[color-mix(in_oklch,var(--itv-accent-bright)_40%,var(--itv-border))]",value:i.seed,onChange:e=>a(t=>({...t,seed:Number(e.target.value)||0}))})]}),(0,v.Nh)(o,"generate_audio")&&(0,r.jsxs)("div",{className:(0,p.cn)(d,"min-h-10"),children:[(0,r.jsx)("span",{className:"shrink-0 text-[13px] font-medium text-itv-muted",children:s("generateAudio")}),(0,r.jsx)(c.r,{checked:i.generateAudio,onCheckedChange:e=>a(t=>({...t,generateAudio:e}))})]}),(0,v.Nh)(o,"custom_props")&&Array.isArray(t.custom_props)&&t.custom_props.map(e=>(0,r.jsx)("div",{className:"py-2",children:(0,r.jsx)(u.Z,{config:e,value:i.customProps[e.key],onChange:t=>a(i=>({...i,customProps:{...i.customProps,[e.key]:t}}))})},e.key))]})}function j(e){let{open:t,onClose:i,onConfirm:c,mode:u,typeId:g,onTypeChange:j,seriesId:k,onSeriesChange:N,model:C,seriesList:S,form:I,setForm:L,modelParamFields:F,advancedFields:E,variant:A,anchorRef:U}=e,q=(0,n.useTranslations)("CreateStudio"),{isMember:P}=(0,l.e7)(),R=(0,v.wg)(u).types.map(e=>({id:e.id,label:q(e.labelKey)})),M=(0,a.useRef)(null),[K,Z]=(0,a.useState)(null),V="mobile-full"===A,$="audio"===u,W=C.voice_options||[],D=$?{voiceLibrary:q("voiceLibrary"),language:q("voiceLanguage"),gendersLabel:q("voiceGenders"),featuredVoices:q("featuredVoices"),emotion:q("emotion"),speed:q("speed"),volume:q("volume"),pitch:q("pitch"),male:q("genders.male"),female:q("genders.female"),neutral:q("genders.neutral"),emotions:{auto:q("emotions.auto"),happy:q("emotions.happy"),sad:q("emotions.sad"),angry:q("emotions.angry"),fearful:q("emotions.fearful"),disgusted:q("emotions.disgusted"),surprised:q("emotions.surprised"),calm:q("emotions.calm")}}:null,z=()=>{let e=null==U?void 0:U.current;if(!e)return;let t=e.getBoundingClientRect(),i=Math.min(320,window.innerWidth-24),r=t.left+t.width/2-i/2;
1r=Math.max(12,Math.min(r,window.innerWidth-12-i)),Z({bottom:window.innerHeight-t.top+10,left:r,width:i})};(0,a.useLayoutEffect)(()=>{t&&!V&&z()},[t,V,U]),(0,a.useEffect)(()=>{if(!t)return;let e=e=>{"Escape"===e.key&&i()},r=e=>{var t,r,a;let o=e.target;!(!o||(null===(t=M.current)||void 0===t?void 0:t.contains(o))||(null===(r=o.closest)||void 0===r?void 0:r.call(o,"[data-create-settings-trigger]")))&&(null!==(a=o.closest)&&void 0!==a&&a.call(o,"[data-voice-library-menu]")||i())},a=()=>{V||z()};document.addEventListener("keydown",e),window.addEventListener("resize",a),window.addEventListener("scroll",a,!0);let o=window.setTimeout(()=>{document.addEventListener("mousedown",r,!0)},0);return()=>{window.clearTimeout(o),document.removeEventListener("keydown",e),document.removeEventListener("mousedown",r,!0),window.removeEventListener("resize",a),window.removeEventListener("scroll",a,!0)}},[t,i,V,U]);let O=$||f(E);if(!t||!V&&!O)return null;let T=(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:(0,p.cn)("fixed inset-0 z-[200]",V?"bg-[color-mix(in_oklch,var(--itv-bg)_55%,transparent)] backdrop-blur-[2px]":"bg-transparent"),"aria-hidden":!0,onClick:i}),(0,r.jsxs)("div",{ref:M,className:(0,p.cn)("z-[201] flex flex-col overflow-hidden border border-itv-border bg-itv-surface shadow-[0_-12px_40px_oklch(0%_0_0_/_0.4)]",V?"fixed inset-x-0 bottom-0 max-h-[min(78dvh,560px)] rounded-t-2xl border-b-0":"fixed max-h-[70vh] rounded-itv border"),style:!V&&K?{bottom:K.bottom,left:K.left,width:K.width}:void 0,role:"dialog","aria-label":q("settings"),"aria-modal":"true",children:[V&&(0,r.jsx)("div",{className:"flex shrink-0 justify-center pb-1 pt-2.5","aria-hidden":!0,children:(0,r.jsx)("span",{className:"h-1 w-9 rounded-full bg-[color-mix(in_oklch,var(--itv-muted)_45%,transparent)]"})}),(0,r.jsxs)("div",{className:(0,p.cn)("flex shrink-0 items-center justify-between border-b border-[color-mix(in_oklch,var(--itv-border)_70%,transparent)]",V?"px-4 pb-2.5 pt-1":"px-4 py-3"),children:[(0,r.jsx)("span",{className:"text-[15px] font-semibold tracking-tight text-itv-fg",children:q("settings")}),(0,r.jsx)("button",{type:"button",className:"grid h-8 w-8 place-items-center rounded-itv text-itv-muted transition-colors hover:bg-[color-mix(in_oklch,var(--itv-surface-2)_90%,transparent)] hover:text-itv-fg","aria-label":q("close"),onClick:i,children:(0,r.jsx)("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":!0,children:(0,r.jsx)("path",{d:"M18 6L6 18M6 6l12 12"})})})]}),(0,r.jsx)("div",{className:(0,p.cn)("min-h-0 flex-1 overflow-y-auto overscroll-contain","px-4 py-3"),children:(0,r.jsxs)("div",{className:"w-full",children:[V&&(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[R.length>1?(0,r.jsxs)("section",{children:[(0,r.jsx)(w,{children:q("sectionType")}),(0,r.jsx)(_,{children:R.map(e=>(0,r.jsx)(b,{selected:g===e.id,onClick:()=>j(e.id),children:e.label},e.id))})]}):null,(0,r.jsxs)("section",{children:[(0,r.jsx)(w,{children:q("sectionModel")}),(0,r.jsx)(_,{children:S.map(e=>(0,r.jsxs)(b,{selected:k===e.id,onClick:()=>N(e.id),children:[(0,r.jsx)("span",{children:e.label}),P||(0,d.ut)(e)?null:(0,r.jsx)(s.a,{})]},e.id))})]}),$&&(0,r.jsxs)("section",{children:[(0,r.jsx)(w,{children:q("sectionVoice")}),(0,r.jsx)("div",{className:"overflow-hidden rounded-itv border border-itv-border bg-itv-surface-2 pt-3",children:(0,r.jsx)(x.X,{options:W,value:I.voiceId,labels:D,onChange:e=>L(t=>({...t,voiceId:e}))})})]}),$&&(0,r.jsxs)("section",{children:[(0,r.jsx)(w,{children:q("sectionEmotion")}),(0,r.jsx)("div",{className:"grid grid-cols-2 gap-1",children:h.pS.map(e=>(0,r.jsx)(b,{selected:I.emotion===e,onClick:()=>L(t=>({...t,emotion:e})),children:D.emotions[e]},e))})]}),($||F.length>0||O)&&(0,r.jsxs)("section",{children:[(0,r.jsx)(w,{children:q("sectionParameters")}),$?(0,r.jsx)(h.Es,{form:I,setForm:L,labels:D}):(0,r.jsx)(m.Z,{model:C,form:I,setForm:L,fields:F,layout:"rows"}),!$&&O&&(0,r.jsx)("div",{className:(0,p.cn)(F.length>0&&"mt-3 border-t border-[color-mix(in_oklch,var(--itv-border)_55%,transparent)] pt-2.5"),children:(0,r.jsx)(y,{model:C,form:I,setForm:L,advancedFields:E,dense:!0})})]})]}),!V&&O&&($?(0,r.jsx)(h.Es,{form:I,setForm:L,labels:D}):(0,r.jsx)(y,{model:C,form:I,setForm:L,advancedFields:E}))]})}),(0,r.jsx)("div",{className:"shrink-0 border-t border-itv-border px-4 pb-[max(0.75rem,env(safe-area-inset-bottom))] pt-3",children:(0,r.jsx)("button",{type:"button",className:"inline-flex w-full min-h-11 items-center justify-center rounded-itv border border-[color-mix(in_oklch,var(--itv-accent)_80%,var(--itv-accent-deep))] bg-[linear-gradient(135deg,var(--itv-accent),var(--itv-accent-deep))] px-4 text-[15px] font-semibold text-itv-accent-on transition-opacity hover:opacity-95",onClick:c,children:q("confirm")})})]})]});return"undefined"!=typeof document?(0,o.createPortal)(T,document.body):T}},8578:function(e,t,i){i.d(t,{pS:function(){return l},Es:function(){return c},ZR:function(){return s}});var r=i(57437);i(2265);var a=i(71422),o=i(84665),n=i(13435);let l=["auto","happy","sad","angry","fearful","disgusted","surprised","calm"];function s(e){let{voices:t,form:i,setForm:s,labels:d,dropdownSide:c="top"}=e;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.Z,{options:t,value:i.voiceId,onChange:e=>s(t=>({...t,voiceId:e})),labels:d}),(0,r.jsx)(o.Z,{selectId:"dock-emotion",side:c,label:d.emotions[i.emotion],value:i.emotion,options:l.map(e=>({id:e,label:d.emotions[e]})),onChange:e=>s(t=>({...t,emotion:e})),ariaLabel:d.emotion,leading:(0,r.jsx)(a.Z,{className:"h-3.5 w-3.5 shrink-0 text-itv-accent-bright","aria-hidden":!0})})]})}function d(e){let{label:t,value:i,min:a,max:o,step:n,onChange:l}=e;return(0,r.jsxs)("label",{className:"block py-2.5",children:[(0,r.jsxs)("span",{className:"mb-2 flex items-center justify-between gap-3 text-[12px] font-medium text-itv-muted",children:[(0,r.jsx)("span",{children:t}),(0,r.jsx)("output",{className:"tabular-nums text-itv-fg",children:i})]}),(0,r.jsx)("input",{type:"range",min:a,max:o,step:n,value:i,className:"h-1.5 w-full cursor-pointer accent-[var(--itv-accent)]","aria-label":t,onChange:e=>l(Number(e.target.value))})]})}function c(e){let{form:t,setForm:i,labels:a}=e;return(0,r.jsxs)("div",{className:"flex flex-col",children:[(0,r.jsx)(d,{label:a.speed,value:t.speed,min:.5,max:2,step:.1,onChange:e=>i(t=>({...t,speed:e}))}),(0,r.jsx)(d,{label:a.volume,value:t.volume,min:1,max:10,step:1,onChange:e=>i(t=>({...t,volume:e}))}),(0,r.jsx)(d,{label:a.pitch,value:t.pitch,min:-12,max:12,step:1,onChange:e=>i(t=>({...t,pitch:e}))})]})}},13435:function(e,t,i){i.d(t,{X:function(){return v},Z:function(){return p}});var r=i(57437),a=i(2265),o=i(54887),n=i(40875),l=i(2988),s=i(94508),d=i(53843),c=i(28199);let u=["male","female","neutral"];function m(e){let{label:t,value:i,options:l,onChange:d}=e,[c,u]=(0,a.useState)(!1),m=(0,a.useRef)(null),v=(0,a.useRef)(null),p=(0,a.useRef)(null),[h,x]=(0,a.useState)(null);(0,a.useLayoutEffect)(()=>
1{if(!c){x(null);return}let e=v.current;if(!e)return;let t=()=>{let t=e.getBoundingClientRect(),i=window.innerHeight-t.bottom-12,r=t.top-12,a=i>=120||i>=r,o=Math.min(200,Math.max(96,a?i-4:r-4)),n=Math.max(t.width,148);a?x({position:"fixed",top:t.bottom+4,left:Math.min(t.left,window.innerWidth-n-12),width:n,maxHeight:o}):x({position:"fixed",bottom:window.innerHeight-t.top+4,left:Math.min(t.left,window.innerWidth-n-12),width:n,maxHeight:o})};return t(),window.addEventListener("resize",t),window.addEventListener("scroll",t,!0),()=>{window.removeEventListener("resize",t),window.removeEventListener("scroll",t,!0)}},[c,l.length]),(0,a.useEffect)(()=>{if(!c)return;let e=e=>{var t,i;let r=e.target;(null===(t=m.current)||void 0===t?void 0:t.contains(r))||(null===(i=p.current)||void 0===i?void 0:i.contains(r))||u(!1)};return document.addEventListener("pointerdown",e,!0),()=>document.removeEventListener("pointerdown",e,!0)},[c]);let g=c&&h&&"undefined"!=typeof document?(0,r.jsx)("div",{ref:p,role:"listbox","data-voice-library-menu":"",style:{position:h.position,top:h.top,bottom:h.bottom,left:h.left,width:h.width},className:"z-[2200] overflow-hidden rounded-[calc(var(--itv-radius)-1px)] border border-itv-border bg-[oklch(15%_0.013_84)] shadow-[0_10px_28px_oklch(0%_0_0_/_0.55)]",onMouseDown:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:(0,r.jsx)("div",{className:"overflow-y-auto overscroll-none bg-[oklch(15%_0.013_84)] p-1 [scrollbar-width:thin]",style:{maxHeight:h.maxHeight},children:l.map(e=>(0,r.jsx)("button",{type:"button",role:"option","aria-selected":e.value===i,className:(0,s.cn)("flex w-full items-center rounded-[calc(var(--itv-radius)-2px)] px-2.5 py-1.5 text-left text-[11px] transition-colors",e.value===i?"bg-[color-mix(in_oklch,var(--itv-accent)_16%,oklch(15%_0.013_84))] font-medium text-itv-accent-bright":"bg-transparent text-itv-fg hover:bg-[color-mix(in_oklch,var(--itv-accent)_10%,oklch(15%_0.013_84))]"),onClick:()=>{d(e.value),u(!1)},children:(0,r.jsx)("span",{className:"min-w-0 truncate",children:e.label})},e.value))})}):null;return(0,r.jsxs)("div",{ref:m,className:"w-full min-w-0",children:[(0,r.jsxs)("button",{ref:v,type:"button","aria-haspopup":"listbox","aria-expanded":c,className:(0,s.cn)("inline-flex h-9 w-full min-w-0 items-center justify-between gap-1.5 rounded-[calc(var(--itv-radius)-1px)] border border-solid bg-itv-surface-2 px-2.5 text-[12px] text-itv-fg outline-none transition-colors","[border-color:color-mix(in_oklch,var(--itv-accent-bright)_45%,var(--itv-border))]","hover:[border-color:color-mix(in_oklch,var(--itv-accent-bright)_58%,var(--itv-border))] hover:bg-[color-mix(in_oklch,var(--itv-accent)_8%,var(--itv-surface-2))]","focus-visible:[border-color:color-mix(in_oklch,var(--itv-accent-bright)_62%,var(--itv-border))]",c&&"[border-color:color-mix(in_oklch,var(--itv-accent-bright)_65%,var(--itv-border))] bg-[color-mix(in_oklch,var(--itv-accent)_10%,var(--itv-surface-2))]"),onClick:()=>u(e=>!e),children:[(0,r.jsx)("span",{className:"min-w-0 truncate",children:t}),(0,r.jsx)(n.Z,{"aria-hidden":!0,className:(0,s.cn)("h-3.5 w-3.5 shrink-0 text-itv-muted transition-transform",c&&"rotate-180 text-itv-accent-bright")})]}),g?(0,o.createPortal)(g,document.body):null]})}function v(e){let{options:t,value:i,onChange:o,labels:n}=e,l=t.find(e=>e.value===i),c=Array.from(new Set(t.map(e=>e.language))).sort(),v=(null==l?void 0:l.language)&&c.includes(l.language)?l.language:"English",[p,h]=(0,a.useState)(v),[x,g]=(0,a.useState)((null==l?void 0:l.gender)||"male"),f={male:n.male,female:n.female,neutral:n.neutral},b=t.filter(e=>e.language===p&&e.gender===x);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"border-b border-itv-border px-4 pb-3.5 pt-1",children:(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsx)("p",{className:"mb-2 text-[10px] font-medium uppercase tracking-[0.1em] text-itv-muted",children:n.language}),(0,r.jsx)(m,{label:p,value:p,onChange:h,options:c.map(e=>({value:e,label:e}))})]}),(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsx)("p",{className:"mb-2 text-[10px] font-medium uppercase tracking-[0.1em] text-itv-muted",children:n.gendersLabel}),(0,r.jsx)(m,{label:f[x],value:x,onChange:e=>g(e),options:u.map(e=>({value:e,label:f[e]}))})]})]})}),(0,r.jsx)("div",{className:"px-4 pb-1.5 pt-3",children:(0,r.jsx)("p",{className:"text-[11px] text-itv-muted",children:n.featuredVoices})}),(0,r.jsx)("div",{className:"grid h-[200px] auto-rows-[58px] grid-cols-1 content-start gap-1.5 overflow-y-auto p-2 sm:grid-cols-2",children:b.map(e=>{var t;let a=(t=e.language,d.pG[t]??"\uD83C\uDF10");return(0,r.jsxs)("button",{type:"button","aria-pressed":e.value===i,className:(0,s.cn)("flex h-[58px] min-w-0 items-center gap-2.5 rounded-[calc(var(--itv-radius)-1px)] border border-solid px-2.5 text-left transition-colors",e.value===i?"[border-color:color-mix(in_oklch,var(--itv-accent)_45%,var(--itv-border))] bg-[color-mix(in_oklch,var(--itv-accent)_14%,var(--itv-surface-2))]":"border-itv-border bg-itv-surface-2 hover:[border-color:color-mix(in_oklch,var(--itv-accent)_30%,var(--itv-border))]"),onClick:()=>o(e.value),children:[(0,r.jsx)("span",{className:"grid h-8 w-8 shrink-0 place-items-center rounded-full border border-itv-border bg-itv-surface text-[14px] leading-none","aria-hidden":!0,
1children:a}),(0,r.jsxs)("span",{className:"min-w-0",children:[(0,r.jsx)("span",{className:"block truncate text-[12px] font-medium text-itv-fg",children:e.label}),(0,r.jsxs)("span",{className:"block truncate text-[10px] text-[color-mix(in_oklch,var(--itv-accent)_70%,var(--itv-muted))]",children:[e.language," \xb7 ",f[e.gender]]}),e.tone?(0,r.jsx)("span",{className:"block truncate text-[10px] text-itv-muted",children:e.tone}):null]})]},e.value)})})]})}function p(e){let{options:t,value:i,onChange:s,labels:d}=e,u=t.find(e=>e.value===i),{open:m,onOpenChange:p}=(0,c.A)("dock-voice"),[h,x]=(0,a.useState)(!1),g=p?!!m:h,f=e=>{p?p(e):x(e)},[b,w]=(0,a.useState)(null),_=(0,a.useRef)(null),y=(0,a.useRef)(null),j=()=>{var e;f(!1),null===(e=_.current)||void 0===e||e.focus()},k=()=>{let e=_.current;if(!e)return;let t=e.getBoundingClientRect(),i=Math.min(520,window.innerWidth-24),r=Math.max(12,Math.min(t.left,window.innerWidth-i-12));w({bottom:window.innerHeight-t.top+10,left:r,width:i})};(0,a.useLayoutEffect)(()=>{if(!g){w(null);return}k()},[g]),(0,a.useLayoutEffect)(()=>{var e;g&&b&&(null===(e=y.current)||void 0===e||e.focus())},[g,b]),(0,a.useEffect)(()=>{if(!g)return;let e=e=>{"Escape"===e.key&&j()},t=e=>{var t,i;let r=e.target,a=r instanceof Element?r:r.parentElement,o=!!(null==a?void 0:a.closest("[data-voice-library-menu]"));(null===(t=y.current)||void 0===t?void 0:t.contains(r))||(null===(i=_.current)||void 0===i?void 0:i.contains(r))||o||j()},i=()=>k();return document.addEventListener("keydown",e),document.addEventListener("pointerdown",t,!0),window.addEventListener("resize",i),window.addEventListener("scroll",i,!0),()=>{document.removeEventListener("keydown",e),document.removeEventListener("pointerdown",t,!0),window.removeEventListener("resize",i),window.removeEventListener("scroll",i,!0)}},[g]);let N=g&&b?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{"aria-hidden":!0,className:"fixed inset-0 z-[2190]",onPointerDown:e=>{e.preventDefault(),j()}}),(0,r.jsxs)("div",{ref:y,tabIndex:-1,role:"dialog","aria-label":d.voiceLibrary,className:"fixed z-[2200] max-h-[min(70vh,520px)] overflow-hidden rounded-itv border border-itv-border bg-itv-surface shadow-[0_18px_50px_oklch(0%_0_0_/_0.42)] outline-none",style:b,children:[(0,r.jsx)("div",{className:"border-b border-itv-border px-4 py-2.5",children:(0,r.jsx)("p",{className:"text-[11px] font-semibold uppercase tracking-[0.1em] text-itv-muted",children:d.voiceLibrary})}),(0,r.jsx)(v,{options:t,value:i,labels:d,onChange:e=>{s(e),j()}})]})]}):null;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("button",{ref:_,type:"button","aria-haspopup":"dialog","aria-expanded":g,"aria-label":d.voiceLibrary,className:"inline-flex h-8 max-w-[190px] min-w-0 items-center gap-1.5 rounded-[calc(var(--itv-radius)-2px)] border border-solid border-itv-border bg-[color-mix(in_oklch,var(--itv-surface-2)_88%,transparent)] px-2.5 text-[12px] text-itv-fg transition-colors hover:[border-color:color-mix(in_oklch,var(--itv-accent-bright)_35%,var(--itv-border))]",onClick:()=>f(!g),children:[(0,r.jsx)(l.Z,{className:"h-3.5 w-3.5 shrink-0 text-itv-accent-bright","aria-hidden":!0}),(0,r.jsx)("span",{className:"truncate",children:(null==u?void 0:u.label)||d.voiceLibrary}),(0,r.jsx)(n.Z,{className:"h-3.5 w-3.5 shrink-0 text-itv-muted","aria-hidden":!0})]}),"undefined"!=typeof document?(0,o.createPortal)(N,document.body):null]})}},87633:function(e,t,i){i.d(t,{B3:function(){return v},Cp:function(){return c},GQ:function(){return u},Nh:function(){return p},kW:function(){return l},ox:function(){return n},sK:function(){return d},wg:function(){return s}});var r=i(45239),a=i(18592);let o=[{id:"type",group:"nav",requires:"always"},{id:"model",group:"nav",requires:"always"},{id:"aspect_ratio",group:"modelParams",requires:"allow_aspect_ratio"},{id:"duration",group:"modelParams",requires:"duration"},{id:"quality",group:"modelParams",requires:"allow_quality"},{id:"resolution",group:"modelParams",requires:"allow_resolution"},{id:"num_images",group:"modelParams",requires:"allow_num_images"},{id:"seed",group:"advanced",requires:"allow_seed"},{id:"generate_audio",group:"advanced",requires:"allow_audio"},{id:"custom_props",group:"advanced",requires:"custom_props"},{id:"first_frame",group:"media",requires:"allow_first_frame"},{id:"last_frame",group:"media",requires:"allow_last_frame"},{id:"images",group:"media",requires:"allow_images"},{id:"image_urls",group:"media",requires:"allow_image"},{id:"video",group:"media",requires:"allow_video"},{id:"videos",group:"media",requires:"allow_videos"},{id:"audio_upload",group:"media",requires:"allow_audio_upload"},{id:"voice",group:"nav",requires:"voice_options"},{id:"emotion",group:"nav",requires:"emotion"},{id:"speech_settings",group:"advanced",requires:"speech_settings"}],n=[{id:"image",labelKey:"modes.image",shortLabelKey:"modes.imageShort",enabled:!0,placeholderKey:"placeholders.image",types:[{id:"text-image-to-image",labelKey:"types.textImageToImage",kind:"image",shellSlots:["image"],getSeries:()=>(0,r.Ip)("text-image-to-image")},{id:"ai-photo-editor",labelKey:"types.aiPhotoEditor",kind:"image",shellSlots:["image"],getSeries:()=>(0,r.Ip)("ai-photo-editor")}]},{id:"video",labelKey:"modes.video",shortLabelKey:"modes.videoShort",enabled:!0,placeholderKey:"placeholders.video",types:[{id:"text-image-to-vi
1deo",labelKey:"types.textImageToVideo",kind:"video",shellSlots:["firstFrame"],getSeries:()=>(0,r.Ip)("text-image-to-video")},{id:"reference-to-video",labelKey:"types.referenceToVideo",kind:"video",shellSlots:["images","video"],getSeries:()=>(0,r.Ip)("reference-to-video")},{id:"frames-to-video",labelKey:"types.framesToVideo",kind:"video",shellSlots:["firstFrame","lastFrame"],getSeries:()=>(0,r.Ip)("frames-to-video")}]},{id:"avatar",labelKey:"modes.avatar",shortLabelKey:"modes.avatarShort",enabled:!0,placeholderKey:"placeholders.avatar",types:[{id:"talking-avatar",labelKey:"types.talkingAvatar",kind:"video",shellSlots:["firstFrame","audio"],getSeries:()=>(0,r.Ip)("talking-avatar")}]},{id:"audio",labelKey:"modes.audio",shortLabelKey:"modes.audioShort",enabled:!0,placeholderKey:"placeholders.audio",types:[{id:"text-to-speech",labelKey:"types.textToSpeech",kind:"audio",shellSlots:[],getSeries:()=>(0,r.Ip)("text-to-speech")}]}],l=["image","video","avatar","audio"];function s(e){return n.find(t=>t.id===e)||n[0]}function d(e,t){return s(e).types.find(e=>e.id===t)}function c(e){var t;return(null===(t=s(e).types[0])||void 0===t?void 0:t.id)??null}function u(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e)return null;let i=null;for(let r of n)for(let o of r.types){let n=o.getSeries(),l=(0,a.dz)(n,e);if(!l)continue;let s=function(e,t){switch(e){case"frames-to-video":return t.hasLastFrame?20:2;case"reference-to-video":return t.hasRefMedia?20:2;case"text-image-to-video":return t.hasLastFrame||t.hasRefMedia?4:12;case"talking-avatar":return t.hasAudio?20:8;case"ai-photo-editor":return t.hasImages?10:3;case"text-image-to-image":return t.hasImages?14:12;case"text-to-speech":return 12;default:return 1}}(o.id,t);(!i||s>i.score)&&(i={mode:r.id,typeId:o.id,seriesId:l.id,score:s})}return i?{mode:i.mode,typeId:i.typeId,seriesId:i.seriesId}:null}let m={image:"image_urls",images:"images",firstFrame:"first_frame",lastFrame:"last_frame",video:"video",videos:"videos",audio:"audio_upload"};function v(e){let{typeDef:t,seriesId:i,form:n}=e,l=t.getSeries(),s=(0,a.f4)(l,i)||l[0]||{id:"",label:"",routes:[{modelId:""}]},d=(0,a.Ip)(n),c=s.routes.length?(0,a.$E)(s,d):"",u=c?(0,r.z4)(t.id,c,s.label):{id:"",label:""},v=(0,a.Ym)(t.shellSlots,s),p=t.shellSlots.map(e=>({id:m[e],group:"media",requires:"always"})),h=o.filter(e=>"type"===e.id||"model"===e.id||"media"!==e.group&&function(e,t){if(!t||"always"===t)return!0;switch(t){case"allow_aspect_ratio":return Array.isArray(e.allow_aspect_ratio)&&e.allow_aspect_ratio.length>0;case"duration":return Array.isArray(e.duration)&&e.duration.length>0||!!e.useVideoDuration;case"allow_quality":return Array.isArray(e.allow_quality)&&e.allow_quality.length>0;case"allow_resolution":return Array.isArray(e.allow_resolution)&&e.allow_resolution.length>0;case"allow_num_images":return Array.isArray(e.allow_num_images)&&e.allow_num_images.length>0;case"allow_seed":return!!e.allow_seed;case"allow_audio":return!!e.allow_audio;case"allow_enable_safety_checker":return!1!==e.allow_enable_safety_checker;case"custom_props":return Array.isArray(e.custom_props)&&e.custom_props.length>0;case"allow_first_frame":return!!e.allow_first_frame;case"allow_last_frame":return!!e.allow_last_frame;case"allow_images":return!!e.allow_images;case"allow_image":return!!e.allow_image;case"allow_video":return!!e.allow_video;case"allow_videos":return!!e.allow_videos;case"allow_audio_upload":return!!e.allow_audio_upload;case"voice_options":return Array.isArray(e.voice_options)&&e.voice_options.length>0;case"emotion":return Array.isArray(e.custom_props)&&e.custom_props.some(e=>!!e&&"object"==typeof e&&"emotion"===e.key);case"speech_settings":return Array.isArray(e.custom_props)&&["speed","vol","pitch"].every(t=>e.custom_props.some(e=>!!e&&"object"==typeof e&&e.key===t));default:return!1}}(u,e.requires));return{typeDef:t,seriesList:l,currentSeries:s,currentModel:u,mediaShell:v,mediaFields:p,modelParamFields:h.filter(e=>"modelParams"===e.group),advancedFields:h.filter(e=>"advanced"===e.group),showPrompt:!u.noPrompt}}function p(e,t){return e.some(e=>e.id===t)}}}]);

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.