videobook 0.2.2 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/README.md +10 -10
  3. package/dist/book-manager.js +40 -2
  4. package/dist/command-reference.js +16 -2
  5. package/dist/env-secrets.js +7 -4
  6. package/dist/image-edit-models.js +1 -0
  7. package/dist/jobs/complete-provider-task.js +7 -1
  8. package/dist/jobs/generate-media.js +4 -0
  9. package/dist/jobs/render-project.js +124 -31
  10. package/dist/media/adapters/index.js +4 -0
  11. package/dist/media/adapters/machgen.js +48 -0
  12. package/dist/media/adapters/types.js +1 -0
  13. package/dist/media/catalog.js +83 -0
  14. package/dist/media/complete.js +1 -1
  15. package/dist/media/cost.js +79 -6
  16. package/dist/media/frontier-gaps.js +49 -0
  17. package/dist/media/frontier.js +30 -0
  18. package/dist/media/json-schema.js +7 -0
  19. package/dist/media/listing.js +9 -2
  20. package/dist/media/machgen.js +261 -0
  21. package/dist/media/model-id.js +1 -1
  22. package/dist/media/preview.js +2 -0
  23. package/dist/media/prompt-dialects.js +2 -0
  24. package/dist/media/ref-fields.js +11 -3
  25. package/dist/media/request.js +49 -0
  26. package/dist/media/seedance-draft.js +48 -0
  27. package/dist/media/wire.js +3 -0
  28. package/dist/notebook-action-catalog.js +5 -0
  29. package/dist/one-password.js +13 -7
  30. package/dist/provider-status-link.js +1 -1
  31. package/dist/provider-task-status.js +6 -3
  32. package/dist/provider-usage.js +24 -10
  33. package/dist/queue.js +3 -0
  34. package/dist/tools/commands.js +1 -1
  35. package/dist/tools/estimate-cost.js +7 -5
  36. package/dist/tools/provider-key-status.js +4 -0
  37. package/dist/tools/reconcile-project-work.js +69 -1
  38. package/dist/usage-providers.js +4 -0
  39. package/dist/workspace-action-catalog.js +1 -1
  40. package/package.json +14 -13
  41. package/ui/assets/{alive-captions-C48o6dfv.js → alive-captions-Bp6dxosy.js} +1 -1
  42. package/ui/assets/confirm-bodies-Ds1HtaGc.js +1 -0
  43. package/ui/assets/{fullscreen-4m0qtZ7w.js → fullscreen-BCeVHjvY.js} +1 -1
  44. package/ui/assets/{goal-ui-2pUWP_B2.js → goal-ui-DbAGwgMN.js} +2 -2
  45. package/ui/assets/index-D1d-F1y9.js +37 -0
  46. package/ui/assets/index-DWfR79lA.css +1 -0
  47. package/ui/assets/{inspector-CnKySYc5.js → inspector-BJTC0luH.js} +1 -1
  48. package/ui/assets/{jobs-ui-lRoS1MbL.js → jobs-ui-C1cbw-xG.js} +1 -1
  49. package/ui/assets/{music-video-BQnnPp-X.js → music-video-CWtxPlxq.js} +1 -1
  50. package/ui/assets/ui-CXDi5Omq.js +2 -0
  51. package/ui/assets/vendor-BFupLz37.js +19 -0
  52. package/ui/assets/{vendor-flow-zBavaNEW.js → vendor-flow-CKiuzaeM.js} +1 -1
  53. package/ui/assets/{vendor-mcp-DQ7EusT9.js → vendor-mcp-DQEeVZH0.js} +1 -1
  54. package/ui/assets/videobook-J-j9bSjM.js +20 -0
  55. package/ui/index.html +12 -12
  56. package/ui/assets/confirm-bodies-aq6Az8Md.js +0 -1
  57. package/ui/assets/index-DmDH4gYr.js +0 -37
  58. package/ui/assets/index-DzPAnCUj.css +0 -1
  59. package/ui/assets/ui-OHFUngrc.js +0 -2
  60. package/ui/assets/vendor-yctIZ9Dz.js +0 -19
  61. package/ui/assets/videobook-DZ58pKW5.js +0 -20
