ryugi-artifacts 1.113.2 → 1.113.3

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ryugi-artifacts",
3
- "version": "1.113.2",
3
+ "version": "1.113.3",
4
4
  "daemonSource": "3fb61bfe80dc",
5
5
  "description": "Server and viewer for the Artideck artifacts app",
6
6
  "license": "UNLICENSED",
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-DlmbjZJV.js";import{B as n,V as r,n as i,s as a}from"./index.js";import{t as o}from"./useArtifactFeed-1e4jVUAL.js";import{S as s,_ as c,a as l,b as u,c as d,d as f,f as p,g as m,h,i as g,l as _,m as v,n as y,o as b,p as x,r as S,s as C,t as w,v as T,x as E,y as D}from"./useStoryboardData-aWqqHGVH.js";import{w as O,x as k}from"./route-Csi4PU7w.js";import{t as A}from"./WarningsBadge-DGnz2zmy.js";import{t as ee}from"./useTypeFavicon-yXOsFZBx.js";import{t as j}from"./cssVar.stylex-CGbpAC1Y.js";import{t as te}from"./jsx-runtime-LKYXHABd.js";/* empty css */import{u as M}from"./stable-CwENW2fR.js";import{cn as N,ln as P,pr as F,sn as I,sr as ne,un as re}from"./url-D8qiZRqE.js";import{t as ie}from"./Segmented-Clhtb1CD.js";import{t as L}from"./clapperboard-BfpJ7tpa.js";import{t as R}from"./play-6FAfeM1L.js";import{t as ae}from"./video-DKoRqEZW.js";import{n as z}from"./imperative-D1UIq_CR.js";import{c as oe,n as se,o as ce}from"./ThreadView-OBDIwTkP.js";import{t as le}from"./message-square-Yl8PoPy_.js";import{t as ue}from"./upload-DffL3XsM.js";import{En as de}from"./useLayerZIndex-D4jsmz12.js";import{Dt as B}from"./MotionConfigContext-HC2vqcJO.js";import{t as fe}from"./DraggablePanel-BuFi6njZ.js";import{t as pe}from"./sliders-horizontal-CuS3-UwA.js";import{n as me,t as V}from"./styles-clvPUBbJ.js";import{t as he}from"./DropdownMenu-CM7q1CMp.js";import{t as ge}from"./local-CvTEMav_.js";import{i as _e,n as ve,r as ye,t as be}from"./zoom-out-DsmGFv1v.js";import{t as xe}from"./plus-DZJ2BVkK.js";import{t as Se}from"./maximize-2-Bc0lXBg6.js";import{t as Ce}from"./PlaybackIcon-D-vfZnSv.js";import{t as we}from"./Input-CVcfIqt2.js";import{F as Te,P as Ee}from"./SelectScrollUpArrow-CTGOrluu.js";import{i as De,n as Oe,r as ke}from"./stringifyLocale-D0juOOnH.js";import{t as Ae}from"./mouse-pointer-2-B-OF_fcG.js";import{t as je}from"./film-A6SU1RGC.js";var Me={name:`blend`,size:24,node:[[`circle`,{cx:`15`,cy:`9`,r:`7`,key:`1i12rt`}],[`circle`,{cx:`9`,cy:`15`,r:`7`,key:`19bs8k`}]]};Me.node;var Ne=B(Me),Pe={name:`captions-off`,size:24,node:[[`path`,{d:`M10.5 5H19a2 2 0 0 1 2 2v8.5`,key:`jqtk4d`}],[`path`,{d:`M17 11h-.5`,key:`1961ue`}],[`path`,{d:`M19 19H5a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2`,key:`1keqsi`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M7 11h4`,key:`1o1z6v`}],[`path`,{d:`M7 15h2.5`,key:`1ina1g`}]]};Pe.node;var Fe=B(Pe),Ie={name:`captions`,size:24,node:[[`rect`,{width:`18`,height:`14`,x:`3`,y:`5`,rx:`2`,ry:`2`,key:`12ruh7`}],[`path`,{d:`M7 15h4M15 15h2M7 11h2M13 11h4`,key:`1ueiar`}]],aliases:[`subtitles`]};Ie.node;var Le=B(Ie),Re={name:`git-compare`,size:24,node:[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`path`,{d:`M11 18H8a2 2 0 0 1-2-2V9`,key:`19pyzm`}]]};Re.node;var ze=B(Re),Be={name:`magnet`,size:24,node:[[`path`,{d:`m12 15 4 4`,key:`lnac28`}],[`path`,{d:`M2.352 10.648a1.205 1.205 0 0 0 0 1.704l2.296 2.296a1.205 1.205 0 0 0 1.704 0l6.029-6.029a1 1 0 1 1 3 3l-6.029 6.029a1.205 1.205 0 0 0 0 1.704l2.296 2.296a1.205 1.205 0 0 0 1.704 0l6.365-6.367A1 1 0 0 0 8.716 4.282z`,key:`nlhkjb`}],[`path`,{d:`m5 8 4 4`,key:`j6kj7e`}]]};Be.node;var Ve=B(Be),He={name:`message-square-plus`,size:24,node:[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M12 8v6`,key:`1ib9pf`}],[`path`,{d:`M9 11h6`,key:`1fldmi`}]]};He.node;var Ue=B(He),We={name:`move-horizontal`,size:24,node:[[`path`,{d:`m18 8 4 4-4 4`,key:`1ak13k`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}]]};We.node;var Ge=B(We),Ke={name:`scan`,size:24,node:[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}]]};Ke.node;var qe=B(Ke),Je={name:`scissors`,size:24,node:[[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M8.12 8.12 12 12`,key:`1alkpv`}],[`path`,{d:`M20 4 8.12 15.88`,key:`xgtan2`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`path`,{d:`M14.8 14.8 20 20`,key:`ptml3r`}]]};Je.node;var Ye=B(Je),Xe={name:`skip-back`,size:24,node:[[`path`,{d:`M17.971 4.285A2 2 0 0 1 21 6v12a2 2 0 0 1-3.029 1.715l-9.997-5.998a2 2 0 0 1-.003-3.432z`,key:`15892j`}],[`path`,{d:`M3 20V4`,key:`1ptbpl`}]]};Xe.node;var Ze=B(Xe),Qe={name:`skip-forward`,size:24,node:[[`path`,{d:`M21 4v16`,key:`7j8fe9`}],[`path`,{d:`M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z`,key:`zs4d6`}]]};Qe.node;var $e=B(Qe),et={name:`step-back`,size:24,node:[[`path`,{d:`M13.971 4.285A2 2 0 0 1 17 6v12a2 2 0 0 1-3.029 1.715l-9.997-5.998a2 2 0 0 1-.003-3.432z`,key:`19qhus`}],[`path`,{d:`M21 20V4`,key:`cb8qj8`}]]};et.node;var tt=B(et),nt={name:`step-forward`,size:24,node:[[`path`,{d:`M10.029 4.285A2 2 0 0 0 7 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z`,key:`1ystz2`}],[`path`,{d:`M3 4v16`,key:`1ph11n`}]]};nt.node;var rt=B(nt),it={name:`volume-2`,size:24,node:[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`path`,{d:`M16 9a5 5 0 0 1 0 6`,key:`1q6k2b`}],[`path`,{d:`M19.364 18.364a9 9 0 0 0 0-12.728`,key:`ijwkga`}]]};it.node;var at=B(it),ot={name:`volume-x`,size:24,node:[[`path`,{d:`M11 4.702a.7.7 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.7.7 0 0 0 11 19.298z`,key:`1p7khw`}],[`path`,{d:`m16.5 14.5 5-5`,key:`cul3yw`}],[`path`,{d:`m16.5 9.5 5 5`,key:`1akey5`}]]};ot.node;var st=B(ot),H=e(t(),1);j.colorBorderSecondary;var U={threads:{k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kOIVth:`x17d4w8g`,kmVPX3:`x927fz6`,kt9PQ7:`xso031l`,kfdmCh:`x1q0q8m5`,kL6WhQ:`xtrfj0v`,$$css:!0},threadsDense:{kE3dHu:`xf18ygs`,kpe85a:`xnuq7ks`,$$css:!0},heading:{kmVPX3:`xlqrw7o`,kMwMTN:`xddlp02`,kGuDYH:`x1j6dyjg`,k63SB2:`x1s688f`,kP9fke:`xtvhhri`,kb6lSQ:`x1vyo3qp`,$$css:!0},card:{kmVPX3:`x2lkgqm`,kMzoRj:`xmkeg23`,ksu8eU:`x1y0btm7`,kVAM5u:`x12xov25`,kaIpWk:`xur7f20`,kWkggS:`x1rozbrz`,kkrTdU:`x1ypdohk`,kGuDYH:`xfifm61`,$$css:!0},open:{kmVPX3:`x1717udv`,kkrTdU:`xt0e3qv`,$$css:!0},resolved:{kSiTet:`x197sbye`,$$css:!0},meta:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kOIVth:`x17d4w8g`,kMwMTN:`xddlp02`,kGuDYH:`x1j6dyjg`,$$css:!0},chip:{k1xSpc:`x3nfvp2`,kGNEyG:`x6s0dn4`,kZKoxP:`xlup9mm`,kg3NbH:`xm9j1uf`,kaIpWk:`x12oqio5`,kWkggS:`xahzvm9`,kMwMTN:`x1bo0w0s`,kMv6JI:`x1b02387`,kGuDYH:`x1k6wstc`,$$css:!0},text:{keoZOQ:`xr9ek0c`,kMwMTN:`xo2rkog`,kHjlTd:`xj0a0fe`,$$css:!0},draft:{kMzoRj:`xmkeg23`,ksu8eU:`x1y0btm7`,kVAM5u:`x11cp7ww`,kaIpWk:`xur7f20`,kWkggS:`x1rozbrz`,$$css:!0},draftLabel:{kmVPX3:`x149dozy`,kMwMTN:`xddlp02`,kGuDYH:`x1j6dyjg`,$$css:!0},rowDraft:{kmVPX3:`x927fz6`,$$css:!0},button:{k1xSpc:`xwz0xwf`,kgQiWS:`x1ku5rj1`,kzqmXN:`x17z2i9w`,kZKoxP:`x17rw0jw`,kmVPX3:`x1717udv`,kMzoRj:`xc342km`,kaIpWk:`x1sxf85j`,kWkggS:`xjbqb8w xj0l527`,kMwMTN:`xddlp02`,kkrTdU:`x1ypdohk`,$$css:!0},layer:{kVAEAm:`x10l6tqk`,kpwlN0:`x10a8y8t`,kY2c9j:`xzkaem6`,kkrTdU:`xsid9ct`,kFalU9:`x5ve5x3`,$$css:!0},box:{kVAEAm:`x10l6tqk`,kMzoRj:`xdh2fpr`,ksu8eU:`x1y0btm7`,kVAM5u:`x11cp7ww`,kaIpWk:`x18zih8k`,kWkggS:`x8897o3`,kfzvcC:`x47corl`,$$css:!0}},W=te(),ct=e=>Math.round(Math.min(Math.max(e,0),1)*1e3)/1e3;function lt({mark:e,onMark:t}){let n=(0,H.useRef)(null),[r,i]=(0,H.useState)(null),a=(e,t,n)=>{let r=e.getBoundingClientRect();return{x:r.width?(t-r.left)/r.width:0,y:r.height?(n-r.top)/r.height:0}},o=(e,t)=>({x:ct(Math.min(e.x,t.x)),y:ct(Math.min(e.y,t.y)),w:ct(Math.abs(t.x-e.x)),h:ct(Math.abs(t.y-e.y))}),s=r??e;return(0,W.jsx)(`div`,{"data-mark-layer":``,onPointerDown:e=>{e.currentTarget.setPointerCapture?.(e.pointerId),n.current=a(e.currentTarget,e.clientX,e.clientY),i(null)},onPointerMove:e=>{n.current&&i(o(n.current,a(e.currentTarget,e.clientX,e.clientY)))},onPointerUp:e=>{if(!n.current)return;let r=o(n.current,a(e.currentTarget,e.clientX,e.clientY));n.current=null,i(null),t(r.w>.01&&r.h>.01?r:null)},...k(U.layer),children:s?(0,W.jsx)(`div`,{style:{left:`${s.x*100}%`,top:`${s.y*100}%`,width:`${s.w*100}%`,height:`${s.h*100}%`},...k(U.box)}):null})}j.colorBorderSecondary;var ut=`#0D99FF`,dt=`#7B61FF`,G={root:{kVAEAm:`xixxii4`,kpwlN0:`x10a8y8t`,k1xSpc:`xrvj5dj`,k9llMU:`x1swazf2`,kumcoG:`x1mkdm3x`,kWkggS:`x1rozbrz`,kMwMTN:`xo2rkog`,kMv6JI:`xqfszdh`,kGuDYH:`x4z9k3i`,$$css:!0},fill:{kVAEAm:`x1n2onr6`,kpwlN0:`x1anvkwx`,kUk6DE:`x98rzlu`,kAzted:`x2lwn1j`,kzqmXN:`xh8yej3`,kZKoxP:`x5yr21d`,$$css:!0},upper:{k1xSpc:`xrvj5dj`,kumcoG:`xx9t13c`,kAzted:`x2lwn1j`,$$css:!0},panel:{k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kZKoxP:`x5yr21d`,kAzted:`x2lwn1j`,k7Eaqz:`xeuugli`,$$css:!0},left:{kWqL5O:`xs1s249`,kSWEuD:`x32b0ac`,k26BEO:`x1vnv1x`,$$css:!0},right:{kZ1KPB:`xe0pwq`,k4WBpm:`x19ypqd9`,kaZRDh:`x1ukcur6`,$$css:!0},tabs:{kUk6DE:`x1okw0bk`,k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kOIVth:`x195vfkc`,kZKoxP:`x90ne7k`,kg3NbH:`xdqyycr`,kXHlph:`xw2csxc`,k5wCbM:`x1rohswg`,kWkggS:`x1rozbrz`,kt9PQ7:`xso031l`,kfdmCh:`x1q0q8m5`,kL6WhQ:`xtrfj0v`,$$css:!0},tab:{kUk6DE:`x1okw0bk`,khDVqt:`xuxw1ft`,k1xSpc:`x3nfvp2`,kGNEyG:`x6s0dn4`,kOIVth:`x1nejdyq`,kZKoxP:`xxk0z11`,kg3NbH:`xdqyycr`,kMzoRj:`xc342km`,kaIpWk:`x1sxf85j`,kWkggS:`xjbqb8w`,kMwMTN:`xddlp02`,kGuDYH:`xfifm61`,kkrTdU:`x1ypdohk`,$$css:!0},tabOn:{kMwMTN:`xo2rkog`,kWkggS:`xahzvm9`,$$css:!0},scroll:{k1xSpc:`x78zum5`,kUk6DE:`x98rzlu`,k7Eaqz:`xeuugli`,kAzted:`x2lwn1j`,$$css:!0},scrollViewport:{kUk6DE:`x98rzlu`,k7Eaqz:`xeuugli`,kAzted:`x2lwn1j`,kXHlph:`x6ikm8r`,kI3sdo:`x1a2a7pz`,$$css:!0},row:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kOIVth:`x167g77z`,kzqmXN:`xh8yej3`,k8WAf4:`x1t0vds8`,kg3NbH:`x1awh872`,kMzoRj:`xc342km`,kaIpWk:`x1kogg8i`,kWkggS:`xjbqb8w x9jwiqo`,kMwMTN:`x1bo0w0s`,kGuDYH:`xfifm61`,k9WMMc:`xdpxx8g`,kkrTdU:`x1ypdohk`,$$css:!0},rowOn:{kWkggS:`x1aw8e8p`,kMwMTN:`xo2rkog`,$$css:!0},rowName:{kUk6DE:`x98rzlu`,k7Eaqz:`xeuugli`,kVQacm:`xb3r6kr`,kg5iWk:`xlyipyv`,khDVqt:`xuxw1ft`,$$css:!0},chip:{kUk6DE:`x1okw0bk`,k1xSpc:`x3nfvp2`,kGNEyG:`x6s0dn4`,kOIVth:`x1jnr06f`,kZKoxP:`xmix8c7`,kg3NbH:`x1xijbu4`,kaIpWk:`x12oqio5`,kWkggS:`xahzvm9`,kMwMTN:`x1bo0w0s`,kMv6JI:`x1b02387`,kGuDYH:`x1j6dyjg`,kcqcaj:`xss6m8b`,$$css:!0},viewer:{k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,k7Eaqz:`xeuugli`,kAzted:`x2lwn1j`,$$css:!0},panelTitle:{k1xSpc:`x3nfvp2`,kGNEyG:`x6s0dn4`,kOIVth:`x17d4w8g`,kg3NbH:`xdqyycr`,kMwMTN:`xo2rkog`,kGuDYH:`xfifm61`,k63SB2:`xk50ysn`,$$css:!0},viewerTitle:{k7Eaqz:`xeuugli`,kg3NbH:`xdqyycr`,kVQacm:`xb3r6kr`,kg5iWk:`xlyipyv`,khDVqt:`xuxw1ft`,kMwMTN:`xo2rkog`,kGuDYH:`xfifm61`,k63SB2:`xk50ysn`,$$css:!0},viewerIndex:{kMwMTN:`xddlp02`,k63SB2:`xo1l8bm`,$$css:!0},monitor:{kUk6DE:`x98rzlu`,k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,kGNEyG:`x6s0dn4`,kjj79g:`xl56j7k`,kOIVth:`x883omv`,k7Eaqz:`xeuugli`,kAzted:`x2lwn1j`,kmVPX3:`x1tamke2`,k9g6sI:`xpqogu8`,kWkggS:`x184qs1t`,$$css:!0},stage:{k9g6sI:`x12h1iku`,kVAEAm:`x1n2onr6`,kUk6DE:`x1okw0bk`,kVQacm:`xb3r6kr`,kaIpWk:`x1kogg8i`,kWkggS:`x15cjo92`,$$css:!0},transport:{k1xSpc:`xrvj5dj`,kumcoG:`x134kloy`,kGNEyG:`x6s0dn4`,kOIVth:`x17d4w8g`,kzqmXN:`xh8yej3`,$$css:!0},transportStart:{kFhvOy:`x1lqcxt8`,$$css:!0},transportGroup:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kOIVth:`x17d4w8g`,$$css:!0},transportEnd:{kFhvOy:`x1qab1bc`,$$css:!0},timecode:{kMv6JI:`x1b02387`,kGuDYH:`x4z9k3i`,k63SB2:`x1s688f`,kcqcaj:`xss6m8b`,$$css:!0},timecodeDim:{k63SB2:`xo1l8bm`,kMwMTN:`xddlp02`,$$css:!0},spacer:{kUk6DE:`x98rzlu`,$$css:!0},tool:{k1xSpc:`x3nfvp2`,kGNEyG:`x6s0dn4`,kjj79g:`xl56j7k`,kOIVth:`x1jnr06f`,kZKoxP:`xd7y6wv`,k7Eaqz:`xlrd64x`,kg3NbH:`xm9j1uf`,kMzoRj:`xc342km`,kaIpWk:`x1kogg8i`,kWkggS:`xjbqb8w xj0l527`,kMwMTN:`x1bo0w0s`,kGuDYH:`xfifm61`,kkrTdU:`x1ypdohk xtgyt42`,kSiTet:`x1hc1fzr x1lfpgzf`,$$css:!0},toolOn:{kWkggS:`x1rozbrz`,kMwMTN:`xo2rkog`,kGVxlE:`xs625wh`,$$css:!0},play:{k1xSpc:`x3nfvp2`,kGNEyG:`x6s0dn4`,kjj79g:`xl56j7k`,kzqmXN:`x1849jeq`,kZKoxP:`x1gnnpzl`,kMzoRj:`xc342km`,kaIpWk:`x16rqkct`,kWkggS:`x19ckca5`,kMwMTN:`xs0jrwl`,kkrTdU:`x1ypdohk`,$$css:!0},section:{kmVPX3:`x1gqud3g`,kt9PQ7:`xso031l`,kfdmCh:`x1q0q8m5`,kL6WhQ:`xtrfj0v`,$$css:!0},sectionTitle:{kogj98:`x1q6ys4k`,kGuDYH:`x1j6dyjg`,k63SB2:`xk50ysn`,kMwMTN:`xddlp02`,$$css:!0},fields:{k1xSpc:`xrvj5dj`,kumcoG:`x1kq99cu`,kGNEyG:`x6s0dn4`,kOIVth:`xbc5af1`,kogj98:`x1ghz6dp`,kGuDYH:`xfifm61`,$$css:!0},label:{kMwMTN:`xddlp02`,$$css:!0},value:{kogj98:`x1ghz6dp`,k1xSpc:`x3nfvp2`,kGNEyG:`x6s0dn4`,kZKoxP:`xxk0z11`,kg3NbH:`xlkn9b3`,kaIpWk:`x1sxf85j`,kWkggS:`x2fo67v`,kMv6JI:`x1b02387`,kcqcaj:`xss6m8b`,kFhvOy:`x1lqcxt8`,$$css:!0},panelBg:{kWkggS:`x12ilycc`,kMwMTN:`xo2rkog`,$$css:!0},binFoot:{kmVPX3:`x1ruevkc`,kEafiO:`x178xt8z`,kPef9Z:`x13fuv20`,kLZC3w:`xxu5053`,$$css:!0},hint:{kmVPX3:`x1tamke2`,kMwMTN:`xddlp02`,kGuDYH:`xfifm61`,kLWn49:`x1dbl2gt`,$$css:!0},timeline:{k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,k7Eaqz:`xeuugli`,kfSwDN:`x87ps6o`,kEafiO:`x178xt8z`,kPef9Z:`x13fuv20`,kLZC3w:`xxu5053`,$$css:!0},toolbar:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kOIVth:`x17d4w8g`,kZKoxP:`xc9qbxq`,kg3NbH:`x1awh872`,kWkggS:`x184qs1t`,kt9PQ7:`xso031l`,kfdmCh:`x1q0q8m5`,kL6WhQ:`xtrfj0v`,$$css:!0},divider:{kzqmXN:`x1i1rx1s`,kZKoxP:`xlup9mm`,kUOVxO:`xjgtzcg`,kWkggS:`xh6qj2i`,$$css:!0},tracks:{kVAEAm:`x1n2onr6`,k7Eaqz:`xeuugli`,kXHlph:`xw2csxc`,kORKVm:`x10wlt62`,kvh3hx:`x7p5m3t`,$$css:!0},range:{kVAEAm:`x10l6tqk`,k87sOh:`x13vifvy`,krVfgx:`x1ey2m1c`,kWkggS:`xthf0r2`,kjGldf:`x1l0rsgs`,kJRH4f:`x1vxew43`,kzOINU:`x1l8qhl3`,kfzvcC:`x47corl`,$$css:!0},rangeShade:{kVAEAm:`x10l6tqk`,k87sOh:`xd402qu`,krVfgx:`x1ey2m1c`,kY2c9j:`xhtitgo`,kWkggS:`x12w3c0i`,kfzvcC:`x47corl`,$$css:!0},ruler:{kVAEAm:`x1n2onr6`,kZKoxP:`xd7y6wv`,kt9PQ7:`xso031l`,kfdmCh:`x1q0q8m5`,kL6WhQ:`xtrfj0v`,kkrTdU:`xsid9ct`,$$css:!0},tick:{kVAEAm:`x10l6tqk`,k87sOh:`x13vifvy`,kZKoxP:`xd7y6wv`,kZ1KPB:`xe0pwq`,k4WBpm:`x19ypqd9`,kaZRDh:`x1ukcur6`,$$css:!0},tickLabel:{kVAEAm:`x10l6tqk`,kbCHJM:`xcqyyxr`,k87sOh:`x1jzctok`,kMv6JI:`x1b02387`,kGuDYH:`x1k6wstc`,kMwMTN:`xddlp02`,$$css:!0},marker:{kVAEAm:`x10l6tqk`,k87sOh:`xfyf068`,kzqmXN:`x1wc42o8`,kZKoxP:`xegnrdp`,koQZXg:`x181ai7j`,kaIpWk:`x983p9h`,k3aq6I:`x1rr8tx7`,kWkggS:`x1f1btkr`,$$css:!0},track:{kVAEAm:`x1n2onr6`,k1xSpc:`x78zum5`,kt9PQ7:`xso031l`,kfdmCh:`x1q0q8m5`,kL6WhQ:`xtrfj0v`,$$css:!0},head:{kVAEAm:`x7wzq59`,kbCHJM:`xu96u03`,kY2c9j:`x16tb26j`,kUk6DE:`x1okw0bk`,k1xSpc:`xrvj5dj`,kumcoG:`x1gwc4ly`,kGNEyG:`x6s0dn4`,k1C7PZ:`x17zd0t2`,kzqmXN:`xylgo91`,kB7OPa:`x9f619`,kg3NbH:`x1awh872`,kWkggS:`x184qs1t`,kWqL5O:`xs1s249`,kSWEuD:`x32b0ac`,k26BEO:`x1vnv1x`,kGuDYH:`x1j6dyjg`,kMwMTN:`x1bo0w0s`,$$css:!0},code:{kMv6JI:`x1b02387`,k63SB2:`x1s688f`,kMwMTN:`xo2rkog`,$$css:!0},headName:{k7Eaqz:`xeuugli`,kVQacm:`xb3r6kr`,kg5iWk:`xlyipyv`,khDVqt:`xuxw1ft`,$$css:!0},headTool:{kzqmXN:`xw4jnvo`,kZKoxP:`x1qx5ct2`,k7Eaqz:`xt4ypqs`,kg3NbH:`xnjsko4`,$$css:!0},lane:{kVAEAm:`x1n2onr6`,kUk6DE:`x98rzlu`,$$css:!0},clip:{kVAEAm:`x10l6tqk`,k87sOh:`xxk6nc9`,krVfgx:`xy1j3rs`,kB7OPa:`x9f619`,kVQacm:`xb3r6kr`,k8WAf4:`xf4egzd`,kg3NbH:`x1xijbu4`,kMzoRj:`xc342km`,kaIpWk:`x12oqio5`,kGuDYH:`x1s31vzs`,k63SB2:`xk50ysn`,k9WMMc:`xdpxx8g`,khDVqt:`xuxw1ft`,kg5iWk:`xlyipyv`,kkrTdU:`x1ypdohk`,$$css:!0},picture:{kWkggS:`x1i3ricu`,kMwMTN:`x19qjqk`,$$css:!0},overlay:{kWkggS:`x1o5s4od`,kMwMTN:`x1elt9gp`,kGVxlE:`x1gulszm`,$$css:!0},captions:{kWkggS:`x1rozbrz`,kMwMTN:`x1bo0w0s`,kGVxlE:`xbot34g`,$$css:!0},voice:{kWkggS:`x1aw8e8p`,kMwMTN:`xlf6a2o`,kGVxlE:`x1o6ojoi`,$$css:!0},music:{kWkggS:`xrax2ds`,kMwMTN:`x1vjbsg6`,kGVxlE:`xpmlbop`,$$css:!0},sfx:{kWkggS:`x1oz5lax`,kMwMTN:`x29mykp`,kGVxlE:`xca7vp3`,$$css:!0},selected:{kI3sdo:`x1er58js`,kInvED:`x1wfwxd8`,$$css:!0},playhead:{kVAEAm:`x10l6tqk`,k87sOh:`x13vifvy`,krVfgx:`x1ey2m1c`,kY2c9j:`xoegz02`,kzqmXN:`xnalus7`,kZ1KPB:`xaqn3yn`,k4WBpm:`x19ypqd9`,kaZRDh:`x125f4ab`,kfzvcC:`x47corl`,$$css:!0}},ft=`application/x-ryugi-sound`;function pt(e,t,n){let{t:r}=O(),i=(0,H.useRef)(null);(0,H.useEffect)(()=>()=>i.current?.pause(),[]);let a=async t=>{if(!e.storyboardSound)return null;let{status:n,body:i}=await e.storyboardSound(t.name,t).catch(()=>({status:0,body:{}}));return n===200&&typeof i.file==`string`?i.file:(z.error(r(`storyboard.edSoundFailed`,{error:String(i.error??n)})),null)};return{preview:e=>{let n=i.current;if(n?.pause(),n?.dataset.file===e){i.current=null;return}let r=new Audio(t+e);r.dataset.file=e,i.current=r,r.play().catch(()=>{})},drop:async(e,t,r)=>{if(!n||e!==`music`&&e!==`sfx`)return;let i=r.getData(ft),o=r.files?.[0],s=i||(o?await a(o):null);s&&n.addSound(e,s,t)}}}var mt=new Set;function ht({current:e,cuts:t,onShot:n,script:r,onPreview:i,sounds:a,storyboard:o,timeline:s}){let{t:c}=O(),[l,u]=(0,H.useState)(`shots`),d=[...new Set(o.shots.flatMap(e=>[e.take,e.src].filter(e=>!!e)))],f=[[`script`,c(`storyboard.edScript`)],[`shots`,c(`storyboard.edShots`)],[`media`,c(`storyboard.edMedia`)],[`sound`,c(`storyboard.edSound`)]];return(0,W.jsxs)(`div`,{...k(G.panel,G.left),children:[(0,W.jsx)(`div`,{...k(G.tabs),children:(0,W.jsx)(ie,{block:!0,size:`small`,value:l,variant:`filled`,options:f.map(([e,t])=>({value:e,title:t,label:(0,W.jsx)(`span`,{"data-bin-tab":e,children:t})})),onChange:e=>u(e)})}),(0,W.jsxs)(I,{...k(G.scroll),children:[(0,W.jsxs)(re,{tabIndex:-1,...k(G.scrollViewport),children:[l===`script`?r:null,l===`shots`?(0,W.jsx)(`div`,{style:{padding:6},children:o.shots.map((t,r)=>(0,W.jsxs)(`button`,{"data-bin-shot":t.id,type:`button`,onClick:()=>n(r),...k(G.row,r===e&&G.rowOn),children:[(0,W.jsx)(`span`,{...k(G.chip),children:r+1}),(0,W.jsx)(`span`,{...k(G.rowName),children:t.title}),(0,W.jsx)(`span`,{...k(G.chip),children:c(`storyboard.ed${{card:`Card`,frame:`Page`,take:`Take`}[_(t,mt)]}`)}),(0,W.jsx)(`span`,{...k(G.chip),children:p(s.shots[r].end-s.shots[r].start)})]},t.id))}):null,l===`media`?(0,W.jsx)(`div`,{style:{padding:6},children:d.map(e=>(0,W.jsxs)(`div`,{...k(G.row),children:[e.startsWith(`takes/`)?(0,W.jsx)(ae,{size:13}):(0,W.jsx)(L,{size:13}),(0,W.jsx)(`span`,{...k(G.rowName),children:e})]},e))}):null,l===`sound`?(0,W.jsxs)(`div`,{style:{padding:6},children:[a.length===0?(0,W.jsx)(`div`,{...k(G.hint),children:c(`storyboard.edNoSound`)}):null,a.map(e=>(0,W.jsxs)(`div`,{draggable:!0,"data-bin-sound":e.file,onDragStart:t=>{t.dataTransfer.setData(ft,e.file),t.dataTransfer.effectAllowed=`copy`},...k(G.row),children:[(0,W.jsx)(M,{icon:R,size:`small`,title:c(`storyboard.edPreviewSound`),onClick:()=>i?.(e.file)}),(0,W.jsx)(`span`,{...k(G.rowName),children:e.file.replace(/^sound\//,``)}),e.bytes===void 0?null:(0,W.jsx)(`span`,{...k(G.chip),children:`${Math.max(1,Math.round(e.bytes/1024))} KB`})]},e.file))]}):null]}),(0,W.jsx)(N,{children:(0,W.jsx)(P,{})})]}),t.length?(0,W.jsx)(`div`,{...k(G.binFoot),children:t.map(e=>(0,W.jsxs)(`div`,{...k(G.row),children:[(0,W.jsx)(L,{size:13}),(0,W.jsx)(`span`,{...k(G.rowName),children:c(`storyboard.cutNumber`,{n:e.n})})]},e.n))}):null]})}var gt=[{kind:`captions`,code:`C1`},{kind:`overlay`,code:`V2`},{kind:`picture`,code:`V1`},{kind:`voice`,code:`A1`},{kind:`music`,code:`A2`},{kind:`sfx`,code:`A3`}],_t=e=>`${e.track}:${e.id}`,vt=.5,yt=new Set;function bt(e,t,n={}){let r=new Map(e.shots.flatMap(e=>e.lines.map(e=>[e.id,e.caption]))),i=e.shots.map((e,n)=>({track:`picture`,id:e.id,shot:e.id,start:t.shots[n].start,end:t.shots[n].end,label:`${n+1} ${e.title}`,picture:_(e,yt)})),a=t.lines.flatMap(e=>[{track:`captions`,id:e.id,shot:e.shot,start:e.start,end:e.end,label:r.get(e.id)??``},{track:`voice`,id:e.id,shot:e.shot,start:e.start,end:e.end,label:``}]),o=e.shots.flatMap((e,r)=>{if(_(e,yt)!==`frame`)return[];let i=t.shots[r],a=e.speed>0?e.speed:1;return(n[e.id]??[]).flatMap(t=>{let n=i.start+(t.start-e.srcIn)/a,r=t.end===null?i.end:i.start+(t.end-e.srcIn)/a;return r<=i.start||n>=i.end?[]:[{track:`overlay`,id:`${e.id}#${t.index}`,shot:e.id,index:t.index,start:Math.max(n,i.start),end:Math.min(r,i.end),label:t.kind}]})}),c=E(e).map(e=>({track:`music`,id:e.id,start:e.start,end:e.end??t.total,label:e.src.replace(/^sound\//,``)})),l=s(e,t).map(e=>({track:`sfx`,id:e.id,shot:e.shot,start:e.start,end:e.start+vt,label:e.src.replace(/^sound\//,``)}));return[...i,...a,...o,...c,...l]}function xt({initial:e,label:t,onCancel:n,onChange:r,onSubmit:i}){let{t:a}=O();return(0,W.jsxs)(`div`,{"data-comment-draft":``,...k(U.draft),children:[(0,W.jsx)(`div`,{...k(U.draftLabel),children:t}),(0,W.jsx)(ce,{autoFocus:!0,initial:e,placeholder:a(`storyboard.commentPlaceholder`),onCancel:n,onChange:r,onSubmit:async e=>{let t=await i(e);return t&&n(),t}})]})}var St=340,K=8;function Ct(e){return e.place===`player`?`player`:e.anchor.line?`line:${e.anchor.line}`:`shot:${e.anchor.shot}`}function wt(e){if(e===`player`)return document.querySelector(`[data-comment-moment]`);let[t,n]=e.split(`:`);return document.querySelector(t===`line`?`[data-line="${n}"]`:`[role="list"] [data-shot="${n}"]`)}function Tt(e){let t=wt(e)?.getBoundingClientRect(),n=window.innerWidth-St-K;return t?e===`player`?{left:Math.max(K,Math.min(n,t.right-St)),bottom:window.innerHeight-t.top+K}:{left:Math.max(K,Math.min(n,t.right+K)),top:Math.max(K,Math.min(window.innerHeight-180,t.top))}:{left:K,top:K}}function Et({draft:e,memory:t,onCancel:n,onSubmit:r}){let i=Ct(e),a=(0,H.useRef)(null),[o,s]=(0,H.useState)(()=>Tt(i));(0,H.useLayoutEffect)(()=>{let e=()=>s(Tt(i));return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[i]);let c=e.place===`player`;return(0,H.useEffect)(()=>{let e=e=>{let t=e.target;a.current?.contains(t)||c&&t.closest?.(`[data-player]`)||n()};return document.addEventListener(`pointerdown`,e,!0),()=>document.removeEventListener(`pointerdown`,e,!0)},[c,n]),(0,W.jsx)(`div`,{"data-comment-popover":i,ref:a,style:o,className:`xixxii4 x68pp3s xj6ak53 xur7f20 x1gah8l2 xi1bcxy x1shwlz2 xatqbsq x1u6ievf`,children:(0,W.jsx)(xt,{initial:t.get(i),label:e.label,onCancel:n,onChange:e=>t.set(i,e),onSubmit:e=>r(e).then(e=>(e&&t.delete(i),e))},i)})}function Dt(e,t,n){return[...n?.byShot.values()??[]].flat().flatMap(n=>{let r=t.shots[e.shots.findIndex(e=>e.id===n.anchor.shot)];return!r||n.anchor.cut!==void 0?[]:[{id:n.id,time:r.start+(n.anchor.t??0),agent:n.messages[0]?.author===`agent`}]})}function Ot(e,t=[]){let n=new Map(t.map(e=>[e.file,e])),r=[...e.music.map(e=>e.src),...e.shots.flatMap(e=>e.sfx.map(e=>e.src))];for(let e of r)n.has(e)||n.set(e,{file:e});return[...n.values()]}var kt=(e,t)=>t.shots.map(t=>({track:`picture`,id:t.id,shot:t.id,start:t.start,end:t.end,label:e.shots.find(e=>e.id===t.id)?.title??t.id})),At=(e={})=>Object.fromEntries(Object.entries(e).map(([e,t])=>[e,t.items])),jt=(e,t)=>!!(e?.target&&e.target!==`invalid`&&t&&(t.total<e.target.min||t.total>e.target.max));function Mt({actions:e,dense:t,heading:n,onJump:r,orphan:i,threads:a}){let{t:o}=O(),[s,c]=(0,H.useState)(null);return a.length?(0,W.jsxs)(`div`,{"data-orphan-threads":i?``:void 0,children:[n?(0,W.jsx)(`div`,{...k(U.heading),children:n}):null,(0,W.jsx)(`div`,{...k(U.threads,t&&U.threadsDense),children:a.map(t=>{let n=[i?o(`storyboard.shotDeleted`):null,t.anchor.cut?o(`storyboard.cutNumber`,{n:t.anchor.cut}):null,t.anchor.t===void 0?null:f(t.anchor.t),t.anchor.line?o(`storyboard.onLine`):null,t.anchor.mark?o(`storyboard.marked`):null].filter(e=>!!e);if(s===t.id)return(0,W.jsx)(`div`,{"data-thread":t.id,...k(U.card,U.open),children:(0,W.jsx)(se,{actions:e,label:n.join(` · `),thread:t})},t.id);let a=t.messages.filter(e=>!e.deleted);return(0,W.jsxs)(`div`,{"data-thread":t.id,role:`button`,tabIndex:0,onClick:()=>{c(t.id),i||r(t)},onKeyDown:e=>{e.key===`Enter`&&(c(t.id),i||r(t))},...k(U.card,t.status===`resolved`&&U.resolved),children:[(0,W.jsxs)(`div`,{...k(U.meta),children:[n.map(e=>(0,W.jsx)(`span`,{...k(U.chip),children:e},e)),a.length>1?(0,W.jsx)(`span`,{children:o(`storyboard.replies`,{count:a.length-1})}):null]}),(0,W.jsx)(`div`,{...k(U.text),children:a[0]?.text})]},t.id)})})]}):null}var Nt={box:{kVAEAm:`x10l6tqk`,k87sOh:`x1qqtqlb`,kCIrl2:`x3m8u43`,kY2c9j:`x1355qak`,kzqmXN:`xwl9fdd`,kskxy:`x12f24lm`,kORKVm:`x1odjw0f`,kGO01o:`x10b6aqq`,kaIpWk:`x1q4ynmn`,kGVxlE:`x1vdxzzn`,$$css:!0}};function Pt({comments:e,onSeek:t,storyboard:n,timeline:r}){let{t:i}=O(),[a,o]=(0,H.useState)(!1),s=(0,H.useRef)(null);(0,H.useEffect)(()=>{if(!a)return;let e=e=>{s.current?.contains(e.target)||o(!1)},t=e=>{e.key===`Escape`&&o(!1)};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[a]);let c=n?.shots??[],l=[...e?.byShot.values()??[]].reduce((e,t)=>e+t.length,0)+(e?.orphans.length??0),u=e=>{let n=r?.shots[c.findIndex(t=>t.id===e.anchor.shot)];n&&t(n.start+(e.anchor.cut===void 0?e.anchor.t??0:0))};return(0,W.jsxs)(`span`,{ref:s,className:`x1n2onr6 x3nfvp2`,children:[(0,W.jsxs)(`button`,{"aria-expanded":a,"aria-label":i(`storyboard.edComments`),"data-comments-menu":``,disabled:!e,type:`button`,onClick:()=>o(e=>!e),...k(G.tool,a&&G.toolOn),children:[(0,W.jsx)(le,{size:14}),l]}),a&&e?(0,W.jsxs)(`div`,{"data-comments-list":``,...k(Nt.box,G.panelBg),children:[l?null:(0,W.jsx)(`div`,{...k(G.hint),children:i(`storyboard.edNoComments`)}),c.map((t,n)=>(0,W.jsx)(Mt,{dense:!0,actions:e.actions,heading:`${n+1} · ${t.title}`,threads:e.byShot.get(t.id)??[],onJump:u},t.id)),(0,W.jsx)(Mt,{dense:!0,orphan:!0,actions:e.actions,heading:i(`storyboard.shotDeleted`),threads:e.orphans,onJump:u})]}):null]})}var Ft={box:{kVAEAm:`x10l6tqk`,k87sOh:`x1qqtqlb`,kCIrl2:`x3m8u43`,kY2c9j:`x1355qak`,kzqmXN:`x1dz1jew`,kmVPX3:`xc7ga6q`,kaIpWk:`x1q4ynmn`,kGVxlE:`x1vdxzzn`,kGuDYH:`x1ct8sxb`,kLWn49:`x1jjo3f5`,$$css:!0}};function It({cards:e,feed:t,latest:n,pending:r,status:i}){let{t:a}=O(),[o,s]=(0,H.useState)(!1),c=t.storyboardExport,l=i?.state===`running`,u=l?i.n:(n??0)+1,d=async()=>{s(!1);let e=await c?.(`POST`).catch(()=>({status:0,body:{}}));e&&(e.status<200||e.status>=300)&&z.error(a(`storyboard.edExportFailed`,{error:String(e.body.error??e.status)}))};return(0,W.jsxs)(`span`,{className:`x1n2onr6 x3nfvp2 x6s0dn4 x17d4w8g`,children:[i?.state===`failed`?(0,W.jsx)(`span`,{"data-export-error":``,title:i.error,className:`x1va8c73 xb3r6kr xlyipyv xuxw1ft x12rwjr2 xfifm61`,children:a(`storyboard.edExportFailed`,{error:i.error??``})}):null,(0,W.jsxs)(`button`,{"data-export":``,disabled:!c||l,type:`button`,onClick:()=>s(e=>!e),...k(G.tool,G.toolOn),children:[(0,W.jsx)(ue,{size:13}),l?a(`storyboard.edExporting`,{n:u,percent:Math.round(i.progress*100)}):a(`storyboard.edExport`,{n:u})]}),l?(0,W.jsx)(`button`,{"aria-label":a(`storyboard.edExportCancel`),"data-export-cancel":``,type:`button`,onClick:()=>void c?.(`DELETE`),...k(G.tool),children:(0,W.jsx)(de,{size:13})}):null,o&&!l?(0,W.jsxs)(`div`,{"data-export-panel":``,...k(Ft.box,G.panelBg),children:[(0,W.jsx)(`div`,{style:{fontWeight:600,marginBottom:6},children:a(`storyboard.edExport`,{n:u})}),e?(0,W.jsx)(`div`,{children:a(`storyboard.edExportCards`,{count:e})}):null,r?(0,W.jsx)(`div`,{children:a(`storyboard.edExportVoice`,{count:r})}):null,!e&&!r?(0,W.jsx)(`div`,{children:a(`storyboard.edExportReady`)}):null,(0,W.jsxs)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,gap:6,marginTop:10},children:[(0,W.jsx)(`button`,{type:`button`,onClick:()=>s(!1),...k(G.tool),children:a(`storyboard.edCancel`)}),(0,W.jsx)(`button`,{"data-export-go":``,type:`button`,onClick:()=>void d(),...k(G.tool,G.toolOn),children:a(`storyboard.edExportGo`)})]})]}):null]})}var Lt={box:{kVAEAm:`x10l6tqk`,k87sOh:`x1qqtqlb`,kCIrl2:`x3m8u43`,kY2c9j:`x1355qak`,kzqmXN:`xdzyupr`,kmVPX3:`x1ruevkc`,kaIpWk:`x1q4ynmn`,kGVxlE:`x1vdxzzn`,$$css:!0}};function Rt({cuts:e,versions:t}){let{t:i}=O(),[a,o]=(0,H.useState)(!1),{viewing:s}=t,c=e=>{t.view(e),o(!1)};return(0,W.jsxs)(`span`,{className:`x1n2onr6 x3nfvp2 x6s0dn4 x17d4w8g`,children:[s?(0,W.jsxs)(`span`,{"data-viewing":``,className:`xfifm61 x29mykp`,children:[i(`storyboard.edViewing`,{n:s.n}),` · `,(0,W.jsx)(`button`,{"data-back":``,type:`button`,onClick:()=>c(null),...k(G.tool),children:i(`storyboard.edBackToTimeline`)})]}):null,(0,W.jsxs)(`button`,{"data-versions":``,type:`button`,onClick:()=>o(e=>!e),...k(G.tool),children:[(0,W.jsx)(r,{size:14}),s?i(`storyboard.cutNumber`,{n:s.n}):i(`storyboard.edTimeline`)]}),a?(0,W.jsxs)(`div`,{role:`menu`,...k(Lt.box,G.panelBg),children:[(0,W.jsxs)(`button`,{"aria-checked":!s,"data-version":`timeline`,role:`menuitemradio`,type:`button`,onClick:()=>c(null),...k(G.row,!s&&G.rowOn),children:[(0,W.jsx)(`span`,{...k(G.rowName),children:i(`storyboard.edTimeline`)}),t.changedNow!==null&&t.latest?(0,W.jsx)(`span`,{...k(G.chip),children:i(`storyboard.edChanged`,{count:t.changedNow,n:t.latest.n})}):null]}),[...e].reverse().map(e=>(0,W.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`},children:[(0,W.jsx)(`button`,{"aria-checked":s?.n===e.n,"data-version":String(e.n),role:`menuitemradio`,type:`button`,onClick:()=>c(e.n),...k(G.row,s?.n===e.n&&G.rowOn),children:(0,W.jsx)(`span`,{...k(G.rowName),children:i(`storyboard.cutNumber`,{n:e.n})})}),(0,W.jsx)(`button`,{"aria-label":i(`storyboard.edCompareWith`,{n:e.n}),"aria-pressed":t.compare?.n===e.n,"data-compare":String(e.n),disabled:!e.hashes,type:`button`,title:e.hashes?i(`storyboard.edCompareWith`,{n:e.n}):i(`storyboard.edNoHashes`),onClick:()=>t.toggleCompare(e.n),...k(G.tool,t.compare?.n===e.n&&G.toolOn),children:(0,W.jsx)(ze,{size:13})}),(0,W.jsx)(`button`,{"aria-label":i(`storyboard.edSideBySide`,{n:e.n}),"aria-pressed":t.side?.n===e.n,"data-side":String(e.n),disabled:!!s,type:`button`,onClick:()=>{t.toggleSide(e.n),o(!1)},...k(G.tool,t.side?.n===e.n&&G.toolOn),children:(0,W.jsx)(n,{size:13})})]},e.n))]}):null]})}function zt({actions:e,comments:t,cuts:n,feed:r,onSeek:i,pending:a,status:o,storyboard:s,timeline:c,title:l,versions:u}){let{t:p}=O(),m=n.at(-1)?.n??null;return(0,W.jsxs)(`div`,{...k(d.header),children:[(0,W.jsx)(`span`,{...k(d.title),children:l}),(0,W.jsxs)(`span`,{"data-total":``,...k(d.total,jt(s,c)&&d.over),children:[p(`storyboard.shots`,{count:s?.shots.length??0}),` ·`,` `,f(c?.total??0),` · `,s?.aspect??`16:9`]}),(0,W.jsx)(`span`,{...k(G.spacer)}),(0,W.jsx)(Pt,{comments:t,storyboard:s,timeline:c,onSeek:i}),(0,W.jsx)(Rt,{cuts:n,versions:u}),(0,W.jsx)(It,{cards:s?.shots.filter(e=>!e.src&&!e.take).length??0,feed:r,latest:m,pending:a,status:o}),e]})}var Bt=(e,t,n,r)=>{let i=Number(globalThis.localStorage?.getItem(e));return Number.isFinite(i)&&i>=t&&i<=n?i:r};function Vt({children:e,initial:t,max:n,min:r,placement:i,storageKey:a}){return(0,W.jsx)(fe,{showHandleWideArea:!0,defaultSize:{width:Bt(a,r,n,t)},expandable:!1,maxWidth:n,minWidth:r,mode:`fixed`,placement:i,showBorder:!1,onSizeChange:(e,t)=>{typeof t?.width==`number`&&globalThis.localStorage?.setItem(a,String(Math.round(t.width)))},children:e})}function Ht({label:e,marker:t,max:n,min:r,onCommit:i,step:a,style:o,suffix:s,value:c}){let[l,u]=(0,H.useState)(void 0),d=()=>{l!==void 0&&l!==(c??null)&&i(l),u(void 0)};return(0,W.jsx)(me,{...t,"aria-label":e,controls:!1,max:n,min:r,size:`small`,step:a,style:{width:`100%`,...o},suffix:s,value:l===void 0?c??null:l,onBlur:d,onChange:e=>u(e),onPressEnter:d,onKeyDown:e=>{e.key===`Escape`&&u(void 0)}})}var Ut={row:{kAzted:`xe0p6wg`,keoZOQ:`xdj266r`,$$css:!0},heading:{kGuDYH:`x4z9k3i`,k63SB2:`x1s688f`,kMwMTN:`xo2rkog`,$$css:!0},value:{kGuDYH:`xfifm61`,kMwMTN:`xo2rkog`,kcqcaj:`xss6m8b`,kHjlTd:`xj0a0fe`,$$css:!0}};function q({children:e,heading:t,title:n}){return(0,W.jsxs)(`div`,{...k(G.section),children:[n?(0,W.jsx)(`h4`,{...k(G.sectionTitle,t&&Ut.heading),children:n}):null,e]})}function J({children:e,label:t,name:n}){return(0,W.jsxs)(`div`,{...k(V.field,Ut.row),children:[(0,W.jsx)(`span`,{...k(V.fieldLabel),children:t}),(0,W.jsx)(`div`,{"data-field":n,...k(V.fieldControl,Ut.value),children:e})]})}function Y({editable:e,label:t,name:n,onValue:r,step:i,suffix:a,text:o,value:s}){return e?(0,W.jsxs)(`div`,{...k(V.field,Ut.row),children:[(0,W.jsx)(`span`,{...k(V.fieldLabel),children:t}),(0,W.jsx)(`div`,{...k(V.fieldControl),children:(0,W.jsx)(Ht,{label:t,marker:{"data-control":n},step:i,suffix:a,value:s,onCommit:r})})]}):(0,W.jsx)(J,{label:t,name:n,children:o})}var Wt=(e,t)=>Math.abs(e-t)<.001,X=e=>Math.round(e*1e3)/1e3,Gt={track:{kVAEAm:`x1n2onr6`,kUk6DE:`x98rzlu`,k7Eaqz:`x900493`,kZKoxP:`xmix8c7`,kaIpWk:`x12oqio5`,$$css:!0},name:{kzqmXN:`xvni27`,kmuXW:`x2lah0s`,$$css:!0}};function Kt({keys:e,length:t,local:n,onKey:r,onSeek:i,rows:a}){let{t:o}=O(),s=e.filter(e=>Wt(e.at,n)),c=a.filter(t=>e.some(e=>e.prop===t.prop)),l=a.filter(e=>!c.includes(e)),d=Math.max(t,.001);return(0,W.jsxs)(`div`,{...k(G.section),children:[(0,W.jsxs)(`h4`,{...k(G.sectionTitle),style:{display:`flex`,alignItems:`center`},children:[(0,W.jsx)(`span`,{style:{flex:1},children:o(`storyboard.edKeys`)}),l.length?(0,W.jsx)(he,{items:l.map(t=>({key:t.prop,label:t.label,onClick:()=>r(t.prop,X(n),X(u(e,t.prop,n,t.fallback)))})),children:(0,W.jsx)(M,{"data-key-add":``,icon:xe,size:`small`,title:o(`storyboard.edAddKey`)})}):null]}),c.map(t=>{let a=e.filter(e=>e.prop===t.prop),s=a.find(e=>Wt(e.at,n)),c=u(e,t.prop,n,t.fallback);return(0,W.jsxs)(`div`,{className:`x78zum5 x6s0dn4 x17d4w8g x21xpn4`,children:[(0,W.jsx)(M,{active:!!s,"aria-pressed":!!s,"data-key-toggle":t.prop,icon:_e,size:`small`,title:o(`storyboard.edKeyToggle`,{prop:t.label}),onClick:()=>r(t.prop,X(n),s?null:X(c))}),(0,W.jsx)(`span`,{...k(V.fieldLabel,Gt.name),children:t.label}),(0,W.jsx)(`div`,{className:`xni59qk x2lah0s`,children:(0,W.jsx)(Ht,{label:t.label,marker:{"data-key-value":t.prop},step:t.step,value:X(c),onCommit:e=>{e!==null&&r(t.prop,X(n),e,s&&s.ease!==`linear`?s.ease:void 0)}})}),(0,W.jsxs)(`span`,{...k(G.chip,Gt.track),children:[a.map(e=>(0,W.jsx)(`button`,{"aria-label":`${t.label} ${e.at}s`,"data-key":`${e.prop}@${e.at}`,type:`button`,style:{left:`calc(${e.at/d*100}% - 5px)`,borderColor:ut,background:Wt(e.at,n)?ut:`transparent`},onClick:()=>i(e.at),className:`x10l6tqk xndqk7f x1wc42o8 xegnrdp x1717udv xvndefy x1y0btm7 x1158fpu x1ypdohk`},e.at)),(0,W.jsx)(`span`,{style:{left:`${n/d*100}%`,borderLeftColor:ut},className:`x10l6tqk x1qiirwl x1t1qrwb xaqn3yn x19ypqd9`})]})]},t.prop)}),s.length?(0,W.jsxs)(`div`,{...k(V.field),style:{minHeight:32},children:[(0,W.jsx)(`span`,{...k(V.fieldLabel),children:o(`storyboard.edEase`)}),(0,W.jsx)(`div`,{"data-key-ease":``,...k(V.fieldControl),children:(0,W.jsx)(ge,{size:`small`,style:{width:`100%`},value:s[0]?.ease??`linear`,options:D.map(e=>({value:e,label:o(`storyboard.edEase_${e.replace(`-`,``)}`)})),onChange:e=>{if(typeof e==`string`)for(let t of s)r(t.prop,t.at,t.value,e)}})})]}):null]})}var qt={card:`storyboard.edCard`,frame:`storyboard.edPage`,take:`storyboard.edTake`},Jt={cut:`storyboard.edCut`,dissolve:`storyboard.edDissolve`,black:`storyboard.edBlack`},Yt=new Set,Xt=e=>e===void 0?`—`:`${e>0?`+`:``}${e} dB`,Zt=(e,t,n)=>r=>e?.send([{op:`attr`,target:t,name:n,value:r}]),Qt=(e,t)=>(n,r,i,a)=>e?.send([{op:`key`,owner:t,prop:n,at:r,value:i,...a?{ease:a}:{}}]);function $t({clip:e,edit:t,storyboard:n,timeline:r}){let{t:i}=O(),a=n.shots.findIndex(t=>t.id===e.id),o=n.shots[a],s=r.shots[a];if(!o||!s)return null;let c=_(o,Yt),l=n.shots[a+1],u={kind:`shot`,id:o.id},d=!!t,f=(e,t)=>!e||e===`cut`?i(Jt.cut):`${i(Jt[e]??Jt.cut)} · ${t}s`,p=[{prop:`x`,label:i(`storyboard.edKeyX`),fallback:0,step:10},{prop:`y`,label:i(`storyboard.edKeyY`),fallback:0,step:10},{prop:`scale`,label:i(`storyboard.edKeyScale`),fallback:1,step:.01},{prop:`opacity`,label:i(`storyboard.edKeyOpacity`),fallback:1,step:.05},...o.take?[{prop:`gain`,label:i(`storyboard.edGain`),fallback:o.gain??0,step:1}]:[]];return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(q,{heading:!0,title:`${a+1} · ${o.title}`,children:(0,W.jsxs)(J,{label:i(`storyboard.edSource`),name:`source`,children:[i(qt[c]),c===`frame`?` · ${o.src}`:c===`take`?` · ${o.take}`:``]})}),(0,W.jsxs)(q,{title:i(`storyboard.edTime`),children:[(0,W.jsx)(J,{label:i(`storyboard.edIn`),name:`in`,children:v(s.start)}),(0,W.jsx)(J,{label:i(`storyboard.edOut`),name:`out`,children:v(s.end)}),(0,W.jsx)(J,{label:i(`storyboard.edLength`),name:`dur`,children:`${o.dur}s`}),(0,W.jsx)(Y,{editable:d,label:i(`storyboard.edSpeed`),name:`speed`,step:.25,text:`${o.speed}×`,value:o.speed,onValue:e=>Zt(t,u,`speed`)(e===1?null:e)})]}),(0,W.jsxs)(q,{title:i(`storyboard.edTransitions`),children:[(0,W.jsx)(J,{label:i(`storyboard.edTransitionIn`),name:`transition-in`,children:f(a>0?o.transition:void 0,o.transitionDur)}),(0,W.jsx)(J,{label:i(`storyboard.edTransitionOut`),name:`transition-out`,children:f(l?.transition,l?.transitionDur)})]}),c===`take`?(0,W.jsx)(q,{title:i(`storyboard.edSound`),children:(0,W.jsx)(Y,{editable:d,label:i(`storyboard.edGain`),name:`gain`,step:1,suffix:`dB`,text:o.gain===void 0?i(`storyboard.edMuted`):Xt(o.gain),value:o.gain,onValue:Zt(t,u,`gain`)})}):null,o.actions.length?(0,W.jsx)(q,{title:i(`storyboard.edActions`),children:(0,W.jsx)(`ul`,{style:{margin:0,paddingLeft:16,fontSize:12},children:o.actions.map((e,t)=>(0,W.jsx)(`li`,{children:e},t))})}):null,t?(0,W.jsx)(Kt,{keys:o.keys,length:o.dur,local:Math.min(Math.max(0,t.time-s.start),o.dur),rows:p,onKey:Qt(t,u),onSeek:e=>t.onSeek(s.start+e)}):null]})}function en({clip:e,edit:t,storyboard:n}){let{t:r}=O(),i=!!t,a=e.track===`music`?n.music.find(t=>t.id===e.id):void 0,o=e.track===`sfx`?n.shots.flatMap(e=>e.sfx).find(t=>t.id===e.id):void 0,s=e.track===`voice`||e.track===`captions`?n.shots.flatMap(e=>e.lines).find(t=>t.id===e.id):void 0,c=a??o,l=a?{kind:`music`,id:a.id}:o?{kind:`sfx`,id:o.id}:s?{kind:`line`,id:s.id}:null,u=e=>n=>l?Zt(t,l,e)(n):void 0;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(q,{heading:!0,title:e.label||e.id,children:[c?(0,W.jsx)(J,{label:r(`storyboard.edFile`),name:`file`,children:c.src}):null,s?(0,W.jsx)(J,{label:r(`storyboard.edLine`),name:`text`,children:s.text}):null,(0,W.jsx)(J,{label:r(`storyboard.edStart`),name:`start`,children:v(e.start)}),(0,W.jsx)(Y,{editable:i&&!!l,label:r(`storyboard.edGain`),name:`gain`,step:1,suffix:`dB`,text:Xt(c?.gain??s?.gain??0),value:c?.gain??s?.gain,onValue:u(`gain`)}),c?(0,W.jsx)(Y,{editable:i,label:r(`storyboard.edFadeIn`),name:`fade-in`,step:.1,suffix:`s`,text:`${c.fadeIn}s`,value:c.fadeIn,onValue:u(`fade-in`)}):null,c?(0,W.jsx)(Y,{editable:i&&!!a,label:r(`storyboard.edFadeOut`),name:`fade-out`,step:.1,suffix:`s`,text:`${c.fadeOut}s`,value:c.fadeOut,onValue:u(`fade-out`)}):null,a?(0,W.jsx)(Y,{editable:i,label:r(`storyboard.edDuck`),name:`duck`,step:1,suffix:`dB`,text:Xt(a.duck),value:a.duck,onValue:u(`duck`)}):null]}),t&&a?(0,W.jsx)(Kt,{keys:a.keys,length:e.end-e.start,local:Math.max(0,t.time-a.at),rows:[{prop:`gain`,label:r(`storyboard.edGain`),fallback:a.gain,step:1}],onKey:Qt(t,{kind:`music`,id:a.id}),onSeek:e=>t.onSeek(a.at+e)}):null]})}function tn({clip:e,edit:t,storyboard:n,timeline:r}){let{t:i}=O();return(0,W.jsxs)(`div`,{"data-inspector":``,...k(G.panel,G.right),children:[(0,W.jsx)(`div`,{...k(G.tabs),children:(0,W.jsxs)(`span`,{...k(G.panelTitle),children:[(0,W.jsx)(pe,{size:13}),i(`storyboard.edInspector`)]})}),(0,W.jsxs)(I,{...k(G.scroll),children:[(0,W.jsx)(re,{tabIndex:-1,...k(G.scrollViewport),children:e?e.track===`picture`?(0,W.jsx)($t,{clip:e,edit:t,storyboard:n,timeline:r}):(0,W.jsx)(en,{clip:e,edit:t,storyboard:n}):(0,W.jsx)(`div`,{...k(G.hint),children:i(`storyboard.edNothing`)})}),(0,W.jsx)(N,{children:(0,W.jsx)(P,{})})]})]})}var nn=(e,t)=>{let[n,r]=l(e);return{width:`min(100%, calc((${t}) * ${n} / ${r}))`,aspectRatio:`${n} / ${r}`}};function rn({captions:e,clock:t,compare:n,cut:r,muted:i,onCaptions:a,onComment:o,onMute:s,overlay:c,picture:u,stage:d,storyboard:f,timeline:p}){let{t:h}=O(),_=(0,H.useRef)(null),[v,S]=(0,H.useState)(0),C=l(f.aspect)[0];(0,H.useEffect)(()=>{let e=_.current;if(!e)return;let t=()=>S(e.clientWidth/C);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[C]);let w=e?x(p.lines,t.time):null,T=w?f.shots.flatMap(e=>e.lines).find(e=>e.id===w.id)?.caption:void 0,E=e=>{t.pause(),t.seek(t.time+e/30)},D=p.shots.find(e=>t.time<e.end)??p.shots.at(-1),A=f.shots.findIndex(e=>e.id===D?.id);return(0,W.jsxs)(`div`,{"data-viewer":``,...k(G.panel,G.viewer),children:[(0,W.jsx)(`div`,{...k(G.tabs),children:A>=0?(0,W.jsxs)(`span`,{"data-viewer-title":``,...k(G.viewerTitle),children:[(0,W.jsxs)(`span`,{...k(G.viewerIndex),children:[A+1,` · `]}),f.shots[A].title]}):null}),(0,W.jsxs)(`div`,{...k(G.monitor),children:[(0,W.jsxs)(`div`,{"data-player":``,ref:_,style:nn(f.aspect,n?`50cqh - 40px`:`100cqh - 44px`),...k(G.stage),onClick:()=>{c||t.toggle()},children:[r?(0,W.jsx)(g,{active:!0,audible:!i,marker:`cut`,playing:t.playing,seeks:t.seeks,src:r.src,start:0,time:t.time,onLength:r.onLength,onTime:t.follow}):d??(0,W.jsx)(y,{...u,muted:i,playing:t.playing,scale:v,seeks:t.seeks,storyboard:f,time:t.time,timeline:p}),T&&!d&&!r?(0,W.jsx)(`div`,{"data-caption":``,...k(b.caption),children:T}):null,c]}),n?(0,W.jsxs)(`div`,{"data-compare-stage":``,style:{display:`flex`,flexDirection:`column`,alignItems:`center`,gap:4,width:`100%`,minHeight:0},children:[(0,W.jsx)(`span`,{...k(G.timecode,G.timecodeDim),children:n.label}),(0,W.jsx)(`div`,{style:nn(f.aspect,`50cqh - 40px`),...k(G.stage),children:(0,W.jsx)(g,{active:!0,marker:`compare`,playing:t.playing,seeks:t.seeks,src:n.src,start:0,time:n.time})})]}):null,(0,W.jsxs)(`div`,{...k(G.transport),children:[(0,W.jsx)(`span`,{"data-timecode":``,...k(G.timecode,G.transportStart),children:m(t.time)}),(0,W.jsxs)(`div`,{"data-transport-center":``,...k(G.transportGroup),children:[(0,W.jsx)(`button`,{"aria-label":h(`storyboard.edToStart`),type:`button`,onClick:()=>t.seek(0),...k(G.tool),children:(0,W.jsx)(Ze,{size:14})}),(0,W.jsx)(`button`,{"aria-label":h(`storyboard.edPrevFrame`),type:`button`,onClick:()=>E(-1),...k(G.tool),children:(0,W.jsx)(tt,{size:14})}),(0,W.jsx)(`button`,{"aria-label":t.playing?h(`storyboard.pause`):h(`storyboard.play`),"data-play":``,type:`button`,onClick:t.toggle,...k(G.play),children:(0,W.jsx)(Ce,{playing:t.playing,size:14})}),(0,W.jsx)(`button`,{"aria-label":h(`storyboard.edNextFrame`),type:`button`,onClick:()=>E(1),...k(G.tool),children:(0,W.jsx)(rt,{size:14})}),(0,W.jsx)(`button`,{"aria-label":h(`storyboard.edToEnd`),type:`button`,onClick:()=>t.seek(p.total),...k(G.tool),children:(0,W.jsx)($e,{size:14})})]}),(0,W.jsxs)(`div`,{...k(G.transportGroup,G.transportEnd),children:[o?(0,W.jsx)(`button`,{"aria-label":h(`storyboard.commentMoment`),"data-comment-moment":``,type:`button`,onClick:o,...k(G.tool),children:(0,W.jsx)(Ue,{size:15})}):null,(0,W.jsx)(`button`,{"aria-label":h(`storyboard.mute`),"aria-pressed":i,type:`button`,onClick:s,...k(G.tool),children:i?(0,W.jsx)(st,{size:15}):(0,W.jsx)(at,{size:15})}),(0,W.jsx)(`button`,{"aria-label":h(`storyboard.captions`),"aria-pressed":e,"data-monitor-captions":``,type:`button`,onClick:a,...k(G.tool),children:e?(0,W.jsx)(Le,{size:15}):(0,W.jsx)(Fe,{size:15})}),(0,W.jsx)(`button`,{"aria-label":h(`storyboard.fullscreen`),type:`button`,onClick:()=>void _.current?.requestFullscreen?.(),...k(G.tool),children:(0,W.jsx)(Se,{size:14})}),(0,W.jsx)(`span`,{...k(G.timecode,G.timecodeDim),children:m(p.total)})]})]})]})]})}j.colorBorderSecondary;var Z={editable:{kaIpWk:`x18zih8k`,kkrTdU:`x1ed109x`,kI3sdo:`x1a2a7pz`,kWkggS:`xjbqb8w xj0l527 x1pv8c5z`,$$css:!0},dur:{kkrTdU:`x7eptgl`,kfSwDN:`x87ps6o`,kFalU9:`x5ve5x3`,$$css:!0},handle:{kkrTdU:`x1jm3nie`,$$css:!0},dropBefore:{kGVxlE:`x1ptyweu`,$$css:!0},dropAfter:{kGVxlE:`x1epkt1z`,$$css:!0},gap:{kVAEAm:`x1n2onr6`,kZKoxP:`xqtp20y`,kY2c9j:`x1vjfegm`,$$css:!0},add:{kVAEAm:`x10l6tqk`,kbCHJM:`x1nrll8i`,k87sOh:`x122giso`,k1xSpc:`xrvj5dj`,kgQiWS:`x1ku5rj1`,kzqmXN:`x1xp8n7a`,kZKoxP:`xmix8c7`,koQZXg:`x125l10s`,kmVPX3:`x1717udv`,kMzoRj:`xmkeg23`,ksu8eU:`x1y0btm7`,kVAM5u:`x12xov25`,kaIpWk:`x16rqkct`,kWkggS:`x1rozbrz`,kMwMTN:`x1bo0w0s`,kkrTdU:`x1ypdohk`,kSiTet:`xg01cxk x1o7uuvo x25t5g8`,k1ekBW:`x19991ni`,kIyJzY:`xgdialr`,$$css:!0},menuWrap:{kVAEAm:`x1n2onr6`,kUk6DE:`x1okw0bk`,kSGwAc:`xqcrz7y`,$$css:!0},menuButton:{k1xSpc:`xrvj5dj`,kgQiWS:`x1ku5rj1`,kzqmXN:`x17z2i9w`,kZKoxP:`x17rw0jw`,kmVPX3:`x1717udv`,kMzoRj:`xc342km`,kaIpWk:`x1sxf85j`,kWkggS:`xjbqb8w xj0l527`,kMwMTN:`xddlp02`,kkrTdU:`x1ypdohk`,$$css:!0},menu:{kVAEAm:`x10l6tqk`,kCIrl2:`x3m8u43`,k87sOh:`x8l1umf`,kY2c9j:`x1u8a7rm`,k1xSpc:`x78zum5`,kXwgrk:`xdt5ytf`,k7Eaqz:`x1i9suas`,kmVPX3:`xfawy5m`,kMzoRj:`xmkeg23`,ksu8eU:`x1y0btm7`,kVAM5u:`x12xov25`,kaIpWk:`xur7f20`,kWkggS:`x12ilycc`,kGVxlE:`x1xto9b0`,$$css:!0},menuItem:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kOIVth:`x167g77z`,kZKoxP:`x1fgtraw`,kg3NbH:`xdqyycr`,kMzoRj:`xc342km`,kaIpWk:`x1sxf85j`,kWkggS:`xjbqb8w xj0l527`,kMwMTN:`xo2rkog`,kGuDYH:`xfifm61`,k9WMMc:`xdpxx8g`,kkrTdU:`x1ypdohk`,$$css:!0},danger:{kMwMTN:`x12vcgws`,$$css:!0}},an=8,on=.1,sn=e=>Math.max(on,Math.round(e*10)/10);function cn({dur:e,onSave:t}){let{t:n}=O(),[r,i]=(0,H.useState)(null),[a,o]=(0,H.useState)(!1);return t?a?(0,W.jsx)(`span`,{"data-chip":``,"data-dur":``,...k(C.chip),children:(0,W.jsx)(ln,{dur:e,onDone:n=>{o(!1),n!==null&&n!==e&&t(n)}})}):(0,W.jsx)(`span`,{"data-chip":``,"data-dur":``,title:n(`storyboard.editDur`),onClick:e=>e.stopPropagation(),onPointerDown:n=>{n.stopPropagation();let r=n.clientX,a=!1,s=e,c=t=>{let n=Math.round((t.clientX-r)/an);n!==0&&(a=!0),s=sn(e+n*on),i(s)},l=()=>{window.removeEventListener(`pointermove`,c),window.removeEventListener(`pointerup`,l),i(null),a?s!==e&&t(s):o(!0)};window.addEventListener(`pointermove`,c),window.addEventListener(`pointerup`,l)},...k(C.chip,Z.dur),children:p(r??e)}):(0,W.jsx)(`span`,{"data-chip":``,"data-dur":``,...k(C.chip),children:p(e)})}function ln({dur:e,onDone:t}){let[n,r]=(0,H.useState)(String(e)),i=(0,H.useRef)(!1),a=e=>{if(i.current)return;i.current=!0;let n=Number((e??``).trim().replace(/s$/i,``));t(e&&Number.isFinite(n)&&n>0?sn(n):null)};return(0,W.jsx)(we,{autoFocus:!0,inputMode:`decimal`,size:`small`,style:{width:64},value:n,onBlur:()=>a(n),onChange:e=>r(e.target.value),onClick:e=>e.stopPropagation(),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),a(n)):e.key===`Escape`&&a(null)}})}function un({allowEmpty:e,children:t,multiline:n,onSave:r,value:i}){let[a,o]=(0,H.useState)(null),s=(0,H.useRef)(!1);if(!r)return(0,W.jsx)(W.Fragment,{children:t??i});if(a===null)return(0,W.jsx)(`span`,{"data-editable":``,role:`button`,tabIndex:0,onClick:()=>{s.current=!1,o(i)},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),s.current=!1,o(i))},...k(Z.editable),children:t??i});let c=t=>{if(s.current)return;s.current=!0;let n=a.trim();t&&n!==i.trim()&&(n||e)&&r(n),o(null)},l={autoFocus:!0,value:a,onBlur:()=>c(!0),onChange:e=>o(e.target.value),onClick:e=>e.stopPropagation(),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey?(e.preventDefault(),c(!0)):e.key===`Escape`&&(e.preventDefault(),c(!1))}};return n?(0,W.jsx)(oe,{autoSize:{minRows:2},style:{fontStyle:`italic`},...l}):(0,W.jsx)(we,{size:`small`,...l})}function dn({onDelete:e,onDuplicate:t}){let{t:n}=O(),[r,i]=(0,H.useState)(!1),a=(0,H.useRef)(null);(0,H.useEffect)(()=>{if(!r)return;let e=e=>{a.current?.contains(e.target)||i(!1)};return window.addEventListener(`pointerdown`,e),()=>window.removeEventListener(`pointerdown`,e)},[r]);let o=e=>()=>{i(!1),e()};return(0,W.jsxs)(`div`,{ref:a,onClick:e=>e.stopPropagation(),...k(Z.menuWrap),children:[(0,W.jsx)(`button`,{"aria-expanded":r,"aria-label":n(`storyboard.rowMenu`),"data-row-menu":``,type:`button`,onClick:()=>i(e=>!e),...k(Z.menuButton),children:(0,W.jsx)(ke,{size:14})}),r?(0,W.jsxs)(`div`,{role:`menu`,...k(Z.menu),children:[(0,W.jsxs)(`button`,{"data-menu-item":`duplicate`,role:`menuitem`,type:`button`,onClick:o(t),...k(Z.menuItem),children:[(0,W.jsx)(Te,{size:13}),n(`storyboard.duplicate`)]}),(0,W.jsxs)(`button`,{"data-menu-item":`delete`,role:`menuitem`,type:`button`,onClick:o(e),...k(Z.menuItem,Z.danger),children:[(0,W.jsx)(Oe,{size:13}),n(`storyboard.delete`)]})]}):null]})}var fn=e=>{let t=e.currentTarget.getBoundingClientRect();return e.clientY>t.top+t.height/2?`after`:`before`};function pn({aspect:e,current:t,drag:n,edit:r,failures:i,follow:a,index:o,onComment:s,onPreview:c,onSeek:l,pending:u,shot:d,span:p,stacked:m,voiced:h}){let{t:g}=O(),_=(0,H.useRef)(null);(0,H.useEffect)(()=>{t&&a&&_.current?.scrollIntoView?.({block:`nearest`})},[t,a]);let v=(0,W.jsxs)(W.Fragment,{children:[s?(0,W.jsx)(`button`,{"aria-label":g(`storyboard.commentShot`),"data-comment-shot":``,title:g(`storyboard.commentShot`),type:`button`,onClick:e=>{e.stopPropagation(),s()},...k(U.button),children:(0,W.jsx)(Ue,{size:14})}):null,r?(0,W.jsx)(dn,{onDelete:r.onDelete,onDuplicate:r.onDuplicate}):null]});return(0,W.jsxs)(`div`,{"aria-current":t,"aria-label":g(`storyboard.shot`,{number:o+1,title:d.title}),"data-shot":d.id,ref:_,role:`listitem`,tabIndex:-1,onClick:l,onDragOver:n?e=>{e.preventDefault(),n.onDragOver(fn(e))}:void 0,onDrop:n?e=>{e.preventDefault(),n.onDrop(fn(e))}:void 0,...k(C.row,m&&C.stacked,t&&C.current,m&&C.flat,n?.side===`before`&&Z.dropBefore,n?.side===`after`&&Z.dropAfter),children:[(0,W.jsx)(`div`,{"data-drag":n?``:void 0,draggable:!!n,title:n?g(`storyboard.dragShot`):void 0,onDragEnd:n?.onDragEnd,onDragStart:n?e=>{e.dataTransfer?.setData(`text/plain`,d.id),e.dataTransfer&&(e.dataTransfer.effectAllowed=`move`),n.onDragStart()}:void 0,...k(C.number,t&&C.numberOn,n&&Z.handle),children:String(o+1).padStart(2,`0`)}),(0,W.jsxs)(`div`,{...k(C.thumb,m&&C.thumbStacked),children:[(0,W.jsx)(`div`,{style:{aspectRatio:e.replace(`:`,` / `)},...k(b.stage),children:(0,W.jsx)(S,{shot:d})}),(0,W.jsxs)(`div`,{...k(C.chips),children:[(0,W.jsx)(`span`,{"data-chip":``,...k(C.chip),children:f(p.start)}),(0,W.jsx)(cn,{dur:d.dur,onSave:r?.onDur})]})]}),(0,W.jsxs)(`div`,{...k(C.main),children:[(0,W.jsx)(`div`,{"data-title":``,...k(C.title),children:(0,W.jsx)(un,{value:d.title,onSave:r?.onTitle})}),d.actions.length?(0,W.jsx)(`ul`,{...k(C.actions),children:d.actions.map((e,t)=>(0,W.jsx)(`li`,{"data-action":t,children:(0,W.jsx)(un,{allowEmpty:!0,value:e,onSave:r&&(e=>r.onAction(t,e))})},`${t}:${e}`))}):null,d.lines.map(e=>(0,W.jsxs)(`div`,{"data-failed":e.id in i,"data-line":e.id,title:i[e.id],...k(C.line,u.has(e.id)&&C.pending,e.id in i&&C.failed),children:[h.has(e.id)?(0,W.jsx)(`button`,{"aria-label":g(`storyboard.playLine`),type:`button`,onClick:t=>{t.stopPropagation(),c(e.id)},...k(C.linePlay),children:(0,W.jsx)(R,{size:9})}):null,(0,W.jsx)(`span`,{...k(C.lineText),children:(0,W.jsxs)(un,{multiline:!0,value:e.text,onSave:r&&(t=>r.onLine(e.id,t)),children:[`“`,e.text,`”`]})}),s?(0,W.jsx)(`button`,{"aria-label":g(`storyboard.commentLine`),"data-comment-line":``,type:`button`,onClick:t=>{t.stopPropagation(),s(e.id)},...k(U.button),children:(0,W.jsx)(le,{size:11})}):null]},e.id))]}),m?(0,W.jsx)(`span`,{...k(C.tailStacked),children:v}):v]})}function mn({current:e,editing:t,failures:n,follow:r,onComment:i,onPreview:a,onSeek:o,pending:s,storyboard:c,timeline:l,voiced:u}){let{t:d}=O();return(0,W.jsx)(`div`,{role:`list`,children:c.shots.map((f,p)=>(0,W.jsxs)(H.Fragment,{children:[(0,W.jsx)(pn,{stacked:!0,aspect:c.aspect,current:p===e,drag:t?.drag(p),edit:t?.edit(p),failures:n,follow:r,index:p,pending:s,shot:f,span:l.shots[p],voiced:u,onComment:i?.(p),onPreview:e=>a(p,e),onSeek:()=>o(p)}),t?(0,W.jsx)(`div`,{...k(Z.gap),children:(0,W.jsx)(`button`,{"aria-label":d(`storyboard.addShot`),"data-add-after":f.id,type:`button`,onClick:()=>t.add(f.id),...k(Z.add),children:(0,W.jsx)(xe,{size:11})})}):null]},f.id))})}var hn=[{tool:`select`,label:`storyboard.edSelect`,icon:(0,W.jsx)(Ae,{size:13})},{tool:`razor`,label:`storyboard.edRazor`,icon:(0,W.jsx)(Ye,{size:13})},{tool:`slip`,label:`storyboard.edSlip`,icon:(0,W.jsx)(Ge,{size:13})}];function gn({edit:e,onZoom:t,pps:n}){let{t:r}=O(),i=e?.tool??`select`;return(0,W.jsxs)(`div`,{...k(G.toolbar),children:[hn.map(t=>(0,W.jsx)(`button`,{"aria-label":r(t.label),"aria-pressed":i===t.tool,"data-tool":t.tool,disabled:!e,type:`button`,onClick:()=>e?.setTool(t.tool),...k(G.tool,i===t.tool&&G.toolOn),children:t.icon},t.tool)),(0,W.jsx)(`span`,{...k(G.divider)}),(0,W.jsx)(`button`,{"aria-label":r(`storyboard.edSnap`),"aria-pressed":!!e?.snap,disabled:!e,type:`button`,onClick:e?.toggleSnap,...k(G.tool,e?.snap&&G.toolOn),children:(0,W.jsx)(Ve,{size:13})}),(0,W.jsx)(`span`,{...k(G.spacer)}),(0,W.jsx)(`button`,{"aria-label":r(`storyboard.edZoomOut`),type:`button`,onClick:()=>t(Math.max(4,n/1.5)),...k(G.tool),children:(0,W.jsx)(be,{size:13})}),(0,W.jsx)(`button`,{"aria-label":r(`storyboard.edZoomIn`),type:`button`,onClick:()=>t(Math.min(400,n*1.5)),...k(G.tool),children:(0,W.jsx)(ve,{size:13})}),(0,W.jsx)(`button`,{"aria-label":r(`storyboard.edFit`),"data-fit":``,type:`button`,onClick:()=>t(0),...k(G.tool),children:(0,W.jsx)(qe,{size:13})})]})}var _n={captions:`storyboard.edTrackCaptions`,overlay:`storyboard.edTrackOverlay`,picture:`storyboard.edTrackPicture`,voice:`storyboard.edTrackVoice`,music:`storyboard.edTrackMusic`,sfx:`storyboard.edTrackSfx`};function vn({captions:e,code:t,kind:n,locked:r,mute:i,onLock:a}){let{t:o}=O();return(0,W.jsxs)(`div`,{"data-track-head":``,...k(G.head),children:[(0,W.jsx)(`span`,{...k(G.code),children:t}),(0,W.jsx)(`span`,{...k(G.headName),children:o(_n[n])}),e?(0,W.jsx)(`button`,{"aria-label":o(`storyboard.captions`),"aria-pressed":e.on,"data-captions-track":``,type:`button`,onClick:e.toggle,...k(G.tool,G.headTool),children:e.on?(0,W.jsx)(Le,{size:11}):(0,W.jsx)(Fe,{size:11})}):i?(0,W.jsx)(`button`,{"aria-label":o(`storyboard.mute`),"aria-pressed":i.on,"data-mute":n,type:`button`,onClick:i.toggle,...k(G.tool,G.headTool),children:i.on?(0,W.jsx)(st,{size:11}):(0,W.jsx)(at,{size:11})}):(0,W.jsx)(`span`,{}),(0,W.jsx)(`button`,{"aria-label":o(`storyboard.edLock`),"aria-pressed":r,"data-lock":n,type:`button`,onClick:a,...k(G.tool,G.headTool),children:r?(0,W.jsx)(Ee,{size:11}):(0,W.jsx)(ye,{size:11})})]})}function yn({changed:e,children:t,clip:n,onDrag:r,onPick:i,pps:a,selected:o,style:s}){let c=(0,H.useRef)(!1),l=e=>t=>{if(t.button!==0)return;t.stopPropagation();let i=t.clientX,o=t.altKey;c.current=!1;let s=e=>{Math.abs(e.clientX-i)>2&&(c.current=!0)},l=t=>{window.removeEventListener(`pointermove`,s),window.removeEventListener(`pointerup`,l),c.current&&r(n,e,(t.clientX-i)/a,o)};window.addEventListener(`pointermove`,s),window.addEventListener(`pointerup`,l)};return(0,W.jsxs)(`button`,{"aria-pressed":o,"data-changed":e?`true`:void 0,"data-clip":n.id,"data-end":String(n.end),"data-start":String(n.start),style:s,title:n.label,type:`button`,onPointerDown:l(`move`),onClick:e=>{if(c.current){c.current=!1;return}let t=e.currentTarget.getBoundingClientRect();i(n,(e.clientX-t.left)/a)},...k(G.clip,G[n.track],o&&G.selected),children:[t,e?(0,W.jsx)(`span`,{"aria-hidden":`true`,style:{position:`absolute`,top:4,right:8,width:7,height:7,borderRadius:4,background:`#f59e0b`}}):null,n.track===`picture`?(0,W.jsx)(`span`,{"aria-hidden":`true`,"data-trim":``,style:{position:`absolute`,top:18,right:0,bottom:0,width:6,cursor:`ew-resize`},onPointerDown:l(`trim`)}):null]})}var bn=[{kind:`cut`,label:`storyboard.edCut`,icon:(0,W.jsx)(F,{size:13})},{kind:`dissolve`,label:`storyboard.edDissolve`,icon:(0,W.jsx)(Ne,{size:13})},{kind:`black`,label:`storyboard.edBlack`,icon:(0,W.jsx)(De,{size:13})}];function xn({dur:e,kind:t,left:n,onAll:r,onDur:i,onKind:a}){let{t:o}=O(),[s,c]=(0,H.useState)(t);return(0,W.jsxs)(`div`,{"data-transition-menu":``,role:`menu`,style:{left:Math.max(0,n-110)},className:`x10l6tqk x1w7g3bh x1w0boku x16grhtn x1ruevkc x1q4ynmn x12ilycc x1c5gc91 x1ct8sxb`,children:[bn.map(e=>(0,W.jsxs)(`button`,{"aria-checked":s===e.kind,"data-transition":e.kind,role:`menuitemradio`,type:`button`,onClick:()=>{c(e.kind),a(e.kind)},...k(G.row,s===e.kind&&G.rowOn),children:[e.icon,(0,W.jsx)(`span`,{...k(G.rowName),children:o(e.label)})]},e.kind)),(0,W.jsxs)(`div`,{className:`x78zum5 x6s0dn4 x167g77z xtybu7z x1gslohp x178xt8z x13fuv20 xxu5053`,children:[(0,W.jsx)(`span`,{children:o(`storyboard.edLength`)}),(0,W.jsx)(me,{"aria-label":o(`storyboard.edLength`),controls:!1,"data-transition-dur":``,defaultValue:e,min:.1,size:`small`,step:.1,style:{width:64},suffix:`s`,onChange:e=>{e!==null&&Number.isFinite(e)&&e>0&&i(e)}}),(0,W.jsx)(`span`,{...k(G.spacer)}),(0,W.jsx)(ne,{"data-transition-all":``,size:`small`,onClick:()=>r(s),children:o(`storyboard.edAllSeams`)})]})]})}var Sn=4,Cn=400,wn=.008,Tn=3,En=e=>Math.round(e*30)/30,Dn=e=>Math.min(Cn,Math.max(Sn,e)),On=e=>Math.hypot(e[1].clientX-e[0].clientX,e[1].clientY-e[0].clientY);function kn({onRange:e,onSeek:t,pps:n,range:r,total:i}){let a=(0,H.useRef)(!1);(0,H.useEffect)(()=>{if(!r)return;let t=t=>{t.key===`Escape`&&e(null)};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[r,e]);let o=(e,t)=>En(Math.min(Math.max(0,(e-t)/n),i));return{onPointerDown:n=>{if(n.button!==0)return;let r=n.currentTarget.getBoundingClientRect().left,i=n.clientX;a.current=!1;let s=n=>{if(!a.current&&Math.abs(n.clientX-i)<=Tn)return;a.current=!0;let s=o(n.clientX,r),[c,l]=[o(i,r),s].sort((e,t)=>e-t);e(l>c?{in:c,out:l}:null),t(s)},c=()=>{window.removeEventListener(`pointermove`,s),window.removeEventListener(`pointerup`,c)};window.addEventListener(`pointermove`,s),window.addEventListener(`pointerup`,c)},onClick:n=>{a.current?a.current=!1:(e(null),t(o(n.clientX,n.currentTarget.getBoundingClientRect().left)))}}}function An(e,t,n){let r=(0,H.useRef)(t),i=(0,H.useRef)(n);i.current=n;let a=(0,H.useRef)(null);r.current=t,(0,H.useLayoutEffect)(()=>{let n=e.current,r=a.current;n&&r&&(a.current=null,n.scrollLeft=Math.max(0,r.time*t-r.offset))},[e,t]),(0,H.useEffect)(()=>{let t=e.current;if(!t)return;let n=(e,n)=>{let o=Dn(e);if(o===r.current)return;let s=n-t.getBoundingClientRect().left-156;a.current={offset:s,time:(t.scrollLeft+s)/r.current},r.current=o,i.current(o)},o=e=>{(e.ctrlKey||e.metaKey)&&(e.preventDefault(),n(r.current*Math.exp(-e.deltaY*wn),e.clientX))},s=null,c=e=>{s=e.touches.length===2?{gap:On(e.touches),pps:r.current}:null},l=e=>{if(!s||e.touches.length!==2||!s.gap)return;e.preventDefault();let t=(e.touches[0].clientX+e.touches[1].clientX)/2;n(s.pps*On(e.touches)/s.gap,t)},u=e=>{e.touches.length<2&&(s=null)},d=r.current,f=e=>{e.preventDefault(),d=r.current},p=e=>{e.preventDefault();let t=e;n(d*(t.scale??1),t.clientX??0)};return t.addEventListener(`wheel`,o,{passive:!1}),t.addEventListener(`touchstart`,c,{passive:!0}),t.addEventListener(`touchmove`,l,{passive:!1}),t.addEventListener(`touchend`,u),t.addEventListener(`gesturestart`,f),t.addEventListener(`gesturechange`,p),()=>{t.removeEventListener(`wheel`,o),t.removeEventListener(`touchstart`,c),t.removeEventListener(`touchmove`,l),t.removeEventListener(`touchend`,u),t.removeEventListener(`gesturestart`,f),t.removeEventListener(`gesturechange`,p)}},[e])}var jn={captions:26,overlay:30,picture:56,voice:40,music:34,sfx:26},Mn=[1,2,5,10,15,30,60],Nn={voice:`voice`,music:`music`,sfx:`sfx`};function Pn({changed:e,clips:t,dim:n,edit:r,onDropSound:i,onRange:a,lanes:o,markers:s,onSeek:c,onSelect:l,onZoom:u,pps:d,range:p,selected:m,storyboard:h,time:g,total:_}){let{t:v}=O(),[y,b]=(0,H.useState)(null),x=Math.max(_,1)*d,S=Mn.find(e=>e*d>=64)??120,C=Array.from({length:Math.floor(_/S)+1},(e,t)=>t*S),w=(0,H.useRef)(null),T=kn({onRange:a,onSeek:c,pps:d,range:p,total:_});An(w,d,u);let E=(e,t)=>{r?.tool===`razor`?r.razor(e,t):l(e)},D=t.filter(e=>e.track===`picture`&&e.start>0),A=h.shots.find(e=>e.id===y);return(0,W.jsxs)(`div`,{"data-pps":d,"data-timeline":``,...k(G.timeline),children:[(0,W.jsx)(gn,{edit:r,pps:d,onZoom:u}),(0,W.jsx)(`div`,{"data-timeline-tracks":``,ref:w,...k(G.tracks),children:(0,W.jsxs)(`div`,{style:{position:`relative`,width:156+x},children:[(0,W.jsxs)(`div`,{...k(G.track),children:[(0,W.jsx)(`div`,{...k(G.head)}),(0,W.jsxs)(`div`,{"data-ruler":``,style:{width:x},onClick:T.onClick,onPointerDown:T.onPointerDown,...k(G.lane,G.ruler),children:[p?(0,W.jsx)(`div`,{"data-in":String(p.in),"data-out":String(p.out),"data-range":``,style:{left:p.in*d,width:(p.out-p.in)*d},...k(G.range)}):null,C.map(e=>(0,W.jsx)(`div`,{style:{left:e*d},...k(G.tick),children:(0,W.jsx)(`span`,{...k(G.tickLabel),children:f(e)})},e)),s.map(e=>(0,W.jsx)(`div`,{"data-marker":e.id,style:{left:e.time*d,...e.agent?{backgroundColor:dt}:{}},...k(G.marker)},e.id))]})]}),gt.map(a=>{let s=Nn[a.kind];return(0,W.jsxs)(`div`,{"data-track":a.kind,style:{height:jn[a.kind],...n&&a.kind!==`picture`?{opacity:.4}:{}},...k(G.track),children:[(0,W.jsx)(vn,{code:a.code,kind:a.kind,locked:!!r?.locks.has(a.kind),captions:a.kind===`captions`&&r?{on:h.captions,toggle:r.captions}:void 0,mute:s&&r?{on:h.mute.includes(s),toggle:()=>r.mute(s)}:void 0,onLock:()=>r?.toggleLock(a.kind)}),(0,W.jsxs)(`div`,{style:{width:x},onDragOver:e=>{i&&(a.kind===`music`||a.kind===`sfx`)&&e.preventDefault()},onDrop:e=>{if(!i||a.kind!==`music`&&a.kind!==`sfx`)return;e.preventDefault();let t=e.currentTarget.getBoundingClientRect();i(a.kind,Math.max(0,(e.clientX-t.left)/d),e.dataTransfer)},...k(G.lane),children:[t.filter(e=>e.track===a.kind).map(t=>(0,W.jsx)(yn,{changed:a.kind===`picture`&&!!e?.has(t.id),clip:t,pps:d,selected:m===_t(t),style:{left:t.start*d,width:Math.max(2,(t.end-t.start)*d-2)},onDrag:(e,t,n,i)=>r?.drag(e,t,n,i),onPick:E,children:o?.[a.kind]?.(t)??t.label},t.id)),a.kind===`picture`&&r?D.map(e=>(0,W.jsx)(`button`,{"aria-label":v(`storyboard.edTransitions`),"data-seam":e.id,type:`button`,style:{position:`absolute`,left:e.start*d-8,top:2,zIndex:5,width:16,height:16,borderRadius:8,borderWidth:0,padding:0,background:`#0D99FF`,color:`#fff`,display:`flex`,alignItems:`center`,justifyContent:`center`,cursor:`pointer`},onClick:()=>b(t=>t===e.id?null:e.id),children:(0,W.jsx)(xe,{size:11})},`seam:${e.id}`)):null,a.kind===`picture`&&r&&A?(0,W.jsx)(xn,{dur:A.transitionDur,kind:A.transition,left:(t.find(e=>e.track===`picture`&&e.id===y)?.start??0)*d,onAll:r.transitionAll,onDur:e=>r.transition(A.id,`transition-dur`,e),onKind:e=>r.transition(A.id,`transition`,e)}):null]})]},a.kind)}),p?(0,W.jsx)(`div`,{style:{left:156+p.in*d,width:(p.out-p.in)*d},...k(G.rangeShade)}):null,(0,W.jsx)(`div`,{style:{left:156+g*d},...k(G.playhead)})]})})]})}var Fn=e=>e instanceof HTMLElement&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName)),In=({edit:e,history:t})=>n=>{if(!e||!t)return!1;let r=n.metaKey||n.ctrlKey,i=n.key.toLowerCase();if(r&&i===`z`)n.shiftKey?t.redo():t.undo();else if(r&&i===`k`)e.splitAtPlayhead();else if(!r&&(n.key===`Backspace`||n.key===`Delete`))return e.remove();else return!1;return!0};function Ln({clock:e,extra:t,timeline:n}){let r=(0,H.useRef)({clock:e,extra:t,timeline:n});r.current={clock:e,extra:t,timeline:n},(0,H.useEffect)(()=>{let e=e=>{let{clock:t,extra:n,timeline:i}=r.current;if(!i||Fn(e.target))return;if(n?.(e)){e.preventDefault();return}if(e.metaKey||e.ctrlKey||e.altKey)return;let a=i.shots.map(e=>e.start);if(e.key===` `||e.key===`k`||e.key===`K`)e.preventDefault(),e.key===` `?t.toggle():t.pause();else if(e.key===`l`||e.key===`L`)t.play();else if(e.key===`j`||e.key===`J`)t.pause(),t.seek(t.time-1);else if(e.key===`ArrowRight`||e.key===`ArrowLeft`){e.preventDefault();let n=e.key===`ArrowRight`;if(!e.shiftKey){t.pause(),t.seek(t.time+(n?1:-1)/30);return}let r=n?a.find(e=>e>t.time+1e-6):[...a].reverse().find(e=>e<t.time-1e-6);t.seek(r??(n?i.total:0))}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[])}function Rn({feed:e,overlays:t,record:n,storyboard:r}){let{t:i}=O(),a=(0,H.useRef)({});(0,H.useEffect)(()=>{a.current=Object.fromEntries(Object.entries(t??{}).map(([e,t])=>[e,t.hash]))},[t]);let o=e.storyboardOverlay,s=(0,H.useCallback)(async(e,t,n,r)=>{if(!o)return null;let s=r??a.current[e],{status:c,body:l}=await o({shot:e,hash:s,index:t,delta:n}).catch(()=>({status:0,body:{}}));return typeof l.hash==`string`&&(a.current={...a.current,[e]:l.hash}),c===200?{applied:typeof l.applied==`number`?l.applied:n,hash:String(l.hash)}:(z.error(c===409?i(`storyboard.stale`):i(`storyboard.editFailed`,{error:String(l.error??c)})),null)},[o,i]);if(!o||!r)return null;let c=(e,t,n,r)=>{let i;return{undo:async()=>{let a=await s(e,t,-n,r);return i=a?.hash,a!==null},redo:async()=>{let r=await s(e,t,n,i);return r&&c(e,t,r.applied,r.hash)}}};return async(e,t)=>{let i=r.shots.find(t=>t.id===e.shot);if(!i||e.index===void 0)return;let a=Math.round(Math.round(t*10)/10*i.speed*1e3)/1e3;if(a===0)return;let o=await s(i.id,e.index,a);o?.applied&&n?.(c(i.id,e.index,o.applied,o.hash))}}var zn=8,Q=e=>Math.round(e*10)/10,Bn=e=>Math.round(e*1e3)/1e3;function Vn({clock:e,onOverlay:t,pps:n,run:r,selected:i,storyboard:a,timeline:o}){let[s,c]=(0,H.useState)(`select`),[l,u]=(0,H.useState)(()=>new Set),[d,f]=(0,H.useState)(!0);if(!r||!a||!o)return null;let p=e=>{e.length&&r(e)},m=e=>a.shots.findIndex(t=>t.id===e),g=(t,r)=>{if(!d)return r;let i=a.shots[t];return[...o.lines.filter(e=>e.shot===i.id).map(e=>e.end),e.time].map(e=>({at:e,gap:Math.abs(e-r)*n})).filter(e=>e.gap<=zn).sort((e,t)=>e.gap-t.gap)[0]?.at??r},_=(e,t,r,i)=>{if(l.has(e.track)||Math.abs(r)*n<2)return[];if(e.track===`picture`){let n=m(e.id),c=a.shots[n];if(t===`trim`){let t=g(n,e.end+r);return[{op:`dur`,shot:c.id,dur:Math.max(.1,Q(t-e.start))}]}if(i||s===`slip`){let e=Bn(Math.max(0,(c.take?c.takeIn??0:c.srcIn)-r*c.speed));return[{op:`attr`,target:{kind:`shot`,id:c.id},name:c.take?`take-in`:`src-in`,value:e}]}let l=(e.start+e.end)/2+r,u=a.shots.find((e,t)=>t!==n&&(o.shots[t].start+o.shots[t].end)/2>l),d=a.shots[n+1];return(u?.id??null)===(d?.id??null)?[]:[{op:`move`,shot:c.id,before:u?.id??null}]}if(e.track===`music`){let t=a.music.find(t=>t.id===e.id);return t?[{op:`attr`,target:{kind:`music`,id:e.id},name:`at`,value:Math.max(0,Q(t.at+r))}]:[]}if(e.track===`sfx`){let t=m(e.shot),n=a.shots[t],i=n?.sfx.find(t=>t.id===e.id);return!n||!i?[]:[{op:`attr`,target:{kind:`sfx`,id:e.id},name:`at`,value:Math.min(Math.max(0,Q(i.at+r)),n.dur)}]}if(e.track===`voice`||e.track===`captions`){let t=m(e.shot),n=o.shots[t];if(!n)return[];let i=e.start-n.start+r;return[{op:`attr`,target:{kind:`line`,id:e.id},name:`at`,value:Math.min(Math.max(0,Q(i)),n.end-n.start)}]}return[]},v=(e,t)=>{let n=a.shots.find(t=>t.id===e);!n||l.has(`picture`)||t<=.05||t>=n.dur-.05||p([{op:`split`,shot:e,at:Q(t)}])};return{tool:s,setTool:c,locks:l,toggleLock:e=>u(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n}),snap:d,toggleSnap:()=>f(e=>!e),drag:(e,n,r,i)=>{e.track===`overlay`?l.has(`overlay`)||t?.(e,r):p(_(e,n,r,i))},razor:(e,t)=>{e.track===`picture`&&v(e.id,t)},splitAtPlayhead:()=>{let t=h(o,e.time),n=o.shots[t];n&&v(a.shots[t].id,e.time-n.start)},remove:()=>{if(!i||l.has(i.track))return!1;if(i.track===`picture`)p([{op:`delete`,shot:i.id}]);else if(i.track===`music`||i.track===`sfx`)p([{op:`remove`,kind:i.track,id:i.id}]);else return!1;return!0},addSound:(e,t,n)=>{if(l.has(e))return;if(e===`music`){p([{op:`add-sound`,kind:e,src:t,at:Math.max(0,Q(n))}]);return}let r=h(o,n),i=o.shots[r];i&&p([{op:`add-sound`,kind:e,shot:a.shots[r].id,src:t,at:Math.max(0,Q(n-i.start))}])},transition:(e,t,n)=>p([{op:`attr`,target:{kind:`shot`,id:e},name:t,value:n}]),transitionAll:e=>p(a.shots.slice(1).map(t=>({op:`attr`,target:{kind:`shot`,id:t.id},name:`transition`,value:e}))),mute:e=>{let t=new Set(a.mute);t.delete(e)||t.add(e),p([{op:`attr`,target:{kind:`root`},name:`mute`,value:[...t].join(` `)||null}])},captions:()=>p([{op:`attr`,target:{kind:`root`},name:`captions`,value:a.captions?`off`:`on`}]),send:p}}function Hn(e){let t=(0,H.useRef)([]),n=(0,H.useRef)([]),r=(0,H.useCallback)(e=>{t.current=[...t.current,e].slice(-100),n.current=[]},[]),i=(0,H.useCallback)(async t=>{if(!e||t.length===0)return null;let n=({hash:r,undo:i})=>{let a;return{undo:async()=>{if(i.length===0)return!1;let t=await e(i,r);return a=t?.hash,t!==null},redo:async()=>{let r=await e(t,a);return r?n(r):null}}},i=await e(t);return i&&r(n(i)),i?.undo??null},[e,r]),a=(0,H.useCallback)(async()=>{let e=t.current.at(-1);e&&(t.current=t.current.slice(0,-1),await e.undo()&&(n.current=[...n.current,e]))},[]),o=(0,H.useCallback)(async()=>{let e=n.current.at(-1);if(!e)return;n.current=n.current.slice(0,-1);let r=await e.redo();r&&(t.current=[...t.current,r])},[]);return e?{record:r,redo:o,run:i,undo:a}:null}function Un(e,t={}){let[n,r]=(0,H.useState)(null),[i,a]=(0,H.useState)(null),[o,s]=(0,H.useState)(null),[c,l]=(0,H.useState)({}),u=t=>t===null?null:e.find(e=>e.n===t)??null,d=e=>{let n=e?.hashes;return n?new Set(Object.keys(t).filter(e=>n[e]!==t[e])):new Set},f=[...e].reverse().find(e=>e.hashes)??null,p=e=>t=>e(e=>e===t?null:t);return{viewing:u(n),compare:u(i),side:u(o),latest:f,changedNow:f?d(f).size:null,changedSince:d,view:e=>{r(e),e!==null&&s(null)},toggleCompare:p(a),toggleSide:p(s),lengthOf:e=>e?c[e.n]:void 0,setLength:(e,t)=>l(n=>n[e]===t?n:{...n,[e]:t})}}var Wn=.35;function Gn(e,t,{paced:n=!1}={}){let[r,i]=(0,H.useState)(0),[a,o]=(0,H.useState)(!1),[s,c]=(0,H.useState)(0),l=(0,H.useRef)({at:0,from:0}),u=(0,H.useRef)(1/0),d=(0,H.useRef)({time:r,playing:a,total:e,range:t,paced:n});d.current={time:r,playing:a,total:e,range:t,paced:n};let f=e=>{l.current={at:performance.now(),from:e},u.current=d.current.paced?e+Wn:1/0};(0,H.useEffect)(()=>{if(!a)return;let e=0,t=()=>{let n=Math.min(l.current.from+(performance.now()-l.current.at)/1e3,u.current),r=d.current.range;r&&n>=r.out?(f(r.in),i(r.in),e=requestAnimationFrame(t)):n>=d.current.total?(i(d.current.total),o(!1)):(i(n),e=requestAnimationFrame(t))};return e=requestAnimationFrame(t),()=>cancelAnimationFrame(e)},[a]);let p=(0,H.useCallback)(e=>{let t=Math.min(Math.max(0,e),d.current.total);f(t),i(t),c(e=>e+1)},[]),m=(0,H.useCallback)(e=>{let t=Math.min(Math.max(0,e),d.current.total);f(t),i(t)},[]),h=(0,H.useCallback)(()=>{let{time:e,total:t,range:n}=d.current,r=n&&(e<n.in||e>=n.out)?n.in:e>=t?0:e;f(r),i(r),o(t>0)},[]),g=(0,H.useCallback)(()=>o(!1),[]);return{time:r,playing:a,seek:p,seeks:s,play:h,pause:g,toggle:(0,H.useCallback)(()=>d.current.playing?g():h(),[g,h]),follow:m}}var Kn=640;function qn(e,t){if(!e||e.readyState<2||!e.videoWidth||!e.videoHeight)return;let n=e.getBoundingClientRect();if(!n.width||!n.height)return;let r=Math.max(n.width/e.videoWidth,n.height/e.videoHeight),i=n.width/r,a=n.height/r,o=(e.videoWidth-i)/2,s=(e.videoHeight-a)/2,c=o+t.x*i,l=s+t.y*a,u=t.w*i,d=t.h*a,f=Math.min(1,Kn/u),p=document.createElement(`canvas`);p.width=Math.max(1,Math.round(u*f)),p.height=Math.max(1,Math.round(d*f));let m=p.getContext(`2d`);if(m)try{return m.drawImage(e,c,l,u,d,0,0,p.width,p.height),p.toDataURL(`image/jpeg`,.8)}catch{return}}var Jn=()=>document.querySelector(`[data-player] video[data-crop-source="true"]`);function Yn({clock:e,comments:t,current:n,cut:r,spans:i,storyboard:a}){let{t:o}=O(),[s,c]=(0,H.useState)(null),[l,u]=(0,H.useState)(null),d=(0,H.useRef)(new Map).current;return!t||!a||!i?null:{draft:s,memory:d,mark:l,setMark:u,cancel:()=>{c(null),u(null)},onShot:e=>t=>{let n=a.shots[e];u(null),c({place:`row`,anchor:t?{shot:n.id,line:t}:{shot:n.id},label:t?o(`storyboard.commentLine`):o(`storyboard.commentOnShot`,{title:n.title})})},onMoment:()=>{let t=a.shots[n],s=i.ranges[n];if(!t||!s)return;e.pause();let l=Math.round((r?e.time:Math.max(0,e.time-s.start))*1e3)/1e3;u(null),c({place:`player`,anchor:r?{shot:t.id,cut:r,t:l}:{shot:t.id,t:l},label:r?o(`storyboard.commentAtCut`,{time:f(l),n:r}):o(`storyboard.commentAt`,{time:f(l),title:t.title})})},submit:e=>{if(!s)return Promise.resolve(!1);let n=s.place===`player`&&l?{...s.anchor,mark:l}:s.anchor,r=n.mark?qn(Jn(),n.mark):void 0;return t.create(n,e,r).then(e=>(e&&u(null),e))}}}function $(e,t,n,r){if(!n)return{ranges:t.shots,strip:t,total:t.total};let i=new Map(n.shots.map(e=>[e.id,e])),a=e.shots.map(e=>{let t=i.get(e.id);return t?{id:t.id,start:t.start,end:t.end}:null}),o=r??n.shots.reduce((e,t)=>Math.max(e,t.end),0);return{ranges:a,strip:{shots:n.shots.map(({id:e,start:t,end:n})=>({id:e,start:t,end:n})),lines:[],total:o},total:o}}function Xn({ranges:e},t){let n=-1,r=-1/0;return e.forEach((e,i)=>{e&&e.start<=t+1e-6&&e.start>r&&(n=i,r=e.start)}),n===-1?e.findIndex(Boolean):n}function Zn(e){let[t,n]=(0,H.useState)(`cut`),[r,i]=(0,H.useState)(null),[a,o]=(0,H.useState)(!1),[s,c]=(0,H.useState)({}),l=t=>t===`cut`?e.find(e=>e.n===r)??e.at(-1)??null:null,u=l(t),d=u?e.filter(e=>e.n<u.n).at(-1)??null:null;return{mode:u?t:`animatic`,cut:u,previous:d,comparing:a&&!!d,setMode:n,cutFor:l,pick:e=>i(e),lengthOf:e=>e?s[e.n]:void 0,setLength:(e,t)=>c(n=>n[e]===t?n:{...n,[e]:t}),toggleCompare:()=>o(e=>!e)}}function Qn(e,t,n,r){let i=e.ranges[n],a=t.ranges[n];return!i||!a?Math.min(r,t.total):Math.min(a.start+Math.max(0,r-i.start),a.end)}var $n=e=>e?[...e.voice,...e.music,...e.sfx]:[];function er({base:e,clock:t,muted:n,plan:r}){let i=(0,H.useRef)(new Map),a=(0,H.useRef)(new Set),o=(0,H.useRef)(t.seeks),s=t=>{let n=`${e}${t.file}`,r=i.current.get(t.key);return r&&r.dataset.src===n||(r?.pause(),r=new Audio(n),r.preload=`auto`,r.dataset.src=n,i.current.set(t.key,r)),r},l=e=>{i.current.get(e)?.pause(),a.current.delete(e)};(0,H.useEffect)(()=>{let e=o.current!==t.seeks;if(o.current=t.seeks,!t.playing||!r){for(let e of[...a.current])l(e);return}let i=new Set;for(let o of $n(r)){if(!(t.time>=o.start&&t.time<o.end))continue;i.add(o.key);let l=s(o);l.volume=n?0:Math.min(1,c(o,r,t.time)),(e||!a.current.has(o.key))&&(l.currentTime=o.from+(t.time-o.start),a.current.add(o.key),l.play()?.catch(()=>{}))}for(let e of[...a.current])i.has(e)||l(e)}),(0,H.useEffect)(()=>()=>{for(let e of i.current.values())e.pause();a.current.clear()},[])}function tr(e,t){let{t:n}=O(),r=(0,H.useRef)(null),[i,a]=(0,H.useState)(null);if(!e||!t)return null;let{shots:o}=t,s=(t,n)=>{let i=r.current;r.current=null,a(null);let s=o[t].id;if(!i||i===s)return;let c=n===`before`?s:o[t+1]?.id??null,l=o.findIndex(e=>e.id===i);c===i||l>=0&&(o[l+1]?.id??null)===c||e([{op:`move`,shot:i,before:c}])};return{add:t=>void e([{op:`add`,after:t,title:n(`storyboard.newShot`)}]),drag:e=>{let t=o[e].id;return{side:i?.shot===t?i.side:null,onDragStart:()=>{r.current=t},onDragEnd:()=>{r.current=null,a(null)},onDragOver:e=>{r.current&&r.current!==t&&a({shot:t,side:e})},onDrop:t=>s(e,t)}},edit:t=>{let r=o[t];return{onTitle:t=>void e([{op:`title`,shot:r.id,text:t}]),onAction:(t,n)=>void e([{op:`action`,shot:r.id,index:t,text:n}]),onLine:(t,n)=>void e([{op:`line`,line:t,text:n}]),onDur:t=>void e([{op:`dur`,shot:r.id,dur:t}]),onDuplicate:()=>void e([{op:`duplicate`,shot:r.id}]),onDelete:()=>{window.confirm(n(`storyboard.deleteConfirm`,{title:r.title}))&&e([{op:`delete`,shot:r.id}])}}}}}function nr(e){let t=e.storyboardComments,n=e.storyboardComment;return(0,H.useMemo)(()=>{if(!n)return null;let e=e=>n(e).then(()=>!0,()=>!1),r=new Set(t?.orphans??[]),i=new Map,a=[];for(let e of t?.comments.threads??[])e.messages.every(e=>e.deleted)||(r.has(e.id)?a.push(e):i.set(e.anchor.shot,[...i.get(e.anchor.shot)??[],e]));return{byShot:i,orphans:a,create:(t,n,r)=>e({op:`create`,anchor:t,text:n,...r?{crop:r}:{}}),actions:{reply:(t,n)=>e({op:`reply`,threadId:t,text:n}),resolve:t=>void e({op:`resolve`,threadId:t}),reopen:t=>void e({op:`reopen`,threadId:t}),edit:(t,n,r)=>void e({op:`edit`,threadId:t,messageId:n,text:r}),remove:(t,n)=>void e({op:`delete`,threadId:t,messageId:n})}}},[n,t])}function rr(e,t,n){let r=(0,H.useRef)(!1);(0,H.useEffect)(()=>{if(r.current||!e||!t)return;r.current=!0;let i=new URLSearchParams(location.search).get(`shot`),a=i?e.shots.findIndex(e=>e.id===i):-1,o=t.ranges[a];o&&n.seek(o.start)},[e,t,n])}function ir(e,t){let{t:n}=O(),r=(0,H.useRef)(t);(0,H.useEffect)(()=>{t&&(r.current=t)},[t]);let i=(0,H.useRef)(Promise.resolve()),a=e.storyboardEdit,o=(0,H.useCallback)((e,t)=>{let o=i.current.then(async()=>{let i=t??r.current;if(!a||!i)return null;let{status:o,body:s}=await a({hash:i,ops:e}).catch(()=>({status:0,body:{}}));return typeof s.hash==`string`&&(r.current=s.hash),o===200?{hash:String(s.hash),undo:Array.isArray(s.undo)?s.undo:[]}:(o===409?z.error(n(`storyboard.stale`)):z.error(n(`storyboard.editFailed`,{error:String(s.error??o)})),null)});return i.current=o.catch(()=>null),o},[a,n]);return a?o:null}function ar({audio:e,base:t,clock:n}){let r=(0,H.useRef)(null),i=(0,H.useCallback)(()=>{r.current?.pause(),r.current=null},[]);return(0,H.useEffect)(()=>{n.playing&&i()},[n.playing,i]),(0,H.useEffect)(()=>i,[i]),{preview:(0,H.useCallback)(a=>{let o=e[a];if(n.pause(),i(),!o)return;let s=new Audio(`${t}${o.file}`);r.current=s,s.play()?.catch(()=>{})},[e,t,n,i])}}var or=16;function sr({actions:e,feed:t,fill:n=!1,id:r}){let{t:i}=O(),a=w(r,t),o=a?.storyboard??null,s=a?.timeline??null,c=Un(a?.cuts??[],a?.shotHashes),{viewing:l}=c,u=o&&s?$(o,s,l,c.lengthOf(l)):null,[f,p]=(0,H.useState)(null),m=Gn(u?.total??s?.total??0,f,{paced:!!l}),[h,g]=(0,H.useState)(null),_=h??o?.captions??!0,[v,y]=(0,H.useState)(!1),[b,x]=(0,H.useState)(or),[S,C]=(0,H.useState)(null),E=a?.contentBase??``,D=Hn(ir(t,a?.hash)),j=tr(D?.run??null,o),{preview:te}=ar({audio:a?.audio??{},base:E,clock:m});er({base:E,clock:m,muted:v,plan:o&&s&&!l?T(o,s,a?.audio??{}):null});let M=u?Xn(u,m.time):-1,N=nr(t),P=Yn({clock:m,comments:N,current:M,cut:l?.n??null,spans:u,storyboard:o}),F=Vn({clock:m,onOverlay:Rn({feed:t,overlays:a?.overlays,record:D?.record,storyboard:o}),pps:b,run:l?null:D?.run??null,selected:S,storyboard:o,timeline:s}),I=pt(t,E,F);Ln({clock:m,timeline:s,extra:In({edit:F,history:D})}),rr(o,u,m),ee(`storyboard`),(0,H.useEffect)(()=>{document.title=a?.title||r},[a?.title,r]);let ne=(0,W.jsx)(zt,{actions:e,comments:N,cuts:a?.cuts??[],feed:t,pending:a?.voicePending.length??0,status:a?.export??null,storyboard:o,timeline:s,title:a?.title??r,versions:c,onSeek:m.seek});if(!o||!s||!u)return(0,W.jsxs)(`div`,{...k(d.root,n&&d.fill),children:[ne,(0,W.jsx)(`div`,{...k(d.message),children:a?a.warnings[0]??i(`storyboard.waiting`):i(`storyboard.connecting`)})]});let re=bt(o,s,At(a?.overlays)),ie=l?[...kt(o,l),...re.filter(e=>e.track!==`picture`)]:re,L=c.side,R=e=>{let t=s.shots[e];t&&m.seek(t.start)},ae=Dt(o,s,N),z=new Set(a?.voicePending??[]),oe=new Set(Object.keys(a?.audio??{})),se=Ot(o,a?.sounds);return(0,W.jsxs)(`div`,{...k(G.root,n&&G.fill),children:[ne,(0,W.jsxs)(`div`,{...k(G.upper),children:[(0,W.jsx)(Vt,{initial:300,max:520,min:240,placement:`left`,storageKey:`ryugi:storyboard-bin-width`,children:(0,W.jsx)(ht,{current:M,cuts:a?.cuts??[],sounds:se,storyboard:o,timeline:s,script:(0,W.jsx)(mn,{current:M,editing:j,failures:a?.voiceFailures??{},follow:m.playing,pending:z,storyboard:o,timeline:s,voiced:oe,onComment:P?e=>P.onShot(e):void 0,onSeek:R,onPreview:(e,t)=>{R(e),te(t)}}),onPreview:I.preview,onShot:R})}),(0,W.jsx)(rn,{captions:_,clock:m,muted:v,storyboard:o,timeline:l?u.strip:s,compare:L?{label:i(`storyboard.cutNumber`,{n:L.n}),src:`${E}${L.file}`,time:Qn(u,$(o,s,L,c.lengthOf(L)),M,m.time)}:null,cut:l?{src:`${E}${l.file}`,onLength:e=>c.setLength(l.n,e)}:null,overlay:P?.draft?.place===`player`?(0,W.jsx)(lt,{mark:P.mark,onMark:P.setMark}):null,picture:{base:E,motion:new Set,report:e=>t.send({...e,artifact:`storyboard/${r}`}),version:a?.version??0},onCaptions:()=>F&&!l?F.captions():g(!_),onComment:P?.onMoment,onMute:()=>y(e=>!e)}),(0,W.jsx)(Vt,{initial:300,max:480,min:260,placement:`right`,storageKey:`ryugi:storyboard-inspector-width`,children:(0,W.jsx)(tn,{clip:S,edit:F?{send:F.send,time:m.time,onSeek:m.seek}:void 0,storyboard:o,timeline:s})})]}),(0,W.jsx)(Pn,{changed:c.compare?c.changedSince(c.compare):void 0,clips:ie,dim:!!l,edit:F,markers:ae,pps:b,range:f,selected:S?_t(S):null,storyboard:o,time:m.time,total:u.total,onDropSound:F?I.drop:void 0,onRange:p,onSeek:m.seek,onSelect:C,onZoom:e=>x(e||or)}),P?.draft?(0,W.jsx)(Et,{draft:P.draft,memory:P.memory,onCancel:P.cancel,onSubmit:P.submit}):null,(0,W.jsx)(A,{warnings:a?.warnings??[]})]})}var cr={controls:{k1xSpc:`x78zum5`,kGNEyG:`x6s0dn4`,kOIVth:`x167g77z`,$$css:!0},label:{kMwMTN:`xddlp02`,kGuDYH:`x1j6dyjg`,$$css:!0}};function lr({current:e,number:t,onSeek:n,time:r,timeline:i}){let a=i.total||1,o=e=>{let t=e.currentTarget.getBoundingClientRect();t.width>0&&n((e.clientX-t.left)/t.width*i.total)};return(0,W.jsxs)(`div`,{"data-strip":``,...k(b.strip),onClick:o,children:[i.shots.map((r,i)=>(0,W.jsx)(`span`,{"aria-current":i===e,"data-strip-shot":r.id,style:{flex:Math.max(r.end-r.start,.01)},onClick:e=>{e.stopPropagation(),n(r.start)},...k(b.segment,i===e&&b.segmentOn),children:t?.(r.id)||i+1},r.id)),(0,W.jsx)(`span`,{style:{left:`${Math.min(r,a)/a*100}%`},...k(b.playhead)})]})}var ur=e=>{let[t,n]=l(e);return{width:`min(100%, calc(62vh * ${t} / ${n}))`,aspectRatio:`${t} / ${n}`}};function dr({captions:e,clock:t,cut:n,current:r,muted:i,onCaptions:a,onComment:o,onCutLength:s,onMute:c,overlay:u,picture:d,storyboard:p,timeline:m}){let{t:h}=O(),_=(0,H.useRef)(null),[v,S]=(0,H.useState)(0),C=l(p.aspect)[0];(0,H.useEffect)(()=>{let e=_.current;if(!e)return;let t=()=>S(e.clientWidth/C);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[C]);let w=e?x(m.lines,t.time):null,T=w?p.shots.flatMap(e=>e.lines).find(e=>e.id===w.id)?.caption:void 0;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{"data-player":``,ref:_,style:ur(p.aspect),...k(b.stage),children:[n?(0,W.jsx)(g,{active:!0,audible:!i,marker:`cut`,playing:t.playing,seeks:t.seeks,src:n,start:0,time:t.time,onLength:s,onTime:t.follow}):(0,W.jsx)(y,{...d,muted:i,playing:t.playing,scale:v,seeks:t.seeks,storyboard:p,time:t.time,timeline:m}),T&&!n?(0,W.jsx)(`div`,{"data-caption":``,...k(b.caption),children:T}):null,u]}),(0,W.jsxs)(`div`,{...k(b.transport),children:[(0,W.jsx)(`button`,{"aria-label":t.playing?h(`storyboard.pause`):h(`storyboard.play`),type:`button`,onClick:t.toggle,...k(b.play),children:(0,W.jsx)(Ce,{playing:t.playing,size:14})}),(0,W.jsxs)(`span`,{"data-clock":``,...k(b.clock),children:[f(t.time),` / `,f(m.total)]}),(0,W.jsx)(`span`,{style:{flex:1}}),o?(0,W.jsx)(`button`,{"aria-label":h(`storyboard.commentMoment`),"data-comment-moment":``,title:h(`storyboard.commentMoment`),type:`button`,onClick:o,...k(b.tool),children:(0,W.jsx)(Ue,{size:16})}):null,(0,W.jsx)(`button`,{"aria-label":h(`storyboard.mute`),"aria-pressed":i,type:`button`,onClick:c,...k(b.tool,!i&&b.toolOn),children:i?(0,W.jsx)(st,{size:16}):(0,W.jsx)(at,{size:16})}),(0,W.jsx)(`button`,{"aria-label":h(`storyboard.captions`),"aria-pressed":e,type:`button`,onClick:a,...k(b.tool,e&&b.toolOn),children:e?(0,W.jsx)(Le,{size:16}):(0,W.jsx)(Fe,{size:16})}),(0,W.jsx)(`button`,{"aria-label":h(`storyboard.fullscreen`),type:`button`,onClick:()=>void _.current?.requestFullscreen?.(),...k(b.tool),children:(0,W.jsx)(Se,{size:15})})]}),(0,W.jsx)(lr,{current:m.shots.findIndex(e=>e.id===p.shots[r]?.id),number:e=>p.shots.findIndex(t=>t.id===e)+1,time:t.time,timeline:m,onSeek:t.seek})]})}function fr({aspect:e,clock:t,current:n,previous:r,spans:i,src:a}){let{t:o}=O();return(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{...k(cr.label),children:o(`storyboard.previousCut`)}),(0,W.jsx)(`div`,{style:ur(e),...k(b.stage),children:(0,W.jsx)(g,{active:!0,marker:`compare`,playing:t.playing,seeks:t.seeks,src:a,start:0,time:Qn(i,r,n,t.time)})})]})}function pr({comparing:e,cut:t,cuts:r,onCompare:i,onPick:a,previous:o}){let{t:s,i18n:c}=O(),l=e=>e?new Date(e).toLocaleString(c.language,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):``;return(0,W.jsxs)(`div`,{...k(cr.controls),children:[(0,W.jsx)(`div`,{"data-cut-version":``,children:(0,W.jsx)(ge,{"aria-label":s(`storyboard.cutVersion`),size:`small`,value:String(t.n),options:[...r].reverse().map(e=>({value:String(e.n),label:`${s(`storyboard.cutNumber`,{n:e.n})}${e.registeredAt?` · ${l(e.registeredAt)}`:``}`})),onChange:e=>{typeof e==`string`&&a(Number(e))}})}),o?(0,W.jsx)(ne,{"aria-pressed":e,"data-compare":``,icon:(0,W.jsx)(n,{size:13}),size:`small`,type:e?`primary`:`default`,onClick:i,children:s(`storyboard.compareWith`,{n:o.n})}):null]})}function mr({actions:e,hasCut:t,mode:n,onMode:r,over:i,shots:a,title:o,total:s}){let{t:c}=O();return(0,W.jsxs)(`header`,{...k(d.header),children:[(0,W.jsx)(`span`,{...k(d.title),children:o}),a!==null&&s!==null?(0,W.jsxs)(`span`,{"data-over":i,"data-total":``,...k(d.total,i&&d.over),children:[c(`storyboard.shots`,{count:a}),` · `,f(s)]}):null,(0,W.jsx)(`span`,{...k(d.spacer)}),(0,W.jsxs)(`span`,{...k(d.segment),children:[(0,W.jsxs)(`button`,{"aria-pressed":n===`animatic`,"data-mode":`animatic`,type:`button`,onClick:()=>r(`animatic`),...k(d.segmentItem,n===`animatic`&&d.segmentOn),children:[(0,W.jsx)(L,{size:13}),c(`storyboard.animatic`)]}),(0,W.jsxs)(`button`,{"aria-pressed":n===`cut`,"data-mode":`cut`,disabled:!t,title:t?void 0:c(`storyboard.noCut`),type:`button`,onClick:()=>r(`cut`),...k(d.segmentItem,n===`cut`&&d.segmentOn),children:[(0,W.jsx)(je,{size:13}),c(`storyboard.cut`)]})]}),e]})}var hr=e=>e instanceof HTMLElement&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName));function gr({clock:e,onCaptions:t,spans:n}){(0,H.useEffect)(()=>{if(!n)return;let r=n.ranges.flatMap(e=>e?[e]:[]).sort((e,t)=>e.start-t.start),i=i=>{if(i.metaKey||i.ctrlKey||i.altKey||hr(i.target))return;let a=n.ranges[Xn(n,e.time)],o=a?r.indexOf(a):-1;if(i.key===` `)i.preventDefault(),e.toggle();else if(i.key===`ArrowRight`&&o<r.length-1)i.preventDefault(),e.seek(r[o+1].start);else if(i.key===`ArrowLeft`&&o>=0){i.preventDefault();let t=r[o].start;e.seek(e.time-t>.5||o===0?t:r[o-1].start)}else(i.key===`c`||i.key===`C`)&&t()};return window.addEventListener(`keydown`,i),()=>window.removeEventListener(`keydown`,i)},[n,e,t])}function _r({actions:e,feed:t,fill:n=!1,id:r}){let{t:i}=O(),a=w(r,t),o=a?.storyboard??null,s=a?.timeline??null,c=a?.cuts??[],l=Zn(c),u=o&&s?$(o,s,l.cut,l.lengthOf(l.cut)):null,f=Gn(u?.total??0,null,{paced:!!l.cut}),[p,m]=(0,H.useState)(null),h=p??o?.captions??!0,[g,_]=(0,H.useState)(!1),v=(0,H.useCallback)(e=>t.send({...e,artifact:`storyboard/${r}`}),[t,r]),y=a?.contentBase??``;er({base:y,clock:f,muted:g,plan:o&&s&&!l.cut?T(o,s,a?.audio??{}):null});let b=u?Xn(u,f.time):-1,x=nr(t),S=Yn({clock:f,comments:x,current:b,cut:l.cut?.n??null,spans:u,storyboard:o}),C=(0,H.useRef)(null);(0,H.useEffect)(()=>{C.current!==null&&(f.seek(C.current),C.current=null)});let E=e=>{if(!o||!s||!u||e===l.mode)return;let t=u.ranges[b],n=t?f.time-t.start:0,r=l.cutFor(e),i=$(o,s,r,l.lengthOf(r)).ranges[b];C.current=i?Math.min(i.start+Math.max(0,n),i.end):0,f.pause(),l.setMode(e)};ee(`storyboard`),(0,H.useEffect)(()=>{document.title=a?.title||r},[a?.title,r]),gr({clock:f,spans:u,onCaptions:()=>m(!h)}),rr(o,u,f);let D=o?.target&&o.target!==`invalid`?o.target:null,j=!!(D&&s&&(s.total<D.min||s.total>D.max)),te=o?.shots[b];return(0,W.jsxs)(`div`,{...k(d.root,n&&d.fill),children:[(0,W.jsx)(mr,{actions:e,hasCut:c.length>0,mode:l.mode,over:j,shots:o?.shots.length??null,title:a?.title??r,total:s?.total??null,onMode:E}),o&&s&&u?(0,W.jsxs)(`div`,{className:`x78zum5 xdt5ytf x1v2ro7d xh8yej3 x104f9w2 x2lwn1j xvueqy4 x1qhigcl x9f619 x1odjw0f`,children:[(0,W.jsx)(dr,{captions:h,clock:f,current:b,cut:l.cut?`${y}${l.cut.file}`:void 0,muted:g,picture:{base:y,motion:new Set,report:v,version:a?.version??0},storyboard:o,timeline:u.strip,overlay:S?.draft?.place===`player`?(0,W.jsx)(lt,{mark:S.mark,onMark:S.setMark}):null,onCaptions:()=>m(!h),onComment:S?.onMoment,onCutLength:e=>l.cut&&l.setLength(l.cut.n,e),onMute:()=>_(e=>!e)}),l.cut?(0,W.jsx)(pr,{comparing:l.comparing,cut:l.cut,cuts:c,previous:l.previous,onCompare:l.toggleCompare,onPick:e=>{f.pause(),C.current=0,l.pick(e)}}):null,l.comparing&&l.previous?(0,W.jsx)(fr,{aspect:o.aspect,clock:f,current:b,spans:u,src:`${y}${l.previous.file}`,previous:$(o,s,l.previous,l.lengthOf(l.previous))}):null,S?.draft?.place===`player`?(0,W.jsx)(xt,{label:S.draft.label,onCancel:S.cancel,onSubmit:S.submit}):null,x&&te?(0,W.jsx)(`div`,{"data-shot-threads":``,children:(0,W.jsx)(Mt,{actions:x.actions,threads:x.byShot.get(te.id)??[],onJump:e=>{let t=u.ranges[b],{cut:n,t:r}=e.anchor;n!==void 0&&n===l.cut?.n&&r!==void 0?f.seek(r):t&&f.seek(Math.min(t.start+(n===void 0?r??0:0),t.end))}})}):null,x?(0,W.jsx)(Mt,{orphan:!0,actions:x.actions,heading:i(`storyboard.deletedShots`),threads:x.orphans,onJump:()=>{}}):null]}):(0,W.jsx)(`div`,{...k(d.message),children:a?a.warnings[0]??i(`storyboard.waiting`):i(`storyboard.connecting`)}),(0,W.jsx)(A,{warnings:a?.warnings??[]})]})}var vr=`(max-width: 900px)`;function yr(){let[e,t]=(0,H.useState)(()=>window.matchMedia?.(vr).matches??!1);return(0,H.useEffect)(()=>{let e=window.matchMedia?.(vr);if(!e)return;let n=()=>t(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}function br({id:e}){let t=o(`storyboard`,e),n=i(),r=n?void 0:(0,W.jsx)(a,{artifact:`storyboard/${e}`});return yr()?(0,W.jsx)(_r,{local:!0,actions:r,feed:t,fill:n,id:e}):(0,W.jsx)(sr,{actions:r,feed:t,fill:n,id:e})}export{br as StoryboardLayout};