@@ -1 +1 @@
1
- import{c as F,j as t,a as A}from"./vendor-react-Dj7D1fD4.js";import{u as be,a as pe,V as Se,A as xe,P as Ne}from"./vendor-remotion-CH1HXrlc.js";import{ec as Ce,ed as ke,ee as we,ef as $e,eg as Pe,eh as de,ei as Te,ej as me,ek as Re,el as Ae,em as Me,en as _e,eo as Ee,ep as Oe,eq as fe,bw as We}from"./videobook-DZ58pKW5.js";import{g as Le,a6 as ze,_ as Fe,h as He,X as Ie}from"./vendor-icons-CGqhCIXV.js";import"./vendor-yctIZ9Dz.js";import"./vendor-mcp-DQ7EusT9.js";const Be={face:"#63c7d8",text:"#f0a860",graphic:"#f0a860"};function De(a){const e=F.c(25),{phrase:s,cue:n,settings:o,sourceWidth:c,sourceHeight:l}=a,{width:i,height:h}=pe();let r,f,m,d;if(e[0]!==h||e[1]!==s.id||e[2]!==s.regions||e[3]!==o||e[4]!==l||e[5]!==c||e[6]!==i){const j={sourceWidth:c,sourceHeight:l,targetWidth:i,targetHeight:h};let v;e[11]!==s.regions||e[12]!==o?(v=new Set($e(s.regions,o)),e[11]=s.regions,e[12]=o,e[13]=v):v=e[13];const C=v;let y;e[14]!==i?(y=Math.round(i/480),e[14]=i,e[15]=y):y=e[15],f=Math.max(2,y),r=xe,e[16]===Symbol.for("react.memo_cache_sentinel")?(m={pointerEvents:"none"},e[16]=m):m=e[16],d=s.regions.map((w,$)=>{const b=Pe(w,j);return t.jsx("div",{style:{position:"absolute",left:b.x*i,top:b.y*h,width:b.width*i,height:b.height*h,border:`${f}px dashed ${Be[w.kind]}`,opacity:C.has(w)?1:.4,borderRadius:f*2}},`${s.id}-${$}`)}),e[0]=h,e[1]=s.id,e[2]=s.regions,e[3]=o,e[4]=l,e[5]=c,e[6]=i,e[7]=r,e[8]=f,e[9]=m,e[10]=d}else r=e[7],f=e[8],m=e[9],d=e[10];let g;e[17]!==n.column||e[18]!==f?(g=t.jsx(Ue,{column:n.column,stroke:f}),e[17]=n.column,e[18]=f,e[19]=g):g=e[19];let u;return e[20]!==r||e[21]!==m||e[22]!==d||e[23]!==g?(u=t.jsxs(r,{style:m,children:[d,g]}),e[20]=r,e[21]=m,e[22]=d,e[23]=g,e[24]=u):u=e[24],u}function Ue(a){const e=F.c(7),{column:s,stroke:n}=a,o=`${Math.max(1,n/2)}px dashed rgba(114, 231, 170, 0.6)`,c=n*2;let l;return e[0]!==s.height||e[1]!==s.width||e[2]!==s.x||e[3]!==s.y||e[4]!==o||e[5]!==c?(l=t.jsx("div",{style:{position:"absolute",left:s.x,top:s.y,width:s.width,height:s.height,border:o,borderRadius:c}}),e[0]=s.height,e[1]=s.width,e[2]=s.x,e[3]=s.y,e[4]=o,e[5]=c,e[6]=l):l=e[6],l}function Ke(a){const e=F.c(34),{mediaUrl:s,sourceWidth:n,sourceHeight:o,cues:c,phrases:l,settings:i,showRegions:h}=a,r=be(),{fps:f,width:m,height:d}=pe();let g;e[0]!==d||e[1]!==o||e[2]!==n||e[3]!==m?(g=ke({sourceWidth:n,sourceHeight:o,targetWidth:m,targetHeight:d}),e[0]=d,e[1]=o,e[2]=n,e[3]=m,e[4]=g):g=e[4];const u=g,j=r/f;let v;e[5]!==c||e[6]!==j?(v=Ce(c,j),e[5]=c,e[6]=j,e[7]=v):v=e[7];const C=v;let y;e[8]!==C||e[9]!==l?(y=C?l.find(M=>M.id===C.id):void 0,e[8]=C,e[9]=l,e[10]=y):y=e[10];const w=y;let $;e[11]===Symbol.for("react.memo_cache_sentinel")?($={background:"#000000"},e[11]=$):$=e[11];let b;e[12]!==u.height||e[13]!==u.width||e[14]!==u.x||e[15]!==u.y?(b={position:"absolute",left:u.x,top:u.y,width:u.width,height:u.height},e[12]=u.height,e[13]=u.width,e[14]=u.x,e[15]=u.y,e[16]=b):b=e[16];let N;e[17]!==s||e[18]!==b?(N=t.jsx(Se,{src:s,style:b}),e[17]=s,e[18]=b,e[19]=N):N=e[19];let P;e[20]!==C||e[21]!==w||e[22]!==i||e[23]!==h||e[24]!==o||e[25]!==n?(P=h&&C&&w&&t.jsx(De,{phrase:w,cue:C,settings:i,sourceWidth:n,sourceHeight:o}),e[20]=C,e[21]=w,e[22]=i,e[23]=h,e[24]=o,e[25]=n,e[26]=P):P=e[26];let p;e[27]!==c||e[28]!==i?(p=t.jsx(we,{cues:c,settings:i,strokeWidth:6,strokeColor:"#000000",shadowBlur:6,shadowOpacity:60}),e[27]=c,e[28]=i,e[29]=p):p=e[29];let k;return e[30]!==N||e[31]!==P||e[32]!==p?(k=t.jsxs(xe,{style:$,children:[N,P,p]}),e[30]=N,e[31]=P,e[32]=p,e[33]=k):k=e[33],k}const ue=[{id:"stack",label:"Stack",hint:"Words land one by one and build a stacked block beside the subject, each line sized to fill the column."},{id:"punch",label:"Punch",hint:"One word at a time, as big as the free space allows. Best on fast verses."},{id:"karaoke",label:"Karaoke",hint:"The whole stacked phrase shows dimmed and lights up word by word."}],Ve=[{id:"pop",label:"Pop"},{id:"slam",label:"Slam"},{id:"rise",label:"Rise"}],qe=[{name:"Green",color:"#72E7AA"},{name:"Pink",color:"#F0B9D0"},{name:"Cyan",color:"#63C7D8"},{name:"Amber",color:"#E7C372"}];function Ge(a,e){if(!a.drifted)return de(a.start);const s=a.driftMs>0?"+":"";return e?`${de(a.start)} · snapped`:`${de(a.start)} · ${s}${a.driftMs}ms`}function Xe(a){const e=F.c(21),{rows:s,phraseLabels:n,activePhrase:o,time:c,snapped:l,onSeek:i}=a;let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx("h3",{children:"Transcript"}),e[0]=h):h=e[0];let r;e[1]!==s.length?(r=t.jsxs("header",{className:"alive-panel-header",children:[h,t.jsxs("p",{children:[s.length," words · timed to the vocal"]})]}),e[1]=s.length,e[2]=r):r=e[2];let f;if(e[3]!==o||e[4]!==i||e[5]!==n||e[6]!==s||e[7]!==l||e[8]!==c){let g;e[10]!==o||e[11]!==i||e[12]!==s||e[13]!==l||e[14]!==c?(g=(u,j)=>t.jsxs("div",{className:"alive-phrase","data-active":j===o||void 0,children:[t.jsxs("div",{className:"alive-phrase-head",children:[t.jsxs("span",{children:["Phrase ",j+1]}),t.jsx("span",{children:u})]}),t.jsx("div",{className:"alive-phrase-words",children:s.filter(v=>v.phraseIndex===j).map(v=>t.jsxs("button",{type:"button",className:"alive-word","data-active":c>=v.start&&c<v.end||void 0,"data-drifted":v.drifted&&!l||void 0,onClick:()=>i(v.start+.03),children:[t.jsx("span",{children:v.text}),t.jsx("small",{children:Ge(v,l)})]},v.key))})]},`${j}-${u}`),e[10]=o,e[11]=i,e[12]=s,e[13]=l,e[14]=c,e[15]=g):g=e[15],f=n.map(g),e[3]=o,e[4]=i,e[5]=n,e[6]=s,e[7]=l,e[8]=c,e[9]=f}else f=e[9];let m;e[16]!==f?(m=t.jsx("div",{className:"alive-transcript-list",children:f}),e[16]=f,e[17]=m):m=e[17];let d;return e[18]!==r||e[19]!==m?(d=t.jsxs("section",{className:"alive-panel alive-transcript","aria-label":"Transcript",children:[r,m]}),e[18]=r,e[19]=m,e[20]=d):d=e[20],d}function ve(a){const e=F.c(10),{label:s,options:n,value:o,onChange:c}=a;let l;if(e[0]!==c||e[1]!==n||e[2]!==o){let h;e[4]!==c||e[5]!==o?(h=r=>t.jsx("button",{type:"button","aria-pressed":r.id===o,onClick:()=>c(r.id),children:r.label},r.id),e[4]=c,e[5]=o,e[6]=h):h=e[6],l=n.map(h),e[0]=c,e[1]=n,e[2]=o,e[3]=l}else l=e[3];let i;return e[7]!==s||e[8]!==l?(i=t.jsx("div",{className:"alive-segmented",role:"group","aria-label":s,children:l}),e[7]=s,e[8]=l,e[9]=i):i=e[9],i}function re(a){const e=F.c(8),{checked:s,onChange:n,children:o}=a;let c;e[0]!==n?(c=h=>n(h.target.checked),e[0]=n,e[1]=c):c=e[1];let l;e[2]!==s||e[3]!==c?(l=t.jsx("input",{type:"checkbox",checked:s,onChange:c}),e[2]=s,e[3]=c,e[4]=l):l=e[4];let i;return e[5]!==o||e[6]!==l?(i=t.jsxs("label",{className:"alive-toggle",children:[l,o]}),e[5]=o,e[6]=l,e[7]=i):i=e[7],i}function Ye(a){const e=F.c(69),{settings:s,showRegions:n,regionsAnalyzed:o,working:c,onChange:l,onShowRegions:i,onReanalyze:h}=a;let r;e[0]!==s.style?(r=ue.find(S=>S.id===s.style)?.hint,e[0]=s.style,e[1]=r):r=e[1];const f=r;let m;e[2]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx("h4",{children:"Style"}),e[2]=m):m=e[2];let d;e[3]!==l?(d=S=>l({style:S}),e[3]=l,e[4]=d):d=e[4];let g;e[5]!==s.style||e[6]!==d?(g=t.jsx(ve,{label:"Caption style",options:ue,value:s.style,onChange:d}),e[5]=s.style,e[6]=d,e[7]=g):g=e[7];let u;e[8]!==f?(u=t.jsx("p",{className:"alive-hint",children:f}),e[8]=f,e[9]=u):u=e[9];let j;e[10]!==g||e[11]!==u?(j=t.jsxs("div",{className:"alive-field",children:[m,g,u]}),e[10]=g,e[11]=u,e[12]=j):j=e[12];let v;e[13]===Symbol.for("react.memo_cache_sentinel")?(v=t.jsx("h4",{children:"Word entrance"}),e[13]=v):v=e[13];let C;e[14]!==l?(C=S=>l({motion:S}),e[14]=l,e[15]=C):C=e[15];let y;e[16]!==s.motion||e[17]!==C?(y=t.jsxs("div",{className:"alive-field",children:[v,t.jsx(ve,{label:"Word entrance",options:Ve,value:s.motion,onChange:C})]}),e[16]=s.motion,e[17]=C,e[18]=y):y=e[18];let w;e[19]===Symbol.for("react.memo_cache_sentinel")?(w=t.jsx("h4",{children:"Frame awareness"}),e[19]=w):w=e[19];let $;e[20]!==l?($=S=>l({avoidFaces:S}),e[20]=l,e[21]=$):$=e[21];let b;e[22]!==s.avoidFaces||e[23]!==$?(b=t.jsx(re,{checked:s.avoidFaces,onChange:$,children:"Keep words off faces"}),e[22]=s.avoidFaces,e[23]=$,e[24]=b):b=e[24];let N;e[25]!==l?(N=S=>l({avoidText:S}),e[25]=l,e[26]=N):N=e[26];let P;e[27]!==s.avoidText||e[28]!==N?(P=t.jsx(re,{checked:s.avoidText,onChange:N,children:"Keep words off on-screen text"}),e[27]=s.avoidText,e[28]=N,e[29]=P):P=e[29];let p;e[30]!==i||e[31]!==n?(p=t.jsx(re,{checked:n,onChange:i,children:"Show detected regions"}),e[30]=i,e[31]=n,e[32]=p):p=e[32];let k;e[33]!==o?(k=!o&&t.jsx("p",{className:"alive-hint alive-warning",children:"Face and text detection did not run, so stacks use the default columns. Set OPENAI_API_KEY and re-run the analysis."}),e[33]=o,e[34]=k):k=e[34];let M;e[35]!==b||e[36]!==P||e[37]!==p||e[38]!==k?(M=t.jsxs("div",{className:"alive-field",children:[w,b,P,p,k]}),e[35]=b,e[36]=P,e[37]=p,e[38]=k,e[39]=M):M=e[39];let D;e[40]===Symbol.for("react.memo_cache_sentinel")?(D=t.jsx("h4",{children:"Audio"}),e[40]=D):D=e[40];let O;e[41]!==l?(O=S=>l({energySizing:S}),e[41]=l,e[42]=O):O=e[42];let _;e[43]!==s.energySizing||e[44]!==O?(_=t.jsxs("div",{className:"alive-field",children:[D,t.jsx(re,{checked:s.energySizing,onChange:O,children:"Size words by vocal energy"})]}),e[43]=s.energySizing,e[44]=O,e[45]=_):_=e[45];let H;e[46]===Symbol.for("react.memo_cache_sentinel")?(H=t.jsx("h4",{children:"Hit color"}),e[46]=H):H=e[46];let W;e[47]!==l||e[48]!==s.hitColor?(W=qe.map(S=>t.jsx("button",{type:"button","aria-label":S.name,"aria-pressed":s.hitColor.toUpperCase()===S.color,onClick:()=>l({hitColor:S.color}),children:t.jsx("span",{style:{background:S.color}})},S.color)),e[47]=l,e[48]=s.hitColor,e[49]=W):W=e[49];let R;e[50]===Symbol.for("react.memo_cache_sentinel")?(R=t.jsx("span",{children:"Text"}),e[50]=R):R=e[50];let x;e[51]!==l?(x=S=>l({textColor:S.target.value.toUpperCase()}),e[51]=l,e[52]=x):x=e[52];let L;e[53]!==s.textColor||e[54]!==x?(L=t.jsxs("label",{className:"alive-color-input",children:[R,t.jsx("input",{type:"color",value:s.textColor,onChange:x})]}),e[53]=s.textColor,e[54]=x,e[55]=L):L=e[55];let I;e[56]!==W||e[57]!==L?(I=t.jsxs("div",{className:"alive-field",children:[H,t.jsxs("div",{className:"alive-swatches",children:[W,L]})]}),e[56]=W,e[57]=L,e[58]=I):I=e[58];let z;e[59]!==h||e[60]!==c?(z=t.jsx("div",{className:"alive-field",children:t.jsx("button",{type:"button",className:"alive-secondary",disabled:c,onClick:h,children:"Re-run analysis"})}),e[59]=h,e[60]=c,e[61]=z):z=e[61];let B;return e[62]!==M||e[63]!==_||e[64]!==I||e[65]!==z||e[66]!==j||e[67]!==y?(B=t.jsxs("section",{className:"alive-panel alive-settings","aria-label":"Caption settings",children:[j,y,M,_,I,z]}),e[62]=M,e[63]=_,e[64]=I,e[65]=z,e[66]=j,e[67]=y,e[68]=B):B=e[68],B}const Je=90;function U(a,e){return`${Math.max(0,a)/e*100}%`}function Qe(a,e,s){if(e.count===0)return`All ${s} words already sit on their vocal onsets`;if(a)return`${e.count} words snapped to their vocal onsets`;const n=e.minMs===e.maxMs?`${e.maxMs}`:`${e.minMs}–${e.maxMs}`;return`${e.count} words start ${n} ms off the vocal`}function Ze(a){const e=a>120?10:a>30?5:1,s=[];for(let n=0;n<=a;n+=e)s.push(n);return s}function et(a,e,s){const n=F.c(5),o=A.useRef(null);let c,l;return n[0]!==e||n[1]!==s||n[2]!==a?(c=()=>{const i=o.current;if(!i||!s)return;const h=a/e*i.scrollWidth;(h<i.scrollLeft||h>i.scrollLeft+i.clientWidth*.85)&&(i.scrollLeft=Math.max(0,h-i.clientWidth*.2))},l=[a,e,s],n[0]=e,n[1]=s,n[2]=a,n[3]=c,n[4]=l):(c=n[3],l=n[4]),A.useEffect(c,l),o}function tt(a){const e=F.c(105),{duration:s,fps:n,time:o,playing:c,envelope:l,rows:i,cues:h,activeCue:r,snapped:f,drift:m}=a,d=Math.max(s,.1),g=et(o,d,c);let u;e[0]!==a||e[1]!==d?(u=T=>{const E=T.currentTarget.getBoundingClientRect();a.onSeek((T.clientX-E.left)/E.width*d)},e[0]=a,e[1]=d,e[2]=u):u=e[2];const j=u;let v;e[3]!==a?(v=()=>a.onStep(-1),e[3]=a,e[4]=v):v=e[4];let C;e[5]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx(Le,{size:16}),e[5]=C):C=e[5];let y;e[6]!==v?(y=t.jsx("button",{type:"button","aria-label":"Previous frame",onClick:v,children:C}),e[6]=v,e[7]=y):y=e[7];const w=c?"Pause":"Play";let $;e[8]!==c?($=c?t.jsx(ze,{size:16}):t.jsx(Fe,{size:16}),e[8]=c,e[9]=$):$=e[9];let b;e[10]!==a.onTogglePlay||e[11]!==w||e[12]!==$?(b=t.jsx("button",{type:"button",className:"alive-play","aria-label":w,onClick:a.onTogglePlay,children:$}),e[10]=a.onTogglePlay,e[11]=w,e[12]=$,e[13]=b):b=e[13];let N;e[14]!==a?(N=()=>a.onStep(1),e[14]=a,e[15]=N):N=e[15];let P;e[16]===Symbol.for("react.memo_cache_sentinel")?(P=t.jsx(He,{size:16}),e[16]=P):P=e[16];let p;e[17]!==N?(p=t.jsx("button",{type:"button","aria-label":"Next frame",onClick:N,children:P}),e[17]=N,e[18]=p):p=e[18];let k;e[19]!==o?(k=de(o),e[19]=o,e[20]=k):k=e[20];let M;e[21]!==k?(M=t.jsx("strong",{className:"alive-clock",children:k}),e[21]=k,e[22]=M):M=e[22];const D=Math.floor(o*n),O=Math.floor(d*n);let _;e[23]!==D||e[24]!==O?(_=t.jsxs("span",{className:"alive-muted",children:["frame ",D," / ",O]}),e[23]=D,e[24]=O,e[25]=_):_=e[25];let H;e[26]===Symbol.for("react.memo_cache_sentinel")?(H=t.jsx("span",{className:"alive-spacer"}),e[26]=H):H=e[26];const W=m.count>0&&!f||void 0;let R;e[27]!==m||e[28]!==i.length||e[29]!==f?(R=Qe(f,m,i.length),e[27]=m,e[28]=i.length,e[29]=f,e[30]=R):R=e[30];let x;e[31]!==W||e[32]!==R?(x=t.jsx("span",{className:"alive-drift","data-drifted":W,children:R}),e[31]=W,e[32]=R,e[33]=x):x=e[33];const L=f?"alive-secondary":"alive-primary alive-warn",I=m.count===0,z=f?"Use transcript timing":"Snap words to audio";let B;e[34]!==a.onToggleSnap||e[35]!==L||e[36]!==I||e[37]!==z?(B=t.jsx("button",{type:"button",className:L,disabled:I,onClick:a.onToggleSnap,children:z}),e[34]=a.onToggleSnap,e[35]=L,e[36]=I,e[37]=z,e[38]=B):B=e[38];let S;e[39]!==M||e[40]!==_||e[41]!==x||e[42]!==B||e[43]!==y||e[44]!==b||e[45]!==p?(S=t.jsxs("div",{className:"alive-transport",children:[y,b,p,M,_,H,x,B]}),e[39]=M,e[40]=_,e[41]=x,e[42]=B,e[43]=y,e[44]=b,e[45]=p,e[46]=S):S=e[46];let ne;e[47]===Symbol.for("react.memo_cache_sentinel")?(ne=t.jsxs("div",{className:"alive-lane-labels","aria-hidden":"true",children:[t.jsx("span",{className:"alive-lane-ruler"}),t.jsx("span",{className:"alive-lane-audio",children:"Audio"}),t.jsx("span",{className:"alive-lane-words",children:"Words"}),t.jsx("span",{className:"alive-lane-stacks",children:"Stacks"})]}),e[47]=ne):ne=e[47];const he=d*Je;let K;e[48]!==he?(K={minWidth:he},e[48]=he,e[49]=K):K=e[49];let V;e[50]!==d?(V=Ze(d).map(T=>t.jsxs("span",{style:{left:U(T,d)},children:[T,"s"]},T)),e[50]=d,e[51]=V):V=e[51];let q;e[52]!==V?(q=t.jsx("div",{className:"alive-lane-ruler",children:V}),e[52]=V,e[53]=q):q=e[53];let G;e[54]!==l?(G=Te(l),e[54]=l,e[55]=G):G=e[55];let X;e[56]!==G?(X=t.jsx("svg",{viewBox:"0 0 1000 100",preserveAspectRatio:"none","aria-hidden":"true",children:t.jsx("path",{d:G})}),e[56]=G,e[57]=X):X=e[57];let Y;e[58]!==i||e[59]!==d||e[60]!==f?(Y=!f&&i.filter(st).map(T=>t.jsx("span",{className:"alive-onset",style:{left:U(T.onset,d)}},T.key)),e[58]=i,e[59]=d,e[60]=f,e[61]=Y):Y=e[61];let J;e[62]!==X||e[63]!==Y?(J=t.jsxs("div",{className:"alive-lane-audio",children:[X,Y]}),e[62]=X,e[63]=Y,e[64]=J):J=e[64];let Q;if(e[65]!==i||e[66]!==d||e[67]!==f||e[68]!==o){let T;e[70]!==d||e[71]!==f||e[72]!==o?(T=E=>t.jsx("span",{className:"alive-chip","data-active":o>=E.start&&o<E.end||void 0,"data-drifted":E.drifted&&!f||void 0,style:{left:U(E.start,d),width:U(E.end-E.start,d)},children:E.text},E.key),e[70]=d,e[71]=f,e[72]=o,e[73]=T):T=e[73],Q=i.map(T),e[65]=i,e[66]=d,e[67]=f,e[68]=o,e[69]=Q}else Q=e[69];let Z;e[74]!==Q?(Z=t.jsx("div",{className:"alive-lane-words",children:Q}),e[74]=Q,e[75]=Z):Z=e[75];let ee;if(e[76]!==r||e[77]!==h||e[78]!==d){let T;e[80]!==r||e[81]!==d?(T=(E,ye)=>t.jsx("span",{className:"alive-stack-bar","data-active":ye===r||void 0,style:{left:U(E.start,d),width:U(E.end-E.start,d)},children:me(E)},E.id),e[80]=r,e[81]=d,e[82]=T):T=e[82],ee=h.map(T),e[76]=r,e[77]=h,e[78]=d,e[79]=ee}else ee=e[79];let te;e[83]!==ee?(te=t.jsx("div",{className:"alive-lane-stacks",children:ee}),e[83]=ee,e[84]=te):te=e[84];let se;e[85]!==d||e[86]!==o?(se=U(o,d),e[85]=d,e[86]=o,e[87]=se):se=e[87];let le;e[88]!==se?(le=t.jsx("span",{className:"alive-playhead",style:{left:se}}),e[88]=se,e[89]=le):le=e[89];let ae;e[90]!==j||e[91]!==K||e[92]!==q||e[93]!==J||e[94]!==Z||e[95]!==te||e[96]!==le?(ae=t.jsxs("div",{className:"alive-lane-tracks",style:K,onClick:j,role:"presentation",children:[q,J,Z,te,le]}),e[90]=j,e[91]=K,e[92]=q,e[93]=J,e[94]=Z,e[95]=te,e[96]=le,e[97]=ae):ae=e[97];let ie;e[98]!==g||e[99]!==ae?(ie=t.jsxs("div",{className:"alive-lanes",children:[ne,t.jsx("div",{className:"alive-lane-scroll",ref:g,children:ae})]}),e[98]=g,e[99]=ae,e[100]=ie):ie=e[100];let oe;e[101]===Symbol.for("react.memo_cache_sentinel")?(oe=t.jsxs("div",{className:"alive-legend","aria-hidden":"true",children:[t.jsxs("span",{children:[t.jsx("i",{className:"alive-legend-chip"}),"Transcript word"]}),t.jsxs("span",{children:[t.jsx("i",{className:"alive-legend-drift"}),"Word off its vocal onset"]}),t.jsxs("span",{children:[t.jsx("i",{className:"alive-legend-onset"}),"Detected vocal onset"]})]}),e[101]=oe):oe=e[101];let ce;return e[102]!==S||e[103]!==ie?(ce=t.jsxs("section",{className:"alive-panel alive-timeline","aria-label":"Caption timeline",children:[S,ie,oe]}),e[102]=S,e[103]=ie,e[104]=ce):ce=e[104],ce}function st(a){return a.drifted}const ge=30;function lt(a){const e=F.c(3),s=A.useRef(null);let n,o;return e[0]!==a?(n=()=>{const c=s.current;return c?.showModal(),c?.querySelector(".alive-close")?.focus(),()=>{c?.close(),We(a)}},o=[a],e[0]=a,e[1]=n,e[2]=o):(n=e[1],o=e[2]),A.useEffect(n,o),s}function at(a){const e=F.c(6),[s,n]=A.useState(0),[o,c]=A.useState(!1);let l,i;e[0]!==a?(l=()=>{const r=a.current;if(!r)return;const f=g=>n(g.detail.frame),m=()=>c(!0),d=()=>c(!1);return r.addEventListener("frameupdate",f),r.addEventListener("play",m),r.addEventListener("pause",d),()=>{r.removeEventListener("frameupdate",f),r.removeEventListener("play",m),r.removeEventListener("pause",d)}},i=[a],e[0]=a,e[1]=l,e[2]=i):(l=e[1],i=e[2]),A.useEffect(l,i);let h;return e[3]!==s||e[4]!==o?(h={frame:s,playing:o},e[3]=s,e[4]=o,e[5]=h):h=e[5],h}function ft(a){const e=F.c(14),{asset:s,state:n,returnFocus:o,onClose:c}=a,l=lt(o),i=`Alive captions for ${s.label}`;let h;e[0]!==c?(h=m=>{m.preventDefault(),c()},e[0]=c,e[1]=h):h=e[1];let r;e[2]!==s.label||e[3]!==c||e[4]!==a||e[5]!==n.data||e[6]!==n.message||e[7]!==n.status?(r=n.status==="ready"?t.jsx(it,{...a,data:n.data}):t.jsxs("div",{className:"alive-studio-message",children:[t.jsx(je,{label:s.label,detail:null,onClose:c}),t.jsx("p",{role:n.status==="error"?"alert":"status",children:n.status==="error"?n.message:"Analysing vocals, phrases and faces…"})]}),e[2]=s.label,e[3]=c,e[4]=a,e[5]=n.data,e[6]=n.message,e[7]=n.status,e[8]=r):r=e[8];let f;return e[9]!==l||e[10]!==i||e[11]!==h||e[12]!==r?(f=t.jsx("dialog",{className:"alive-studio","aria-label":i,onCancel:h,ref:l,children:r}),e[9]=l,e[10]=i,e[11]=h,e[12]=r,e[13]=f):f=e[13],f}function je(a){const e=F.c(12),{label:s,detail:n,onClose:o,children:c}=a;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx("h2",{children:"Alive captions"}),e[0]=l):l=e[0];const i=n?` · ${n}`:"";let h;e[1]!==s||e[2]!==i?(h=t.jsxs("span",{className:"alive-muted",children:[s,i]}),e[1]=s,e[2]=i,e[3]=h):h=e[3];let r;e[4]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx("span",{className:"alive-spacer"}),e[4]=r):r=e[4];let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(Ie,{size:16}),e[5]=f):f=e[5];let m;e[6]!==o?(m=t.jsx("button",{type:"button",className:"alive-close","aria-label":"Close alive captions",onClick:o,children:f}),e[6]=o,e[7]=m):m=e[7];let d;return e[8]!==c||e[9]!==h||e[10]!==m?(d=t.jsxs("header",{className:"alive-header",children:[l,h,r,c,m]}),e[8]=c,e[9]=h,e[10]=m,e[11]=d):d=e[11],d}function it({asset:a,data:e,onClose:s,onSave:n,onRender:o,onReanalyze:c}){const{analysis:l}=e,i=Math.round(a.fps??ge)||ge,h=Math.max(1,Math.round(l.durationSeconds*i)),[r,f]=A.useState(e.settings),[m,d]=A.useState(()=>Re(a.width,a.height)),[g,u]=A.useState(!0),[j,v]=A.useState(null),[C,y]=A.useState(null),w=A.useRef(null),{frame:$,playing:b}=at(w),N=$/i,P=A.useMemo(()=>Ae(l,m),[l,m]),p=A.useMemo(()=>Me(l.phrases,r,P),[l.phrases,r,P]),k=A.useMemo(()=>_e(l,r),[l,r]),M=A.useMemo(()=>Ee(k),[k]),D=A.useMemo(()=>({mediaUrl:a.mediaUrl,sourceWidth:l.sourceWidth,sourceHeight:l.sourceHeight,cues:p,phrases:l.phrases,settings:r,showRegions:g}),[a.mediaUrl,l,p,r,g]),O=Oe(p,N),_=x=>w.current?.seekTo(Math.max(0,Math.min(h-1,Math.round(x*i)))),H=x=>f(L=>({...L,...x})),W=async(x,L,I)=>{v(x),y(null);try{await L(),y(I)}catch(z){y(z instanceof Error?z.message:String(z))}finally{v(null)}},R=fe.find(x=>x.id===m)??fe[0];return t.jsxs("div",{className:"alive-studio-body",children:[t.jsxs(je,{label:a.label,detail:`${l.sourceWidth}×${l.sourceHeight} · ${i} fps`,onClose:s,children:[t.jsx("div",{className:"alive-segmented",role:"group","aria-label":"Preview orientation",children:fe.map(x=>t.jsx("button",{type:"button","aria-pressed":x.id===m,onClick:()=>d(x.id),children:x.label},x.id))}),t.jsx("button",{type:"button",className:"alive-secondary",disabled:j!==null,onClick:()=>{W("Saving",()=>n(r),"Saved. Renders of this video now use alive captions.")},children:"Save"}),t.jsxs("button",{type:"button",className:"alive-primary",disabled:j!==null,onClick:()=>{W("Rendering",()=>o(r,m),`Saved and queued a ${R.label} render.`)},children:["Render ",R.label]})]}),t.jsxs("div",{className:"alive-main",children:[t.jsx(Xe,{rows:k,phraseLabels:p.map(me),activePhrase:O,time:N,snapped:r.snapToOnsets,onSeek:_}),t.jsxs("div",{className:"alive-stage",children:[t.jsx("div",{className:"alive-player",style:{aspectRatio:`${R.width} / ${R.height}`},children:t.jsx(Ne,{ref:w,component:Ke,inputProps:D,durationInFrames:h,fps:i,compositionWidth:R.width,compositionHeight:R.height,style:{width:"100%",height:"100%"},clickToPlay:!0,spaceKeyToPlayOrPause:!0})}),t.jsx("p",{className:"alive-status",role:"status",children:j?`${j}…`:C??(O>=0?`${me(p[O])} · ${p[O].lines.length} lines`:"Between phrases")})]}),t.jsx(Ye,{settings:r,showRegions:g,regionsAnalyzed:l.regionsAnalyzed,working:j!==null,onChange:H,onShowRegions:u,onReanalyze:()=>{W("Re-running analysis",c,"Analysis refreshed.")}})]}),t.jsx(tt,{duration:l.durationSeconds,fps:i,time:N,playing:b,envelope:l.envelope,rows:k,cues:p,activeCue:O,snapped:r.snapToOnsets,drift:M,onSeek:_,onStep:x=>_(N+x/i),onTogglePlay:()=>w.current?.toggle(),onToggleSnap:()=>H({snapToOnsets:!r.snapToOnsets})})]})}export{ft as AliveCaptionsStudio};
1
+ import{c as F,j as t,a as A}from"./vendor-react-Dj7D1fD4.js";import{u as be,a as xe,V as Se,A as pe,P as Ne}from"./vendor-remotion-CH1HXrlc.js";import{eg as Ce,eh as ke,ei as we,ej as $e,ek as Pe,el as de,em as Te,en as me,eo as Re,ep as Ae,eq as Me,er as _e,es as Ee,et as Oe,eu as fe,bx as We}from"./videobook-J-j9bSjM.js";import{g as Le,a6 as ze,_ as Fe,h as He,X as Ie}from"./vendor-icons-CGqhCIXV.js";import"./vendor-BFupLz37.js";import"./vendor-mcp-DQEeVZH0.js";const Be={face:"#63c7d8",text:"#f0a860",graphic:"#f0a860"};function De(a){const e=F.c(25),{phrase:s,cue:n,settings:o,sourceWidth:c,sourceHeight:l}=a,{width:i,height:h}=xe();let r,f,m,d;if(e[0]!==h||e[1]!==s.id||e[2]!==s.regions||e[3]!==o||e[4]!==l||e[5]!==c||e[6]!==i){const j={sourceWidth:c,sourceHeight:l,targetWidth:i,targetHeight:h};let v;e[11]!==s.regions||e[12]!==o?(v=new Set($e(s.regions,o)),e[11]=s.regions,e[12]=o,e[13]=v):v=e[13];const C=v;let y;e[14]!==i?(y=Math.round(i/480),e[14]=i,e[15]=y):y=e[15],f=Math.max(2,y),r=pe,e[16]===Symbol.for("react.memo_cache_sentinel")?(m={pointerEvents:"none"},e[16]=m):m=e[16],d=s.regions.map((w,$)=>{const b=Pe(w,j);return t.jsx("div",{style:{position:"absolute",left:b.x*i,top:b.y*h,width:b.width*i,height:b.height*h,border:`${f}px dashed ${Be[w.kind]}`,opacity:C.has(w)?1:.4,borderRadius:f*2}},`${s.id}-${$}`)}),e[0]=h,e[1]=s.id,e[2]=s.regions,e[3]=o,e[4]=l,e[5]=c,e[6]=i,e[7]=r,e[8]=f,e[9]=m,e[10]=d}else r=e[7],f=e[8],m=e[9],d=e[10];let g;e[17]!==n.column||e[18]!==f?(g=t.jsx(Ue,{column:n.column,stroke:f}),e[17]=n.column,e[18]=f,e[19]=g):g=e[19];let u;return e[20]!==r||e[21]!==m||e[22]!==d||e[23]!==g?(u=t.jsxs(r,{style:m,children:[d,g]}),e[20]=r,e[21]=m,e[22]=d,e[23]=g,e[24]=u):u=e[24],u}function Ue(a){const e=F.c(7),{column:s,stroke:n}=a,o=`${Math.max(1,n/2)}px dashed rgba(114, 231, 170, 0.6)`,c=n*2;let l;return e[0]!==s.height||e[1]!==s.width||e[2]!==s.x||e[3]!==s.y||e[4]!==o||e[5]!==c?(l=t.jsx("div",{style:{position:"absolute",left:s.x,top:s.y,width:s.width,height:s.height,border:o,borderRadius:c}}),e[0]=s.height,e[1]=s.width,e[2]=s.x,e[3]=s.y,e[4]=o,e[5]=c,e[6]=l):l=e[6],l}function Ke(a){const e=F.c(34),{mediaUrl:s,sourceWidth:n,sourceHeight:o,cues:c,phrases:l,settings:i,showRegions:h}=a,r=be(),{fps:f,width:m,height:d}=xe();let g;e[0]!==d||e[1]!==o||e[2]!==n||e[3]!==m?(g=ke({sourceWidth:n,sourceHeight:o,targetWidth:m,targetHeight:d}),e[0]=d,e[1]=o,e[2]=n,e[3]=m,e[4]=g):g=e[4];const u=g,j=r/f;let v;e[5]!==c||e[6]!==j?(v=Ce(c,j),e[5]=c,e[6]=j,e[7]=v):v=e[7];const C=v;let y;e[8]!==C||e[9]!==l?(y=C?l.find(M=>M.id===C.id):void 0,e[8]=C,e[9]=l,e[10]=y):y=e[10];const w=y;let $;e[11]===Symbol.for("react.memo_cache_sentinel")?($={background:"#000000"},e[11]=$):$=e[11];let b;e[12]!==u.height||e[13]!==u.width||e[14]!==u.x||e[15]!==u.y?(b={position:"absolute",left:u.x,top:u.y,width:u.width,height:u.height},e[12]=u.height,e[13]=u.width,e[14]=u.x,e[15]=u.y,e[16]=b):b=e[16];let N;e[17]!==s||e[18]!==b?(N=t.jsx(Se,{src:s,style:b}),e[17]=s,e[18]=b,e[19]=N):N=e[19];let P;e[20]!==C||e[21]!==w||e[22]!==i||e[23]!==h||e[24]!==o||e[25]!==n?(P=h&&C&&w&&t.jsx(De,{phrase:w,cue:C,settings:i,sourceWidth:n,sourceHeight:o}),e[20]=C,e[21]=w,e[22]=i,e[23]=h,e[24]=o,e[25]=n,e[26]=P):P=e[26];let x;e[27]!==c||e[28]!==i?(x=t.jsx(we,{cues:c,settings:i,strokeWidth:6,strokeColor:"#000000",shadowBlur:6,shadowOpacity:60}),e[27]=c,e[28]=i,e[29]=x):x=e[29];let k;return e[30]!==N||e[31]!==P||e[32]!==x?(k=t.jsxs(pe,{style:$,children:[N,P,x]}),e[30]=N,e[31]=P,e[32]=x,e[33]=k):k=e[33],k}const ue=[{id:"stack",label:"Stack",hint:"Words land one by one and build a stacked block beside the subject, each line sized to fill the column."},{id:"punch",label:"Punch",hint:"One word at a time, as big as the free space allows. Best on fast verses."},{id:"karaoke",label:"Karaoke",hint:"The whole stacked phrase shows dimmed and lights up word by word."}],Ve=[{id:"pop",label:"Pop"},{id:"slam",label:"Slam"},{id:"rise",label:"Rise"}],qe=[{name:"Green",color:"#72E7AA"},{name:"Pink",color:"#F0B9D0"},{name:"Cyan",color:"#63C7D8"},{name:"Amber",color:"#E7C372"}];function Ge(a,e){if(!a.drifted)return de(a.start);const s=a.driftMs>0?"+":"";return e?`${de(a.start)} · snapped`:`${de(a.start)} · ${s}${a.driftMs}ms`}function Xe(a){const e=F.c(21),{rows:s,phraseLabels:n,activePhrase:o,time:c,snapped:l,onSeek:i}=a;let h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx("h3",{children:"Transcript"}),e[0]=h):h=e[0];let r;e[1]!==s.length?(r=t.jsxs("header",{className:"alive-panel-header",children:[h,t.jsxs("p",{children:[s.length," words · timed to the vocal"]})]}),e[1]=s.length,e[2]=r):r=e[2];let f;if(e[3]!==o||e[4]!==i||e[5]!==n||e[6]!==s||e[7]!==l||e[8]!==c){let g;e[10]!==o||e[11]!==i||e[12]!==s||e[13]!==l||e[14]!==c?(g=(u,j)=>t.jsxs("div",{className:"alive-phrase","data-active":j===o||void 0,children:[t.jsxs("div",{className:"alive-phrase-head",children:[t.jsxs("span",{children:["Phrase ",j+1]}),t.jsx("span",{children:u})]}),t.jsx("div",{className:"alive-phrase-words",children:s.filter(v=>v.phraseIndex===j).map(v=>t.jsxs("button",{type:"button",className:"alive-word","data-active":c>=v.start&&c<v.end||void 0,"data-drifted":v.drifted&&!l||void 0,onClick:()=>i(v.start+.03),children:[t.jsx("span",{children:v.text}),t.jsx("small",{children:Ge(v,l)})]},v.key))})]},`${j}-${u}`),e[10]=o,e[11]=i,e[12]=s,e[13]=l,e[14]=c,e[15]=g):g=e[15],f=n.map(g),e[3]=o,e[4]=i,e[5]=n,e[6]=s,e[7]=l,e[8]=c,e[9]=f}else f=e[9];let m;e[16]!==f?(m=t.jsx("div",{className:"alive-transcript-list",children:f}),e[16]=f,e[17]=m):m=e[17];let d;return e[18]!==r||e[19]!==m?(d=t.jsxs("section",{className:"alive-panel alive-transcript","aria-label":"Transcript",children:[r,m]}),e[18]=r,e[19]=m,e[20]=d):d=e[20],d}function ve(a){const e=F.c(10),{label:s,options:n,value:o,onChange:c}=a;let l;if(e[0]!==c||e[1]!==n||e[2]!==o){let h;e[4]!==c||e[5]!==o?(h=r=>t.jsx("button",{type:"button","aria-pressed":r.id===o,onClick:()=>c(r.id),children:r.label},r.id),e[4]=c,e[5]=o,e[6]=h):h=e[6],l=n.map(h),e[0]=c,e[1]=n,e[2]=o,e[3]=l}else l=e[3];let i;return e[7]!==s||e[8]!==l?(i=t.jsx("div",{className:"alive-segmented",role:"group","aria-label":s,children:l}),e[7]=s,e[8]=l,e[9]=i):i=e[9],i}function re(a){const e=F.c(8),{checked:s,onChange:n,children:o}=a;let c;e[0]!==n?(c=h=>n(h.target.checked),e[0]=n,e[1]=c):c=e[1];let l;e[2]!==s||e[3]!==c?(l=t.jsx("input",{type:"checkbox",checked:s,onChange:c}),e[2]=s,e[3]=c,e[4]=l):l=e[4];let i;return e[5]!==o||e[6]!==l?(i=t.jsxs("label",{className:"alive-toggle",children:[l,o]}),e[5]=o,e[6]=l,e[7]=i):i=e[7],i}function Ye(a){const e=F.c(69),{settings:s,showRegions:n,regionsAnalyzed:o,working:c,onChange:l,onShowRegions:i,onReanalyze:h}=a;let r;e[0]!==s.style?(r=ue.find(S=>S.id===s.style)?.hint,e[0]=s.style,e[1]=r):r=e[1];const f=r;let m;e[2]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx("h4",{children:"Style"}),e[2]=m):m=e[2];let d;e[3]!==l?(d=S=>l({style:S}),e[3]=l,e[4]=d):d=e[4];let g;e[5]!==s.style||e[6]!==d?(g=t.jsx(ve,{label:"Caption style",options:ue,value:s.style,onChange:d}),e[5]=s.style,e[6]=d,e[7]=g):g=e[7];let u;e[8]!==f?(u=t.jsx("p",{className:"alive-hint",children:f}),e[8]=f,e[9]=u):u=e[9];let j;e[10]!==g||e[11]!==u?(j=t.jsxs("div",{className:"alive-field",children:[m,g,u]}),e[10]=g,e[11]=u,e[12]=j):j=e[12];let v;e[13]===Symbol.for("react.memo_cache_sentinel")?(v=t.jsx("h4",{children:"Word entrance"}),e[13]=v):v=e[13];let C;e[14]!==l?(C=S=>l({motion:S}),e[14]=l,e[15]=C):C=e[15];let y;e[16]!==s.motion||e[17]!==C?(y=t.jsxs("div",{className:"alive-field",children:[v,t.jsx(ve,{label:"Word entrance",options:Ve,value:s.motion,onChange:C})]}),e[16]=s.motion,e[17]=C,e[18]=y):y=e[18];let w;e[19]===Symbol.for("react.memo_cache_sentinel")?(w=t.jsx("h4",{children:"Frame awareness"}),e[19]=w):w=e[19];let $;e[20]!==l?($=S=>l({avoidFaces:S}),e[20]=l,e[21]=$):$=e[21];let b;e[22]!==s.avoidFaces||e[23]!==$?(b=t.jsx(re,{checked:s.avoidFaces,onChange:$,children:"Keep words off faces"}),e[22]=s.avoidFaces,e[23]=$,e[24]=b):b=e[24];let N;e[25]!==l?(N=S=>l({avoidText:S}),e[25]=l,e[26]=N):N=e[26];let P;e[27]!==s.avoidText||e[28]!==N?(P=t.jsx(re,{checked:s.avoidText,onChange:N,children:"Keep words off on-screen text"}),e[27]=s.avoidText,e[28]=N,e[29]=P):P=e[29];let x;e[30]!==i||e[31]!==n?(x=t.jsx(re,{checked:n,onChange:i,children:"Show detected regions"}),e[30]=i,e[31]=n,e[32]=x):x=e[32];let k;e[33]!==o?(k=!o&&t.jsx("p",{className:"alive-hint alive-warning",children:"Face and text detection did not run, so stacks use the default columns. Set OPENAI_API_KEY and re-run the analysis."}),e[33]=o,e[34]=k):k=e[34];let M;e[35]!==b||e[36]!==P||e[37]!==x||e[38]!==k?(M=t.jsxs("div",{className:"alive-field",children:[w,b,P,x,k]}),e[35]=b,e[36]=P,e[37]=x,e[38]=k,e[39]=M):M=e[39];let D;e[40]===Symbol.for("react.memo_cache_sentinel")?(D=t.jsx("h4",{children:"Audio"}),e[40]=D):D=e[40];let O;e[41]!==l?(O=S=>l({energySizing:S}),e[41]=l,e[42]=O):O=e[42];let _;e[43]!==s.energySizing||e[44]!==O?(_=t.jsxs("div",{className:"alive-field",children:[D,t.jsx(re,{checked:s.energySizing,onChange:O,children:"Size words by vocal energy"})]}),e[43]=s.energySizing,e[44]=O,e[45]=_):_=e[45];let H;e[46]===Symbol.for("react.memo_cache_sentinel")?(H=t.jsx("h4",{children:"Hit color"}),e[46]=H):H=e[46];let W;e[47]!==l||e[48]!==s.hitColor?(W=qe.map(S=>t.jsx("button",{type:"button","aria-label":S.name,"aria-pressed":s.hitColor.toUpperCase()===S.color,onClick:()=>l({hitColor:S.color}),children:t.jsx("span",{style:{background:S.color}})},S.color)),e[47]=l,e[48]=s.hitColor,e[49]=W):W=e[49];let R;e[50]===Symbol.for("react.memo_cache_sentinel")?(R=t.jsx("span",{children:"Text"}),e[50]=R):R=e[50];let p;e[51]!==l?(p=S=>l({textColor:S.target.value.toUpperCase()}),e[51]=l,e[52]=p):p=e[52];let L;e[53]!==s.textColor||e[54]!==p?(L=t.jsxs("label",{className:"alive-color-input",children:[R,t.jsx("input",{type:"color",value:s.textColor,onChange:p})]}),e[53]=s.textColor,e[54]=p,e[55]=L):L=e[55];let I;e[56]!==W||e[57]!==L?(I=t.jsxs("div",{className:"alive-field",children:[H,t.jsxs("div",{className:"alive-swatches",children:[W,L]})]}),e[56]=W,e[57]=L,e[58]=I):I=e[58];let z;e[59]!==h||e[60]!==c?(z=t.jsx("div",{className:"alive-field",children:t.jsx("button",{type:"button",className:"alive-secondary",disabled:c,onClick:h,children:"Re-run analysis"})}),e[59]=h,e[60]=c,e[61]=z):z=e[61];let B;return e[62]!==M||e[63]!==_||e[64]!==I||e[65]!==z||e[66]!==j||e[67]!==y?(B=t.jsxs("section",{className:"alive-panel alive-settings","aria-label":"Caption settings",children:[j,y,M,_,I,z]}),e[62]=M,e[63]=_,e[64]=I,e[65]=z,e[66]=j,e[67]=y,e[68]=B):B=e[68],B}const Je=90;function U(a,e){return`${Math.max(0,a)/e*100}%`}function Qe(a,e,s){if(e.count===0)return`All ${s} words already sit on their vocal onsets`;if(a)return`${e.count} words snapped to their vocal onsets`;const n=e.minMs===e.maxMs?`${e.maxMs}`:`${e.minMs}–${e.maxMs}`;return`${e.count} words start ${n} ms off the vocal`}function Ze(a){const e=a>120?10:a>30?5:1,s=[];for(let n=0;n<=a;n+=e)s.push(n);return s}function et(a,e,s){const n=F.c(5),o=A.useRef(null);let c,l;return n[0]!==e||n[1]!==s||n[2]!==a?(c=()=>{const i=o.current;if(!i||!s)return;const h=a/e*i.scrollWidth;(h<i.scrollLeft||h>i.scrollLeft+i.clientWidth*.85)&&(i.scrollLeft=Math.max(0,h-i.clientWidth*.2))},l=[a,e,s],n[0]=e,n[1]=s,n[2]=a,n[3]=c,n[4]=l):(c=n[3],l=n[4]),A.useEffect(c,l),o}function tt(a){const e=F.c(105),{duration:s,fps:n,time:o,playing:c,envelope:l,rows:i,cues:h,activeCue:r,snapped:f,drift:m}=a,d=Math.max(s,.1),g=et(o,d,c);let u;e[0]!==a||e[1]!==d?(u=T=>{const E=T.currentTarget.getBoundingClientRect();a.onSeek((T.clientX-E.left)/E.width*d)},e[0]=a,e[1]=d,e[2]=u):u=e[2];const j=u;let v;e[3]!==a?(v=()=>a.onStep(-1),e[3]=a,e[4]=v):v=e[4];let C;e[5]===Symbol.for("react.memo_cache_sentinel")?(C=t.jsx(Le,{size:16}),e[5]=C):C=e[5];let y;e[6]!==v?(y=t.jsx("button",{type:"button","aria-label":"Previous frame",onClick:v,children:C}),e[6]=v,e[7]=y):y=e[7];const w=c?"Pause":"Play";let $;e[8]!==c?($=c?t.jsx(ze,{size:16}):t.jsx(Fe,{size:16}),e[8]=c,e[9]=$):$=e[9];let b;e[10]!==a.onTogglePlay||e[11]!==w||e[12]!==$?(b=t.jsx("button",{type:"button",className:"alive-play","aria-label":w,onClick:a.onTogglePlay,children:$}),e[10]=a.onTogglePlay,e[11]=w,e[12]=$,e[13]=b):b=e[13];let N;e[14]!==a?(N=()=>a.onStep(1),e[14]=a,e[15]=N):N=e[15];let P;e[16]===Symbol.for("react.memo_cache_sentinel")?(P=t.jsx(He,{size:16}),e[16]=P):P=e[16];let x;e[17]!==N?(x=t.jsx("button",{type:"button","aria-label":"Next frame",onClick:N,children:P}),e[17]=N,e[18]=x):x=e[18];let k;e[19]!==o?(k=de(o),e[19]=o,e[20]=k):k=e[20];let M;e[21]!==k?(M=t.jsx("strong",{className:"alive-clock",children:k}),e[21]=k,e[22]=M):M=e[22];const D=Math.floor(o*n),O=Math.floor(d*n);let _;e[23]!==D||e[24]!==O?(_=t.jsxs("span",{className:"alive-muted",children:["frame ",D," / ",O]}),e[23]=D,e[24]=O,e[25]=_):_=e[25];let H;e[26]===Symbol.for("react.memo_cache_sentinel")?(H=t.jsx("span",{className:"alive-spacer"}),e[26]=H):H=e[26];const W=m.count>0&&!f||void 0;let R;e[27]!==m||e[28]!==i.length||e[29]!==f?(R=Qe(f,m,i.length),e[27]=m,e[28]=i.length,e[29]=f,e[30]=R):R=e[30];let p;e[31]!==W||e[32]!==R?(p=t.jsx("span",{className:"alive-drift","data-drifted":W,children:R}),e[31]=W,e[32]=R,e[33]=p):p=e[33];const L=f?"alive-secondary":"alive-primary alive-warn",I=m.count===0,z=f?"Use transcript timing":"Snap words to audio";let B;e[34]!==a.onToggleSnap||e[35]!==L||e[36]!==I||e[37]!==z?(B=t.jsx("button",{type:"button",className:L,disabled:I,onClick:a.onToggleSnap,children:z}),e[34]=a.onToggleSnap,e[35]=L,e[36]=I,e[37]=z,e[38]=B):B=e[38];let S;e[39]!==M||e[40]!==_||e[41]!==p||e[42]!==B||e[43]!==y||e[44]!==b||e[45]!==x?(S=t.jsxs("div",{className:"alive-transport",children:[y,b,x,M,_,H,p,B]}),e[39]=M,e[40]=_,e[41]=p,e[42]=B,e[43]=y,e[44]=b,e[45]=x,e[46]=S):S=e[46];let ne;e[47]===Symbol.for("react.memo_cache_sentinel")?(ne=t.jsxs("div",{className:"alive-lane-labels","aria-hidden":"true",children:[t.jsx("span",{className:"alive-lane-ruler"}),t.jsx("span",{className:"alive-lane-audio",children:"Audio"}),t.jsx("span",{className:"alive-lane-words",children:"Words"}),t.jsx("span",{className:"alive-lane-stacks",children:"Stacks"})]}),e[47]=ne):ne=e[47];const he=d*Je;let K;e[48]!==he?(K={minWidth:he},e[48]=he,e[49]=K):K=e[49];let V;e[50]!==d?(V=Ze(d).map(T=>t.jsxs("span",{style:{left:U(T,d)},children:[T,"s"]},T)),e[50]=d,e[51]=V):V=e[51];let q;e[52]!==V?(q=t.jsx("div",{className:"alive-lane-ruler",children:V}),e[52]=V,e[53]=q):q=e[53];let G;e[54]!==l?(G=Te(l),e[54]=l,e[55]=G):G=e[55];let X;e[56]!==G?(X=t.jsx("svg",{viewBox:"0 0 1000 100",preserveAspectRatio:"none","aria-hidden":"true",children:t.jsx("path",{d:G})}),e[56]=G,e[57]=X):X=e[57];let Y;e[58]!==i||e[59]!==d||e[60]!==f?(Y=!f&&i.filter(st).map(T=>t.jsx("span",{className:"alive-onset",style:{left:U(T.onset,d)}},T.key)),e[58]=i,e[59]=d,e[60]=f,e[61]=Y):Y=e[61];let J;e[62]!==X||e[63]!==Y?(J=t.jsxs("div",{className:"alive-lane-audio",children:[X,Y]}),e[62]=X,e[63]=Y,e[64]=J):J=e[64];let Q;if(e[65]!==i||e[66]!==d||e[67]!==f||e[68]!==o){let T;e[70]!==d||e[71]!==f||e[72]!==o?(T=E=>t.jsx("span",{className:"alive-chip","data-active":o>=E.start&&o<E.end||void 0,"data-drifted":E.drifted&&!f||void 0,style:{left:U(E.start,d),width:U(E.end-E.start,d)},children:E.text},E.key),e[70]=d,e[71]=f,e[72]=o,e[73]=T):T=e[73],Q=i.map(T),e[65]=i,e[66]=d,e[67]=f,e[68]=o,e[69]=Q}else Q=e[69];let Z;e[74]!==Q?(Z=t.jsx("div",{className:"alive-lane-words",children:Q}),e[74]=Q,e[75]=Z):Z=e[75];let ee;if(e[76]!==r||e[77]!==h||e[78]!==d){let T;e[80]!==r||e[81]!==d?(T=(E,ye)=>t.jsx("span",{className:"alive-stack-bar","data-active":ye===r||void 0,style:{left:U(E.start,d),width:U(E.end-E.start,d)},children:me(E)},E.id),e[80]=r,e[81]=d,e[82]=T):T=e[82],ee=h.map(T),e[76]=r,e[77]=h,e[78]=d,e[79]=ee}else ee=e[79];let te;e[83]!==ee?(te=t.jsx("div",{className:"alive-lane-stacks",children:ee}),e[83]=ee,e[84]=te):te=e[84];let se;e[85]!==d||e[86]!==o?(se=U(o,d),e[85]=d,e[86]=o,e[87]=se):se=e[87];let le;e[88]!==se?(le=t.jsx("span",{className:"alive-playhead",style:{left:se}}),e[88]=se,e[89]=le):le=e[89];let ae;e[90]!==j||e[91]!==K||e[92]!==q||e[93]!==J||e[94]!==Z||e[95]!==te||e[96]!==le?(ae=t.jsxs("div",{className:"alive-lane-tracks",style:K,onClick:j,role:"presentation",children:[q,J,Z,te,le]}),e[90]=j,e[91]=K,e[92]=q,e[93]=J,e[94]=Z,e[95]=te,e[96]=le,e[97]=ae):ae=e[97];let ie;e[98]!==g||e[99]!==ae?(ie=t.jsxs("div",{className:"alive-lanes",children:[ne,t.jsx("div",{className:"alive-lane-scroll",ref:g,children:ae})]}),e[98]=g,e[99]=ae,e[100]=ie):ie=e[100];let oe;e[101]===Symbol.for("react.memo_cache_sentinel")?(oe=t.jsxs("div",{className:"alive-legend","aria-hidden":"true",children:[t.jsxs("span",{children:[t.jsx("i",{className:"alive-legend-chip"}),"Transcript word"]}),t.jsxs("span",{children:[t.jsx("i",{className:"alive-legend-drift"}),"Word off its vocal onset"]}),t.jsxs("span",{children:[t.jsx("i",{className:"alive-legend-onset"}),"Detected vocal onset"]})]}),e[101]=oe):oe=e[101];let ce;return e[102]!==S||e[103]!==ie?(ce=t.jsxs("section",{className:"alive-panel alive-timeline","aria-label":"Caption timeline",children:[S,ie,oe]}),e[102]=S,e[103]=ie,e[104]=ce):ce=e[104],ce}function st(a){return a.drifted}const ge=30;function lt(a){const e=F.c(3),s=A.useRef(null);let n,o;return e[0]!==a?(n=()=>{const c=s.current;return c?.showModal(),c?.querySelector(".alive-close")?.focus(),()=>{c?.close(),We(a)}},o=[a],e[0]=a,e[1]=n,e[2]=o):(n=e[1],o=e[2]),A.useEffect(n,o),s}function at(a){const e=F.c(6),[s,n]=A.useState(0),[o,c]=A.useState(!1);let l,i;e[0]!==a?(l=()=>{const r=a.current;if(!r)return;const f=g=>n(g.detail.frame),m=()=>c(!0),d=()=>c(!1);return r.addEventListener("frameupdate",f),r.addEventListener("play",m),r.addEventListener("pause",d),()=>{r.removeEventListener("frameupdate",f),r.removeEventListener("play",m),r.removeEventListener("pause",d)}},i=[a],e[0]=a,e[1]=l,e[2]=i):(l=e[1],i=e[2]),A.useEffect(l,i);let h;return e[3]!==s||e[4]!==o?(h={frame:s,playing:o},e[3]=s,e[4]=o,e[5]=h):h=e[5],h}function ft(a){const e=F.c(14),{asset:s,state:n,returnFocus:o,onClose:c}=a,l=lt(o),i=`Alive captions for ${s.label}`;let h;e[0]!==c?(h=m=>{m.preventDefault(),c()},e[0]=c,e[1]=h):h=e[1];let r;e[2]!==s.label||e[3]!==c||e[4]!==a||e[5]!==n.data||e[6]!==n.message||e[7]!==n.status?(r=n.status==="ready"?t.jsx(it,{...a,data:n.data}):t.jsxs("div",{className:"alive-studio-message",children:[t.jsx(je,{label:s.label,detail:null,onClose:c}),t.jsx("p",{role:n.status==="error"?"alert":"status",children:n.status==="error"?n.message:"Analysing vocals, phrases and faces…"})]}),e[2]=s.label,e[3]=c,e[4]=a,e[5]=n.data,e[6]=n.message,e[7]=n.status,e[8]=r):r=e[8];let f;return e[9]!==l||e[10]!==i||e[11]!==h||e[12]!==r?(f=t.jsx("dialog",{className:"alive-studio","aria-label":i,onCancel:h,ref:l,children:r}),e[9]=l,e[10]=i,e[11]=h,e[12]=r,e[13]=f):f=e[13],f}function je(a){const e=F.c(12),{label:s,detail:n,onClose:o,children:c}=a;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx("h2",{children:"Alive captions"}),e[0]=l):l=e[0];const i=n?` · ${n}`:"";let h;e[1]!==s||e[2]!==i?(h=t.jsxs("span",{className:"alive-muted",children:[s,i]}),e[1]=s,e[2]=i,e[3]=h):h=e[3];let r;e[4]===Symbol.for("react.memo_cache_sentinel")?(r=t.jsx("span",{className:"alive-spacer"}),e[4]=r):r=e[4];let f;e[5]===Symbol.for("react.memo_cache_sentinel")?(f=t.jsx(Ie,{size:16}),e[5]=f):f=e[5];let m;e[6]!==o?(m=t.jsx("button",{type:"button",className:"alive-close","aria-label":"Close alive captions",onClick:o,children:f}),e[6]=o,e[7]=m):m=e[7];let d;return e[8]!==c||e[9]!==h||e[10]!==m?(d=t.jsxs("header",{className:"alive-header",children:[l,h,r,c,m]}),e[8]=c,e[9]=h,e[10]=m,e[11]=d):d=e[11],d}function it({asset:a,data:e,onClose:s,onSave:n,onRender:o,onReanalyze:c}){const{analysis:l}=e,i=Math.round(a.fps??ge)||ge,h=Math.max(1,Math.round(l.durationSeconds*i)),[r,f]=A.useState(e.settings),[m,d]=A.useState(()=>Re(a.width,a.height)),[g,u]=A.useState(!0),[j,v]=A.useState(null),[C,y]=A.useState(null),w=A.useRef(null),{frame:$,playing:b}=at(w),N=$/i,P=A.useMemo(()=>Ae(l,m),[l,m]),x=A.useMemo(()=>Me(l.phrases,r,P),[l.phrases,r,P]),k=A.useMemo(()=>_e(l,r),[l,r]),M=A.useMemo(()=>Ee(k),[k]),D=A.useMemo(()=>({mediaUrl:a.mediaUrl,sourceWidth:l.sourceWidth,sourceHeight:l.sourceHeight,cues:x,phrases:l.phrases,settings:r,showRegions:g}),[a.mediaUrl,l,x,r,g]),O=Oe(x,N),_=p=>w.current?.seekTo(Math.max(0,Math.min(h-1,Math.round(p*i)))),H=p=>f(L=>({...L,...p})),W=async(p,L,I)=>{v(p),y(null);try{await L(),y(I)}catch(z){y(z instanceof Error?z.message:String(z))}finally{v(null)}},R=fe.find(p=>p.id===m)??fe[0];return t.jsxs("div",{className:"alive-studio-body",children:[t.jsxs(je,{label:a.label,detail:`${l.sourceWidth}×${l.sourceHeight} · ${i} fps`,onClose:s,children:[t.jsx("div",{className:"alive-segmented",role:"group","aria-label":"Preview orientation",children:fe.map(p=>t.jsx("button",{type:"button","aria-pressed":p.id===m,onClick:()=>d(p.id),children:p.label},p.id))}),t.jsx("button",{type:"button",className:"alive-secondary",disabled:j!==null,onClick:()=>{W("Saving",()=>n(r),"Saved. Renders of this video now use alive captions.")},children:"Save"}),t.jsxs("button",{type:"button",className:"alive-primary",disabled:j!==null,onClick:()=>{W("Rendering",()=>o(r,m),`Saved and queued a ${R.label} render.`)},children:["Render ",R.label]})]}),t.jsxs("div",{className:"alive-main",children:[t.jsx(Xe,{rows:k,phraseLabels:x.map(me),activePhrase:O,time:N,snapped:r.snapToOnsets,onSeek:_}),t.jsxs("div",{className:"alive-stage",children:[t.jsx("div",{className:"alive-player",style:{aspectRatio:`${R.width} / ${R.height}`},children:t.jsx(Ne,{ref:w,component:Ke,inputProps:D,durationInFrames:h,fps:i,compositionWidth:R.width,compositionHeight:R.height,style:{width:"100%",height:"100%"},clickToPlay:!0,spaceKeyToPlayOrPause:!0})}),t.jsx("p",{className:"alive-status",role:"status",children:j?`${j}…`:C??(O>=0?`${me(x[O])} · ${x[O].lines.length} lines`:"Between phrases")})]}),t.jsx(Ye,{settings:r,showRegions:g,regionsAnalyzed:l.regionsAnalyzed,working:j!==null,onChange:H,onShowRegions:u,onReanalyze:()=>{W("Re-running analysis",c,"Analysis refreshed.")}})]}),t.jsx(tt,{duration:l.durationSeconds,fps:i,time:N,playing:b,envelope:l.envelope,rows:k,cues:x,activeCue:O,snapped:r.snapToOnsets,drift:M,onSeek:_,onStep:p=>_(N+p/i),onTogglePlay:()=>w.current?.toggle(),onToggleSnap:()=>H({snapToOnsets:!r.snapToOnsets})})]})}export{ft as AliveCaptionsStudio};
@@ -0,0 +1 @@
1
+ import{c as de,a as je,j as t}from"./vendor-react-Dj7D1fD4.js";import{c1 as Gt,c2 as Kt,c3 as Yt,c4 as Xt,i as Jt,c5 as Zt,c6 as el,c7 as tl,c8 as It,c9 as Lt,ca as Ft,cb as ll,cc as sl,ad as nl,cd as il,ce as al,cf as rl,cg as ol,ch as pt,ci as cl,cj as xt,ck as dl,cl as ml,cm as ul,b2 as hl,E as fl,cn as pl,b3 as xl,co as gl,cp as Mt,ae as bl,cq as vl,Y as jl,cr as yl,bJ as wl,b5 as Nl,b6 as Sl,cs as Cl,ct as kl,cu as Pl,cv as Je,cw as gt,cx as bt,cy as _l,cz as El,cA as vt,cB as $l,cC as Al,cD as Rl,cE as Tl,cF as Il,cG as Ll,cH as Fl,bf as Ml,cI as Dl,x as Ol,cJ as Hl,cK as Ul,cL as Vl,cM as Ql,cN as ql,cO as Bl,cP as zl,cQ as Dt,cR as Wl,cS as jt,cT as yt,cU as wt,cV as Gl,cW as Kl,cX as Nt,cY as St,cZ as Yl,c_ as Xl,c$ as Jl,d0 as Zl,d1 as es,d2 as mt,d3 as ts,d4 as Ot,d5 as ls,d6 as ss,d7 as ns,d8 as is,d9 as as}from"./videobook-J-j9bSjM.js";import{P as rs,I as os,V as cs,a as ds,D as ms,R as us,G as Ct,M as Ht}from"./ui-CXDi5Omq.js";import{F as Ut,ac as ft,c as ut,x as Vt,g as hs,h as fs,X as Qt,m as ps,i as xs,k as gs,w as bs,V as vs,ai as js,ad as ys,_ as kt}from"./vendor-icons-CGqhCIXV.js";function Cn(i){const e=de.c(40),{review:s,onChange:l,disabled:n}=i,a=je.useRef(null),r=je.useRef(null),u=je.useRef(!1),[c,p]=je.useState(null),o=s.suggestion,f=o?.startSeconds??0,d=o?.endSeconds??0,m=o?.fps??30;let h;e[0]!==d||e[1]!==o||e[2]!==f?(h=o?Gt(f,d,o.durationSeconds):null,e[0]=d,e[1]=o,e[2]=f,e[3]=h):h=e[3];const x=h;let g;e[4]!==d||e[5]!==m?(g=()=>{const N=a.current;if(!N)return;N.pause(),r.current=null;let E=0;const I=()=>{!N.seeking&&r.current==="hook"&&N.currentTime>=d-.5/m&&(u.current?(r.current="full",N.currentTime=0,N.play().catch(()=>p("Press Play to resume the preview."))):(r.current=null,N.pause())),E=requestAnimationFrame(I)};return E=requestAnimationFrame(I),()=>{cancelAnimationFrame(E),N.pause()}},e[4]=d,e[5]=m,e[6]=g):g=e[6];let S;e[7]!==d||e[8]!==m||e[9]!==s.mediaUrl||e[10]!==f?(S=[s.mediaUrl,f,d,m],e[7]=d,e[8]=m,e[9]=s.mediaUrl,e[10]=f,e[11]=S):S=e[11],je.useEffect(g,S);let j;e[12]!==f?(j=async N=>{const E=a.current;if(E){p(null),u.current=N,r.current="hook",E.currentTime=f;try{await E.play()}catch{p("Unable to play this preview. Try Play again.")}}},e[12]=f,e[13]=j):j=e[13];const C=j;let y;e[14]!==d||e[15]!==m||e[16]!==l||e[17]!==f?(y=(N,E)=>{if(N.key!=="ArrowLeft"&&N.key!=="ArrowRight")return;N.preventDefault();const I=(N.key==="ArrowRight"?1:-1)*(N.shiftKey?1:1/m);l(E==="start"?f+I:f,E==="end"?d+I:d)},e[14]=d,e[15]=m,e[16]=l,e[17]=f,e[18]=y):y=e[18];const k=y;let w;e[19]===Symbol.for("react.memo_cache_sentinel")?(w=()=>{r.current==="hook"&&u.current&&a.current?(r.current="full",a.current.currentTime=0,a.current.play().catch(()=>p("Press Play to resume the preview."))):r.current=null},e[19]=w):w=e[19];let b;e[20]!==s.mediaUrl?(b=t.jsx("video",{ref:a,src:s.mediaUrl,"aria-label":"Cold-open preview",controls:!0,playsInline:!0,preload:"metadata",onEnded:w}),e[20]=s.mediaUrl,e[21]=b):b=e[21];let v;e[22]!==n||e[23]!==d||e[24]!==m||e[25]!==x||e[26]!==k||e[27]!==l||e[28]!==C||e[29]!==o||e[30]!==f?(v=o?t.jsxs(t.Fragment,{children:[t.jsx("p",{children:o.reason}),t.jsxs("div",{className:"cold-open-bounds",children:[t.jsxs("label",{children:["Start (seconds)",t.jsx("input",{type:"number","aria-label":"Highlight start",step:1/m,min:0,max:o.durationSeconds,value:Number.isFinite(f)?f:"",disabled:n,onKeyDown:N=>k(N,"start"),onChange:N=>l(N.target.valueAsNumber,d)})]}),t.jsxs("label",{children:["End (seconds)",t.jsx("input",{type:"number","aria-label":"Highlight end",step:1/m,min:0,max:o.durationSeconds,value:Number.isFinite(d)?d:"",disabled:n,onKeyDown:N=>k(N,"end"),onChange:N=>l(f,N.target.valueAsNumber)})]})]}),t.jsxs("div",{className:"cold-open-playback",children:[t.jsx("button",{type:"button",disabled:n||!!x,onClick:()=>{C(!1)},children:"Play highlight"}),t.jsx("button",{type:"button",disabled:n||!!x,onClick:()=>{C(!0)},children:"Preview cold open"})]}),t.jsx("p",{children:x??`${(d-f).toFixed(2)}s highlight → full ${o.durationSeconds.toFixed(2)}s clip · ${(o.durationSeconds+d-f).toFixed(2)}s total`}),t.jsx("small",{children:"← → nudge one frame · Shift + ← → nudge one second"})]}):t.jsx("p",{children:"AI will suggest a 2–5 second highlight. Review its timing before creating the copy. Analysis uses your configured provider and may incur charges."}),e[22]=n,e[23]=d,e[24]=m,e[25]=x,e[26]=k,e[27]=l,e[28]=C,e[29]=o,e[30]=f,e[31]=v):v=e[31];let _;e[32]!==c?(_=c&&t.jsx("p",{role:"alert",children:c}),e[32]=c,e[33]=_):_=e[33];let $;e[34]!==v||e[35]!==_?($=t.jsxs("div",{className:"cold-open-controls",children:[v,_]}),e[34]=v,e[35]=_,e[36]=$):$=e[36];let A;return e[37]!==$||e[38]!==b?(A=t.jsxs("div",{className:"cold-open-review-body",children:[b,$]}),e[37]=$,e[38]=b,e[39]=A):A=e[39],A}const ws={en:"EN",th:"TH · ไทย"};function Ns(i){if(!i)return"Media details unavailable";const e=[i.duration?nl(i.duration):null,i.width&&i.height?`${i.width}×${i.height}`:null].filter(Boolean);return e.length?e.join(" · "):i.type}function Ss(i){const e=de.c(34),{post:s,asset:l,onOpenPost:n}=i,a=!!s.definition.source?.snapshotArtifactId;let r;e[0]!==l||e[1]!==s.address?(r=l?.mediaUrl&&l.type==="image"?t.jsx("img",{src:l.mediaUrl,alt:""}):l?.mediaUrl?t.jsx("video",{src:l.mediaUrl,poster:l.thumbnailUrl??void 0,muted:!0,playsInline:!0,preload:"metadata","aria-label":`${s.address} clip`}):t.jsx("span",{className:"post-delivery-media-fallback",children:t.jsx(Ut,{size:18,"aria-hidden":"true"})}),e[0]=l,e[1]=s.address,e[2]=r):r=e[2];const u=r,c=`post-delivery-post${a?"":" post-delivery-post-blocked"}`,p=`Post ${s.address}`;let o;e[3]!==u?(o=t.jsx("div",{className:"post-delivery-media",children:u}),e[3]=u,e[4]=o):o=e[4];const f=l?.label??s.label;let d;e[5]!==s.address||e[6]!==f?(d=t.jsxs("strong",{children:[s.address," · ",f]}),e[5]=s.address,e[6]=f,e[7]=d):d=e[7];let m;e[8]!==l?(m=Ns(l),e[8]=l,e[9]=m):m=e[9];let h;e[10]!==m?(h=t.jsx("span",{children:m}),e[10]=m,e[11]=h):h=e[11];let x;e[12]!==a||e[13]!==s.definition.createdAt?(x=a?t.jsxs("span",{children:["Clip saved ",new Date(s.definition.createdAt).toLocaleString()]}):t.jsxs("span",{className:"post-delivery-warning",children:[t.jsx(ft,{size:12,"aria-hidden":"true"}),"No saved source clip"]}),e[12]=a,e[13]=s.definition.createdAt,e[14]=x):x=e[14];let g;e[15]!==s.runtime.icloud?.completedAt?(g=s.runtime.icloud?.completedAt&&t.jsxs("span",{className:"post-delivery-done",children:[t.jsx(ut,{size:12,"aria-hidden":"true"}),"Already on iPhone; saving again checks the files"]}),e[15]=s.runtime.icloud?.completedAt,e[16]=g):g=e[16];let S;e[17]!==s.runtime.dropbox?.completedAt?(S=s.runtime.dropbox?.completedAt&&t.jsxs("span",{className:"post-delivery-done",children:[t.jsx(ut,{size:12,"aria-hidden":"true"}),"Already in Dropbox; uploading again checks the files"]}),e[17]=s.runtime.dropbox?.completedAt,e[18]=S):S=e[18];let j;e[19]!==a||e[20]!==n?(j=!a&&t.jsx("button",{type:"button",onClick:n,children:"Choose a clip in the Post panel"}),e[19]=a,e[20]=n,e[21]=j):j=e[21];let C;e[22]!==g||e[23]!==S||e[24]!==j||e[25]!==d||e[26]!==h||e[27]!==x?(C=t.jsxs("div",{className:"post-delivery-post-copy",children:[d,h,x,g,S,j]}),e[22]=g,e[23]=S,e[24]=j,e[25]=d,e[26]=h,e[27]=x,e[28]=C):C=e[28];let y;return e[29]!==C||e[30]!==c||e[31]!==p||e[32]!==o?(y=t.jsxs("article",{className:c,"aria-label":p,children:[o,C]}),e[29]=C,e[30]=c,e[31]=p,e[32]=o,e[33]=y):y=e[33],y}function Cs(i){const e=de.c(17),{review:s,disabled:l,onCopyChange:n,onLanguage:a}=i,r=s.copy;let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=t.jsx("span",{className:"post-delivery-heading",children:"Platform"}),e[0]=u):u=e[0];let c;e[1]!==r||e[2]!==l||e[3]!==n?(c=rl.map(h=>t.jsx("button",{type:"button","aria-pressed":r.platform===h.id,disabled:l,onClick:()=>n({...r,platform:h.id}),children:h.label},h.id)),e[1]=r,e[2]=l,e[3]=n,e[4]=c):c=e[4];let p;e[5]!==c?(p=t.jsxs("div",{className:"post-copy-group",children:[u,t.jsx("div",{className:"post-delivery-switch",role:"group","aria-label":"Platform",children:c})]}),e[5]=c,e[6]=p):p=e[6];let o;e[7]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx("span",{className:"post-delivery-heading",children:"Language"}),e[7]=o):o=e[7];let f;e[8]!==r||e[9]!==l||e[10]!==a?(f=ol.map(h=>t.jsx("button",{type:"button","aria-pressed":r.language===h,disabled:l,onClick:()=>a(h),children:ws[h]},h)),e[8]=r,e[9]=l,e[10]=a,e[11]=f):f=e[11];let d;e[12]!==f?(d=t.jsxs("div",{className:"post-copy-group",children:[o,t.jsx("div",{className:"post-delivery-switch",role:"group","aria-label":"Caption language",children:f})]}),e[12]=f,e[13]=d):d=e[13];let m;return e[14]!==p||e[15]!==d?(m=t.jsxs("div",{className:"post-copy-toolbar",children:[p,d]}),e[14]=p,e[15]=d,e[16]=m):m=e[16],m}function ks(i){const e=de.c(21),{copy:s,disabled:l,onCopyChange:n}=i,a=s.tracks[s.language];if(!a||a.versions.length<2)return null;const r=l||a.index===0;let u;e[0]!==s||e[1]!==n?(u=()=>n(pt(s,-1)),e[0]=s,e[1]=n,e[2]=u):u=e[2];let c;e[3]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(hs,{size:12,"aria-hidden":"true"}),e[3]=c):c=e[3];let p;e[4]!==r||e[5]!==u?(p=t.jsx("button",{type:"button","aria-label":"Previous caption version",disabled:r,onClick:u,children:c}),e[4]=r,e[5]=u,e[6]=p):p=e[6];const o=a.index+1;let f;e[7]!==o||e[8]!==a.versions.length?(f=t.jsxs("small",{children:["v",o,"/",a.versions.length]}),e[7]=o,e[8]=a.versions.length,e[9]=f):f=e[9];const d=l||a.index===a.versions.length-1;let m;e[10]!==s||e[11]!==n?(m=()=>n(pt(s,1)),e[10]=s,e[11]=n,e[12]=m):m=e[12];let h;e[13]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx(fs,{size:12,"aria-hidden":"true"}),e[13]=h):h=e[13];let x;e[14]!==d||e[15]!==m?(x=t.jsx("button",{type:"button","aria-label":"Next caption version",disabled:d,onClick:m,children:h}),e[14]=d,e[15]=m,e[16]=x):x=e[16];let g;return e[17]!==x||e[18]!==p||e[19]!==f?(g=t.jsxs("span",{className:"post-copy-versions",children:[p,f,x]}),e[17]=x,e[18]=p,e[19]=f,e[20]=g):g=e[20],g}function Ps(i){const e=de.c(37),{copy:s,disabled:l,onCopyChange:n}=i,[a,r]=je.useState("");let u,c,p,o,f,d,m,h;if(e[0]!==s||e[1]!==l||e[2]!==a||e[3]!==n){h=It(s)?.tags??[];let y;e[12]!==s||e[13]!==a||e[14]!==n?(y=()=>{a.trim()&&(n(cl(s,a)),r(""))},e[12]=s,e[13]=a,e[14]=n,e[15]=y):y=e[15],u=y,c=b=>{b.key==="Enter"||b.key===","?(b.preventDefault(),u()):b.key==="Backspace"&&!a&&h.length&&n(xt(s,h[h.length-1]))},d="post-copy-tags";let k;e[16]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx("label",{htmlFor:"post-delivery-tag",children:"Tags"}),e[16]=k):k=e[16],m=t.jsxs("div",{className:"post-delivery-label-row",children:[k,t.jsxs("small",{children:[h.length," · added after the caption"]})]}),p="post-copy-tag-field",o=s.language;let w;e[17]!==s||e[18]!==l||e[19]!==n?(w=b=>t.jsxs("span",{className:"post-copy-tag",children:["#",b,t.jsx("button",{type:"button","aria-label":`Remove tag ${b}`,disabled:l,onClick:()=>n(xt(s,b)),children:t.jsx(Qt,{size:11,"aria-hidden":"true"})})]},b),e[17]=s,e[18]=l,e[19]=n,e[20]=w):w=e[20],f=h.map(w),e[0]=s,e[1]=l,e[2]=a,e[3]=n,e[4]=u,e[5]=c,e[6]=p,e[7]=o,e[8]=f,e[9]=d,e[10]=m,e[11]=h}else u=e[4],c=e[5],p=e[6],o=e[7],f=e[8],d=e[9],m=e[10],h=e[11];const x=h.length?"+ tag":"Add a tag, then Enter";let g;e[21]===Symbol.for("react.memo_cache_sentinel")?(g=y=>r(y.target.value),e[21]=g):g=e[21];let S;e[22]!==u||e[23]!==l||e[24]!==a||e[25]!==c||e[26]!==x?(S=t.jsx("input",{id:"post-delivery-tag",type:"text",value:a,disabled:l,spellCheck:!1,placeholder:x,onChange:g,onKeyDown:c,onBlur:u}),e[22]=u,e[23]=l,e[24]=a,e[25]=c,e[26]=x,e[27]=S):S=e[27];let j;e[28]!==p||e[29]!==o||e[30]!==f||e[31]!==S?(j=t.jsxs("div",{className:p,lang:o,children:[f,S]}),e[28]=p,e[29]=o,e[30]=f,e[31]=S,e[32]=j):j=e[32];let C;return e[33]!==d||e[34]!==m||e[35]!==j?(C=t.jsxs("div",{className:d,children:[m,j]}),e[33]=d,e[34]=m,e[35]=j,e[36]=C):C=e[36],C}function _s(i){const e=de.c(34),{copy:s,disabled:l,onCopyChange:n,onRegen:a}=i;let r;e[0]!==s||e[1]!==n?(r=w=>n({...s,prompt:s.prompt.trim()?`${s.prompt.trim()}, ${w.toLowerCase()}`:w}),e[0]=s,e[1]=n,e[2]=r):r=e[2];const u=r;let c;e[3]!==l||e[4]!==a?(c=w=>{w.key!=="Enter"||w.metaKey||w.ctrlKey||(w.preventDefault(),l||a())},e[3]=l,e[4]=a,e[5]=c):c=e[5];const p=c;let o;e[6]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsx("label",{htmlFor:"post-delivery-astra",children:"Regen with Astra"}),e[6]=o):o=e[6];const f=Ft[s.platform],d=Lt[s.language];let m;e[7]!==f||e[8]!==d?(m=t.jsxs("div",{className:"post-delivery-label-row",children:[o,t.jsxs("small",{children:["video analysis + your note · ",f," · ",d]})]}),e[7]=f,e[8]=d,e[9]=m):m=e[9];let h;e[10]!==s||e[11]!==n?(h=w=>n({...s,prompt:w.target.value}),e[10]=s,e[11]=n,e[12]=h):h=e[12];let x;e[13]!==s.prompt||e[14]!==l||e[15]!==p||e[16]!==h?(x=t.jsx("input",{id:"post-delivery-astra",type:"text",value:s.prompt,disabled:l,maxLength:1e3,placeholder:"Tell Astra how to rewrite — punchier hook, mention the rain, 3 tags…",onChange:h,onKeyDown:p}),e[13]=s.prompt,e[14]=l,e[15]=p,e[16]=h,e[17]=x):x=e[17];let g;e[18]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx(Vt,{size:12,"aria-hidden":"true"}),e[18]=g):g=e[18];let S;e[19]!==l||e[20]!==a?(S=t.jsxs("button",{type:"button",className:"post-copy-regen-button",disabled:l,onClick:a,children:[g,"Regen post"]}),e[19]=l,e[20]=a,e[21]=S):S=e[21];let j;e[22]!==S||e[23]!==x?(j=t.jsxs("div",{className:"post-copy-regen-row",children:[x,S]}),e[22]=S,e[23]=x,e[24]=j):j=e[24];let C;e[25]!==u||e[26]!==l?(C=il.map(w=>t.jsx("button",{type:"button",disabled:l,onClick:()=>u(w),children:w},w)),e[25]=u,e[26]=l,e[27]=C):C=e[27];let y;e[28]!==C?(y=t.jsx("div",{className:"post-copy-presets",children:C}),e[28]=C,e[29]=y):y=e[29];let k;return e[30]!==j||e[31]!==y||e[32]!==m?(k=t.jsxs("div",{className:"post-copy-regen",children:[m,j,y]}),e[30]=j,e[31]=y,e[32]=m,e[33]=k):k=e[33],k}function Es(i){const e=de.c(84),{post:s,review:l,busy:n,onCopyChange:a,onLanguage:r,onRegen:u}=i;let c;e[0]!==s?(c=el(s),e[0]=s,e[1]=c):c=e[1];const p=c,o=l.copy,f=o.drafting?.language===o.language,d=n||p;let m,h,x,g,S,j,C,y,k,w,b;if(e[2]!==o||e[3]!==d||e[4]!==a||e[5]!==r||e[6]!==l){const V=tl(o);let U;e[18]!==o?(U=It(o),e[18]=o,e[19]=U):U=e[19],b=U;const B=b&&b.origin!=="saved"&&b.origin!=="edited";m="post-delivery-caption";const L=d||!!o.drafting;e[20]!==a||e[21]!==r||e[22]!==l||e[23]!==L?(h=t.jsx(Cs,{review:l,disabled:L,onCopyChange:a,onLanguage:r}),e[20]=a,e[21]=r,e[22]=l,e[23]=L,e[24]=h):h=e[24],k="post-delivery-label-row";let H;e[25]===Symbol.for("react.memo_cache_sentinel")?(H=t.jsx("label",{htmlFor:"post-delivery-caption",children:"Caption"}),e[25]=H):H=e[25];let T;e[26]!==B?(T=B&&t.jsxs("span",{className:"post-copy-badge",children:[t.jsx(Vt,{size:10,"aria-hidden":"true"}),"Auto · from video analysis"]}),e[26]=B,e[27]=T):T=e[27],e[28]!==T?(w=t.jsxs("span",{className:"post-copy-caption-label",children:[H,T]}),e[28]=T,e[29]=w):w=e[29],C="post-copy-caption-meta";const O=d||!!o.drafting;e[30]!==o||e[31]!==a||e[32]!==O?(y=t.jsx(ks,{copy:o,disabled:O,onCopyChange:a}),e[30]=o,e[31]=a,e[32]=O,e[33]=y):y=e[33],x=V.over||V.length>al?"confirm-field-error":void 0,g=V.length.toLocaleString(),S=" / ",j=V.limit.toLocaleString(),e[2]=o,e[3]=d,e[4]=a,e[5]=r,e[6]=l,e[7]=m,e[8]=h,e[9]=x,e[10]=g,e[11]=S,e[12]=j,e[13]=C,e[14]=y,e[15]=k,e[16]=w,e[17]=b}else m=e[7],h=e[8],x=e[9],g=e[10],S=e[11],j=e[12],C=e[13],y=e[14],k=e[15],w=e[16],b=e[17];let v;e[34]!==x||e[35]!==g||e[36]!==S||e[37]!==j?(v=t.jsxs("small",{className:x,children:[g,S,j]}),e[34]=x,e[35]=g,e[36]=S,e[37]=j,e[38]=v):v=e[38];let _;e[39]!==v||e[40]!==C||e[41]!==y?(_=t.jsxs("span",{className:C,children:[y,v]}),e[39]=v,e[40]=C,e[41]=y,e[42]=_):_=e[42];let $;e[43]!==_||e[44]!==k||e[45]!==w?($=t.jsxs("div",{className:k,children:[w,_]}),e[43]=_,e[44]=k,e[45]=w,e[46]=$):$=e[46];let A;e[47]!==n||e[48]!==o||e[49]!==f||e[50]!==p||e[51]!==a||e[52]!==s||e[53]!==b?.body?(A=f?t.jsxs("div",{className:"post-copy-drafting",role:"status",children:["Astra is writing the ",Lt[o.language]," caption for ",Ft[o.platform],"…"]}):t.jsx("textarea",{id:"post-delivery-caption",lang:o.language,value:p?s.definition.caption:b?.body??"",disabled:n,readOnly:p,placeholder:"Write the caption that ships with this clip…",onChange:V=>a(ll(o,{body:V.target.value}))}),e[47]=n,e[48]=o,e[49]=f,e[50]=p,e[51]=a,e[52]=s,e[53]=b?.body,e[54]=A):A=e[54];let N;e[55]!==o.error?(N=o.error&&t.jsx("small",{className:"confirm-field-error",children:o.error}),e[55]=o.error,e[56]=N):N=e[56];let E;e[57]!==o||e[58]!==d||e[59]!==f||e[60]!==p||e[61]!==a?(E=!p&&t.jsx(Ps,{copy:o,disabled:d||f,onCopyChange:a}),e[57]=o,e[58]=d,e[59]=f,e[60]=p,e[61]=a,e[62]=E):E=e[62];let I;e[63]!==o||e[64]!==p||e[65]!==s?(I=p?"Frozen at the first delivery. Create a new Post to change it.":`${sl(o)} · Saved to ${s.address} and written to caption.txt${s.definition.credits?" with its credits":""}.`,e[63]=o,e[64]=p,e[65]=s,e[66]=I):I=e[66];let F;e[67]!==I?(F=t.jsx("small",{children:I}),e[67]=I,e[68]=F):F=e[68];let M;e[69]!==n||e[70]!==o||e[71]!==p||e[72]!==a||e[73]!==u?(M=!p&&t.jsx(_s,{copy:o,disabled:n||!!o.drafting,onCopyChange:a,onRegen:u}),e[69]=n,e[70]=o,e[71]=p,e[72]=a,e[73]=u,e[74]=M):M=e[74];let D;return e[75]!==m||e[76]!==h||e[77]!==$||e[78]!==A||e[79]!==N||e[80]!==E||e[81]!==F||e[82]!==M?(D=t.jsxs("div",{className:m,children:[h,$,A,N,E,F,M]}),e[75]=m,e[76]=h,e[77]=$,e[78]=A,e[79]=N,e[80]=E,e[81]=F,e[82]=M,e[83]=D):D=e[83],D}function $s(i){const e=de.c(19),{review:s,busy:l,onConnect:n,onCheckConnection:a}=i,r=s.connection;if(!r){let x;return e[0]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx("p",{className:"post-delivery-account",children:"Checking Dropbox…"}),e[0]=x):x=e[0],x}if(r.connected){let x;return e[1]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsxs("p",{className:"post-delivery-account post-delivery-account-ready",children:[t.jsx(ut,{size:12,"aria-hidden":"true"}),"Dropbox connected"]}),e[1]=x):x=e[1],x}const u=s.connecting||r.pending?"Waiting for Dropbox approval…":"Dropbox not connected";let c;e[2]!==u?(c=t.jsx("span",{children:u}),e[2]=u,e[3]=c):c=e[3];const p=l||s.connecting||!r.hasCredentials;let o;e[4]!==n||e[5]!==p?(o=t.jsx("button",{type:"button",disabled:p,onClick:n,children:"Connect Dropbox ↗"}),e[4]=n,e[5]=p,e[6]=o):o=e[6];let f;e[7]!==l||e[8]!==a?(f=t.jsx("button",{type:"button",disabled:l,onClick:a,children:"Check again"}),e[7]=l,e[8]=a,e[9]=f):f=e[9];let d;e[10]!==o||e[11]!==f?(d=t.jsxs("div",{children:[o,f]}),e[10]=o,e[11]=f,e[12]=d):d=e[12];let m;e[13]!==r.error?(m=r.error&&t.jsx("small",{className:"confirm-field-error",children:r.error}),e[13]=r.error,e[14]=m):m=e[14];let h;return e[15]!==c||e[16]!==d||e[17]!==m?(h=t.jsxs("div",{className:"post-delivery-account post-delivery-account-missing",children:[c,d,m]}),e[15]=c,e[16]=d,e[17]=m,e[18]=h):h=e[18],h}function As(i){return i.trim().replace(/\/+$/u,"")||"…"}function kn(i){const e=de.c(65),s=i.review.destination==="icloud",l=s?i.review.icloudFolder:i.review.dropboxFolder;let n;e[0]!==s||e[1]!==i.review.dropboxFolder||e[2]!==i.review.icloudFolder?(n=s?Kt(i.review.icloudFolder):Yt(i.review.dropboxFolder),e[0]=s,e[1]=i.review.dropboxFolder,e[2]=i.review.icloudFolder,e[3]=n):n=e[3];const a=n;let r;e[4]!==i.review.icloud?(r=Xt(i.review.icloud),e[4]=i.review.icloud,e[5]=r):r=e[5];const u=r;let c;e[6]!==s||e[7]!==i.review.receipt||e[8]!==i.review.sync?.error||e[9]!==i.review.sync?.phase?(c=i.review.receipt&&s?Jt(i.review.sync?.phase??null,i.review.sync?.error):null,e[6]=s,e[7]=i.review.receipt,e[8]=i.review.sync?.error,e[9]=i.review.sync?.phase,e[10]=c):c=e[10];const p=c,o=i.review.icloud&&!i.review.icloud.available?i.review.icloud.reason??"iCloud Drive isn't available on this Mac.":null;let f;e[11]!==i.asset||e[12]!==i.onOpenPost||e[13]!==i.post?(f=t.jsx(Ss,{post:i.post,asset:i.asset,onOpenPost:i.onOpenPost}),e[11]=i.asset,e[12]=i.onOpenPost,e[13]=i.post,e[14]=f):f=e[14];let d;e[15]!==i.busy||e[16]!==i.onCopyChange||e[17]!==i.onLanguage||e[18]!==i.onRegen||e[19]!==i.post||e[20]!==i.review?(d=t.jsx(Es,{post:i.post,review:i.review,busy:i.busy,onCopyChange:i.onCopyChange,onLanguage:i.onLanguage,onRegen:i.onRegen}),e[15]=i.busy,e[16]=i.onCopyChange,e[17]=i.onLanguage,e[18]=i.onRegen,e[19]=i.post,e[20]=i.review,e[21]=d):d=e[21];let m;e[22]===Symbol.for("react.memo_cache_sentinel")?(m=t.jsx("span",{className:"post-delivery-heading",children:"Destination"}),e[22]=m):m=e[22];let h;e[23]!==i?(h=()=>i.onDestination("icloud"),e[23]=i,e[24]=h):h=e[24];let x;e[25]!==s||e[26]!==i.busy||e[27]!==h?(x=t.jsx("button",{type:"button","aria-pressed":s,disabled:i.busy,onClick:h,children:"iCloud · iPhone"}),e[25]=s,e[26]=i.busy,e[27]=h,e[28]=x):x=e[28];const g=!s;let S;e[29]!==i?(S=()=>i.onDestination("dropbox"),e[29]=i,e[30]=S):S=e[30];let j;e[31]!==i.busy||e[32]!==g||e[33]!==S?(j=t.jsx("button",{type:"button","aria-pressed":g,disabled:i.busy,onClick:S,children:"Dropbox"}),e[31]=i.busy,e[32]=g,e[33]=S,e[34]=j):j=e[34];let C;e[35]!==j||e[36]!==x?(C=t.jsxs("div",{className:"post-delivery-switch",role:"group","aria-label":"Destination",children:[x,j]}),e[35]=j,e[36]=x,e[37]=C):C=e[37];let y;e[38]!==o?(y=o&&t.jsxs("p",{className:"post-delivery-warning",children:[t.jsx(ft,{size:12,"aria-hidden":"true"}),o]}),e[38]=o,e[39]=y):y=e[39];let k;e[40]!==l||e[41]!==a||e[42]!==s||e[43]!==i||e[44]!==u?(k=s?t.jsxs(t.Fragment,{children:[u&&t.jsx("p",{className:i.review.icloud?.shared===!1?"post-delivery-warning":"post-delivery-done",children:u}),t.jsx("label",{className:"confirm-field",htmlFor:"post-delivery-folder",children:"Folder"}),t.jsx("input",{id:"post-delivery-folder",type:"text",value:l,disabled:i.busy,spellCheck:!1,"aria-invalid":a?!0:void 0,onChange:A=>i.onFolderChange(A.target.value)}),t.jsxs("small",{children:["Appears on iPhone in Files › Shared › Videobook › ",As(l)]})]}):t.jsxs(t.Fragment,{children:[t.jsx($s,{review:i.review,busy:i.busy,onConnect:i.onConnect,onCheckConnection:i.onCheckConnection}),t.jsx("label",{className:"confirm-field",htmlFor:"post-delivery-folder",children:"Folder"}),t.jsx("input",{id:"post-delivery-folder",type:"text",value:l,disabled:i.busy,spellCheck:!1,"aria-invalid":a?!0:void 0,onChange:A=>i.onFolderChange(A.target.value)}),t.jsx("small",{children:"Uploads clip and caption.txt here. Other files in the folder are kept."})]}),e[40]=l,e[41]=a,e[42]=s,e[43]=i,e[44]=u,e[45]=k):k=e[45];let w;e[46]!==i.review.receipt?(w=i.review.receipt&&t.jsx("p",{className:"post-delivery-receipt",children:i.review.receipt}),e[46]=i.review.receipt,e[47]=w):w=e[47];let b;e[48]!==p?(b=p&&t.jsx("p",{className:"post-delivery-progress",children:p}),e[48]=p,e[49]=b):b=e[49];let v;e[50]!==i.busy||e[51]!==i.onLink||e[52]!==i.post?(v=Zt(i.post)&&t.jsx(rs,{post:i.post,disabled:i.busy,className:"post-delivery-link",onLink:i.onLink}),e[50]=i.busy,e[51]=i.onLink,e[52]=i.post,e[53]=v):v=e[53];let _;e[54]!==C||e[55]!==y||e[56]!==k||e[57]!==w||e[58]!==b||e[59]!==v?(_=t.jsxs("div",{className:"post-delivery-destination",children:[m,C,y,k,w,b,v]}),e[54]=C,e[55]=y,e[56]=k,e[57]=w,e[58]=b,e[59]=v,e[60]=_):_=e[60];let $;return e[61]!==_||e[62]!==f||e[63]!==d?($=t.jsxs("div",{className:"post-delivery-body",children:[f,d,_]}),e[61]=_,e[62]=f,e[63]=d,e[64]=$):$=e[64],$}const Rs=new Map;function Pt(i){const e=i.cell.inputs;return e&&typeof e.generationMode=="string"?e.generationMode:""}function Ts(i,e){const s=new Map;for(const l of i)if(l.asset)for(const n of[l.cellId,`@${l.address}`,l.asset.artifactId,`@${l.asset.artifactId}`,l.asset.mediaUrl,l.asset.thumbnailUrl])n&&s.set(n,l.asset);for(const l of Mt(e).urlPlaceholders){const n=s.get(l.reference);n&&s.set(l.url,n)}return s}function _t(i){const e=de.c(25),{badge:s,busy:l,onClick:n,source:a,title:r}=i;let u;e[0]!==s?(u=t.jsx("span",{className:"generation-review-source-badge",children:s}),e[0]=s,e[1]=u):u=e[1];let c;e[2]!==a.asset||e[3]!==a.type?(c=a.asset??{type:a.type,mediaUrl:null,thumbnailUrl:null,duration:null},e[2]=a.asset,e[3]=a.type,e[4]=c):c=e[4];let p;e[5]!==c?(p=t.jsx("span",{className:"generation-review-source-preview",children:t.jsx(Ht,{asset:c,eager:!0})}),e[5]=c,e[6]=p):p=e[6];const o=a.mention??a.address;let f;e[7]!==o?(f=t.jsxs("strong",{children:["@",o]}),e[7]=o,e[8]=f):f=e[8];const d=a.mention?`@${a.address} · `:"";let m;e[9]!==a.targetLabel||e[10]!==a.type?(m=a.targetLabel??a.type.replaceAll("_"," "),e[9]=a.targetLabel,e[10]=a.type,e[11]=m):m=e[11];let h;e[12]!==d||e[13]!==m?(h=t.jsxs("small",{children:[d,m]}),e[12]=d,e[13]=m,e[14]=h):h=e[14];let x;e[15]!==f||e[16]!==h?(x=t.jsxs("span",{className:"generation-review-source-copy",children:[f,h]}),e[15]=f,e[16]=h,e[17]=x):x=e[17];let g;return e[18]!==l||e[19]!==n||e[20]!==u||e[21]!==p||e[22]!==x||e[23]!==r?(g=t.jsxs("button",{type:"button",className:"generation-review-source",disabled:l,onClick:n,title:r,children:[u,p,x]}),e[18]=l,e[19]=n,e[20]=u,e[21]=p,e[22]=x,e[23]=r,e[24]=g):g=e[24],g}function Pn(i){const e=de.c(153),{actions:s,busy:l,draft:n,modes:a,preview:r,previewError:u,previewLoading:c,previewStale:p,sources:o,sourceOptions:f,voiceCatalog:d,promptEditor:m,promptHistory:h,inputFooter:x,compatibleModeIds:g,sourceVisible:S,notebookId:j,doltArtifactAssets:C,onActionChange:y,onAddSource:k,onModeChange:w,onPromptChange:b,onRefreshPreview:v,onRemoveSource:_,onSelectSource:$,onSettingChange:A}=i,N=S===void 0?!1:S,E=j===void 0?"":j,[I,F]=je.useState(!1),M=dl(n.cell.type,Pt(n),n.action.operation,o),D=ml(s,M);let V;e[0]!==n?(V=ul(n),e[0]=n,e[1]=V):V=e[1];const U=V;let B;e[2]!==n.cell.inputs?(B=n.cell.inputs??{},e[2]=n.cell.inputs,e[3]=B):B=e[3];let L;e[4]!==n.action.model||e[5]!==B?(L=hl(n.action.model,B),e[4]=n.action.model,e[5]=B,e[6]=L):L=e[6];const H=L,T=fl();let O;e[7]!==d?(O=()=>{d&&d.ensureLoaded().catch(Bs)},e[7]=d,e[8]=O):O=e[8];const Y=O;let X;e[9]!==d?(X=()=>{d&&d.refresh().catch(qs)},e[9]=d,e[10]=X):X=e[10];const te=X;let W;e[11]!==n.action.controls||e[12]!==n.cell.type?(W=n.cell.type==="generate_audio"?n.action.controls.find(Qs):void 0,e[11]=n.action.controls,e[12]=n.cell.type,e[13]=W):W=e[13];const z=W;let G;e[14]!==d?.voices||e[15]!==z?(G=z?d?.voices??[]:[],e[14]=d?.voices,e[15]=z,e[16]=G):G=e[16];const K=G,Z=K.length>0,ge=typeof U.voice_id=="string"?U.voice_id:"";let se;e[17]!==n.action.model?(se=pl(n.action.model),e[17]=n.action.model,e[18]=se):se=e[18];const be=se,ne=n.cell.inputs?.generationMode??n.cell.inputs?.mode;let pe;e[19]!==n.action.model||e[20]!==ne?(pe=xl(n.action.model,ne),e[19]=n.action.model,e[20]=ne,e[21]=pe):pe=e[21];const oe=pe,we=oe?n.action.controls.filter(Vs):be?n.action.controls.filter(Us):n.action.controls,ie=Z?n.action.controls.filter(Hs):we,me=ie.filter(Os),ce=ie.filter(Ds);let le;e[22]!==r?(le=wl(r),e[22]=r,e[23]=le):le=e[23];const J=le;let ue;e[24]!==r||e[25]!==o?(ue=Ts(o,r),e[24]=r,e[25]=o,e[26]=ue):ue=e[26];const ae=ue,re=gl(r),Se=p?[]:Mt(r).promptLeaks;let ve;e[27]!==n.action.model||e[28]!==n.action.provider||e[29]!==n.action.tool||e[30]!==n.cell.inputs||e[31]!==n.cell.prompt||e[32]!==J?(ve=J??{status:"unresolved_draft",message:"The server preview has not resolved this draft yet.",payload:null,draft:{tool:n.action.tool,provider:n.action.provider,model:n.action.model,prompt:n.cell.prompt,inputs:n.cell.inputs??{}}},e[27]=n.action.model,e[28]=n.action.provider,e[29]=n.action.tool,e[30]=n.cell.inputs,e[31]=n.cell.prompt,e[32]=J,e[33]=ve):ve=e[33];const ye=ve;let Ce;e[34]!==n.cell||e[35]!==E||e[36]!==N?(Ce=N?bl(E,n.cell).length:0,e[34]=n.cell,e[35]=E,e[36]=N,e[37]=Ce):Ce=e[37];const xe=Ce;let Ne;e[38]===Symbol.for("react.memo_cache_sentinel")?(Ne=t.jsx("span",{className:"confirm-section-label",children:"Inputs"}),e[38]=Ne):Ne=e[38];let fe;if(e[39]!==l||e[40]!==_||e[41]!==$||e[42]!==o){let q;e[44]!==l||e[45]!==_||e[46]!==$?(q=Be=>t.jsxs("div",{className:"generation-review-source-wrap",children:[t.jsx(_t,{badge:"Input",busy:l,source:Be,title:`Select @${Be.address} on the board`,onClick:()=>$(Be.cellId)}),t.jsx("button",{type:"button",className:"generation-review-source-remove",disabled:l,"aria-label":`Remove @${Be.address} input`,title:`Remove @${Be.address} input`,onClick:()=>_(Be.cellId,Be.targetInput),children:t.jsx(Qt,{size:11,"aria-hidden":"true"})})]},`${Be.cellId}:${Be.targetInput??""}`),e[44]=l,e[45]=_,e[46]=$,e[47]=q):q=e[47],fe=o.map(q),e[39]=l,e[40]=_,e[41]=$,e[42]=o,e[43]=fe}else fe=e[43];let ee;e[48]!==o.length?(ee=o.length===0&&t.jsxs("div",{className:"generation-review-text-input",children:[t.jsx("span",{children:"Input"}),t.jsx("strong",{children:"Prompt only"}),t.jsx("small",{children:"No source media attached"})]}),e[48]=o.length,e[49]=ee):ee=e[49];let Ee;e[50]!==l||e[51]!==I||e[52]!==f.length?(Ee=f.length>0&&t.jsxs("button",{type:"button",className:"generation-review-source-add",disabled:l,"aria-expanded":I,onClick:()=>F(Ms),children:[t.jsx(ps,{size:14,"aria-hidden":"true"}),t.jsx("span",{children:"Add input"})]}),e[50]=l,e[51]=I,e[52]=f.length,e[53]=Ee):Ee=e[53];let $e;e[54]!==fe||e[55]!==ee||e[56]!==Ee?($e=t.jsxs("div",{className:"generation-review-sources",children:[fe,ee,Ee]}),e[54]=fe,e[55]=ee,e[56]=Ee,e[57]=$e):$e=e[57];let ke;e[58]!==l||e[59]!==k||e[60]!==I||e[61]!==f?(ke=I&&f.length>0&&t.jsx("div",{className:"generation-review-sources generation-review-source-options","aria-label":"Available input cells",children:f.map(q=>t.jsx(_t,{badge:"Add",busy:l,source:q,title:`Add @${q.address} as ${q.targetLabel??"input"}`,onClick:()=>{k(q.cellId,q.targetInput),F(!1)}},`${q.cellId}:${q.targetInput??""}`))}),e[58]=l,e[59]=k,e[60]=I,e[61]=f,e[62]=ke):ke=e[62];let Re;e[63]!==x||e[64]!==$e||e[65]!==ke?(Re=t.jsxs("section",{className:"confirm-section generation-review-input-section","aria-label":"Inputs",children:[Ne,$e,ke,x]}),e[63]=x,e[64]=$e,e[65]=ke,e[66]=Re):Re=e[66];let Te;e[67]===Symbol.for("react.memo_cache_sentinel")?(Te=t.jsx("span",{className:"confirm-section-label",children:"Model"}),e[67]=Te):Te=e[67];const Oe=n.action.id,De=l||s.length===0;let Pe;e[68]!==y?(Pe=q=>y(q.target.value),e[68]=y,e[69]=Pe):Pe=e[69];const ze=D.map(Ls);let _e;e[70]!==n.action.id||e[71]!==De||e[72]!==Pe||e[73]!==ze?(_e=t.jsxs("label",{children:[Te,t.jsx("select",{"aria-label":"Generation model",value:Oe,disabled:De,onChange:Pe,children:ze})]}),e[70]=n.action.id,e[71]=De,e[72]=Pe,e[73]=ze,e[74]=_e):_e=e[74];let Fe;e[75]!==l||e[76]!==g||e[77]!==n||e[78]!==a||e[79]!==w?(Fe=a.length>1&&t.jsxs("label",{children:[t.jsx("span",{className:"confirm-section-label",children:"Type"}),t.jsx("select",{"aria-label":"Generation type",value:Pt(n),disabled:l,onChange:q=>w(q.target.value),children:a.map(q=>t.jsxs("option",{value:q.id,children:[vl(q.id),g&&!g.has(q.id)?" · check inputs":""]},q.id))})]}),e[75]=l,e[76]=g,e[77]=n,e[78]=a,e[79]=w,e[80]=Fe):Fe=e[80];let Ie;e[81]!==_e||e[82]!==Fe?(Ie=t.jsxs("section",{className:"generation-review-model-section","aria-label":"Model",children:[_e,Fe]}),e[81]=_e,e[82]=Fe,e[83]=Ie):Ie=e[83];let Le;e[84]!==l||e[85]!==n.action.controls||e[86]!==be||e[87]!==A||e[88]!==U||e[89]!==o?(Le=be&&t.jsx(os,{sources:o,settings:U,controls:n.action.controls,busy:l,onChange:A}),e[84]=l,e[85]=n.action.controls,e[86]=be,e[87]=A,e[88]=U,e[89]=o,e[90]=Le):Le=e[90];let He;e[91]!==oe?(He=oe&&t.jsx("p",{className:"muted",children:Nl}),e[91]=oe,e[92]=He):He=e[92];let P;e[93]!==H?(P=H&&t.jsx("p",{className:"muted",children:Sl}),e[93]=H,e[94]=P):P=e[94];let he;e[95]!==l||e[96]!==Y||e[97]!==H||e[98]!==A||e[99]!==U?(he=q=>t.jsx(Ct,{control:q,settings:U,busy:l||q.name==="aspect_ratio"&&!!H,toggleClassName:"generation-review-toggle",onFocus:q.name==="voice_id"?Y:void 0,onChange:Be=>A(q.name,Be)},q.name),e[95]=l,e[96]=Y,e[97]=H,e[98]=A,e[99]=U,e[100]=he):he=e[100];let Ue;e[101]!==l||e[102]!==A||e[103]!==T||e[104]!==te||e[105]!==ge||e[106]!==Z||e[107]!==d||e[108]!==z||e[109]!==K?(Ue=z&&d&&t.jsxs("section",{className:"generation-review-voice-section","aria-label":"Voice",children:[t.jsx("span",{className:"confirm-section-label",children:"Voice"}),Z&&t.jsx("div",{className:"generation-review-voices",role:"listbox","aria-label":"ElevenLabs voices","data-testid":"generation-review-voices",children:t.jsx(cs,{voices:K,selectedVoiceId:ge,playingVoiceId:T.playingVoiceId,disabled:l,onSelect:q=>{jl(q),A("voice_id",q)},onTogglePreview:T.toggle})}),d.loading&&K.length===0&&t.jsx("small",{children:"Loading voices…"}),d.error&&t.jsx("small",{role:"alert",children:d.error}),t.jsx("button",{type:"button",disabled:l||d.loading,onClick:te,children:d.loading?"Loading voices…":d.error?"Retry voices":Z?"Refresh voices":"Load voices"}),d?.warning&&t.jsx("small",{children:d.warning})]}),e[101]=l,e[102]=A,e[103]=T,e[104]=te,e[105]=ge,e[106]=Z,e[107]=d,e[108]=z,e[109]=K,e[110]=Ue):Ue=e[110];const Ge=m??t.jsxs("div",{className:"generation-review-prompt-field",children:[t.jsxs("div",{className:"confirm-section-heading",children:[t.jsx("span",{children:"Prompt"}),h&&t.jsx(ds,{history:h,disabled:l})]}),t.jsx("textarea",{rows:3,"aria-label":"Prompt",value:n.cell.prompt??"","aria-invalid":Se.length>0,disabled:l,onChange:q=>b(q.target.value),onKeyDown:q=>{h?.handlePromptKeyDown(q)}})]}),Ke=Se.length>0&&t.jsx("div",{className:"generation-review-reference-errors",role:"alert",children:Se.map(Is)});let Ze;e[111]!==Ge||e[112]!==Ke?(Ze=t.jsxs("section",{className:"generation-review-prompt-section","aria-label":"Prompt",children:[Ge,Ke]}),e[111]=Ge,e[112]=Ke,e[113]=Ze):Ze=e[113];let et;e[114]!==C||e[115]!==xe||e[116]!==n.cell||e[117]!==E||e[118]!==N?(et=N&&t.jsxs("section",{className:"confirm-section generation-review-dolt-section","aria-label":"Dolt source",children:[t.jsxs("div",{className:"confirm-section-heading",children:[t.jsx("span",{children:"Dolt source"}),t.jsxs("strong",{children:["cells · ",xe," columns"]})]}),t.jsx("div",{className:"generation-review-dolt",tabIndex:0,"aria-label":"Dolt source preview",children:t.jsx(ms,{notebookId:E,cell:n.cell,artifactAssets:C??Rs,heading:!1})})]}),e[114]=C,e[115]=xe,e[116]=n.cell,e[117]=E,e[118]=N,e[119]=et):et=e[119];const Ye=N?"MCP payload":"Payload",Xe=N?"MCP payload":"Payload";let Ve;e[120]!==Xe?(Ve=t.jsx("span",{children:Xe}),e[120]=Xe,e[121]=Ve):Ve=e[121];let Qe;e[122]!==c||e[123]!==p?(Qe=(p||c)&&t.jsx("small",{className:"generation-review-json-stale",role:"status",children:"Updating…"}),e[122]=c,e[123]=p,e[124]=Qe):Qe=e[124];let We;e[125]!==Ve||e[126]!==Qe?(We=t.jsxs("div",{className:"confirm-section-heading",children:[Ve,Qe]}),e[125]=Ve,e[126]=Qe,e[127]=We):We=e[127];const R=N?"MCP payload preview":"Generation payload preview";let Q;e[128]!==ae||e[129]!==u||e[130]!==ye||e[131]!==c||e[132]!==J?.payload||e[133]!==N?(Q=c?t.jsx("span",{className:"generation-review-json-status",role:"status",children:"Loading preview…"}):u?t.jsx("span",{className:"generation-review-json-status generation-review-json-error",role:"alert",children:u}):t.jsx(us,{value:N?ye:J?.payload??null,ariaLabel:N?"MCP payload JSON":"Generation payload JSON",artifactAssets:ae,mediaDisplay:"preview"}),e[128]=ae,e[129]=u,e[130]=ye,e[131]=c,e[132]=J?.payload,e[133]=N,e[134]=Q):Q=e[134];let Ae;e[135]!==c||e[136]!==R||e[137]!==Q?(Ae=t.jsx("div",{className:"generation-review-json",tabIndex:0,"aria-label":R,"aria-busy":c,children:Q}),e[135]=c,e[136]=R,e[137]=Q,e[138]=Ae):Ae=e[138];let Me;e[139]!==Ye||e[140]!==We||e[141]!==Ae?(Me=t.jsxs("section",{className:"confirm-section generation-review-source-section","aria-label":Ye,children:[We,Ae]}),e[139]=Ye,e[140]=We,e[141]=Ae,e[142]=Me):Me=e[142];let qe;e[143]===Symbol.for("react.memo_cache_sentinel")?(qe=t.jsx("span",{className:"confirm-section-label",children:"Estimate"}),e[143]=qe):qe=e[143];const lt=c||p?"…":!u&&re.usd!==null&&!re.unknown?`$${re.usd.toFixed(re.usd<.01?4:2)}`:"—";let tt;e[144]!==lt?(tt=t.jsx("strong",{children:lt}),e[144]=lt,e[145]=tt):tt=e[145];const nt=c||p?"Updating estimate…":u||re.unknown||re.usd===null?"Cost estimate unavailable":yl(re.warnings)?"Historical average per call; this request can differ":"Estimated provider cost";let at;e[146]!==nt?(at=t.jsx("small",{children:nt}),e[146]=nt,e[147]=at):at=e[147];let rt;return e[148]!==l||e[149]!==v||e[150]!==u||e[151]!==c?(rt=u&&t.jsxs("button",{type:"button",disabled:l||c,onClick:v,children:[t.jsx(gs,{size:10,"aria-hidden":"true"}),"Retry preview"]}),e[148]=l,e[149]=v,e[150]=u,e[151]=c,e[152]=rt):rt=e[152],t.jsxs("div",{className:"confirm-generation","data-view":N?"source":"form",children:[Re,t.jsxs("div",{className:"confirm-section generation-review-editor",hidden:N===!0,children:[Ie,Le,t.jsxs("section",{className:"generation-review-settings-section","aria-label":"Settings",children:[He,P,t.jsxs("div",{className:"generation-review-settings",children:[me.map(he),ie.length===0&&t.jsx("span",{className:"generation-review-defaults",children:"Provider defaults"})]}),ce.length>0&&t.jsx("div",{className:"generation-review-toggles",children:ce.map(q=>t.jsx(Ct,{control:q,settings:U,busy:l,toggleClassName:"generation-review-toggle",onChange:Be=>A(q.name,Be)},q.name))})]}),Ue,Ze]}),et,Me,t.jsxs("section",{className:"confirm-section generation-review-estimate-section","aria-label":"Estimate",children:[qe,tt,t.jsx("span",{children:re.currency}),at,rt]})]})}function Is(i){return t.jsxs("span",{title:i.message,children:[t.jsx(xs,{size:12,"aria-hidden":"true"}),t.jsx("code",{children:i.token}),i.message]},`${i.token}:${i.code}`)}function Ls(i){return t.jsx("optgroup",{label:i.label,children:i.rows.map(Fs)},i.label)}function Fs(i){const{action:e,ranking:s}=i;return t.jsxs("option",{value:e.id,disabled:e.available===!1,children:[s?`#${s.rank} · `:"",e.title," · ",e.providerLabel,s?` · Elo ${s.elo} · ${s.priceLabel}`:"",e.available===!1?" · unavailable":""]},e.id)}function Ms(i){return!i}function Ds(i){return i.kind==="boolean"}function Os(i){return i.kind!=="boolean"}function Hs(i){return i.name!=="voice_id"}function Us(i){return!["start_time","resume_time","duration"].includes(i.name)}function Vs(i){return!["duration","aspect_ratio"].includes(i.name)}function Qs(i){return i.name==="voice_id"}function qs(){}function Bs(){}function zs(i){return`$${i.toFixed(i<.01?4:2)}`}function _n(i){const e=de.c(66),{busy:s,clip:l,choices:n,languageCode:a,diarize:r,tagAudioEvents:u,estimateUsd:c,estimateLoading:p,estimateUnavailable:o,onClipChange:f,onLanguageChange:d,onDiarizeChange:m,onTagAudioEventsChange:h}=i,x=!p&&c!==null&&!o;let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=t.jsx("span",{className:"confirm-section-label",children:"Clip"}),e[0]=g):g=e[0];let S;e[1]!==l?(S=t.jsxs("section",{className:"confirm-section generation-review-input-section","aria-label":"Clip",children:[g,l?t.jsxs("div",{className:"generation-review-source",children:[t.jsx("span",{className:"generation-review-source-badge",children:"Input"}),t.jsx("span",{className:"generation-review-source-preview",children:t.jsx(Ht,{asset:{type:l.type,mediaUrl:l.mediaUrl,thumbnailUrl:l.thumbnailUrl,duration:l.duration},eager:!0})}),t.jsxs("span",{className:"generation-review-source-copy",children:[t.jsx("strong",{children:l.label}),t.jsx("small",{children:l.type})]})]}):t.jsxs("div",{className:"generation-review-text-input",children:[t.jsx("span",{children:"Input"}),t.jsx("strong",{children:"No clip"}),t.jsx("small",{children:"Choose a video or audio clip"})]})]}),e[1]=l,e[2]=S):S=e[2];let j;e[3]===Symbol.for("react.memo_cache_sentinel")?(j=t.jsx("span",{children:"Clip"}),e[3]=j):j=e[3];const C=l?.artifactId??"";let y;e[4]!==f?(y=K=>f(K.target.value||null),e[4]=f,e[5]=y):y=e[5];let k;e[6]===Symbol.for("react.memo_cache_sentinel")?(k=t.jsx("option",{value:"",children:"Choose a clip"}),e[6]=k):k=e[6];let w;e[7]!==n?(w=n.map(Ws),e[7]=n,e[8]=w):w=e[8];let b;e[9]!==s||e[10]!==C||e[11]!==y||e[12]!==w?(b=t.jsx("section",{className:"generation-review-settings-section","aria-label":"Clip choice",children:t.jsx("div",{className:"generation-review-settings",children:t.jsxs("label",{children:[j,t.jsxs("select",{"aria-label":"Clip",value:C,disabled:s,onChange:y,children:[k,w]})]})})}),e[9]=s,e[10]=C,e[11]=y,e[12]=w,e[13]=b):b=e[13];let v;e[14]===Symbol.for("react.memo_cache_sentinel")?(v=t.jsx("div",{className:"confirm-section-heading",children:t.jsx("span",{children:"Language"})}),e[14]=v):v=e[14];let _;e[15]!==d?(_=K=>d(K.target.value),e[15]=d,e[16]=_):_=e[16];let $;e[17]!==s||e[18]!==a||e[19]!==_?($=t.jsxs("div",{className:"generation-review-prompt-field",children:[v,t.jsx("textarea",{rows:3,"aria-label":"Language",placeholder:"Auto-detect",value:a,disabled:s,onChange:_})]}),e[17]=s,e[18]=a,e[19]=_,e[20]=$):$=e[20];let A;e[21]===Symbol.for("react.memo_cache_sentinel")?(A=t.jsx("p",{className:"muted",children:"Leave blank to auto-detect. ElevenLabs returns word timing when an audio track and key are available. Otherwise OpenAI returns a plain transcript."}),e[21]=A):A=e[21];let N;e[22]!==$?(N=t.jsxs("section",{className:"generation-review-prompt-section","aria-label":"Language",children:[$,A]}),e[22]=$,e[23]=N):N=e[23];let E;e[24]!==m?(E=K=>m(K.target.checked),e[24]=m,e[25]=E):E=e[25];let I;e[26]!==s||e[27]!==r||e[28]!==E?(I=t.jsx("input",{type:"checkbox",checked:r,disabled:s,onChange:E}),e[26]=s,e[27]=r,e[28]=E,e[29]=I):I=e[29];let F;e[30]===Symbol.for("react.memo_cache_sentinel")?(F=t.jsx("span",{children:"Diarize speakers"}),e[30]=F):F=e[30];let M;e[31]!==I?(M=t.jsxs("label",{className:"generation-review-toggle",children:[I,F]}),e[31]=I,e[32]=M):M=e[32];let D;e[33]!==h?(D=K=>h(K.target.checked),e[33]=h,e[34]=D):D=e[34];let V;e[35]!==s||e[36]!==D||e[37]!==u?(V=t.jsx("input",{type:"checkbox",checked:u,disabled:s,onChange:D}),e[35]=s,e[36]=D,e[37]=u,e[38]=V):V=e[38];let U;e[39]===Symbol.for("react.memo_cache_sentinel")?(U=t.jsx("span",{children:"Tag audio events"}),e[39]=U):U=e[39];let B;e[40]!==V?(B=t.jsxs("label",{className:"generation-review-toggle",children:[V,U]}),e[40]=V,e[41]=B):B=e[41];let L;e[42]!==M||e[43]!==B?(L=t.jsxs("div",{className:"generation-review-toggles",children:[M,B]}),e[42]=M,e[43]=B,e[44]=L):L=e[44];let H;e[45]!==N||e[46]!==L||e[47]!==b?(H=t.jsxs("div",{className:"generation-review-editor",children:[b,N,L]}),e[45]=N,e[46]=L,e[47]=b,e[48]=H):H=e[48];let T;e[49]===Symbol.for("react.memo_cache_sentinel")?(T=t.jsx("span",{className:"confirm-section-label",children:"Estimate"}),e[49]=T):T=e[49];let O;e[50]!==p||e[51]!==c||e[52]!==x?(O=p?"…":x&&c!==null?zs(c):"—",e[50]=p,e[51]=c,e[52]=x,e[53]=O):O=e[53];let Y;e[54]!==O?(Y=t.jsx("strong",{children:O}),e[54]=O,e[55]=Y):Y=e[55];let X;e[56]===Symbol.for("react.memo_cache_sentinel")?(X=t.jsx("span",{children:"USD"}),e[56]=X):X=e[56];const te=p?"Updating estimate…":x?"Estimated provider cost":"Cost estimate unavailable";let W;e[57]!==te?(W=t.jsx("small",{children:te}),e[57]=te,e[58]=W):W=e[58];let z;e[59]!==Y||e[60]!==W?(z=t.jsxs("section",{className:"confirm-section generation-review-estimate-section","aria-label":"Estimate",children:[T,Y,X,W]}),e[59]=Y,e[60]=W,e[61]=z):z=e[61];let G;return e[62]!==S||e[63]!==H||e[64]!==z?(G=t.jsxs("div",{className:"confirm-transcribe",children:[S,H,z]}),e[62]=S,e[63]=H,e[64]=z,e[65]=G):G=e[65],G}function Ws(i){return t.jsxs("option",{value:i.artifactId,children:[i.label," · ",i.type]},i.artifactId)}function Et(i){const e=de.c(28),{label:s,mediaUrl:l,muted:n,playbackRate:a,windows:r}=i,u=je.useRef(null),c=je.useRef(null),p=je.useRef(0);let o;e[0]!==r?(o=r.map(Xs).join("|"),e[0]=r,e[1]=o):o=e[1];const f=o;let d;e[2]!==a||e[3]!==f?(d=()=>{const b=u.current;if(!b)return;const v=f.split("|").flatMap(Ys);p.current=0;const _=v[0]?.startSeconds??0,$=()=>{b.currentTime=_,c.current=_,b.playbackRate=a,b.play().catch(Ks)};let A=0,N,E=!1;const I=()=>{N!==void 0&&typeof b.cancelVideoFrameCallback=="function"&&(b.cancelVideoFrameCallback(N),N=void 0),A&&(cancelAnimationFrame(A),A=0)},F=()=>{if(E)return;const D=Rl({activeWindowIndex:p.current,currentTimeSeconds:b.currentTime,pendingSeekSeconds:c.current,windows:v});D.type==="seek"?(b.currentTime=D.timeSeconds,c.current=D.timeSeconds,p.current=D.windowIndex,b.play().catch(Gs)):c.current!==null&&Math.abs(b.currentTime-c.current)<=.03333333333333333&&(c.current=null),M()},M=()=>{if(!E){if(typeof b.requestVideoFrameCallback=="function"){N=b.requestVideoFrameCallback(()=>F());return}A=requestAnimationFrame(()=>F())}};return b.readyState>=HTMLMediaElement.HAVE_METADATA?$():b.addEventListener("loadedmetadata",$,{once:!0}),M(),()=>{E=!0,I(),b.removeEventListener("loadedmetadata",$)}},e[2]=a,e[3]=f,e[4]=d):d=e[4];let m;e[5]!==l||e[6]!==a||e[7]!==f?(m=[l,a,f],e[5]=l,e[6]=a,e[7]=f,e[8]=m):m=e[8],je.useEffect(d,m);let h,x;e[9]!==a?(h=()=>{const b=u.current;b&&(b.playbackRate=a)},x=[a],e[9]=a,e[10]=h,e[11]=x):(h=e[10],x=e[11]),je.useEffect(h,x);let g;e[12]!==r?(g=r[0]?`${Je(r[0].startSeconds)}–${Je(r[r.length-1].endSeconds)}`:"",e[12]=r,e[13]=g):g=e[13];const S=g;let j;e[14]!==s?(j=t.jsx("span",{children:s}),e[14]=s,e[15]=j):j=e[15];let C;e[16]!==S?(C=t.jsx("strong",{children:S}),e[16]=S,e[17]=C):C=e[17];let y;e[18]!==j||e[19]!==C?(y=t.jsxs("div",{className:"confirm-split-loop-heading",children:[j,C]}),e[18]=j,e[19]=C,e[20]=y):y=e[20];let k;e[21]!==s||e[22]!==l||e[23]!==n?(k=t.jsx("video",{ref:u,"aria-label":s,src:l,muted:n,playsInline:!0,preload:"auto"}),e[21]=s,e[22]=l,e[23]=n,e[24]=k):k=e[24];let w;return e[25]!==k||e[26]!==y?(w=t.jsxs("section",{className:"confirm-split-loop",children:[y,k]}),e[25]=k,e[26]=y,e[27]=w):w=e[27],w}function Gs(){}function Ks(){}function Ys(i){const[e,s]=i.split(":").map(Number);return Number.isFinite(e)&&Number.isFinite(s)&&s>e?[{startSeconds:e,endSeconds:s}]:[]}function Xs(i){return`${i.startSeconds}:${i.endSeconds}`}const Js=[-1,-.1,-.01,.01,.1,1],Zs=[-1,-.1,.1,1];function En(i){const e=de.c(178),{cutPointsSeconds:s,mediaUrl:l,onChange:n,outputMode:a,selectedIndex:r,sourceDurationSeconds:u,sourceFps:c}=i,p=je.useRef(null),[o,f]=je.useState(!1),[d,m]=je.useState("in"),[h,x]=je.useState(null),[g,S]=je.useState(null),[j,C]=je.useState(null),[y,k]=je.useState(null);let w;e[0]!==s||e[1]!==u?(w=Cl({cutPointsSeconds:s,sourceDurationSeconds:u}),e[0]=s,e[1]=u,e[2]=w):w=e[2];const b=w,v=b[r]??b[0];let _;e[3]!==c?(_=El(c),e[3]=c,e[4]=_):_=e[4];const $=_;let A;e[5]!==v||e[6]!==u?(A=v?kl({segment:v,sourceDurationSeconds:u}):{segment:{startSeconds:0,endSeconds:0},surroundings:[]},e[5]=v,e[6]=u,e[7]=A):A=e[7];const N=A,E=v?`${v.startSeconds}:${v.endSeconds}`:"";let I;e[8]!==h||e[9]!==v?.startSeconds?(I=h??v?.startSeconds.toFixed(3)??"",e[8]=h,e[9]=v?.startSeconds,e[10]=I):I=e[10];const F=I;let M;e[11]!==g||e[12]!==v?.endSeconds?(M=g??v?.endSeconds.toFixed(3)??"",e[11]=g,e[12]=v?.endSeconds,e[13]=M):M=e[13];const D=M;let V;e[14]!==E||e[15]!==v?.durationSeconds||e[16]!==y?(V=y?.key===E?y.value:Pl(v?.durationSeconds??1),e[14]=E,e[15]=v?.durationSeconds,e[16]=y,e[17]=V):V=e[17];const U=V;let B;e[18]!==n||e[19]!==a?(B=R=>{C(null),x(null),S(null),n({cutPointsSeconds:R.cutPointsSeconds,outputMode:R.outputMode??a,selectedIndex:R.selectedIndex})},e[18]=n,e[19]=a,e[20]=B):B=e[20];const L=B;let H;e[21]!==L?(H=R=>{x(null),S(null),L(R)},e[21]=L,e[22]=H):H=e[22];const T=H;let O;e[23]!==T||e[24]!==s||e[25]!==r||e[26]!==u?(O=R=>{T(gt({cutPointsSeconds:s,deltaSeconds:R,index:r,sourceDurationSeconds:u}))},e[23]=T,e[24]=s,e[25]=r,e[26]=u,e[27]=O):O=e[27];const Y=O;let X;e[28]!==T||e[29]!==s||e[30]!==r||e[31]!==u?(X=R=>{T(bt({cutPointsSeconds:s,deltaSeconds:R,index:r,sourceDurationSeconds:u}))},e[28]=T,e[29]=s,e[30]=r,e[31]=u,e[32]=X):X=e[32];const te=X;let W;e[33]!==T||e[34]!==s||e[35]!==v||e[36]!==r||e[37]!==u?(W=(R,Q)=>{if(!v)return;const Ae=Math.round(Number(R)*1e3)/1e3,Me=Math.round(Number(Q)*1e3)/1e3;if(!Number.isFinite(Ae)||!Number.isFinite(Me)){C("Enter start and end times in seconds");return}const qe=vt({cutPointsSeconds:s,endSeconds:Me,index:r,sourceDurationSeconds:u,startSeconds:Ae});if(qe.cutPointsSeconds.length===s.length&&qe.cutPointsSeconds.every((lt,tt)=>lt===s[tt])&&(Ae!==v.startSeconds||Me!==v.endSeconds)){C(`Choose a range from ${Je(v.startSeconds)} that stays inside neighbouring pieces`),x(null),S(null);return}T(qe)},e[33]=T,e[34]=s,e[35]=v,e[36]=r,e[37]=u,e[38]=W):W=e[38];const z=W;let G;e[39]!==T||e[40]!==s||e[41]!==v||e[42]!==r||e[43]!==u?(G=R=>{const Q=p.current?.currentTime;!v||typeof Q!="number"||!Number.isFinite(Q)||T(vt({cutPointsSeconds:s,endSeconds:R==="out"?Q:v.endSeconds,index:r,sourceDurationSeconds:u,startSeconds:R==="in"?Q:v.startSeconds}))},e[39]=T,e[40]=s,e[41]=v,e[42]=r,e[43]=u,e[44]=G):G=e[44];const K=G;let Z;e[45]!==d||e[46]!==Y||e[47]!==te?(Z=R=>{if(R.key!=="ArrowLeft"&&R.key!=="ArrowRight"||R.target instanceof HTMLInputElement)return;R.preventDefault();const Q=R.key==="ArrowLeft"?-1:1,Ae=R.altKey?.01:R.shiftKey?1:.1;d==="out"?te(Q*Ae):Y(Q*Ae)},e[45]=d,e[46]=Y,e[47]=te,e[48]=Z):Z=e[48];const ge=Z,se=U?.25:1,be=a==="remove"?"JOIN PREVIEW":"SURROUNDINGS";let ne;e[49]!==a||e[50]!==b.length||e[51]!==v?(ne=v?a==="all"?`Apply creates ${b.length} cells`:a==="keep"?`Apply creates 1 cell: ${Je(v.startSeconds)}-${Je(v.endSeconds)}`:`Apply creates 1 cell without ${Je(v.startSeconds)}-${Je(v.endSeconds)}`:"",e[49]=a,e[50]=b.length,e[51]=v,e[52]=ne):ne=e[52];const pe=ne;let oe;e[53]!==s||e[54]!==$||e[55]!==r?(oe=(R,Q,Ae)=>t.jsxs("div",{className:"confirm-split-nudges",children:[Js.map(Me=>{const qe=Ae(Me),lt=qe.cutPointsSeconds.every((tt,nt)=>tt===s[nt])&&qe.selectedIndex===r;return t.jsxs("button",{type:"button",disabled:lt,onFocus:()=>m(R),onClick:()=>Q(Me),children:[Me>0?"+":"−",Math.abs(Me),"s"]},`${R}:${Me}`)}),$!==null&&t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button","aria-label":"Previous frame",title:"Previous frame",onFocus:()=>m(R),onClick:()=>Q(-$),children:"◂"}),t.jsx("button",{type:"button","aria-label":"Next frame",title:"Next frame",onFocus:()=>m(R),onClick:()=>Q($),children:"▸"})]})]}),e[53]=s,e[54]=$,e[55]=r,e[56]=oe):oe=e[56];const we=oe;let ie;e[57]===Symbol.for("react.memo_cache_sentinel")?(ie=t.jsx("span",{children:"Source"}),e[57]=ie):ie=e[57];let me;e[58]!==u?(me=Je(u),e[58]=u,e[59]=me):me=e[59];let ce;e[60]!==me?(ce=t.jsxs("div",{className:"confirm-section-heading",children:[ie,t.jsxs("strong",{children:[me," total"]})]}),e[60]=me,e[61]=ce):ce=e[61];let le;e[62]!==l?(le=t.jsx("video",{ref:p,src:l,controls:!0,playsInline:!0,preload:"metadata"}),e[62]=l,e[63]=le):le=e[63];let J;e[64]!==K?(J=t.jsx("button",{type:"button",onClick:()=>K("in"),children:"SET IN HERE"}),e[64]=K,e[65]=J):J=e[65];let ue;e[66]!==K?(ue=t.jsx("button",{type:"button",onClick:()=>K("out"),children:"SET OUT HERE"}),e[66]=K,e[67]=ue):ue=e[67];let ae;e[68]!==J||e[69]!==ue?(ae=t.jsxs("div",{className:"confirm-actions-row",children:[J,ue]}),e[68]=J,e[69]=ue,e[70]=ae):ae=e[70];let re;e[71]!==ce||e[72]!==le||e[73]!==ae?(re=t.jsxs("section",{className:"confirm-section","aria-label":"Source player",children:[ce,le,ae]}),e[71]=ce,e[72]=le,e[73]=ae,e[74]=re):re=e[74];let Se;e[75]===Symbol.for("react.memo_cache_sentinel")?(Se=t.jsx("span",{className:"confirm-section-label",children:"Pieces"}),e[75]=Se):Se=e[75];let ve;if(e[76]!==s||e[77]!==L||e[78]!==b||e[79]!==r){let R;e[81]!==s||e[82]!==L||e[83]!==r?(R=Q=>t.jsxs("button",{type:"button",role:"listitem",className:Q.index===r?"active":void 0,"aria-pressed":Q.index===r,onClick:()=>L({cutPointsSeconds:s,selectedIndex:Q.index}),children:[String(Q.index+1).padStart(2,"0")," ",Je(Q.startSeconds),"-",Je(Q.endSeconds)]},`${Q.startSeconds}:${Q.endSeconds}`),e[81]=s,e[82]=L,e[83]=r,e[84]=R):R=e[84],ve=b.map(R),e[76]=s,e[77]=L,e[78]=b,e[79]=r,e[80]=ve}else ve=e[80];let ye;e[85]!==ve?(ye=t.jsx("div",{className:"confirm-chips",role:"list",children:ve}),e[85]=ve,e[86]=ye):ye=e[86];const Ce=!v||v.durationSeconds<.04;let xe;e[87]!==T||e[88]!==s||e[89]!==r||e[90]!==u?(xe=()=>T($l({cutPointsSeconds:s,index:r,sourceDurationSeconds:u})),e[87]=T,e[88]=s,e[89]=r,e[90]=u,e[91]=xe):xe=e[91];let Ne;e[92]===Symbol.for("react.memo_cache_sentinel")?(Ne=t.jsx(bs,{size:12,"aria-hidden":"true"}),e[92]=Ne):Ne=e[92];let fe;e[93]!==Ce||e[94]!==xe?(fe=t.jsxs("button",{type:"button",disabled:Ce,onClick:xe,children:[Ne,"Split piece in half"]}),e[93]=Ce,e[94]=xe,e[95]=fe):fe=e[95];const ee=r>=b.length-1;let Ee;e[96]!==T||e[97]!==s||e[98]!==r||e[99]!==u?(Ee=()=>T(Al({cutPointsSeconds:s,index:r,sourceDurationSeconds:u})),e[96]=T,e[97]=s,e[98]=r,e[99]=u,e[100]=Ee):Ee=e[100];let $e;e[101]!==ee||e[102]!==Ee?($e=t.jsx("button",{type:"button",disabled:ee,onClick:Ee,children:"Merge with next"}),e[101]=ee,e[102]=Ee,e[103]=$e):$e=e[103];let ke;e[104]!==fe||e[105]!==$e?(ke=t.jsxs("div",{className:"confirm-actions-row",children:[fe,$e]}),e[104]=fe,e[105]=$e,e[106]=ke):ke=e[106];let Re;e[107]!==ye||e[108]!==ke?(Re=t.jsxs("section",{className:"confirm-section","aria-label":"Pieces",children:[Se,ye,ke]}),e[107]=ye,e[108]=ke,e[109]=Re):Re=e[109];let Te;e[110]!==re||e[111]!==Re?(Te=t.jsxs("div",{className:"confirm-split-column",children:[re,Re]}),e[110]=re,e[111]=Re,e[112]=Te):Te=e[112];let Oe;e[113]===Symbol.for("react.memo_cache_sentinel")?(Oe=t.jsx("span",{children:"Loops"}),e[113]=Oe):Oe=e[113];let De;e[114]===Symbol.for("react.memo_cache_sentinel")?(De=()=>f(en),e[114]=De):De=e[114];let Pe;e[115]!==o?(Pe=o?t.jsx(vs,{size:13}):t.jsx(js,{size:13}),e[115]=o,e[116]=Pe):Pe=e[116];const ze=o?"Sound on":"Sound off";let _e;e[117]!==o||e[118]!==Pe||e[119]!==ze?(_e=t.jsxs("div",{className:"confirm-section-heading",children:[Oe,t.jsxs("button",{type:"button","aria-pressed":o,onClick:De,children:[Pe,ze]})]}),e[117]=o,e[118]=Pe,e[119]=ze,e[120]=_e):_e=e[120];const Fe=!o;let Ie;e[121]!==N.segment?(Ie=[N.segment],e[121]=N.segment,e[122]=Ie):Ie=e[122];let Le;e[123]!==l||e[124]!==se||e[125]!==Fe||e[126]!==Ie?(Le=t.jsx(Et,{label:"SEGMENT",mediaUrl:l,muted:Fe,playbackRate:se,windows:Ie}),e[123]=l,e[124]=se,e[125]=Fe,e[126]=Ie,e[127]=Le):Le=e[127];const He=!o;let P;e[128]!==l||e[129]!==se||e[130]!==be||e[131]!==He||e[132]!==N.surroundings?(P=t.jsx(Et,{label:be,mediaUrl:l,muted:He,playbackRate:se,windows:N.surroundings}),e[128]=l,e[129]=se,e[130]=be,e[131]=He,e[132]=N.surroundings,e[133]=P):P=e[133];let he;e[134]!==Le||e[135]!==P?(he=t.jsxs("div",{className:"confirm-split-loops",children:[Le,P]}),e[134]=Le,e[135]=P,e[136]=he):he=e[136];let Ue;e[137]!==T||e[138]!==z||e[139]!==s||e[140]!==F||e[141]!==we||e[142]!==Y||e[143]!==te||e[144]!==D||e[145]!==E||e[146]!==v||e[147]!==r||e[148]!==U||e[149]!==u?(Ue=v&&t.jsxs("div",{className:"confirm-split-bounds",children:[t.jsxs("div",{className:"confirm-split-bound",children:[t.jsx("span",{children:"IN"}),t.jsx("input",{type:"number","aria-label":"IN seconds",step:"0.001",value:F,onFocus:()=>m("in"),onChange:R=>x(R.target.value),onBlur:()=>z(F,D),onKeyDown:R=>{R.key==="Enter"&&(R.preventDefault(),z(F,D))}}),we("in",Y,R=>gt({cutPointsSeconds:s,deltaSeconds:R,index:r,sourceDurationSeconds:u}))]}),t.jsxs("div",{className:"confirm-split-bound",children:[t.jsx("span",{children:"OUT"}),t.jsx("input",{type:"number","aria-label":"OUT seconds",step:"0.001",value:D,onFocus:()=>m("out"),onChange:R=>S(R.target.value),onBlur:()=>z(F,D),onKeyDown:R=>{R.key==="Enter"&&(R.preventDefault(),z(F,D))}}),we("out",te,R=>bt({cutPointsSeconds:s,deltaSeconds:R,index:r,sourceDurationSeconds:u}))]}),t.jsxs("div",{className:"confirm-split-bound",children:[t.jsx("span",{children:"MOVE"}),t.jsxs("output",{"aria-label":"Piece duration",children:[v.durationSeconds.toFixed(3),"s"]}),t.jsxs("div",{className:"confirm-split-nudges",children:[Zs.map(R=>{const Q=_l({cutPointsSeconds:s,deltaSeconds:R,index:r,sourceDurationSeconds:u}),Ae=Q.cutPointsSeconds.every((Me,qe)=>Me===s[qe]);return t.jsxs("button",{type:"button",disabled:Ae,onClick:()=>T(Q),children:[R>0?"+":"−",Math.abs(R),"s"]},`move:${R}`)}),t.jsx("button",{type:"button","aria-pressed":U,onClick:()=>k({key:E,value:!U}),children:"Slow ×0.25"})]})]})]}),e[137]=T,e[138]=z,e[139]=s,e[140]=F,e[141]=we,e[142]=Y,e[143]=te,e[144]=D,e[145]=E,e[146]=v,e[147]=r,e[148]=U,e[149]=u,e[150]=Ue):Ue=e[150];let Ge;e[151]!==j?(Ge=j&&t.jsx("p",{className:"confirm-field-error",role:"alert",children:j}),e[151]=j,e[152]=Ge):Ge=e[152];let Ke;e[153]!==_e||e[154]!==he||e[155]!==Ue||e[156]!==Ge?(Ke=t.jsxs("section",{className:"confirm-section","aria-label":"Loops",children:[_e,he,Ue,Ge]}),e[153]=_e,e[154]=he,e[155]=Ue,e[156]=Ge,e[157]=Ke):Ke=e[157];let Ze;e[158]===Symbol.for("react.memo_cache_sentinel")?(Ze=t.jsx("span",{className:"confirm-section-label",children:"Output"}),e[158]=Ze):Ze=e[158];let et;e[159]===Symbol.for("react.memo_cache_sentinel")?(et=[["keep","KEEP segment"],["remove","REMOVE segment"],["all","ALL pieces"]],e[159]=et):et=e[159];let Ye;e[160]!==s||e[161]!==L||e[162]!==a||e[163]!==b.length||e[164]!==r?(Ye=t.jsx("div",{className:"confirm-chips",children:et.map(R=>{const[Q,Ae]=R;return t.jsx("button",{type:"button",className:a===Q?"active":void 0,"aria-pressed":a===Q,disabled:Q==="remove"&&b.length<2,onClick:()=>L({cutPointsSeconds:s,outputMode:Q,selectedIndex:r}),children:Ae},Q)})}),e[160]=s,e[161]=L,e[162]=a,e[163]=b.length,e[164]=r,e[165]=Ye):Ye=e[165];let Xe;e[166]!==pe?(Xe=t.jsx("p",{className:"confirm-help",children:pe}),e[166]=pe,e[167]=Xe):Xe=e[167];let Ve;e[168]!==Ye||e[169]!==Xe?(Ve=t.jsxs("section",{className:"confirm-section","aria-label":"Output mode",children:[Ze,Ye,Xe]}),e[168]=Ye,e[169]=Xe,e[170]=Ve):Ve=e[170];let Qe;e[171]!==Ke||e[172]!==Ve?(Qe=t.jsxs("div",{className:"confirm-split-column",children:[Ke,Ve]}),e[171]=Ke,e[172]=Ve,e[173]=Qe):Qe=e[173];let We;return e[174]!==ge||e[175]!==Te||e[176]!==Qe?(We=t.jsxs("div",{className:"confirm-split",onKeyDown:ge,children:[Te,Qe]}),e[174]=ge,e[175]=Te,e[176]=Qe,e[177]=We):We=e[177],We}function en(i){return!i}function qt(i){const e=de.c(3),{prompt:s}=i;if(!s.trim())return null;let l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=t.jsx("b",{"aria-hidden":"true",children:"›"}),e[0]=l):l=e[0];let n;return e[1]!==s?(n=t.jsxs("p",{className:"confirm-prompt-echo",children:[l,t.jsx("span",{children:s})]}),e[1]=s,e[2]=n):n=e[2],n}function Bt({columns:i,settings:e}){return t.jsx("dl",{className:"confirm-settings","aria-label":"Action settings",style:{gridTemplateColumns:`repeat(${i}, minmax(0, 1fr))`},children:e.map(s=>t.jsxs("div",{className:[s.wide?"confirm-setting-wide":"",s.tone==="warning"?"confirm-setting-warning":""].join(" ").trim()||void 0,children:[t.jsx("dt",{children:s.label}),t.jsx("dd",{children:s.value})]},s.label))})}function $n(i){const e=de.c(125),{asset:s,busy:l,connection:n,draft:a,onChange:r,onConnect:u,onThreadCreditsChange:c,onThreadOptionsChange:p,onThreadPromptChange:o,prompt:f,settings:d,sourceLabel:m,threadReview:h}=i,x=s?.type==="video"||s?.type==="final",g=s?.type==="image"?s.mediaUrl??s.thumbnailUrl:null,S=a.scheduledFor!==null;let j;e[0]!==a.postText?(j=a.postText.trim(),e[0]=a.postText,e[1]=j):j=e[1];const C=j==="",y=Tl(n?.status??null);let k;e[2]!==n?(k=n?.status?Il(n.status):null,e[2]=n,e[3]=k):k=e[3];const w=k,b=a.postText.length>y;let v,_,$,A,N,E,I,F,M,D;if(e[4]!==w||e[5]!==s||e[6]!==l||e[7]!==n||e[8]!==a.orientation||e[9]!==a.postText||e[10]!==a.scheduledFor||e[11]!==g||e[12]!==y||e[13]!==r||e[14]!==u||e[15]!==c||e[16]!==p||e[17]!==o||e[18]!==f||e[19]!==S||e[20]!==d||e[21]!==m||e[22]!==h||e[23]!==b||e[24]!==C||e[25]!==x){const B=h?Ll(h):[];let L;e[36]!==h?(L=h?Fl(h.context):!1,e[36]=h,e[37]=L):L=e[37];const H=L;let T;e[38]!==n?(T=n?.status?Ml(n.status,{connecting:n.connecting}):null,e[38]=n,e[39]=T):T=e[39];const O=T,Y=O!==null&&O.tone!=="connected";_="confirm-routed confirm-post";let X;e[40]!==f?(X=t.jsx(qt,{prompt:f}),e[40]=f,e[41]=X):X=e[41];let te;e[42]!==d?(te=t.jsx(Bt,{columns:2,settings:d}),e[42]=d,e[43]=te):te=e[43],e[44]!==X||e[45]!==te?($=t.jsxs("div",{className:"confirm-routed-main",children:[X,te]}),e[44]=X,e[45]=te,e[46]=$):$=e[46],A="x-post-preview",N="X post preview";let W,z;e[47]===Symbol.for("react.memo_cache_sentinel")?(W=t.jsx("span",{"aria-hidden":"true",children:"X"}),z=t.jsx("strong",{children:"Post preview"}),e[47]=W,e[48]=z):(W=e[47],z=e[48]),e[49]!==m?(E=t.jsxs("header",{children:[W,t.jsxs("div",{children:[z,t.jsx("small",{children:m})]})]}),e[49]=m,e[50]=E):E=e[50],e[51]!==l||e[52]!==n||e[53]!==O||e[54]!==u||e[55]!==Y?(I=Y&&O&&t.jsxs("div",{className:`x-post-connection x-post-connection-${O.tone}`,role:"status","aria-label":"X connection",children:[t.jsxs("div",{children:[t.jsx("strong",{children:O.label}),t.jsx("span",{children:O.detail}),n?.connecting&&n.authorizeUrl&&t.jsx("a",{href:n.authorizeUrl,target:"_blank",rel:"noopener noreferrer",children:"Open the X authorization page"})]}),u&&(O.actionLabel||n?.connecting)&&t.jsx("button",{type:"button",disabled:l||n?.connecting,onClick:u,children:n?.connecting?"Waiting…":O.actionLabel})]}),e[51]=l,e[52]=n,e[53]=O,e[54]=u,e[55]=Y,e[56]=I):I=e[56],e[57]!==s||e[58]!==g||e[59]!==m||e[60]!==x?(F=t.jsx("div",{className:"x-post-preview-media",children:x&&s?.mediaUrl?t.jsx("video",{src:s.mediaUrl,poster:s.thumbnailUrl??void 0,controls:!0,playsInline:!0,preload:"metadata"}):g?t.jsx("img",{src:g,alt:`${m} post preview`}):t.jsxs("div",{className:"x-post-preview-fallback",children:[t.jsx(Ut,{size:28,"aria-hidden":"true"}),t.jsx("span",{children:"Media preview unavailable"})]})}),e[57]=s,e[58]=g,e[59]=m,e[60]=x,e[61]=F):F=e[61];let G;e[62]===Symbol.for("react.memo_cache_sentinel")?(G=t.jsx("label",{htmlFor:"x-post-title",children:"Title"}),e[62]=G):G=e[62];const K=C||b;let Z;e[63]!==r?(Z=ee=>r({postText:ee.target.value}),e[63]=r,e[64]=Z):Z=e[64];let ge;e[65]!==l||e[66]!==a.postText||e[67]!==K||e[68]!==Z?(ge=t.jsx("textarea",{id:"x-post-title","aria-invalid":K,disabled:l,placeholder:"Title (required)",required:!0,rows:3,value:a.postText,onChange:Z}),e[65]=l,e[66]=a.postText,e[67]=K,e[68]=Z,e[69]=ge):ge=e[69];const se=C||b?"confirm-field-error":void 0,be=C?"A title is required":`${a.postText.length}/${y} characters`;let ne;e[70]!==se||e[71]!==be?(ne=t.jsx("small",{className:se,children:be}),e[70]=se,e[71]=be,e[72]=ne):ne=e[72];let pe;e[73]!==w?(pe=w&&t.jsx("small",{className:"x-post-account",children:w}),e[73]=w,e[74]=pe):pe=e[74],e[75]!==ge||e[76]!==ne||e[77]!==pe?(M=t.jsxs("div",{className:"x-post-preview-copy",children:[G,ge,ne,pe]}),e[75]=ge,e[76]=ne,e[77]=pe,e[78]=M):M=e[78];let oe;e[79]===Symbol.for("react.memo_cache_sentinel")?(oe=t.jsx("span",{children:"Publish"}),e[79]=oe):oe=e[79];const we=S?"schedule":"now";let ie;e[80]!==r?(ie=ee=>r({scheduledFor:ee.target.value==="schedule"?ql():null}),e[80]=r,e[81]=ie):ie=e[81];let me,ce;e[82]===Symbol.for("react.memo_cache_sentinel")?(me=t.jsx("option",{value:"now",children:"Now"}),ce=t.jsx("option",{value:"schedule",children:"Schedule"}),e[82]=me,e[83]=ce):(me=e[82],ce=e[83]);let le;e[84]!==l||e[85]!==we||e[86]!==ie?(le=t.jsxs("label",{className:"confirm-field",children:[oe,t.jsxs("select",{"aria-label":"Publish timing",disabled:l,value:we,onChange:ie,children:[me,ce]})]}),e[84]=l,e[85]=we,e[86]=ie,e[87]=le):le=e[87];let J;e[88]===Symbol.for("react.memo_cache_sentinel")?(J=t.jsx("span",{children:"Orientation"}),e[88]=J):J=e[88];const ue=l||s?.type==="image",ae=a.orientation??"source";let re;e[89]!==r?(re=ee=>r({orientation:ee.target.value==="portrait"||ee.target.value==="landscape"?ee.target.value:null}),e[89]=r,e[90]=re):re=e[90];let Se,ve,ye;e[91]===Symbol.for("react.memo_cache_sentinel")?(Se=t.jsx("option",{value:"source",children:"Keep source"}),ve=t.jsx("option",{value:"portrait",children:"Portrait"}),ye=t.jsx("option",{value:"landscape",children:"Landscape"}),e[91]=Se,e[92]=ve,e[93]=ye):(Se=e[91],ve=e[92],ye=e[93]);let Ce;e[94]!==ue||e[95]!==ae||e[96]!==re?(Ce=t.jsxs("select",{"aria-label":"Video orientation",disabled:ue,value:ae,onChange:re,children:[Se,ve,ye]}),e[94]=ue,e[95]=ae,e[96]=re,e[97]=Ce):Ce=e[97];let xe;e[98]!==s?.type?(xe=s?.type==="image"&&t.jsx("small",{children:"Video posts only"}),e[98]=s?.type,e[99]=xe):xe=e[99];let Ne;e[100]!==Ce||e[101]!==xe?(Ne=t.jsxs("label",{className:"confirm-field",children:[J,Ce,xe]}),e[100]=Ce,e[101]=xe,e[102]=Ne):Ne=e[102];let fe;e[103]!==l||e[104]!==a.scheduledFor||e[105]!==r||e[106]!==S?(fe=S&&t.jsxs("label",{className:"confirm-field",children:[t.jsx("span",{children:"Date and time"}),t.jsx("input",{"aria-label":"Schedule date and time",disabled:l,required:!0,type:"datetime-local",value:Ol(a.scheduledFor??""),onChange:ee=>r({scheduledFor:Dl(ee.target.value)})}),t.jsx("small",{children:"Uses your local timezone"})]}),e[103]=l,e[104]=a.scheduledFor,e[105]=r,e[106]=S,e[107]=fe):fe=e[107],e[108]!==le||e[109]!==Ne||e[110]!==fe?(D=t.jsxs("div",{className:"x-post-preview-options",role:"group","aria-label":"Post options",children:[le,Ne,fe]}),e[108]=le,e[109]=Ne,e[110]=fe,e[111]=D):D=e[111],v=x&&h&&t.jsxs("section",{className:"x-post-thread","aria-label":"How it was made thread",children:[t.jsxs("label",{className:"x-post-thread-master",children:[t.jsx("input",{type:"checkbox",checked:h.options.enabled,disabled:l||h.loading||!H,onChange:ee=>p?.({enabled:ee.target.checked})}),t.jsxs("span",{children:[t.jsx("strong",{children:"Add how-it-was-made thread"}),t.jsx("small",{children:"Reply with the prompt and input images, then thank the original video"})]})]}),h.loading?t.jsx("small",{children:"Loading generation details…"}):h.error?t.jsx("small",{className:"confirm-field-error",children:h.error}):H?h.options.enabled?t.jsxs("div",{className:"x-post-thread-steps",children:[h.context.steps.map((ee,Ee)=>t.jsx(sn,{busy:l,index:Ee,maxCharacters:y,prompt:Hl(h,ee),reply:B.find($e=>$e.stepId===ee.id)??null,step:ee,stepCount:h.context.steps.length,onPromptChange:o},ee.id)),h.context.credits.length>0&&t.jsx(an,{busy:l,maxCharacters:y,replyCount:B.filter(tn).length,text:Ul(h),onChange:c}),B.length===0&&t.jsx("small",{className:"confirm-field-error",children:Vl})]}):null:t.jsx("small",{children:"No generation details were found."})]}),e[4]=w,e[5]=s,e[6]=l,e[7]=n,e[8]=a.orientation,e[9]=a.postText,e[10]=a.scheduledFor,e[11]=g,e[12]=y,e[13]=r,e[14]=u,e[15]=c,e[16]=p,e[17]=o,e[18]=f,e[19]=S,e[20]=d,e[21]=m,e[22]=h,e[23]=b,e[24]=C,e[25]=x,e[26]=v,e[27]=_,e[28]=$,e[29]=A,e[30]=N,e[31]=E,e[32]=I,e[33]=F,e[34]=M,e[35]=D}else v=e[26],_=e[27],$=e[28],A=e[29],N=e[30],E=e[31],I=e[32],F=e[33],M=e[34],D=e[35];let V;e[112]!==v||e[113]!==A||e[114]!==N||e[115]!==E||e[116]!==I||e[117]!==F||e[118]!==M||e[119]!==D?(V=t.jsxs("article",{className:A,"aria-label":N,children:[E,I,F,M,D,v]}),e[112]=v,e[113]=A,e[114]=N,e[115]=E,e[116]=I,e[117]=F,e[118]=M,e[119]=D,e[120]=V):V=e[120];let U;return e[121]!==_||e[122]!==$||e[123]!==V?(U=t.jsxs("div",{className:_,children:[$,V]}),e[121]=_,e[122]=$,e[123]=V,e[124]=U):U=e[124],U}function tn(i){return i.stepId===null}function zt(i){return i===0?"nothing to post":`posts as ${i} ${i===1?"reply":"replies"}`}function ln(i){const e=Ql(i.images).length;return e===i.images.length?"Input images":`Input images · first ${e} of ${i.images.length} attach`}function sn(i){const e=de.c(37),{busy:s,index:l,maxCharacters:n,onPromptChange:a,prompt:r,reply:u,step:c,stepCount:p}=i,o=`x-post-thread-prompt-${l}`,f=u?.text.length??0,d=f>n,m=p>1?`Generation step ${l+1}`:"Generation step";let h;e[0]!==l||e[1]!==p?(h=p>1&&t.jsxs("small",{className:"x-post-thread-step-ordinal",children:["Step ",l+1," of ",p]}),e[0]=l,e[1]=p,e[2]=h):h=e[2];let x;e[3]!==c.model?(x=c.model&&t.jsxs("div",{className:"x-post-thread-field",children:[t.jsx("span",{className:"x-post-thread-label",children:"Model"}),t.jsxs("p",{className:"x-post-thread-model",children:[t.jsx("span",{children:c.model.label}),c.model.provider&&t.jsxs("small",{children:["via ",c.model.provider]})]})]}),e[3]=c.model,e[4]=x):x=e[4];let g;e[5]!==o?(g=t.jsx("label",{className:"x-post-thread-label",htmlFor:o,children:"Prompt"}),e[5]=o,e[6]=g):g=e[6];const S=d?"confirm-field-error":void 0,j=u?1:0;let C;e[7]!==j?(C=zt(j),e[7]=j,e[8]=C):C=e[8];let y;e[9]!==n||e[10]!==f||e[11]!==S||e[12]!==C?(y=t.jsxs("small",{className:S,children:[f,"/",n," characters with heading"," · ",C]}),e[9]=n,e[10]=f,e[11]=S,e[12]=C,e[13]=y):y=e[13];let k;e[14]!==g||e[15]!==y?(k=t.jsxs("div",{className:"x-post-thread-field-head",children:[g,y]}),e[14]=g,e[15]=y,e[16]=k):k=e[16];let w;e[17]!==a||e[18]!==c.id?(w=A=>a?.(c.id,A.target.value),e[17]=a,e[18]=c.id,e[19]=w):w=e[19];let b;e[20]!==s||e[21]!==r||e[22]!==o||e[23]!==w||e[24]!==d?(b=t.jsx("textarea",{id:o,"aria-invalid":d,disabled:s,rows:4,value:r,onChange:w}),e[20]=s,e[21]=r,e[22]=o,e[23]=w,e[24]=d,e[25]=b):b=e[25];let v;e[26]!==b||e[27]!==k?(v=t.jsxs("div",{className:"x-post-thread-field",children:[k,b]}),e[26]=b,e[27]=k,e[28]=v):v=e[28];let _;e[29]!==c?(_=c.images.length>0&&t.jsxs("div",{className:"x-post-thread-field",children:[t.jsx("span",{className:"x-post-thread-label",children:ln(c)}),t.jsx("div",{className:"x-post-thread-images",children:c.images.map(nn)})]}),e[29]=c,e[30]=_):_=e[30];let $;return e[31]!==m||e[32]!==v||e[33]!==_||e[34]!==h||e[35]!==x?($=t.jsxs("article",{className:"x-post-thread-step","aria-label":m,children:[h,x,v,_]}),e[31]=m,e[32]=v,e[33]=_,e[34]=h,e[35]=x,e[36]=$):$=e[36],$}function nn(i){return t.jsxs("figure",{children:[t.jsx("img",{src:i.thumbnailUrl??i.mediaUrl??void 0,alt:i.label}),t.jsx("figcaption",{children:i.label})]},i.assetId)}function an(i){const e=de.c(18),{busy:s,maxCharacters:l,onChange:n,replyCount:a,text:r}=i,u=r.length>l;let c;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx("label",{className:"x-post-thread-label",htmlFor:"x-post-thread-credits",children:"Credits"}),e[0]=c):c=e[0];const p=u?"confirm-field-error":void 0,o=r.length;let f;e[1]!==a?(f=zt(a),e[1]=a,e[2]=f):f=e[2];let d;e[3]!==l||e[4]!==p||e[5]!==f||e[6]!==r.length?(d=t.jsxs("div",{className:"x-post-thread-field-head",children:[c,t.jsxs("small",{className:p,children:[o,"/",l," characters · ",f]})]}),e[3]=l,e[4]=p,e[5]=f,e[6]=r.length,e[7]=d):d=e[7];let m;e[8]!==n?(m=g=>n?.(g.target.value),e[8]=n,e[9]=m):m=e[9];let h;e[10]!==s||e[11]!==m||e[12]!==r||e[13]!==u?(h=t.jsx("textarea",{id:"x-post-thread-credits","aria-invalid":u,disabled:s,rows:2,value:r,onChange:m}),e[10]=s,e[11]=m,e[12]=r,e[13]=u,e[14]=h):h=e[14];let x;return e[15]!==d||e[16]!==h?(x=t.jsx("article",{className:"x-post-thread-step","aria-label":"Credits",children:t.jsxs("div",{className:"x-post-thread-field",children:[d,h]})}),e[15]=d,e[16]=h,e[17]=x):x=e[17],x}function rn(i){const e=de.c(15),{effectiveSpeed:s,mediaUrl:l,thumbnailUrl:n}=i,a=je.useRef(null),[r,u]=je.useState(!1),c=s&&s>0?s:1;let p;e[0]!==c?(p=()=>{const j=a.current;if(!j)return;const C=()=>u(!0),y=()=>u(!1);j.defaultPlaybackRate=c;const k=()=>{j.defaultPlaybackRate=c,j.playbackRate=c,j.muted=!0,j.play().catch(()=>u(!1))};return j.addEventListener("play",C),j.addEventListener("pause",y),j.readyState>=HTMLMediaElement.HAVE_METADATA?k():j.addEventListener("loadedmetadata",k,{once:!0}),()=>{j.removeEventListener("loadedmetadata",k),j.removeEventListener("play",C),j.removeEventListener("pause",y),j.pause()}},e[0]=c,e[1]=p):p=e[1];let o;e[2]!==l||e[3]!==c?(o=[l,c],e[2]=l,e[3]=c,e[4]=o):o=e[4],je.useEffect(p,o);let f;e[5]!==s?(f=s?`preview at ${Bl(s)}×`:"source preview",e[5]=s,e[6]=f):f=e[6];const d=f,m=n??void 0;let h;e[7]!==l||e[8]!==m?(h=t.jsx("video",{ref:a,src:l,poster:m,controls:!0,loop:!0,muted:!0,playsInline:!0,preload:"auto"}),e[7]=l,e[8]=m,e[9]=h):h=e[9];const x=r?`Live ${d} — source not yet changed`:`Press Play for ${d} — source not yet changed`;let g;e[10]!==x?(g=t.jsx("small",{children:x}),e[10]=x,e[11]=g):g=e[11];let S;return e[12]!==h||e[13]!==g?(S=t.jsxs(t.Fragment,{children:[h,g]}),e[12]=h,e[13]=g,e[14]=S):S=e[14],S}function An(i){const e=de.c(14),{prompt:s,settings:l,speedPreview:n}=i,a=n===void 0?null:n,r=a?2:Math.min(6,Math.max(1,l.length)),u=`confirm-routed${a?" confirm-routed-with-preview":""}`;let c;e[0]!==s?(c=t.jsx(qt,{prompt:s}),e[0]=s,e[1]=c):c=e[1];let p;e[2]!==r||e[3]!==l?(p=t.jsx(Bt,{columns:r,settings:l}),e[2]=r,e[3]=l,e[4]=p):p=e[4];let o;e[5]!==c||e[6]!==p?(o=t.jsxs("div",{className:"confirm-routed-main",children:[c,p]}),e[5]=c,e[6]=p,e[7]=o):o=e[7];let f;e[8]!==a?(f=a&&t.jsx("div",{className:"confirm-routed-preview","aria-label":"Speed change preview",children:a.unavailableReason===null?t.jsx(rn,{effectiveSpeed:a.effectiveSpeed,mediaUrl:a.mediaUrl??"",thumbnailUrl:a.thumbnailUrl},a.mediaUrl??"speed-preview"):t.jsx("p",{className:"confirm-routed-preview-fallback",children:`Preview unavailable — ${a.unavailableReason}.`})}),e[8]=a,e[9]=f):f=e[9];let d;return e[10]!==u||e[11]!==o||e[12]!==f?(d=t.jsxs("div",{className:u,children:[o,f]}),e[10]=u,e[11]=o,e[12]=f,e[13]=d):d=e[13],d}function Rn(i){const e=de.c(19),{busy:s,onToggleSuggestion:l,plan:n,previews:a}=i;let r;e[0]!==n.confirmation.reason?(r=t.jsx("p",{children:n.confirmation.reason}),e[0]=n.confirmation.reason,e[1]=r):r=e[1];let u;e[2]!==s||e[3]!==l||e[4]!==n.suggestions?(u=n.suggestions&&t.jsxs("fieldset",{className:"confirm-plan-suggestions",children:[t.jsx("legend",{children:"Include suggestions"}),n.suggestions.map(d=>t.jsxs("label",{children:[t.jsx("input",{type:"checkbox",checked:d.included,disabled:s,onChange:()=>l(d.suggestionId)}),t.jsxs("span",{children:[t.jsx("strong",{children:d.label}),d.detail&&t.jsx("small",{children:d.detail})]})]},d.suggestionId))]}),e[2]=s,e[3]=l,e[4]=n.suggestions,e[5]=u):u=e[5];let c;e[6]!==r||e[7]!==u?(c=t.jsxs("div",{className:"confirm-plan-context",children:[r,u]}),e[6]=r,e[7]=u,e[8]=c):c=e[8];let p;if(e[9]!==n.stages||e[10]!==a){let d;e[12]!==a?(d=m=>{const h=m.kind==="edit"?a[m.stageId]:void 0;return t.jsxs("li",{children:[t.jsx("span",{children:m.kind.toUpperCase()}),t.jsx("strong",{children:m.summary}),h&&t.jsxs(t.Fragment,{children:[t.jsxs("small",{children:[h.diff.changedClipIds.length," clips · duration ",h.diff.beforeDurationFrames," → ",h.diff.afterDurationFrames," frames"]}),h.warnings.map((x,g)=>t.jsxs("p",{className:"confirm-stage-warning",children:[t.jsx(ft,{size:11,"aria-hidden":"true"}),x.message]},`${m.stageId}:warning:${g}`)),h.conflicts.map((x,g)=>t.jsxs("p",{className:"confirm-stage-conflict",children:[t.jsx(ys,{size:11,"aria-hidden":"true"}),x.message]},`${m.stageId}:conflict:${g}`))]}),m.kind==="queued"&&t.jsxs("small",{children:[m.provider&&m.model?`${m.provider} · ${m.model}`:m.tool,m.estimatedCostUsd!==void 0?` · estimated $${m.estimatedCostUsd.toFixed(4)}`:m.estimateUnavailable?" · cost estimate unavailable":""]})]},m.stageId)},e[12]=a,e[13]=d):d=e[13],p=n.stages.map(d),e[9]=n.stages,e[10]=a,e[11]=p}else p=e[11];let o;e[14]!==p?(o=t.jsx("ol",{className:"confirm-stages","aria-label":"Planned stages",children:p}),e[14]=p,e[15]=o):o=e[15];let f;return e[16]!==c||e[17]!==o?(f=t.jsxs("div",{className:"confirm-plan",children:[c,o]}),e[16]=c,e[17]=o,e[18]=f):f=e[18],f}function Tn(i){const e=de.c(12),{kindLabel:s,reason:l,stageTitle:n}=i;let a;e[0]!==l?(a=t.jsx("div",{className:"confirm-plan-context",children:t.jsx("p",{children:l})}),e[0]=l,e[1]=a):a=e[1];let r;e[2]!==s?(r=t.jsx("span",{children:s}),e[2]=s,e[3]=r):r=e[3];let u;e[4]!==n?(u=t.jsx("strong",{children:n}),e[4]=n,e[5]=u):u=e[5];let c;e[6]!==r||e[7]!==u?(c=t.jsx("ol",{className:"confirm-stages","aria-label":"Planned stages",children:t.jsxs("li",{children:[r,u]})}),e[6]=r,e[7]=u,e[8]=c):c=e[8];let p;return e[9]!==a||e[10]!==c?(p=t.jsxs("div",{className:"confirm-plan",children:[a,c]}),e[9]=a,e[10]=c,e[11]=p):p=e[11],p}const $t={"top-left":"Top left","top-center":"Top center","top-right":"Top right","middle-left":"Middle left","middle-center":"Middle center","middle-right":"Middle right","bottom-left":"Bottom left","bottom-center":"Bottom center","bottom-right":"Bottom right"},Wt=["fe2601bf8","8209bd208","ba34532e8","ba6ee3ae8","ba95bfae8","824f55208","feaaaabf8","00ccb8800","33c3ed680","646dcd668","8abc29c48","f976883d0","2bd10cc08","246bc6840","3ae7049a0","78227f738","1fa124fc0","b072db3a8","f715de7b0","a150ca198","7aac44a60","ed6a62858","060607bf8","5d2a6a4c8","aa0132f80","0087658f0","fe9a35ac0","8277d98f8","ba51bbff0","bacc3e160","ba9403e00","824b0bc28","fe263c180"],dt=Wt.length;function on(){const i=[];for(let e=0;e<dt;e+=1){const s=Wt[e];for(let l=0;l<dt;l+=1)(Number.parseInt(s.charAt(Math.floor(l/4)),16)&8>>l%4)!==0&&i.push(`M${l} ${e}h1v1h-1z`)}return i.join("")}const cn=on(),At=28,dn=16,mn={center:"Centered","above-qr":"Above QR","on-qr":"On QR","below-qr":"Below QR"};function un(){const i=de.c(1);let e;return i[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx("svg",{className:"watermark-preview-qr-modules",viewBox:`0 0 ${dt} ${dt}`,shapeRendering:"crispEdges",children:t.jsx("path",{d:cn,fill:"currentColor"})}),i[0]=e):e=i[0],e}function hn(i){const e=de.c(5),{platform:s}=i,l=`watermark-preview-platform-icon watermark-preview-${s}-icon`,n=es[s];let a;e[0]!==n?(a=t.jsx("path",{d:n,fill:"currentColor"}),e[0]=n,e[1]=a):a=e[1];let r;return e[2]!==l||e[3]!==a?(r=t.jsx("svg",{className:l,viewBox:"0 0 24 24","aria-hidden":"true",children:a}),e[2]=l,e[3]=a,e[4]=r):r=e[4],r}function ot(i){return Math.round(i*100)}function fn(i){return i>0?`${i.toFixed(1)}s`:"Off"}function pn(i,e,s){if(s<=0)return{left:0,width:100};const l=it(i/s*100,0,100),n=it((e??s)/s*100,l,100);return{left:l,width:n-l}}function it(i,e,s){return Math.min(s,Math.max(e,i))}function Rt(i){return Number.isFinite(i)?`${i.toFixed(1)}s`:"0.0s"}function ht(i,e){return dn*(Math.min(i,e)/e)}function xn(i,e,s){const[l,n]=i.split("-"),a=[],r={aspectRatio:"1 / 1",height:`${ht(e,s)}%`};n==="left"&&(r.left="2%"),n==="right"&&(r.right="2%"),n==="center"&&(r.left="50%",a.push("translateX(-50%)"));const u=`${2*(e/s)}%`;return l==="top"&&(r.top=u),l==="bottom"&&(r.bottom=u),l==="middle"&&(r.top="50%",a.push("translateY(-50%)")),a.length>0&&(r.transform=a.join(" ")),r}function gn(i,e,s,l,n,a){const r=Ot(l);if(n==="center")return{aspectRatio:`${mt} / ${r}`,height:`${ht(i,e)*(r/ts)}%`,top:`${s}%`,left:"50%",transform:"translate(-50%, -50%)"};const[u,c]=a.split("-"),p=ht(i,e),o=p*(e/i),f=p*(r/mt),d=2*(i/e),m=Math.max(.4,p*.06);let h=c==="left"?2:c==="right"?98-o:50-o/2;const x=u==="top"?d:u==="bottom"?100-d-p:50-p/2;let g=n==="above-qr"?x-f-m:n==="below-qr"?x+p+m:x+(p-f)/2;return h=it(h,2,98-o),g=it(g,d,100-d-f),{aspectRatio:`${mt} / ${r}`,width:`${o}%`,height:"auto",top:`${g}%`,left:`${h}%`}}function bn(i,e,s){const l=(Ot(e)-2)/2*(s/100);return{paddingInline:`${i/At}em`,borderRadius:`${l/At}em`}}function ct(i){const e=de.c(16),{busy:s,checked:l,description:n,disabled:a,label:r,onChange:u}=i,p=s||(a===void 0?!1:a);let o;e[0]!==u?(o=g=>u(g.target.checked),e[0]=u,e[1]=o):o=e[1];let f;e[2]!==l||e[3]!==p||e[4]!==o?(f=t.jsx("input",{type:"checkbox",checked:l,disabled:p,onChange:o}),e[2]=l,e[3]=p,e[4]=o,e[5]=f):f=e[5];let d;e[6]!==r?(d=t.jsx("strong",{children:r}),e[6]=r,e[7]=d):d=e[7];let m;e[8]!==n?(m=t.jsx("small",{children:n}),e[8]=n,e[9]=m):m=e[9];let h;e[10]!==d||e[11]!==m?(h=t.jsxs("span",{className:"confirm-toggle-copy",children:[d,m]}),e[10]=d,e[11]=m,e[12]=h):h=e[12];let x;return e[13]!==f||e[14]!==h?(x=t.jsxs("label",{className:"confirm-toggle",children:[f,h]}),e[13]=f,e[14]=h,e[15]=x):x=e[15],x}function st(i){const e=de.c(19),{busy:s,id:l,label:n,max:a,min:r,onChange:u,output:c,value:p}=i;let o;e[0]!==l||e[1]!==n?(o=t.jsx("label",{htmlFor:l,children:n}),e[0]=l,e[1]=n,e[2]=o):o=e[2];let f;e[3]!==l||e[4]!==c?(f=t.jsx("output",{htmlFor:l,children:c}),e[3]=l,e[4]=c,e[5]=f):f=e[5];let d;e[6]!==u?(d=x=>u(Number(x.target.value)),e[6]=u,e[7]=d):d=e[7];let m;e[8]!==s||e[9]!==l||e[10]!==a||e[11]!==r||e[12]!==d||e[13]!==p?(m=t.jsx("input",{id:l,type:"range",min:r,max:a,step:"1",value:p,disabled:s,onChange:d}),e[8]=s,e[9]=l,e[10]=a,e[11]=r,e[12]=d,e[13]=p,e[14]=m):m=e[14];let h;return e[15]!==o||e[16]!==f||e[17]!==m?(h=t.jsxs("div",{className:"confirm-range",children:[o,f,m]}),e[15]=o,e[16]=f,e[17]=m,e[18]=h):h=e[18],h}function Tt(i){const e=de.c(102),{busy:s,currentTime:l,duration:n,endSeconds:a,idPrefix:r,label:u,onChange:c,playhead:p,startSeconds:o}=i;let f;e[0]!==n||e[1]!==a||e[2]!==o?(f=ls(o,a,n),e[0]=n,e[1]=a,e[2]=o,e[3]=f):f=e[3];const d=f;let m;e[4]!==n||e[5]!==a||e[6]!==o?(m=pn(o,a,n),e[4]=n,e[5]=a,e[6]=o,e[7]=m):m=e[7];const h=m,x=a??(n>0?n:null),g=`${u} timing`;let S;e[8]!==u?(S=t.jsx("span",{children:u}),e[8]=u,e[9]=S):S=e[9];const j=`${h.left}%`,C=`${h.width}%`;let y;e[10]!==j||e[11]!==C?(y=t.jsx("span",{className:"watermark-timeline-window",style:{left:j,width:C}}),e[10]=j,e[11]=C,e[12]=y):y=e[12];const k=`${p}%`;let w;e[13]!==k?(w=t.jsx("span",{className:"watermark-timeline-playhead",style:{left:k}}),e[13]=k,e[14]=w):w=e[14];let b;e[15]!==y||e[16]!==w?(b=t.jsxs("div",{className:"watermark-timeline","aria-hidden":"true",children:[y,w]}),e[15]=y,e[16]=w,e[17]=b):b=e[17];let v;e[18]===Symbol.for("react.memo_cache_sentinel")?(v=t.jsx("span",{children:"Start (s)"}),e[18]=v):v=e[18];const _=`${r}-start`,$=`${u} start`,A=n>0?n:void 0;let N;e[19]!==a||e[20]!==c?(N=ae=>c(Math.max(0,Number(ae.target.value)||0),a),e[19]=a,e[20]=c,e[21]=N):N=e[21];let E;e[22]!==s||e[23]!==o||e[24]!==_||e[25]!==$||e[26]!==A||e[27]!==N?(E=t.jsxs("label",{className:"confirm-watermark-timing-field",children:[v,t.jsx("input",{id:_,"aria-label":$,type:"number",min:"0",max:A,step:"0.1",value:o,disabled:s,onChange:N})]}),e[22]=s,e[23]=o,e[24]=_,e[25]=$,e[26]=A,e[27]=N,e[28]=E):E=e[28];let I;e[29]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx("span",{children:"End (s)"}),e[29]=I):I=e[29];const F=`${r}-end`,M=`${u} end`,D=!d,V=n>0?n:void 0,U=a??"";let B;e[30]!==n?(B=n>0?n.toFixed(1):"Clip end",e[30]=n,e[31]=B):B=e[31];let L;e[32]!==c||e[33]!==o?(L=ae=>c(o,ae.target.value===""?null:Math.max(0,Number(ae.target.value)||0)),e[32]=c,e[33]=o,e[34]=L):L=e[34];let H;e[35]!==s||e[36]!==F||e[37]!==M||e[38]!==D||e[39]!==V||e[40]!==U||e[41]!==B||e[42]!==L?(H=t.jsxs("label",{className:"confirm-watermark-timing-field",children:[I,t.jsx("input",{id:F,"aria-label":M,"aria-invalid":D,type:"number",min:"0",max:V,step:"0.1",value:U,placeholder:B,disabled:s,onChange:L})]}),e[35]=s,e[36]=F,e[37]=M,e[38]=D,e[39]=V,e[40]=U,e[41]=B,e[42]=L,e[43]=H):H=e[43];let T;e[44]===Symbol.for("react.memo_cache_sentinel")?(T=t.jsx("span",{children:"Duration (s)"}),e[44]=T):T=e[44];const O=`${r}-duration`,Y=`${u} duration`,X=!d,te=n>0?Math.max(0,n-o):void 0;let W;e[45]!==o||e[46]!==x?(W=x===null?"":Number(Math.max(0,x-o).toFixed(6)),e[45]=o,e[46]=x,e[47]=W):W=e[47];let z;e[48]!==n||e[49]!==c||e[50]!==o?(z=ae=>c(o,ae.target.value===""?null:Number(Math.min(n>0?n:1/0,o+Math.max(0,Number(ae.target.value)||0)).toFixed(6))),e[48]=n,e[49]=c,e[50]=o,e[51]=z):z=e[51];let G;e[52]!==s||e[53]!==O||e[54]!==Y||e[55]!==X||e[56]!==te||e[57]!==W||e[58]!==z?(G=t.jsxs("label",{className:"confirm-watermark-timing-field",children:[T,t.jsx("input",{id:O,"aria-label":Y,"aria-invalid":X,type:"number",min:"0",max:te,step:"any",value:W,placeholder:"Clip end",disabled:s,onChange:z})]}),e[52]=s,e[53]=O,e[54]=Y,e[55]=X,e[56]=te,e[57]=W,e[58]=z,e[59]=G):G=e[59];const K=`Set ${u} start from playhead`;let Z;e[60]!==l||e[61]!==a||e[62]!==c?(Z=()=>c(a===null?l:Math.min(l,Math.max(0,a-.1)),a),e[60]=l,e[61]=a,e[62]=c,e[63]=Z):Z=e[63];let ge;e[64]===Symbol.for("react.memo_cache_sentinel")?(ge=t.jsx(kt,{size:8,"aria-hidden":"true"}),e[64]=ge):ge=e[64];let se;e[65]!==s||e[66]!==K||e[67]!==Z?(se=t.jsxs("button",{type:"button","aria-label":K,disabled:s,onClick:Z,children:[ge,"Start"]}),e[65]=s,e[66]=K,e[67]=Z,e[68]=se):se=e[68];const be=`Set ${u} end from playhead`;let ne;e[69]!==l||e[70]!==c||e[71]!==o?(ne=()=>c(o,Math.max(l,o+.1)),e[69]=l,e[70]=c,e[71]=o,e[72]=ne):ne=e[72];let pe;e[73]===Symbol.for("react.memo_cache_sentinel")?(pe=t.jsx(kt,{size:8,"aria-hidden":"true"}),e[73]=pe):pe=e[73];let oe;e[74]!==s||e[75]!==be||e[76]!==ne?(oe=t.jsxs("button",{type:"button","aria-label":be,disabled:s,onClick:ne,children:[pe,"End"]}),e[74]=s,e[75]=be,e[76]=ne,e[77]=oe):oe=e[77];const we=`Use whole clip for ${u}`;let ie;e[78]!==c?(ie=()=>c(0,null),e[78]=c,e[79]=ie):ie=e[79];let me;e[80]!==s||e[81]!==we||e[82]!==ie?(me=t.jsx("button",{type:"button","aria-label":we,disabled:s,onClick:ie,children:"Whole"}),e[80]=s,e[81]=we,e[82]=ie,e[83]=me):me=e[83];let ce;e[84]!==se||e[85]!==oe||e[86]!==me?(ce=t.jsxs("div",{className:"confirm-watermark-timing-actions",children:[se,oe,me]}),e[84]=se,e[85]=oe,e[86]=me,e[87]=ce):ce=e[87];let le;e[88]!==b||e[89]!==E||e[90]!==H||e[91]!==G||e[92]!==S||e[93]!==ce?(le=t.jsxs("div",{className:"confirm-watermark-timing-row",children:[S,b,E,H,G,ce]}),e[88]=b,e[89]=E,e[90]=H,e[91]=G,e[92]=S,e[93]=ce,e[94]=le):le=e[94];let J;e[95]!==u||e[96]!==d?(J=!d&&t.jsxs("p",{className:"confirm-field-error",children:[u," end time must be after its start time."]}),e[95]=u,e[96]=d,e[97]=J):J=e[97];let ue;return e[98]!==g||e[99]!==le||e[100]!==J?(ue=t.jsxs("div",{className:"confirm-watermark-timing",role:"group","aria-label":g,children:[le,J]}),e[98]=g,e[99]=le,e[100]=J,e[101]=ue):ue=e[101],ue}function vn(i){const e=de.c(228),{busy:s,state:l,onChange:n,onMediaMetadata:a}=i,[r,u]=je.useState(0),c=l.identities[l.platform];let p,o,f;e[0]!==c.handle||e[1]!==l.platform?(p=zl(c.handle),o=Dt[l.platform],f=Wl(p||"<handle>",l.platform),e[0]=c.handle,e[1]=l.platform,e[2]=p,e[3]=o,e[4]=f):(p=e[2],o=e[3],f=e[4]);const d=f,m=l.durationSeconds??0,h=l.includeHandle&&!p;let x;e[5]!==p||e[6]!==l.includeQr||e[7]!==l.url?(x=l.includeQr&&!l.url.trim()&&!p,e[5]=p,e[6]=l.includeQr,e[7]=l.url,e[8]=x):x=e[8];const g=x;let S;e[9]!==r||e[10]!==m||e[11]!==l.fadeSeconds||e[12]!==l.qrEndSeconds||e[13]!==l.qrOpacity||e[14]!==l.qrStartSeconds?(S=jt(r,l.qrStartSeconds,l.qrEndSeconds,m,l.qrOpacity,l.fadeSeconds),e[9]=r,e[10]=m,e[11]=l.fadeSeconds,e[12]=l.qrEndSeconds,e[13]=l.qrOpacity,e[14]=l.qrStartSeconds,e[15]=S):S=e[15];const j=S;let C;e[16]!==r||e[17]!==m||e[18]!==l.fadeSeconds||e[19]!==l.handleEndSeconds||e[20]!==l.handleOpacity||e[21]!==l.handleStartSeconds?(C=jt(r,l.handleStartSeconds,l.handleEndSeconds,m,l.handleOpacity,l.fadeSeconds),e[16]=r,e[17]=m,e[18]=l.fadeSeconds,e[19]=l.handleEndSeconds,e[20]=l.handleOpacity,e[21]=l.handleStartSeconds,e[22]=C):C=e[22];const y=C,k=l.position==="auto"?"bottom-right":l.position,w=l.width!==null&&l.width>0?l.width:16,b=l.height!==null&&l.height>0?l.height:9;let v;e[23]!==r||e[24]!==m?(v=m>0?it(r/m*100,0,100):0,e[23]=r,e[24]=m,e[25]=v):v=e[25];const _=v;let $;e[26]===Symbol.for("react.memo_cache_sentinel")?($=t.jsx("span",{children:"Preview"}),e[26]=$):$=e[26];let A;e[27]!==r?(A=Rt(r),e[27]=r,e[28]=A):A=e[28];let N;e[29]!==m?(N=m>0?Rt(m):"—",e[29]=m,e[30]=N):N=e[30];let E;e[31]!==A||e[32]!==N?(E=t.jsxs("div",{className:"confirm-section-heading",children:[$,t.jsxs("strong",{children:[A," / ",N]})]}),e[31]=A,e[32]=N,e[33]=E):E=e[33];let I;e[34]!==s||e[35]!==r||e[36]!==m||e[37]!==n||e[38]!==_||e[39]!==l.includeQr||e[40]!==l.qrEndSeconds||e[41]!==l.qrStartSeconds?(I=l.includeQr&&t.jsx(Tt,{busy:s,currentTime:r,duration:m,endSeconds:l.qrEndSeconds,idPrefix:"watermark-qr-timing",label:"QR",playhead:_,startSeconds:l.qrStartSeconds,onChange:(P,he)=>n({qrStartSeconds:P,qrEndSeconds:he})}),e[34]=s,e[35]=r,e[36]=m,e[37]=n,e[38]=_,e[39]=l.includeQr,e[40]=l.qrEndSeconds,e[41]=l.qrStartSeconds,e[42]=I):I=e[42];let F;e[43]!==s||e[44]!==r||e[45]!==m||e[46]!==n||e[47]!==_||e[48]!==l.handleEndSeconds||e[49]!==l.handleStartSeconds||e[50]!==l.includeHandle?(F=l.includeHandle&&t.jsx(Tt,{busy:s,currentTime:r,duration:m,endSeconds:l.handleEndSeconds,idPrefix:"watermark-handle-timing",label:"Handle",playhead:_,startSeconds:l.handleStartSeconds,onChange:(P,he)=>n({handleStartSeconds:P,handleEndSeconds:he})}),e[43]=s,e[44]=r,e[45]=m,e[46]=n,e[47]=_,e[48]=l.handleEndSeconds,e[49]=l.handleStartSeconds,e[50]=l.includeHandle,e[51]=F):F=e[51];let M;e[52]!==I||e[53]!==F?(M=t.jsxs("div",{className:"confirm-watermark-timings",children:[I,F]}),e[52]=I,e[53]=F,e[54]=M):M=e[54];const D=`${w} / ${b}`,V=w/b;let U;e[55]!==D||e[56]!==V?(U={aspectRatio:D,"--watermark-preview-ratio":V},e[55]=D,e[56]=V,e[57]=U):U=e[57];const B=U;let L;e[58]!==a||e[59]!==l.mediaUrl||e[60]!==l.thumbnailUrl?(L=l.mediaUrl?t.jsx("video",{src:l.mediaUrl,poster:l.thumbnailUrl??void 0,controls:!0,playsInline:!0,preload:"metadata",onLoadedMetadata:P=>{const he=P.currentTarget;Number.isFinite(he.duration)&&he.duration>0&&he.videoWidth>0&&he.videoHeight>0&&a({durationSeconds:he.duration,width:he.videoWidth,height:he.videoHeight})},onTimeUpdate:P=>u(P.currentTarget.currentTime),onSeeked:P=>u(P.currentTarget.currentTime)}):l.thumbnailUrl?t.jsx("img",{src:l.thumbnailUrl,alt:""}):t.jsx("span",{className:"watermark-preview-empty",children:"Video preview unavailable"}),e[58]=a,e[59]=l.mediaUrl,e[60]=l.thumbnailUrl,e[61]=L):L=e[61];let H;e[62]!==b||e[63]!==k||e[64]!==w||e[65]!==j||e[66]!==l.includeQr?(H=l.includeQr&&t.jsx("span",{className:"watermark-preview-overlay watermark-preview-qr",style:{...xn(k,w,b),opacity:j},"aria-hidden":"true",children:t.jsx(un,{})}),e[62]=b,e[63]=k,e[64]=w,e[65]=j,e[66]=l.includeQr,e[67]=H):H=e[67];let T;e[68]!==p||e[69]!==y||e[70]!==b||e[71]!==k||e[72]!==w||e[73]!==l.handlePadding||e[74]!==l.handlePaddingY||e[75]!==l.handlePlacement||e[76]!==l.handleRounding||e[77]!==l.handleVerticalPercent||e[78]!==l.includeHandle||e[79]!==l.includeHandleBorder||e[80]!==l.includePlatformIcon||e[81]!==l.includeQr||e[82]!==l.platform?(T=l.includeHandle&&t.jsx("span",{className:"watermark-preview-overlay watermark-preview-handle",style:{...gn(w,b,l.handleVerticalPercent,l.handlePaddingY,l.includeQr?l.handlePlacement:"center",k),opacity:y},"aria-hidden":"true",children:t.jsxs("span",{className:`watermark-preview-handle-pill${l.includeHandleBorder?"":" without-border"}`,style:bn(l.handlePadding,l.handlePaddingY,l.handleRounding),children:[l.includePlatformIcon&&t.jsx(hn,{platform:l.platform}),t.jsx("span",{children:p||"handle"})]})}),e[68]=p,e[69]=y,e[70]=b,e[71]=k,e[72]=w,e[73]=l.handlePadding,e[74]=l.handlePaddingY,e[75]=l.handlePlacement,e[76]=l.handleRounding,e[77]=l.handleVerticalPercent,e[78]=l.includeHandle,e[79]=l.includeHandleBorder,e[80]=l.includePlatformIcon,e[81]=l.includeQr,e[82]=l.platform,e[83]=T):T=e[83];let O;e[84]!==l.includeQr||e[85]!==l.position?(O=l.includeQr&&l.position==="auto"&&t.jsx("span",{className:"watermark-auto-preview",children:"AUTO · QR previewing bottom right"}),e[84]=l.includeQr,e[85]=l.position,e[86]=O):O=e[86];let Y;e[87]!==B||e[88]!==L||e[89]!==H||e[90]!==T||e[91]!==O?(Y=t.jsxs("div",{className:"watermark-video-stage",style:B,children:[L,H,T,O]}),e[87]=B,e[88]=L,e[89]=H,e[90]=T,e[91]=O,e[92]=Y):Y=e[92];let X;e[93]!==M||e[94]!==Y||e[95]!==E?(X=t.jsxs("section",{className:"confirm-section confirm-watermark-preview","aria-label":"Preview",children:[E,M,Y]}),e[93]=M,e[94]=Y,e[95]=E,e[96]=X):X=e[96];let te;e[97]===Symbol.for("react.memo_cache_sentinel")?(te=t.jsx("span",{className:"confirm-section-label",children:"Identity"}),e[97]=te):te=e[97];let W;e[98]===Symbol.for("react.memo_cache_sentinel")?(W=t.jsx("span",{children:"Platform"}),e[98]=W):W=e[98];const z=l.platform;let G;e[99]!==n?(G=P=>{const he=P.target.value;ss(he)&&n({platform:he})},e[99]=n,e[100]=G):G=e[100];let K;e[101]===Symbol.for("react.memo_cache_sentinel")?(K=ns.map(jn),e[101]=K):K=e[101];let Z;e[102]!==s||e[103]!==l.platform||e[104]!==G?(Z=t.jsxs("label",{className:"confirm-field",children:[W,t.jsx("select",{value:z,disabled:s,onChange:G,children:K})]}),e[102]=s,e[103]=l.platform,e[104]=G,e[105]=Z):Z=e[105];const ge=l.includeHandle&&!l.includeQr;let se;e[106]!==n?(se=P=>n({includeHandle:P}),e[106]=n,e[107]=se):se=e[107];let be;e[108]!==s||e[109]!==l.includeHandle||e[110]!==ge||e[111]!==se?(be=t.jsx(ct,{busy:s,checked:l.includeHandle,description:"Centered account badge",disabled:ge,label:"Include handle",onChange:se}),e[108]=s,e[109]=l.includeHandle,e[110]=ge,e[111]=se,e[112]=be):be=e[112];let ne;e[113]!==s||e[114]!==p||e[115]!==h||e[116]!==c.handle||e[117]!==c.recent||e[118]!==n||e[119]!==o||e[120]!==l.includeHandle||e[121]!==l.loadingConfig?(ne=l.includeHandle&&t.jsxs(t.Fragment,{children:[t.jsxs("label",{className:"confirm-field",children:[t.jsxs("span",{children:[o," handle"]}),t.jsxs("div",{className:`confirm-handle-field${h?" invalid":""}`,children:[t.jsx("span",{"aria-hidden":"true",children:"@"}),t.jsx("input",{type:"text",value:c.handle,placeholder:l.loadingConfig?"Loading…":"handle","aria-invalid":h,disabled:s,onChange:P=>n({handle:P.target.value})})]}),h&&t.jsx("span",{className:"confirm-field-error",children:"Required while Include handle is on"})]}),c.recent.length>0&&t.jsx("div",{className:"confirm-chips",role:"group","aria-label":"Recent handles",children:c.recent.map(P=>t.jsxs("button",{type:"button",className:P===p?"active":"","aria-pressed":P===p,disabled:s,onClick:()=>n({handle:P}),children:["@",P]},P))})]}),e[113]=s,e[114]=p,e[115]=h,e[116]=c.handle,e[117]=c.recent,e[118]=n,e[119]=o,e[120]=l.includeHandle,e[121]=l.loadingConfig,e[122]=ne):ne=e[122];const pe=l.includeQr&&!l.includeHandle;let oe;e[123]!==n?(oe=P=>n({includeQr:P,...P?{}:{handlePlacement:"center"}}),e[123]=n,e[124]=oe):oe=e[124];let we;e[125]!==s||e[126]!==l.includeQr||e[127]!==pe||e[128]!==oe?(we=t.jsx(ct,{busy:s,checked:l.includeQr,description:"Separately placed scannable link",disabled:pe,label:"Include QR code",onChange:oe}),e[125]=s,e[126]=l.includeQr,e[127]=pe,e[128]=oe,e[129]=we):we=e[129];let ie;e[130]!==s||e[131]!==g||e[132]!==n||e[133]!==l.includeQr||e[134]!==l.url||e[135]!==d?(ie=l.includeQr&&t.jsxs("label",{className:"confirm-field",children:[t.jsx("span",{children:"QR link"}),t.jsx("input",{type:"text",value:l.url,placeholder:d,"aria-invalid":g,disabled:s,onChange:P=>n({url:P.target.value})}),g&&t.jsx("span",{className:"confirm-field-error",children:"Enter a link, or a handle it can point to"})]}),e[130]=s,e[131]=g,e[132]=n,e[133]=l.includeQr,e[134]=l.url,e[135]=d,e[136]=ie):ie=e[136];let me;e[137]!==s||e[138]!==n||e[139]!==l.includeHandle||e[140]!==l.saveDefault?(me=l.includeHandle&&t.jsxs("label",{className:"confirm-check",children:[t.jsx("input",{type:"checkbox",checked:l.saveDefault,disabled:s,onChange:P=>n({saveDefault:P.target.checked})}),"Save as default handle"]}),e[137]=s,e[138]=n,e[139]=l.includeHandle,e[140]=l.saveDefault,e[141]=me):me=e[141];let ce;e[142]!==Z||e[143]!==be||e[144]!==ne||e[145]!==we||e[146]!==ie||e[147]!==me?(ce=t.jsxs("section",{className:"confirm-section","aria-label":"Identity",children:[te,Z,be,ne,we,ie,me]}),e[142]=Z,e[143]=be,e[144]=ne,e[145]=we,e[146]=ie,e[147]=me,e[148]=ce):ce=e[148];let le;e[149]===Symbol.for("react.memo_cache_sentinel")?(le=t.jsx("span",{className:"confirm-section-label",children:"Appearance"}),e[149]=le):le=e[149];let J;e[150]!==s||e[151]!==n||e[152]!==o||e[153]!==l.handlePadding||e[154]!==l.handlePaddingY||e[155]!==l.handleRounding||e[156]!==l.includeHandle||e[157]!==l.includeHandleBorder||e[158]!==l.includePlatformIcon?(J=l.includeHandle&&t.jsxs(t.Fragment,{children:[t.jsx(ct,{busy:s,checked:l.includePlatformIcon,description:`${o} mark before the handle`,label:`Show ${o} icon`,onChange:P=>n({includePlatformIcon:P})}),t.jsx(ct,{busy:s,checked:l.includeHandleBorder,description:"Outline around the pill",label:"Handle border",onChange:P=>n({includeHandleBorder:P})}),t.jsx(st,{busy:s,id:"watermark-handle-padding-x",label:"Handle padding X",min:wt,max:yt,output:`${l.handlePadding}px`,value:l.handlePadding,onChange:P=>n({handlePadding:P})}),t.jsx(st,{busy:s,id:"watermark-handle-padding-y",label:"Handle padding Y",min:wt,max:yt,output:`${l.handlePaddingY}px`,value:l.handlePaddingY,onChange:P=>n({handlePaddingY:P})}),t.jsx(st,{busy:s,id:"watermark-handle-rounding",label:"Corner rounding",min:Kl,max:Gl,output:`${l.handleRounding}%`,value:l.handleRounding,onChange:P=>n({handleRounding:P})})]}),e[150]=s,e[151]=n,e[152]=o,e[153]=l.handlePadding,e[154]=l.handlePaddingY,e[155]=l.handleRounding,e[156]=l.includeHandle,e[157]=l.includeHandleBorder,e[158]=l.includePlatformIcon,e[159]=J):J=e[159];let ue;e[160]!==s||e[161]!==n||e[162]!==l.includeQr||e[163]!==l.qrOpacity?(ue=l.includeQr&&t.jsx(st,{busy:s,id:"watermark-qr-opacity",label:"QR opacity",min:St*100,max:Nt*100,output:`${ot(l.qrOpacity)}%`,value:ot(l.qrOpacity),onChange:P=>n({qrOpacity:P/100})}),e[160]=s,e[161]=n,e[162]=l.includeQr,e[163]=l.qrOpacity,e[164]=ue):ue=e[164];let ae;e[165]!==s||e[166]!==n||e[167]!==l.handleOpacity||e[168]!==l.includeHandle?(ae=l.includeHandle&&t.jsx(st,{busy:s,id:"watermark-handle-opacity",label:"Handle opacity",min:St*100,max:Nt*100,output:`${ot(l.handleOpacity)}%`,value:ot(l.handleOpacity),onChange:P=>n({handleOpacity:P/100})}),e[165]=s,e[166]=n,e[167]=l.handleOpacity,e[168]=l.includeHandle,e[169]=ae):ae=e[169];let re;e[170]!==l.fadeSeconds?(re=fn(l.fadeSeconds),e[170]=l.fadeSeconds,e[171]=re):re=e[171];let Se;e[172]!==l.fadeSeconds?(Se=Math.round(l.fadeSeconds*10),e[172]=l.fadeSeconds,e[173]=Se):Se=e[173];let ve;e[174]!==n?(ve=P=>n({fadeSeconds:P/10}),e[174]=n,e[175]=ve):ve=e[175];let ye;e[176]!==s||e[177]!==re||e[178]!==Se||e[179]!==ve?(ye=t.jsx(st,{busy:s,id:"watermark-fade",label:"Fade in/out",min:as*10,max:is*10,output:re,value:Se,onChange:ve}),e[176]=s,e[177]=re,e[178]=Se,e[179]=ve,e[180]=ye):ye=e[180];let Ce;e[181]===Symbol.for("react.memo_cache_sentinel")?(Ce=t.jsx("small",{className:"confirm-help",children:"Fades only where a watermark starts or ends inside the clip."}),e[181]=Ce):Ce=e[181];let xe;e[182]!==J||e[183]!==ue||e[184]!==ae||e[185]!==ye?(xe=t.jsxs("section",{className:"confirm-section","aria-label":"Appearance",children:[le,J,ue,ae,ye,Ce]}),e[182]=J,e[183]=ue,e[184]=ae,e[185]=ye,e[186]=xe):xe=e[186];let Ne;e[187]===Symbol.for("react.memo_cache_sentinel")?(Ne=t.jsx("span",{className:"confirm-section-label",children:"Position"}),e[187]=Ne):Ne=e[187];let fe;e[188]===Symbol.for("react.memo_cache_sentinel")?(fe=t.jsx("span",{children:"QR position"}),e[188]=fe):fe=e[188];const ee=`confirm-chip${l.position==="auto"?" active":""}`,Ee=l.position==="auto",$e=s||!l.includeQr;let ke;e[189]!==n?(ke=()=>n({position:"auto"}),e[189]=n,e[190]=ke):ke=e[190];let Re;e[191]!==ee||e[192]!==Ee||e[193]!==$e||e[194]!==ke?(Re=t.jsxs("div",{className:"confirm-watermark-qr-position-heading",children:[fe,t.jsx("button",{type:"button",className:ee,"aria-pressed":Ee,disabled:$e,onClick:ke,children:"Auto"})]}),e[191]=ee,e[192]=Ee,e[193]=$e,e[194]=ke,e[195]=Re):Re=e[195];let Te;e[196]!==s||e[197]!==n||e[198]!==l.includeQr||e[199]!==l.position?(Te=Yl.map(P=>t.jsx("button",{type:"button",className:l.position===P?"active":"","aria-label":$t[P],"aria-pressed":l.position===P,title:$t[P],disabled:s||!l.includeQr,onClick:()=>n({position:P}),children:t.jsx("span",{})},P)),e[196]=s,e[197]=n,e[198]=l.includeQr,e[199]=l.position,e[200]=Te):Te=e[200];let Oe;e[201]!==Te?(Oe=t.jsx("div",{className:"confirm-position-grid",role:"group","aria-label":"QR position",children:Te}),e[201]=Te,e[202]=Oe):Oe=e[202];let De;e[203]!==Re||e[204]!==Oe?(De=t.jsxs("div",{className:"confirm-watermark-qr-position",children:[Re,Oe]}),e[203]=Re,e[204]=Oe,e[205]=De):De=e[205];let Pe;e[206]!==s||e[207]!==n||e[208]!==l.handlePlacement||e[209]!==l.handleVerticalPercent||e[210]!==l.includeHandle||e[211]!==l.includeQr?(Pe=l.includeHandle&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"confirm-watermark-handle-placement",children:[t.jsx("span",{children:"Handle placement"}),t.jsx("div",{className:"confirm-chips",role:"group","aria-label":"Handle placement",children:Xl.map(P=>{const Ue=s||P!=="center"&&!l.includeQr;return t.jsx("button",{type:"button",className:l.handlePlacement===P?"active":"","aria-pressed":l.handlePlacement===P,disabled:Ue,onClick:()=>n({handlePlacement:P}),children:mn[P]},P)})})]}),l.handlePlacement==="center"&&t.jsx(st,{busy:s,id:"watermark-handle-vertical",label:"Handle vertical position",min:Zl,max:Jl,output:`${l.handleVerticalPercent}% from top`,value:l.handleVerticalPercent,onChange:P=>n({handleVerticalPercent:P})})]}),e[206]=s,e[207]=n,e[208]=l.handlePlacement,e[209]=l.handleVerticalPercent,e[210]=l.includeHandle,e[211]=l.includeQr,e[212]=Pe):Pe=e[212];const ze=l.includeQr&&l.includeHandle?l.handlePlacement==="center"?"Auto places the QR away from faces and text. The handle stays horizontally centered.":"Auto places the QR away from faces and text. The handle sits with the QR.":l.includeQr?"Auto places the QR away from faces and text.":"The handle stays horizontally centered.";let _e;e[213]!==ze?(_e=t.jsx("small",{className:"confirm-help",children:ze}),e[213]=ze,e[214]=_e):_e=e[214];let Fe;e[215]!==Pe||e[216]!==_e?(Fe=t.jsxs("div",{className:"confirm-watermark-handle-position",children:[Pe,_e]}),e[215]=Pe,e[216]=_e,e[217]=Fe):Fe=e[217];let Ie;e[218]!==De||e[219]!==Fe?(Ie=t.jsxs("section",{className:"confirm-section confirm-watermark-position","aria-label":"Position",children:[Ne,De,Fe]}),e[218]=De,e[219]=Fe,e[220]=Ie):Ie=e[220];let Le;e[221]!==ce||e[222]!==xe||e[223]!==Ie?(Le=t.jsxs("div",{className:"confirm-watermark-controls",children:[ce,xe,Ie]}),e[221]=ce,e[222]=xe,e[223]=Ie,e[224]=Le):Le=e[224];let He;return e[225]!==X||e[226]!==Le?(He=t.jsxs("div",{className:"confirm-watermark",children:[X,Le]}),e[225]=X,e[226]=Le,e[227]=He):He=e[227],He}function jn(i){return t.jsx("option",{value:i,children:Dt[i]},i)}const In=Object.freeze(Object.defineProperty({__proto__:null,WatermarkBody:vn},Symbol.toStringTag,{value:"Module"}));export{Cn as C,Pn as G,Tn as N,kn as P,An as R,En as S,_n as T,In as W,Rn as a,$n as b};
@@ -1 +1 @@
1
- import{a as i,j as t,b as ce,c as O}from"./vendor-react-Dj7D1fD4.js";import{B as ue,k as de}from"./ui-OHFUngrc.js";import{bw as X,dJ as me,dK as fe,dL as pe}from"./videobook-DZ58pKW5.js";import{ap as he,a2 as be,X as xe}from"./vendor-icons-CGqhCIXV.js";function J(n){const e=O.c(7),{address:u,asset:a}=n;let o;e[0]!==u?(o=t.jsxs("strong",{children:["@",u]}),e[0]=u,e[1]=o):o=e[1];let l;e[2]!==a?(l=me(a).map(ye),e[2]=a,e[3]=l):l=e[3];let c;return e[4]!==o||e[5]!==l?(c=t.jsxs("p",{className:"media-fullscreen-details",children:[o,l]}),e[4]=o,e[5]=l,e[6]=c):c=e[6],c}function ye(n){return t.jsx("span",{children:n},n)}function ge(n){return n instanceof HTMLElement&&(n.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(n.tagName))}function je(n){const e=O.c(11),{address:u,playbackUrl:a,posterUrl:o,videoRef:l}=n;if(!a){let d;e[0]!==u||e[1]!==o?(d=o?t.jsx("img",{src:o,alt:`@${u} poster`}):null,e[0]=u,e[1]=o,e[2]=d):d=e[2];let h,b;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx("strong",{children:"Playback unavailable"}),b=t.jsx("p",{children:"This video has a preview image but no playable media yet."}),e[3]=h,e[4]=b):(h=e[3],b=e[4]);let x;return e[5]!==d?(x=t.jsxs("div",{className:"notebook-media-unavailable",role:"status",children:[d,h,b]}),e[5]=d,e[6]=x):x=e[6],x}const c=o??void 0;let p;return e[7]!==a||e[8]!==c||e[9]!==l?(p=t.jsx("video",{ref:l,src:a,poster:c,controls:!0,tabIndex:0,controlsList:"nofullscreen nodownload noremoteplayback",disablePictureInPicture:!0,playsInline:!0,autoPlay:!0,preload:"auto"},a),e[7]=a,e[8]=c,e[9]=l,e[10]=p):p=e[10],p}function Ne({asset:n,address:e,initialMode:u="view",subjectMap:a=null,subjectMapLoading:o=!1,analysisUnavailableReason:l=null,composerPortalRef:c,actionsOpen:p=!1,returnFocus:d=null,initialRegions:h,initialInstruction:b="",onInstructionChange:x,replacementCandidates:G=[],imageEditModels:Q,imageEditModelsLoading:Y,defaultImageEditModelId:Z,onEstimateImageEditCost:_,onAnalyzeSubjects:ee,onCaptureFrame:w,onEditingChange:te,onEditSubjects:A,onSubmitEditInstruction:M,onClose:T}){const g=i.useRef(null),$=i.useRef(null),j=i.useRef(null),U=i.useRef(null),N=i.useRef(null),y=i.useRef(!1),m=n.type==="video"||n.type==="final",R=n.mediaUrl,D=n.thumbnailUrl,v=R??D,L=m||!!v,C=!m&&!!(A||M),[se,F]=i.useState(m?"view":u),[ne,re]=i.useState(b),[P,K]=i.useState(!1),[S,I]=i.useState(null),k=se==="edit"&&!m;if(i.useEffect(()=>(y.current=!0,()=>{y.current=!1}),[]),i.useEffect(()=>{if(!L)return;const s=g.current;if(!s)return;U.current=d??(document.activeElement instanceof HTMLElement?document.activeElement:null);const r=document.querySelector(".app-shell"),E=r?.inert??!1,f=r?.getAttribute("aria-hidden")??null,ie=document.body.style.overflow;return r&&(r.inert=!0,r.setAttribute("aria-hidden","true")),document.body.style.overflow="hidden",s.showModal(),j.current?.focus(),()=>{s.close(),r&&(r.inert=E,f===null?r.removeAttribute("aria-hidden"):r.setAttribute("aria-hidden",f)),document.body.style.overflow=ie;const V=N.current;if(V){N.current=null,V();return}const W=U.current;X(W),requestAnimationFrame(()=>X(W))}},[L,d]),!m&&!v)return null;const B=s=>{if(!g.current)return;const r=pe(g.current);(s==="first"?r[0]:r.at(-1))?.focus({preventScroll:!0})},z=s=>{s.detail>0&&(N.current=fe()),T()},q=()=>{F("view"),requestAnimationFrame(()=>j.current?.focus())},oe=async()=>{const s=$.current;if(!s||!w||P)return;const r=Number.isFinite(s.duration)?s.duration:null,E=Math.max(0,r===null?s.currentTime:Math.min(s.currentTime,Math.max(0,r-.05)));K(!0),I(null);try{const f=await w(E);y.current&&I({tone:"success",text:`Frame saved to ${f}`})}catch(f){y.current&&I({tone:"error",text:f instanceof Error?f.message:String(f)})}finally{y.current&&K(!1)}},ae=s=>{k||s.defaultPrevented||ge(s.target)||s.metaKey||s.ctrlKey||s.altKey||!C||s.key.toLowerCase()!=="e"||(s.preventDefault(),F("edit"))},le=t.jsxs(t.Fragment,{children:[t.jsxs("header",{className:"media-fullscreen-chrome",children:[t.jsx(J,{address:e,asset:n}),t.jsxs("div",{className:"notebook-media-fullscreen-actions",children:[C&&t.jsxs("button",{type:"button",className:"media-fullscreen-edit","aria-keyshortcuts":"E",onClick:()=>F("edit"),children:[t.jsx(he,{size:16}),"Edit image"]}),m&&R&&w&&t.jsxs("button",{type:"button",className:"notebook-media-capture-button",disabled:P,onClick:()=>{oe()},children:[P?t.jsx(ue,{size:16}):t.jsx(be,{size:16}),"Extract frame"]}),t.jsx("button",{ref:j,type:"button",className:"notebook-media-fullscreen-close",onClick:z,"aria-label":"Close fullscreen preview","aria-keyshortcuts":"Escape","data-composer-focus":"return",children:t.jsx(xe,{size:20})}),S&&t.jsx("p",{className:`notebook-media-capture-status ${S.tone}`,role:"status",children:S.text})]})]}),t.jsx("div",{className:"media-fullscreen-stage",children:m?t.jsx(je,{address:e,playbackUrl:R,posterUrl:D,videoRef:$}):t.jsx("img",{src:v??"",alt:`@${e}`})}),C&&t.jsxs("p",{className:"media-fullscreen-keys","aria-hidden":"true",children:[t.jsxs("span",{children:[t.jsx("kbd",{children:"E"})," edit"]}),t.jsxs("span",{children:[t.jsx("kbd",{children:"Esc"})," close"]})]})]}),H=t.jsxs("dialog",{ref:g,className:`notebook-media-fullscreen ${k?"image-editor":"media-viewer"}${m?" playback-only":""}`,role:"dialog","aria-modal":"true","aria-label":`Fullscreen preview for @${e}`,onKeyDown:ae,onCancel:s=>{s.preventDefault(),k?q():T()},children:[p&&t.jsx("div",{ref:c,className:"notebook-media-composer-host actions-only","aria-label":"Media actions input"}),t.jsx("span",{className:"sr-only",tabIndex:0,"aria-hidden":"true",onFocus:()=>B("last")}),k?t.jsx(de,{address:e,mediaUrl:v??"",width:a?.width??n.width??1e3,height:a?.height??n.height??1e3,details:t.jsx(J,{address:e,asset:n}),subjectMap:a,subjectMapLoading:o,analysisUnavailableReason:l,initialRegions:h,instruction:ne,onInstructionChange:s=>{re(s),x?.(s)},replacementCandidates:G,imageEditModels:Q,imageEditModelsLoading:Y,defaultImageEditModelId:Z,onEstimateImageEditCost:_,closeRef:j,onAnalyzeSubjects:ee,onEditingChange:te,onEditSubjects:A,onSubmitInstruction:M,onBack:q,onClose:z}):le,t.jsx("span",{className:"sr-only",tabIndex:0,"aria-hidden":"true",onFocus:()=>B("first")})]});return typeof document>"u"?H:ce.createPortal(H,document.body)}export{Ne as N};
1
+ import{a as i,j as t,b as ce,c as G}from"./vendor-react-Dj7D1fD4.js";import{B as ue,k as de}from"./ui-CXDi5Omq.js";import{bx as W,dN as me,dO as fe,dP as pe}from"./videobook-J-j9bSjM.js";import{ap as he,a2 as xe,X as be}from"./vendor-icons-CGqhCIXV.js";function X(n){const e=G.c(7),{address:u,asset:a}=n;let o;e[0]!==u?(o=t.jsxs("strong",{children:["@",u]}),e[0]=u,e[1]=o):o=e[1];let l;e[2]!==a?(l=me(a).map(ye),e[2]=a,e[3]=l):l=e[3];let c;return e[4]!==o||e[5]!==l?(c=t.jsxs("p",{className:"media-fullscreen-details",children:[o,l]}),e[4]=o,e[5]=l,e[6]=c):c=e[6],c}function ye(n){return t.jsx("span",{children:n},n)}function ge(n){return n instanceof HTMLElement&&(n.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(n.tagName))}function je(n){const e=G.c(11),{address:u,playbackUrl:a,posterUrl:o,videoRef:l}=n;if(!a){let d;e[0]!==u||e[1]!==o?(d=o?t.jsx("img",{src:o,alt:`@${u} poster`}):null,e[0]=u,e[1]=o,e[2]=d):d=e[2];let h,x;e[3]===Symbol.for("react.memo_cache_sentinel")?(h=t.jsx("strong",{children:"Playback unavailable"}),x=t.jsx("p",{children:"This video has a preview image but no playable media yet."}),e[3]=h,e[4]=x):(h=e[3],x=e[4]);let b;return e[5]!==d?(b=t.jsxs("div",{className:"notebook-media-unavailable",role:"status",children:[d,h,x]}),e[5]=d,e[6]=b):b=e[6],b}const c=o??void 0;let p;return e[7]!==a||e[8]!==c||e[9]!==l?(p=t.jsx("video",{ref:l,src:a,poster:c,controls:!0,tabIndex:0,controlsList:"nofullscreen nodownload noremoteplayback",disablePictureInPicture:!0,playsInline:!0,autoPlay:!0,preload:"auto"},a),e[7]=a,e[8]=c,e[9]=l,e[10]=p):p=e[10],p}function Ne({asset:n,address:e,initialMode:u="view",subjectMap:a=null,subjectMapLoading:o=!1,analysisUnavailableReason:l=null,composerPortalRef:c,actionsOpen:p=!1,returnFocus:d=null,initialRegions:h,initialInstruction:x="",onInstructionChange:b,replacementCandidates:J=[],imageEditModels:Q,imageEditModelsLoading:Y,defaultImageEditModelId:Z,onEstimateImageEditCost:_,onAnalyzeSubjects:ee,onCaptureFrame:w,onEditingChange:te,onEditSubjects:A,onSubmitEditInstruction:M,onClose:T}){const g=i.useRef(null),$=i.useRef(null),j=i.useRef(null),U=i.useRef(null),N=i.useRef(null),y=i.useRef(!1),m=n.type==="video"||n.type==="final",R=n.mediaUrl,D=n.thumbnailUrl,v=R??D,L=m||!!v,P=!m&&!!(A||M),[se,C]=i.useState(m?"view":u),[ne,re]=i.useState(x),[F,B]=i.useState(!1),[S,I]=i.useState(null),k=se==="edit"&&!m;if(i.useEffect(()=>(y.current=!0,()=>{y.current=!1}),[]),i.useEffect(()=>{if(!L)return;const s=g.current;if(!s)return;U.current=d??(document.activeElement instanceof HTMLElement?document.activeElement:null);const r=document.querySelector(".app-shell"),E=r?.inert??!1,f=r?.getAttribute("aria-hidden")??null,ie=document.body.style.overflow;return r&&(r.inert=!0,r.setAttribute("aria-hidden","true")),document.body.style.overflow="hidden",s.showModal(),j.current?.focus(),()=>{s.close(),r&&(r.inert=E,f===null?r.removeAttribute("aria-hidden"):r.setAttribute("aria-hidden",f)),document.body.style.overflow=ie;const V=N.current;if(V){N.current=null,V();return}const O=U.current;W(O),requestAnimationFrame(()=>W(O))}},[L,d]),!m&&!v)return null;const K=s=>{if(!g.current)return;const r=pe(g.current);(s==="first"?r[0]:r.at(-1))?.focus({preventScroll:!0})},z=s=>{s.detail>0&&(N.current=fe()),T()},q=()=>{C("view"),requestAnimationFrame(()=>j.current?.focus())},oe=async()=>{const s=$.current;if(!s||!w||F)return;const r=Number.isFinite(s.duration)?s.duration:null,E=Math.max(0,r===null?s.currentTime:Math.min(s.currentTime,Math.max(0,r-.05)));B(!0),I(null);try{const f=await w(E);y.current&&I({tone:"success",text:`Frame saved to ${f}`})}catch(f){y.current&&I({tone:"error",text:f instanceof Error?f.message:String(f)})}finally{y.current&&B(!1)}},ae=s=>{k||s.defaultPrevented||ge(s.target)||s.metaKey||s.ctrlKey||s.altKey||!P||s.key.toLowerCase()!=="e"||(s.preventDefault(),C("edit"))},le=t.jsxs(t.Fragment,{children:[t.jsxs("header",{className:"media-fullscreen-chrome",children:[t.jsx(X,{address:e,asset:n}),t.jsxs("div",{className:"notebook-media-fullscreen-actions",children:[P&&t.jsxs("button",{type:"button",className:"media-fullscreen-edit","aria-keyshortcuts":"E",onClick:()=>C("edit"),children:[t.jsx(he,{size:16}),"Edit image"]}),m&&R&&w&&t.jsxs("button",{type:"button",className:"notebook-media-capture-button",disabled:F,onClick:()=>{oe()},children:[F?t.jsx(ue,{size:16}):t.jsx(xe,{size:16}),"Extract frame"]}),t.jsx("button",{ref:j,type:"button",className:"notebook-media-fullscreen-close",onClick:z,"aria-label":"Close fullscreen preview","aria-keyshortcuts":"Escape","data-composer-focus":"return",children:t.jsx(be,{size:20})}),S&&t.jsx("p",{className:`notebook-media-capture-status ${S.tone}`,role:"status",children:S.text})]})]}),t.jsx("div",{className:"media-fullscreen-stage",children:m?t.jsx(je,{address:e,playbackUrl:R,posterUrl:D,videoRef:$}):t.jsx("img",{src:v??"",alt:`@${e}`})}),P&&t.jsxs("p",{className:"media-fullscreen-keys","aria-hidden":"true",children:[t.jsxs("span",{children:[t.jsx("kbd",{children:"E"})," edit"]}),t.jsxs("span",{children:[t.jsx("kbd",{children:"Esc"})," close"]})]})]}),H=t.jsxs("dialog",{ref:g,className:`notebook-media-fullscreen ${k?"image-editor":"media-viewer"}${m?" playback-only":""}`,role:"dialog","aria-modal":"true","aria-label":`Fullscreen preview for @${e}`,onKeyDown:ae,onCancel:s=>{s.preventDefault(),k?q():T()},children:[p&&t.jsx("div",{ref:c,className:"notebook-media-composer-host actions-only","aria-label":"Media actions input"}),t.jsx("span",{className:"sr-only",tabIndex:0,"aria-hidden":"true",onFocus:()=>K("last")}),k?t.jsx(de,{address:e,mediaUrl:v??"",width:a?.width??n.width??1e3,height:a?.height??n.height??1e3,details:t.jsx(X,{address:e,asset:n}),subjectMap:a,subjectMapLoading:o,analysisUnavailableReason:l,initialRegions:h,instruction:ne,onInstructionChange:s=>{re(s),b?.(s)},replacementCandidates:J,imageEditModels:Q,imageEditModelsLoading:Y,defaultImageEditModelId:Z,onEstimateImageEditCost:_,closeRef:j,onAnalyzeSubjects:ee,onEditingChange:te,onEditSubjects:A,onSubmitInstruction:M,onBack:q,onClose:z}):le,t.jsx("span",{className:"sr-only",tabIndex:0,"aria-hidden":"true",onFocus:()=>K("first")})]});return typeof document>"u"?H:ce.createPortal(H,document.body)}export{Ne as N};