PageSourceSearch

https://wavevisual.com/_next/static/chunks/2523-854a4a2563670473.js

js wavevisual.com collected 2026-10-04 13:33:22 UTC 411,326 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2523],{61367:function(e,t,i){"use strict";i.d(t,{U:function(){return n}});var r=i(52322);i(2784);let n=()=>(0,r.jsx)("div",{className:"flex flex-col items-center p-4",children:(0,r.jsx)("p",{className:"w-full",children:"Thank you for registering. You will receive an email that includes a link to verify your email address."})})},52745:function(e,t,i){"use strict";i.d(t,{J:function(){return f}});var r=i(52322),n=i(2784),a=i(63955),o=i(83112),l=i(42670),s=i(94133),d=i(78369),c=i(21353),u=i(7355),p=i(18997),m=i(10289);let f=e=>{var t;let{switchToLogin:i}=e,f=(0,u.aC)(),x=(0,o.Z)(),h=(0,m.M)(),{handleSubmit:g,register:v,setError:b,setValue:E,formState:{errors:y}}=(0,a.cI)({defaultValues:{}}),w=(0,n.useCallback)(async e=>{h.setPending();try{await f.sendPasswordResetEmail(e.email),h.setSuccess()}catch(e){(null==e?void 0:e.code)==="auth/user-not-found"&&b("email",{type:"notfound"}),p.H(e),h.setError()}},[f,h,b]);return(0,r.jsxs)("form",{onSubmit:g(w),className:"flex flex-col items-center p-4 pb-2 md:px-6 md:pt-6",children:[h.isSuccessful&&(0,r.jsx)("div",{className:"flex w-full mb-3",children:(0,r.jsx)(l.Z,{id:"ForgotPasswordPanel.SentEmail"})}),(0,r.jsx)("div",{className:"flex w-full mb-3",children:(0,r.jsx)(d.I,{type:"email",...v("email",{required:!0}),label:x.formatMessage({id:"Form.EmailAddress.Label"}),placeholder:"[email protected]",className:"w-full",errorText:(null==y?void 0:y.email)&&x.formatMessage({id:"Form.EmailAddress.ErrorMessage.".concat(null==y?void 0:null===(t=y.email)||void 0===t?void 0:t.type)}),onChange:e=>{let{target:t}=e;E("email",t.value),h.isSuccessful&&h.setInitial()},disabled:h.isPending,id:"forgot-password-input"})}),(0,r.jsxs)(c.z,{theme:"blue",block:!0,type:"submit",size:"large",disabled:h.isPending,className:"mt-2",children:[h.isPending&&(0,r.jsx)(s.p,{className:"mr-2",fontSize:20}),(0,r.jsx)(l.Z,{id:"ForgotPasswordPanel.SubmitButton"})]}),(0,r.jsx)(c.z,{theme:"link",onClick:i,type:"button",className:"mt-2",children:(0,r.jsx)(l.Z,{id:"ForgotPasswordPanel.SigninInstead"})})]})}},64907:function(e,t,i){"use strict";i.d(t,{_:function(){return g}});var r=i(52322),n=i(2784),a=i(63955),o=i(83112),l=i(42670),s=i(99127),d=i(85973),c=i(78369),u=i(21353),p=i(94133),m=i(7355),f=i(18997),x=i(1825);function h(e){switch(null==e?void 0:e.code){case"auth/user-not-found":case"auth/email-already-in-use":case"auth/internal-error":default:return"email";case"auth/wrong-password":case"auth/weak-password":return"current-password"}}let g=e=>{var t,i,g,v,b;let{switchToRegister:E,close:y,switchToForgotPassword:w,onSuccess:S,withHeader:j,withGoogle:C}
1=e,N=(0,m.aC)(),_=(0,o.Z)(),[R,A]=(0,n.useState)(!1),{handleSubmit:k,register:I,setError:z,setValue:M,formState:{errors:D,isSubmitSuccessful:T}}=(0,a.cI)({defaultValues:{}}),O=(0,n.useCallback)(async e=>{A(!0);try{await N.signInWithEmailAndPassword(e.email,e["current-password"]),(0,x.e)({theme:"success",content:e.email?"Signed in as ".concat(e.email):"Signed in successfully"}),y&&y(),S&&S()}catch(t){if((null==t?void 0:t.code)==="auth/popup-closed-by-user"||(null==t?void 0:t.code)==="auth/cancelled-popup-request"){A(!1);return}f.H(t);let e=_.formatMessage({id:"Auth.ErrorMessage.".concat(t.code)})||(null==t?void 0:t.message);z(h(t),{type:null==t?void 0:t.code,message:e}),A(!1)}},[N,y,_,S,z]),F=(0,n.useCallback)(async()=>{try{var e,t;A(!0),await N.signInWithGoogle(),(0,x.e)({theme:"success",content:(null===(e=N.userDetails)||void 0===e?void 0:e.email)?"Signed in as ".concat(null===(t=N.userDetails)||void 0===t?void 0:t.email):"Signed in successfully"}),y&&y()}catch(e){if(A(!1),(null==e?void 0:e.code)==="auth/popup-closed-by-user")return;f.H(e),z(h(e),{type:null==e?void 0:e.code,message:_.formatMessage({id:"Auth.ErrorMessage.".concat(e.code)})||(null==e?void 0:e.message)})}},[N,y,_,z]);return T?(0,r.jsx)("div",{className:"rounded-md bg-green-50 p-4",children:(0,r.jsxs)("div",{className:"flex",children:[(0,r.jsx)("div",{className:"shrink-0",children:(0,r.jsx)(s.KP3,{className:"h-5 w-5 text-green-600","aria-hidden":"true"})}),(0,r.jsx)("div",{className:"ml-3",children:(0,r.jsx)("h3",{className:"text-sm font-medium text-green-600",children:(null===(t=N.userDetails)||void 0===t?void 0:t.email)?"Signed in as ".concat(null===(i=N.userDetails)||void 0===i?void 0:i.email):"Signed in successfully"})})]})}):(0,r.jsxs)(r.Fragment,{children:[j&&(0,r.jsx)("h1",{className:"mb-4 text-base text-center",children:"Sign in to your account"}),C&&(0,r.jsx)("div",{className:"my-2",children:(0,r.jsxs)("button",{className:"w-full border border-gray-800 rounded justify-center flex items-center p-2.5 text-gray-900",onClick:F,children:[(0,r.jsx)(d.JM8,{className:"mr-2",fontSize:22}),"Sign in with Google"]})}),(0,r.jsxs)("form",{onSubmit:k(O),className:"flex flex-col items-center py-4 pb-2",children:[(0,r.jsx)("div",{className:"flex w-full mb-3",children:(0,r.jsx)(c.I,{type:"email",...I("email",{required:!0}),onChange:e=>{let{target:t}=e;return M("email",t.value)},label:_.formatMessage({id:"Form.EmailAddress.Label"}),placeholder:"[email protected]",autoComplete:"on",className:"w-full",autoFocus:!0,readOnly:R,errorText:(null==D?void 0:D.email)&&((null==D?void 0:D.email.message)||_.formatMessage({id:"Form.EmailAddress.ErrorMessage.".concat(null==D?void 0:null===(g=D.email)||void 0===g?void 0:g.type)}))})}),(0,r.jsx)("div",{className:"flex w-full mb-3",children:(0,r.jsx)(c.I,{type:"password",...I("current-password",{required:!0}),onChange:e=>{let{target:t}=e;return M("current-password",t.value)},label:_.formatMessage({id:"Form.Password.Label"}),placeholder:"*******",autoComplete:"on",className:"w-full",readOnly:R,errorText:(null==D?void 0:D["current-password"])&&((null==D?void 0:null===(v=D["current-password"])||void 0===v?void 0:v.message)||_.formatMessage({id:"Form.Password.ErrorMessage.".concat(null==D?void 0:null===(b=D["current-password"])||void 0===b?void 0:b.type)}))})}),(0,r.jsxs)(u.z,{theme:"blue",block:!0,type:"submit",size:"large",disabled:R,className:"mt-2",children:[R&&(0,r.jsx)(p.p,{className:"mr-2",fontSize:20}),(0,r.jsx)(l.Z,{id:"SigninPanel.SubmitButton"})]}),(0,r.jsx)(u.z,{theme:"link",onClick:w,type:"button",className:"mt-2",children:(0,r.jsx)(l.Z,{id:"SigninPanel.ForgotPassword"})}),(0,r.jsx)(u.z,{theme:"link",onClick:E,type:"button",className:"mt-2",children:(0,r.jsx)(l.Z,{id:"SigninPanel.RegisterInstead"})})]})]})}},42307:function(e,t,i){"use strict";i.d(t,{K:function(){return g}});var r=i(52322),n=i(2784),a=i(63955),o=i(83112),l=i(42670),s=i(85973),d=i(94133),c=i(78369),u=i(21353),p=i(7355),m=i(18997),f=i(1825);function x(e){switch(null==e?void 0:e.code){case"auth/user-not-found":case"auth/email-already-in-use":case"auth/internal-error":default:return"email";case"auth/wrong-password":case"auth/weak-password":return"new-password"}}function h(e){let t=null==e?void 0:e.message.split(":");return t.length>1?t.slice(1).join(":"):null==e?void 0:e.message}let g=e=>{var t,i,g,v,b;let{switchToLogin:E,switchToVerification:y,withHeader:w,withGoogle:S,close:j}
1=e,C=(0,p.aC)(),N=(0,o.Z)(),[_,R]=(0,n.useState)(!1),{handleSubmit:A,register:k,formState:{errors:I},setError:z,setValue:M}=(0,a.cI)({defaultValues:{}}),D=(0,n.useCallback)(async e=>{if(e["new-password"]!==e.passwordAgain){z("passwordAgain",{type:"auth/incorrect",message:N.formatMessage({id:"Form.PasswordAgain.ErrorMessage.incorrect"})});return}try{R(!0),await C.createUserWithEmailAndPassword(e.email,e["new-password"]),(0,f.e)({theme:"success",content:e.email?"Signed in as ".concat(e.email):"Signed in successfully"}),y()}catch(e){if((null==e?void 0:e.code)==="auth/popup-closed-by-user"||(null==e?void 0:e.code)==="auth/cancelled-popup-request"){R(!1);return}m.H(e),z(x(e),{type:null==e?void 0:e.code,message:h(e)}),R(!1)}},[z,N,C,y]),T=(0,n.useCallback)(async()=>{try{await C.signInWithGoogle(),(0,f.e)({theme:"success",content:"Signed in with Google"}),j&&j()}catch(e){m.H(e),z(x(e),{type:null==e?void 0:e.code,message:h(e)})}},[C,j,z]);return(0,r.jsxs)(r.Fragment,{children:[w&&(0,r.jsx)("h1",{className:"mb-4 text-base text-center",children:"Register an account"}),S&&(0,r.jsx)("div",{className:"my-2",children:(0,r.jsxs)("button",{className:"w-full border border-gray-800 rounded justify-center flex items-center p-2.5",onClick:T,children:[(0,r.jsx)(s.JM8,{className:"mr-2",fontSize:22}),"Register with Google"]})}),(0,r.jsxs)("form",{onSubmit:A(D),className:"flex flex-col items-center py-4 pb-2",children:[(0,r.jsx)("div",{className:"flex w-full mb-3",children:(0,r.jsx)(c.I,{type:"email",...k("email",{required:!0}),onChange:e=>{let{target:t}=e;return M("email",t.value)},label:N.formatMessage({id:"Form.EmailAddress.Label"}),placeholder:"[email protected]",className:"w-full",autoFocus:!0,readOnly:_,errorText:I.email&&(I.email.message||N.formatMessage({id:"Form.EmailAddress.ErrorMessage.".concat(null==I?void 0:null===(t=I.email)||void 0===t?void 0:t.type)}))})}),(0,r.jsx)("div",{className:"flex w-full mb-3",children:(0,r.jsx)(c.I,{type:"password",...k("new-password",{required:!0}),onChange:e=>{let{target:t}=e;return M("new-password",t.value)},label:N.formatMessage({id:"Form.Password.Label"}),autoComplete:"on",placeholder:"*******",className:"w-full",readOnly:_,errorText:(null==I?void 0:I["new-password"])&&((null==I?void 0:null===(i=I["new-password"])||void 0===i?void 0:i.message)||N.formatMessage({id:"Form.Password.ErrorMessage.".concat(null==I?void 0:null===(g=I["new-password"])||void 0===g?void 0:g.type)}))})}),(0,r.jsx)("div",{className:"flex w-full mb-3",children:(0,r.jsx)(c.I,{type:"password",...k("passwordAgain",{required:!0}),onChange:e=>{let{target:t}=e;return M("passwordAgain",t.value)},label:"Repeat password",autoComplete:"on",placeholder:"*******",className:"w-full",readOnly:_,errorText:(null==I?void 0:I.passwordAgain)&&((null==I?void 0:null===(v=I.passwordAgain)||void 0===v?void 0:v.message)||N.formatMessage({id:"Form.PasswordAgain.ErrorMessage.".concat(null==I?void 0:null===(b=I.passwordAgain)||void 0===b?void 0:b.type)}))})}),(0,r.jsxs)(u.z,{theme:"success",size:"large",block:!0,type:"submit",disabled:_,className:"mt-2",children:[_&&(0,r.jsx)(d.p,{className:"mr-2",fontSize:20}),(0,r.jsx)(l.Z,{id:"RegisterPanel.SubmitButton"})]}),(0,r.jsx)(u.z,{theme:"link",onClick:E,type:"button",className:"mt-2",disabled:_,children:(0,r.jsx)(l.Z,{id:"RegisterPanel.SigninInstead"})})]})]})}},6968:function(e,t,i){"use strict";i.d(t,{i:function(){return v}});var r=i(52322),n=i(2784),a=i(42670),o=i(99127),l=i(21749),s=i(46979),d=i(79130),c=i.n(d),u=i(17835),p=i(64818),m=i(4280),f=i(30118),x=i(95058),h=i.n(x);let g=c().bind(h());function v(e){var t,i;let d;let{visible:c,onClose:x,disableAlpha:h}=e,v="objectName"in e&&null!=e.objectName,b=v?e.objectName:void 0,E=v?void 0:e.onChange,y=v?void 0:e.onRemove,{updateTextNode:w,textNodes:S}=(0,f._i)(),j=v&&b?S.find(e=>e.name===b):null,C=v?null!==(t=null==j?void 0:j.fillColor)&&void 0!==t?t:"#000000":e.color,N=(0,n.useCallback)((e,t)=>{let i=new l.fabric.Color(e);t&&i.setAlpha(t);let r="#".concat(i.toHexa());v&&b?w(b,{fillColor:r}):E&&E(r)},[v,b,w,E]),_=v&&(null==j?void 0:j.text)?(0,r.jsx)("span",{className:"flex-1 text-ellipsis text-xl",style:{color:C,fontFamily:j.fontFamily},children:j.text}):void 0;return d=v?(0,r.jsx)(u.iI,{className:"text-lg font-semibold leading-none tracking-tight",children:(0,r.jsx)(a.Z,{id:"Editor.Menu.Text.Color",defaultMessage:"Color"})}):y?(0,r.jsx)(u.iI,{className:"text-lg font-semibold leading-none tracking-tight",children:(0,r.jsxs)("button",{type:"button",className:g("deleteColor","flex items-center justify-center rounded-full px-3 py-1 text-base text-white hover:text-white"),onClick:()=>{x(),y()},children:[(0,r.jsx)(o.VPh,{fontSize:20,className:"mr-1"})," Delete"]})}):(0,r.jsx)(u.iI,{className:"text-lg font-semibold leading-none tracking-tight",children:(0,r.jsx)(a.Z,{id:"Editor.Menu.Text.Color",defaultMessage:"Color"})}),(0,r.jsx)(u.dy,{open:c,onOpenChange:e=>!e&&x(),children:(0,r.jsxs)(u.sc,{className:"flex max-h-[85vh] flex-col overflow-hidden rounded-t-xl px-0",children:[(0,r.jsxs)("div",{className:"flex shrink-0 flex-row items-center justify-between gap-2 border-b border-gray-200 px-5 py-3",children:[(0,r.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[(0,r.jsx)("span",{className:"h-8 w-8 shrink-0 rounded-full",style:{backgroundColor:C,boxShadow:"inset 0 0 0 1px ".concat((0,m.BR)(C))},"aria-hidden":!0,"data-testid":"color-sheet-current"}),(0,r.jsxs)("div",{className:"min-w-0",children:[d,(0,r.jsx)("span",{className:"text-xs uppercase text-gray-500",children:null!==(i=(0,m.kB)(C))&&void 0!==i?i:C})]})]}),(0,r.jsx)(u.uh,{asChild:!0,children:(0,r.jsx)("button",{type:"button",className:"-mr-1 flex h-8 w-8 shrink-0 items-center justify-center rounded text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-700","aria-label":"Close",children:(0,r.jsx)(s.Z,{className:"h-5 w-5"})})})]}),(0,r.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto pb-6 pt-4","data-vaul-no-drag":!0,style:{touchAction:"pan-y"},children:(0,r.jsx)(p.J,{color:C,setColor:N,disableAlpha:h,preview:_})})]})})}},64818:function(e,t,i){"use strict";i.d(t,{J:function(){return m}});var r=i(52322),n=i(2784),a=i(12524),o=i.n(a),l=i(79426),s=i(90317),d=i(29020),c=i(96284),u=i(81582);let p=[{id:"swatches",label:"Presets"},{id:"custom",label:"Custom"}];
1function m(e){let{color:t,setColor:i,disableAlpha:a,preview:m,padding:f=!0,compact:x}=e,[h,g]=(0,n.useState)("swatches"),{recentColors:v,rememberColor:b}=(0,u.h)(),E=(0,n.useCallback)((e,t)=>{i(e,t),b(e)},[b,i]);return(0,r.jsxs)("div",{className:o()("space-y-3",{"px-5":f}),children:[m&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"flex items-center py-1",children:m}),(0,r.jsx)(c.i,{})]}),(0,r.jsx)(l.O,{tabs:p,value:h,onChange:g,"data-testid":"color-sheet-tabs"}),"swatches"===h?(0,r.jsx)(s.c,{color:t,setColor:E,recentColors:v,compact:x}):(0,r.jsx)(d.s,{color:t,onChange:(e,t)=>E(e,t),disableAlpha:a})]})}},13699:function(e,t,i){"use strict";i.d(t,{g:function(){return l}});var r=i(52322);i(2784);var n=i(46979),a=i(17835),o=i(88745);function l(e){let{visible:t,onClose:i,title:l,...s}=e;return(0,r.jsx)(a.dy,{open:t,onOpenChange:e=>!e&&i(),children:(0,r.jsxs)(a.sc,{className:"flex max-h-[85vh] flex-col overflow-hidden rounded-t-xl px-0",children:[(0,r.jsxs)("div",{className:"flex shrink-0 flex-row items-center justify-between gap-2 border-b border-gray-200 px-5 py-3",children:[(0,r.jsx)(a.iI,{className:"text-lg font-semibold leading-none tracking-tight",children:l}),(0,r.jsx)(a.uh,{asChild:!0,children:(0,r.jsx)("button",{type:"button",className:"-mr-1 flex h-8 w-8 shrink-0 items-center justify-center rounded text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-700","aria-label":"Close",children:(0,r.jsx)(n.Z,{className:"h-5 w-5"})})})]}),(0,r.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto px-5 pb-8 pt-4","data-vaul-no-drag":!0,style:{touchAction:"pan-y"},children:(0,r.jsx)(o.V,{...s})})]})})}},88745:function(e,t,i){"use strict";i.d(t,{V:function(){return j}});var r=i(52322),n=i(2784),a=i(12524),o=i.n(a),l=i(21749),s=i(32434),d=i(21881),c=i(18816),u=i(76206),p=i(42011),m=i(18997),f=i(79426),x=i(96284),h=i(32193),g=i(73100),v=i(90317),b=i(29020),E=i(12443),y=i(4280),w=i(81582);let S=[{id:"swatches",label:"Presets"},{id:"custom",label:"Custom"}],j=e=>{var t;let{colors:i,onColorsChange:a,disableAlpha:j,gradientDirection:C,onGradientDirectionChange:N,canBeTransparent:_=!1,defaultColor:R="#000000",palettes:A,lightArrow:k,"data-testid":I}
1=e,[z,M]=(0,n.useState)("swatches"),[D,T]=(0,n.useState)(0),{recentColors:O,rememberColor:F}=(0,w.h)(),L=Math.min(D,Math.max(0,i.length-1)),P=null!==(t=i[L])&&void 0!==t?t:R,U=i.length>0,W=_?U:i.length>1,B=i.length<E.U;(0,n.useEffect)(()=>{T(e=>Math.min(e,Math.max(0,i.length-1)))},[i.length]);let G=(0,n.useCallback)((e,t)=>{let r=new l.fabric.Color(e);void 0!==t&&r.setAlpha(t);let n="#".concat(r.toHexa());if(F(e),0===i.length){a([n]),T(0);return}let o=[...i];o[L]=n,a(o)},[i,a,F,L]),H=(0,n.useCallback)(()=>{var e;if(!B)return;let t=null!==(e=i[i.length-1])&&void 0!==e?e:R;a([...i,t]),T(i.length)},[B,i,R,a]),V=(0,n.useCallback)(()=>{if(!W)return;let e=i.filter((e,t)=>t!==L);a(e),T(Math.max(0,Math.min(L,e.length-1)))},[W,i,a,L]),Z=(0,n.useCallback)(e=>{let t=L+e;if(t<0||t>=i.length)return;let r=[...i];[r[L],r[t]]=[r[t],r[L]],a(r),T(t)},[i,a,L]),Y=(0,n.useCallback)((e,t)=>{(0,m.Kz)("palette-click",{paletteId:t.id,target:null!=I?I:"color-stops"}),a(e),T(0)},[I,a]);return(0,r.jsxs)("div",{className:"space-y-4","data-testid":I,children:[(0,r.jsx)(g.q,{colorArray:i,onApply:Y,gradientDirection:C,palettes:A,"data-testid":"".concat(null!=I?I:"color-stops","-palettes")}),(0,r.jsx)(x.i,{}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"mb-2 flex items-center justify-between gap-3",children:[(0,r.jsx)("p",{className:"text-xs font-medium uppercase tracking-wide text-gray-500",children:U?"Colors (".concat(i.length,"/").concat(E.U,")"):"Transparent"}),i.length>1&&N&&(0,r.jsx)(h.U,{colors:i,value:C,onChange:N,lightArrow:k})]}),(0,r.jsxs)("div",{className:"flex h-14 w-full touch-manipulation rounded-xl border border-gray-300",children:[i.map((e,t)=>{let i=t===L;return(0,r.jsx)("button",{type:"button",onClick:()=>T(t),"aria-label":"Color ".concat(t+1,": ").concat(e),"aria-pressed":i,"data-testid":"color-stop-".concat(t),className:o()("relative flex-1 transition-transform first:rounded-l-[11px] last:rounded-r-[11px]","focus:z-10 focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 focus-visible:ring-inset",t>0&&"border-l border-black/10",i&&"z-10 scale-105 shadow-lg"),style:{backgroundColor:e},children:i&&(0,r.jsx)(s.Z,{className:o()("absolute inset-0 m-auto h-5 w-5",(0,y.eO)(e)?"text-gray-900":"text-white"),strokeWidth:3})},"stop-".concat(t))}),B&&(0,r.jsx)("button",{type:"button",onClick:H,"aria-label":"Add color","data-testid":"add-color-stop",className:o()("flex flex-1 items-center justify-center text-gray-500 transition-colors","first:rounded-l-[11px] last:rounded-r-[11px] hover:bg-gray-50 hover:text-gray-800","focus:z-10 focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 focus-visible:ring-inset",U&&"border-l border-black/10"),children:(0,r.jsx)(d.Z,{className:"h-5 w-5"})})]}),U&&(i.length>1||W)&&(0,r.jsxs)("div",{className:"mt-3 flex items-center gap-2",children:[i.length>1&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{type:"button",onClick:()=>Z(-1),disabled:0===L,"aria-label":"Move color earlier","data-testid":"move-stop-back",className:"flex h-9 w-9 items-center justify-center rounded-md border border-gray-300 text-gray-700 disabled:opacity-40",children:(0,r.jsx)(c.Z,{className:"h-5 w-5"})}),(0,r.jsx)("button",{type:"button",onClick:()=>Z(1),disabled:L===i.length-1,"aria-label":"Move color later","data-testid":"move-stop-forward",className:"flex h-9 w-9 items-center justify-center rounded-md border border-gray-300 text-gray-700 disabled:opacity-40",children:(0,r.jsx)(u.Z,{className:"h-5 w-5"})})]}),W&&(0,r.jsxs)("button",{type:"button",onClick:V,"data-testid":"remove-color-stop",className:"flex h-9 items-center gap-1.5 rounded-md px-3 text-sm font-medium text-red-600 hover:bg-red-50",children:[(0,r.jsx)(p.Z,{className:"h-4 w-4"}),"Remove"]})]})]}),(0,r.jsx)(f.O,{tabs:S,value:z,onChange:M,"data-testid":"color-stops-tabs"}),"swatches"===z&&(0,r.jsx)(v.c,{color:P,setColor:G,recentColors:O,compact:!0}),"custom"===z&&(0,r.jsx)(b.s,{color:P,onChange:(e,t)=>
1G(e,t),disableAlpha:j})]})}},79426:function(e,t,i){"use strict";i.d(t,{O:function(){return o}});var r=i(52322);i(2784);var n=i(12524),a=i.n(n);function o(e){let{tabs:t,value:i,onChange:n,"data-testid":o}=e;return(0,r.jsx)("div",{role:"tablist","data-testid":o,className:"flex w-full rounded-lg bg-gray-100 p-1",children:t.map(e=>{let t=e.id===i;return(0,r.jsx)("button",{type:"button",role:"tab","aria-selected":t,"data-testid":"color-tab-".concat(e.id),onClick:()=>n(e.id),className:a()("min-h-[2.5rem] flex-1 rounded-md px-3 text-sm font-medium transition-colors","focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500",t?"bg-white text-gray-900 shadow-sm":"text-gray-600 hover:text-gray-900"),children:e.label},e.id)})})}},32193:function(e,t,i){"use strict";i.d(t,{U:function(){return u}});var r=i(52322);i(2784);var n=i(12524),a=i.n(n),o=i(99127),l=i(93795),s=i(59637),d=i(41753);function c(e){let{kind:t,rotation:i,lightArrow:n}=e;return"radial"===t?(0,r.jsx)("span",{className:a()("h-3.5 w-3.5 rounded-full border-2 bg-white/40 shadow-sm",n?"border-white/80":"border-gray-900/80")}):(0,r.jsx)(o.mGl,{size:20,className:a()("drop-shadow-sm",n?"text-white":"text-gray-900"),style:{transform:"rotate(".concat(i,"deg)")}})}let u=e=>{var t,i;let{colors:n,value:o=l.DEFAULT_GRADIENT_DIRECTION,onChange:u,lightArrow:p}=e,m=null!==(i=null!==(t=l.GRADIENT_DIRECTIONS.find(e=>e.value===o))&&void 0!==t?t:l.GRADIENT_DIRECTIONS.find(e=>e.value===l.DEFAULT_GRADIENT_DIRECTION))&&void 0!==i?i:l.GRADIENT_DIRECTIONS[5];return(0,r.jsxs)(s.h_,{children:[(0,r.jsx)(s.$F,{asChild:!0,children:(0,r.jsx)("button",{type:"button",className:"inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-md border border-indigo-600 p-0.5 transition-colors hover:border-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500","aria-label":"Gradient direction: ".concat(m.label),title:"Gradient direction",children:(0,r.jsx)("span",{className:"flex h-full w-full items-center justify-center rounded-[3px]",style:{background:(0,d.Q)(n,o)},children:(0,r.jsx)(c,{kind:m.kind,rotation:m.rotation,lightArrow:p})})})}),(0,r.jsx)(s.AW,{align:"end",className:"min-w-0 overflow-visible p-3 !shadow-lg",children:(0,r.jsx)("div",{className:"grid grid-cols-3 gap-2",children:l.GRADIENT_DIRECTIONS.map(e=>(0,r.jsx)(s.Xi,{className:a()("h-14 w-14 justify-center rounded-lg border p-0 focus:bg-indigo-50",e.value===o?"border-indigo-600":"border-gray-200"),onSelect:t=>{t.preventDefault(),u(e.value)},"aria-label":e.label,style:{gridColumn:e.gridColumn,gridRow:e.gridRow},children:(0,r.jsx)("span",{className:"flex h-12 w-12 items-center justify-center rounded-md",style:{background:(0,d.Q)(n,e.value)},children:(0,r.jsx)(c,{kind:e.kind,rotation:e.rotation,lightArrow:p})})},e.value))})})]})}},73100:function(e,t,i){"use strict";i.d(t,{q:function(){return m}});var r=i(52322),n=i(2784),a=i(12524),o=i.n(a),l=i(32434),s=i(42670),d=i(93795),c=i(12443),u=i(41753),p=i(4280);let m=e=>{let{colorArray:t,onApply:i,gradientDirection:a,palettes:m=c.m,"data-testid":f}=e,x=null!=a?a:d.DEFAULT_GRADIENT_DIRECTION,h=(0,n.useCallback)(e=>{i([...e.colors],e)},[i]);return(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"mb-2 text-xs font-medium uppercase tracking-wide text-gray-500",children:(0,r.jsx)(s.Z,{id:"Editor.Menu.Colors.Palettes",defaultMessage:"Palettes"})}),(0,r.jsx)("div",{className:"grid grid-cols-3 gap-2 sm:grid-cols-4 lg:grid-cols-4","data-testid":f,children:m.map(e=>{var i;let n=e.colors.length===t.length&&e.colors.every((e,i)=>(0,p.tr)(e)===(0,p.tr)(t[i])),a=e.colors.length>1?(0,u.Q)(e.colors,x):e.colors[0],s=null!==(i=e.colors[Math.floor(e.colors.length/2)])&&void 0!==i?i:"#FFFFFF";return(0,r.jsxs)("button",{type:"button",onClick:()=>h(e),"aria-label":e.label,"aria-pressed":n,title:e.label,"data-testid":"palette-".concat(e.id),className:o()("relative flex h-12 w-full cursor-pointer items-end justify-center overflow-hidden","rounded-lg p-0 transition-transform active:scale-95 lg:h-11 lg:hover:scale-105","focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500",n?"ring-2 ring-indigo-600 ring-offset-2":"shadow-[inset_0_0_0_1px_rgba(0,0,0,0.15)]"),style:{background:a},children:[n&&(0,r.jsx)(l.Z,{className:o()("absolute left-1/2 top-1/2 h-5 w-5 -translate-x-1/2 -translate-y-1/2",(0,p.eO)(s)?"text-gray-900":"text-white"),strokeWidth:3}),(0,r.jsx)("span",{className:"pointer-events-none w-full truncate bg-black/45 px-1 py-[3px] text-[10px] font-medium leading-none text-white",children:e.label})]},e.id)})})]})}},90317:function(e,t,i){"use strict";i.d(t,{c:function(){return c}});var r=i(52322);i(2784);var n=i(32434),a=i(12524),o=i.n(a),l=i(27974),s=i(4280);let d=e=>{let{hex:t,label:i,selected:a,onSelect:l}=e;return(0,r.jsx)("button",{type:"button",onClick:()=>l(t),"aria-label":i,"aria-pressed":a,title:i,"data-testid":"swatch-".concat(t.replace("#","").toLowerCase()),className:o()("relative flex h-11 w-full touch-manipulation items-center justify-center rounded-lg lg:h-9","transition-transform focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500","active:scale-95 lg:hover:scale-110",a&&"ring-2 ring-indigo-600 ring-offset-2"),style:{backgroundColor:t,boxShadow:"inset 0 0 0 1px ".concat((0,s.BR)(t))},children:a&&(0,r.jsx)(n.Z,{className:o()("h-4 w-4",(0,s.eO)(t)?"text-gray-900":"text-white"),strokeWidth:3})})},c=e=>{let{color:t,setColor:i,recentColors:n,compact:a,className:c}=e,u=e=>i(e,1),p=o()("grid gap-1.5 grid-cols-6",{"lg:grid-cols-12":!a});return(0,r.jsxs)("div",{className:o()("space-y-4",c),"data-testid":"swatch-grid",children:[n&&n.length>0&&(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"mb-2 text-xs font-medium uppercase tracking-wide text-gray-500",children:"Recent"}),(0,r.jsx)("div",{className:p,children:n.map(e=>(0,r.jsx)(d,{hex:e,label:"Recent colour ".concat(e),selected:(0,s.YQ)(e,t),onSelect:u},"recent-".concat(e)))})]}),(0,r.jsx)("div",{className:o()(p,{"max-h-[45vh] overflow-y-auto overscroll-contain pr-1":!a}),children:l.L.flatMap(e=>e.swatches.map(i=>(0,r.jsx)(d,{hex:i.hex,label:i.label,selected:(0,s.YQ)(i.hex,t),onSelect:u},"".concat(e.id,"-").concat(i.hex))))})]})}},29020:function(e,t,i){"use strict";i.d(t,{s:function(){return g}});var r=i(52322),n=i(2784),a=i(75210),o=i(12524),l=i.n(o);function s(e){let t=e.trim().replace("#","");if(8!==t.length)return 1;let i=parseInt(t.slice(6,8),16);return Number.isNaN(i)?1:i/255}function d(e){return Math.round(Math.min(255,Math.max(0,e))).toString(16).padStart(2,"0").toUpperCase()}function c(e){let t,{h:i,s:r,v:n}=e,a=(i%360+360)%360,o=n*r,l=o*(1-Math.abs(a/60%2-1)),s=n-o;return{r:((t=a<60?[o,l,0]:a<120?[l,o,0]:a<180?[0,o,l]:a<240?[0,l,o]:a<300?[l,0,o]:[o,0,l])[0]+s)*255,g:(t[1]+s)*255,b:(t[2]+s)*255}}function u(e){return function(e){let{r:t,g:i,b:r}=e,n=t/255,a=i/255,o=r/255,l=Math.max(n,a,o),s=l-Math.min(n,a,o),d=0;return 0!==s&&(d=(l===n?(a-o)/s%6:l===a?(o-n)/s+2:(n-a)/s+4)*60)<0&&(d+=360),{h:d,s:0===l?0:s/l,v:l}}(function(e){let t=e.trim().replace("#",""),i=3===t.length?t.split("").map(e=>e+e).join(""):t,r=parseInt(i.slice(0,2),16),n=parseInt(i.slice(2,4),16),a=parseInt(i.slice(4,6),16);return Number.isNaN(r)||Number.isNaN(n)||Number.isNaN(a)?{r:0,g:0,b:0}:{r,g:n,b:a}}(e))}function p(e){return function(e){let{r:t,g:i,b:r}=e;return"#".concat(d(t)).concat(d(i)).concat(d(r))}(c(e))}var m=i(4280);function f(){var e;return null!==(e=window.EyeDropper)&&void 0!==e?e:null}function x(e){return Math.min(1,Math.max(0,e))}function h(e){let t=(0,n.useRef)(null),i=(0,n.useCallback)((i,r)=>{let n=t.current;if(!n)return;let a=n.getBoundingClientRect();0!==a.width&&0!==a.height&&e(x((i-a.left)/a.width),x((r-a.top)/a.height))},[e]),r=(0,n.useCallback)(e=>{e.currentTarget.setPointerCapture(e.pointerId),i(e.clientX,e.clientY)},[i]),a=(0,n.useCallback)(e=>{e.currentTarget.hasPointerCapture(e.pointerId)&&i(e.clientX,e.clientY)},[i]),o=(0,n.useCallback)(e=>{e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId)},[]);return{ref:t,handlers:{onPointerDown:r,onPointerMove:a,onPointerUp:o,onPointerCancel:o}}}let g=e=>{var t;let{color:i,onChange:o,disableAlpha:d}
1=e,[x,g]=(0,n.useState)(()=>u(i)),[v,b]=(0,n.useState)(()=>s(i)),[E,y]=(0,n.useState)(null),w=(0,n.useRef)(p(u(i))),S=null!==(t=(0,m.kB)(i))&&void 0!==t?t:"#000000",j=s(i);(0,n.useEffect)(()=>{S!==w.current&&(w.current=S,g(u(S)))},[S]),(0,n.useEffect)(()=>{b(e=>Math.abs(e-j)>1/255?j:e)},[j]);let C=(0,n.useCallback)((e,t)=>{let i=p(e);w.current=i,g(e),b(t),o(i,t)},[o]),N=(0,n.useCallback)((e,t)=>C({...x,s:e,v:1-t},v),[v,C,x]),_=(0,n.useCallback)(e=>C({...x,h:360*e},v),[v,C,x]),R=(0,n.useCallback)(e=>C(x,e),[C,x]),A=h(N),k=h(_),I=h(R),z=p(x),M=function(e){let{r:t,g:i,b:r}=c(e);return"rgb(".concat(Math.round(t),", ").concat(Math.round(i),", ").concat(Math.round(r),")")}({h:x.h,s:1,v:1}),D=(0,n.useMemo)(f,[]),T=(0,n.useCallback)(e=>{let t=(0,m.kB)(e);t&&C(u(t),v)},[v,C]),O=(0,n.useCallback)(async()=>{if(D)try{let{sRGBHex:e}=await new D().open();T(e)}catch(e){}},[T,D]);return(0,r.jsxs)("div",{className:"space-y-3","data-testid":"touch-color-picker",children:[(0,r.jsxs)("div",{ref:A.ref,...A.handlers,role:"presentation","data-testid":"saturation-area",className:"relative h-40 w-full cursor-crosshair touch-none overflow-hidden rounded-lg sm:h-44",style:{backgroundColor:M},children:[(0,r.jsx)("div",{className:"absolute inset-0",style:{background:"linear-gradient(to right, #fff, rgba(255,255,255,0))"}}),(0,r.jsx)("div",{className:"absolute inset-0",style:{background:"linear-gradient(to top, #000, rgba(0,0,0,0))"}}),(0,r.jsx)("div",{className:"pointer-events-none absolute h-5 w-5 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-white shadow-[0_0_0_1px_rgba(0,0,0,0.4)]",style:{left:"".concat(100*x.s,"%"),top:"".concat((1-x.v)*100,"%"),backgroundColor:z}})]}),(0,r.jsx)("div",{ref:k.ref,...k.handlers,role:"presentation","data-testid":"hue-slider",className:"relative h-6 w-full cursor-pointer touch-none rounded-full",style:{background:"linear-gradient(to right, #FF0000, #FFFF00, #00FF00, #00FFFF, #0000FF, #FF00FF, #FF0000)"},children:(0,r.jsx)("div",{className:"pointer-events-none absolute top-1/2 h-7 w-7 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-white shadow-[0_0_0_1px_rgba(0,0,0,0.35)]",style:{left:"".concat(x.h/360*100,"%"),backgroundColor:M}})}),!d&&(0,r.jsxs)("div",{ref:I.ref,...I.handlers,role:"presentation","data-testid":"alpha-slider",className:"relative h-6 w-full cursor-pointer touch-none overflow-hidden rounded-full",style:{background:"repeating-conic-gradient(#d4d4d4 0% 25%, #ffffff 0% 50%) 50% / 12px 12px"},children:[(0,r.jsx)("div",{className:"absolute inset-0",style:{background:"linear-gradient(to right, rgba(0,0,0,0), ".concat(z,")")}}),(0,r.jsx)("div",{className:"pointer-events-none absolute top-1/2 h-7 w-7 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-white shadow-[0_0_0_1px_rgba(0,0,0,0.35)]",style:{left:"".concat(100*v,"%"),backgroundColor:z}})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsxs)("label",{className:"flex flex-1 items-center gap-2 rounded-lg border border-gray-300 px-3 py-2 focus-within:border-indigo-500",children:[(0,r.jsx)("span",{className:"text-sm font-medium text-gray-500",children:"Hex"}),(0,r.jsx)("input",{type:"text",inputMode:"text",autoCapitalize:"characters",autoCorrect:"off",spellCheck:!1,maxLength:7,"aria-label":"Hex colour value","data-testid":"hex-input",className:"w-full min-w-0 border-0 bg-transparent p-0 text-base uppercase text-gray-900 outline-none focus:ring-0",value:null!=E?E:z,onChange:e=>{let{value:t}=e.target;y(t),T(t)},onBlur:()=>y(null)})]}),D&&(0,r.jsx)("button",{type:"button",onClick:O,"aria-label":"Pick a colour from the screen","data-testid":"eyedropper-button",className:l()("flex h-11 w-11 shrink-0 items-center justify-center rounded-lg border border-gray-300","text-gray-600 transition-colors hover:border-gray-400 hover:text-gray-900"),children:(0,r.jsx)(a.Z,{className:"h-5 w-5"})})]})]})}},12443:function(e,t,i){"use strict";i.d(t,{U:function(){return r},m:function(){return n}});let r=5,n=[{id:"reef",label:"Reef",colors:["#0E9AA7","#3DA4AB","#F6CD61","#FE8A71"]},{id:"peony",label:"Peony",colors:["#BE8ABF","#EA9ABB","#FEA5AD","#F8C3AF"]},{id:"sea-glass",label:"Sea Glass",colors:["#ED8E7C","#ECE2E1","#D3E0DC","#AEE1E1"]},{id:"sorbet",label:"Sorbet",colors:["#C6E7A6","#E7E7A6","#E7C6A6","#E7A6C2"]},{id:"wildflower",label:"Wildflower",colors:["#A03C78","#ED8E7C","#CDF3A2","#93D9A3"]},{id:"voltage",label:"Voltage",colors:["#791CFD","#39ACF6"]},{id:"graphite",label:"Graphite",colors:["#FFFFFF","#737373","#171717"]},{id:"midnight",label:"Midnight",colors:["#171717","#312E81","#0C4A6E"]},{id:"sunset",label:"Sunset",colors:["#FF5F6D","#FF9966","#FFC371","#7B4397"]},{id:"ocean",label:"Ocean",colors:["#012E4A","#036280","#1AA5B7","#7FE3D4"]},{id:"forest",label:"Forest",colors:["#1B4332","#2D6A4F","#74C69D","#D8F3DC"]},{id:"blush",label:"Blush",colors:["#FFF1F2","#FECDD3","#F9A8B4","#E6849A"]},{id:"terracotta",label:"Terracotta",colors:["#7C3A2D","#B45A3C","#E08E5F","#F2D3B6"]},{id:"neon",label:"Neon",colors:["#00F5D4","#00BBF9","#9B5DE5","#F15BB5"]}
1,{id:"berry",label:"Berry",colors:["#3D0B37","#7B2D5E","#C2417A","#F294B8"]},{id:"gold",label:"Gold",colors:["#3D2E00","#8A6A16","#D4A72C","#F3DFA2"]},{id:"mint",label:"Mint",colors:["#0B5D51","#2A9D8F","#7FD8BE","#D6F5EC"]},{id:"lavender",label:"Lavender",colors:["#312E81","#6D5FD5","#A78BFA","#E9D5FF"]},{id:"ember",label:"Ember",colors:["#7F1D1D","#F59E0B"]},{id:"arctic",label:"Arctic",colors:["#0C4A6E","#38BDF8","#E0F2FE"]}]},27974:function(e,t,i){"use strict";i.d(t,{L:function(){return r}});let r=[{id:"base",label:"Neutral",swatches:[{hex:"#FFFFFF",label:"White"},{hex:"#F5F5F5",label:"Off white"},{hex:"#D4D4D4",label:"Light grey"},{hex:"#737373",label:"Grey"},{hex:"#262626",label:"Charcoal"},{hex:"#000000",label:"Black"}]},{id:"stone",label:"Warm grey",swatches:[{hex:"#FAFAF9",label:"Warm grey 50"},{hex:"#E7E5E4",label:"Warm grey 200"},{hex:"#A8A29E",label:"Warm grey 400"},{hex:"#57534E",label:"Warm grey 600"},{hex:"#292524",label:"Warm grey 800"},{hex:"#0C0A09",label:"Warm grey 950"}]},{id:"slate",label:"Cool grey",swatches:[{hex:"#F8FAFC",label:"Cool grey 50"},{hex:"#E2E8F0",label:"Cool grey 200"},{hex:"#94A3B8",label:"Cool grey 400"},{hex:"#475569",label:"Cool grey 600"},{hex:"#1E293B",label:"Cool grey 800"},{hex:"#020617",label:"Cool grey 950"}]},{id:"red",label:"Red",swatches:[{hex:"#FEF2F2",label:"Red 50"},{hex:"#FECACA",label:"Red 200"},{hex:"#F87171",label:"Red 400"},{hex:"#DC2626",label:"Red 600"},{hex:"#991B1B",label:"Red 800"},{hex:"#450A0A",label:"Red 950"}]},{id:"orange",label:"Orange",swatches:[{hex:"#FFF7ED",label:"Orange 50"},{hex:"#FED7AA",label:"Orange 200"},{hex:"#FB923C",label:"Orange 400"},{hex:"#EA580C",label:"Orange 600"},{hex:"#9A3412",label:"Orange 800"},{hex:"#431407",label:"Orange 950"}]},{id:"amber",label:"Amber",swatches:[{hex:"#FFFBEB",label:"Amber 50"},{hex:"#FDE68A",label:"Amber 200"},{hex:"#FBBF24",label:"Amber 400"},{hex:"#D97706",label:"Amber 600"},{hex:"#92400E",label:"Amber 800"},{hex:"#451A03",label:"Amber 950"}]},{id:"yellow",label:"Yellow",swatches:[{hex:"#FEFCE8",label:"Yellow 50"},{hex:"#FEF08A",label:"Yellow 200"},{hex:"#FACC15",label:"Yellow 400"},{hex:"#CA8A04",label:"Yellow 600"},{hex:"#854D0E",label:"Yellow 800"},{hex:"#422006",label:"Yellow 950"}]},{id:"lime",label:"Lime",swatches:[{hex:"#F7FEE7",label:"Lime 50"},{hex:"#D9F99D",label:"Lime 200"},{hex:"#A3E635",label:"Lime 400"},{hex:"#65A30D",label:"Lime 600"},{hex:"#3F6212",label:"Lime 800"},{hex:"#1A2E05",label:"Lime 950"}]},{id:"green",label:"Green",swatches:[{hex:"#F0FDF4",label:"Green 50"},{hex:"#BBF7D0",label:"Green 200"},{hex:"#4ADE80",label:"Green 400"},{hex:"#16A34A",label:"Green 600"},{hex:"#166534",label:"Green 800"},{hex:"#052E16",label:"Green 950"}]},{id:"teal",label:"Teal",swatches:[{hex:"#F0FDFA",label:"Teal 50"},{hex:"#99F6E4",label:"Teal 200"},{hex:"#2DD4BF",label:"Teal 400"},{hex:"#0D9488",label:"Teal 600"},{hex:"#115E59",label:"Teal 800"},{hex:"#042F2E",label:"Teal 950"}]},{id:"sky",label:"Sky",swatches:[{hex:"#F0F9FF",label:"Sky 50"},{hex:"#BAE6FD",label:"Sky 200"},{hex:"#38BDF8",label:"Sky 400"},{hex:"#0284C7",label:"Sky 600"},{hex:"#075985",label:"Sky 800"},{hex:"#082F49",label:"Sky 950"}]},{id:"blue",label:"Blue",swatches:[{hex:"#EFF6FF",label:"Blue 50"},{hex:"#BFDBFE",label:"Blue 200"},{hex:"#60A5FA",label:"Blue 400"},{hex:"#2563EB",label:"Blue 600"},{hex:"#1E40AF",label:"Blue 800"},{hex:"#172554",label:"Blue 950"}]},{id:"indigo",label:"Indigo",swatches:[{hex:"#EEF2FF",label:"Indigo 50"},{hex:"#C7D2FE",label:"Indigo 200"},{hex:"#818CF8",label:"Indigo 400"},{hex:"#4F46E5",label:"Indigo 600"},{hex:"#3730A3",label:"Indigo 800"},{hex:"#1E1B4B",label:"Indigo 950"}]},{id:"violet",label:"Violet",swatches:[{hex:"#F5F3FF",label:"Violet 50"},{hex:"#DDD6FE",label:"Violet 200"},{hex:"#A78BFA",label:"Violet 400"},{hex:"#7C3AED",label:"Violet 600"},{hex:"#5B21B6",label:"Violet 800"},{hex:"#2E1065",label:"Violet 950"}]},{id:"fuchsia",label:"Fuchsia",swatches:[{hex:"#FDF4FF",label:"Fuchsia 50"},{hex:"#F5D0FE",label:"Fuchsia 200"},{hex:"#E879F9",label:"Fuchsia 400"},{hex:"#C026D3",label:"Fuchsia 600"},{hex:"#86198F",label:"Fuchsia 800"},{hex:"#4A044E",label:"Fuchsia 950"}]},{id:"pink",label:"Pink",swatches:[{hex:"#FDF2F8",label:"Pink 50"},{hex:"#FBCFE8",label:"Pink 200"},{hex:"#F472B6",label:"Pink 400"},{hex:"#DB2777",label:"Pink 600"},{hex:"#9D174D",label:"Pink 800"},{hex:"#500724",label:"Pink 950"}]},{id:"rose",label:"Rose",swatches:[{hex:"#FFF1F2",label:"Rose 50"},{hex:"#FECDD3",label:"Rose 200"},{hex:"#FB7185",label:"Rose 400"},{hex:"#E11D48",label:"Rose 600"},{hex:"#9F1239",label:"Rose 800"},{hex:"#4C0519",label:"Rose 950"}]}];r.flatMap(e=>e.swatches)},4280:function(e,t,i){"use strict";i.d(t,{BR:function(){return d},YQ:function(){return a},eO:function(){return s},kB:function(){return o},tr:function(){return n}});let r=/^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/;function n(e){let t=e.trim().toUpperCase();return 7===t.length?"".concat(t,"FF"):t}function a(e,t){return n(e)===n(t)}function o(e){let t=e.trim().replace(/^#/,"");if(!r.test(t.trim()))return null;if(3===t.length){let[e,i,r]=t.split("");
1return"#".concat(e).concat(e).concat(i).concat(i).concat(r).concat(r).toUpperCase()}return"#".concat(t.slice(0,6)).toUpperCase()}function l(e){let t=n(e).replace("#","");if(t.length<6)return 1;let i=parseInt(t.slice(0,2),16),r=parseInt(t.slice(2,4),16),a=parseInt(t.slice(4,6),16),o=8===t.length?parseInt(t.slice(6,8),16)/255:1;return[i,r,a].some(Number.isNaN)?1:(.2126*i+.7152*r+.0722*a)/255*o+(1-o)}function s(e){return l(e)>.6}function d(e){return l(e)>.85?"rgba(0, 0, 0, 0.25)":"rgba(0, 0, 0, 0.1)"}},41753:function(e,t,i){"use strict";i.d(t,{Q:function(){return n}});let r=["#ffffff","#e5e7eb"];function n(e,t){let i=e.length>1?e:r;if("radial"===t)return"radial-gradient(circle, ".concat(i.join(", "),")");let n=t.replace(/^to-/,"to ").replace(/-/g," ");return"linear-gradient(".concat(n,", ").concat(i.join(", "),")")}},3420:function(e,t,i){"use strict";i.d(t,{zH:function(){return h},e9:function(){return N}});var r=i(52322),n=i(2784),a=i(28316),o=i(99127),l=i(79130),s=i.n(l),d=i(21749),c=i(3752),u=i(95058),p=i.n(u),m=i(6968),f=i(64818);let x=s().bind(p()),h=e=>{let{onChange:t,disableAlpha:i,color:l,onRemove:s,"data-testid":u,startOpen:p,readonly:h,onOpenChange:g,size:v}=e,b=(0,c.d)(),[E,y]=(0,n.useState)(p||!1),w=null!=v?v:b?42:36,S=(0,n.useRef)(null),j=(0,n.useRef)(null),[C,N]=(0,n.useState)(null),_=(0,n.useCallback)((e,i)=>{let r=new d.fabric.Color(e);i&&r.setAlpha(i),t("#".concat(r.toHexa()))},[t]),R=(0,n.useCallback)(()=>{y(!1),null==g||g(!1)},[g]);(0,n.useEffect)(()=>{if(E&&!b)return window.document.addEventListener("mousedown",e,{passive:!0}),()=>{window.document.removeEventListener("mousedown",e)};function e(e){var t,i;let r=e.target;(null===(t=S.current)||void 0===t?void 0:t.contains(r))||(null===(i=j.current)||void 0===i?void 0:i.contains(r))||R()}},[E,b,R]),(0,n.useLayoutEffect)(()=>{if(!E||b||!S.current){N(null);return}let e=()=>{S.current&&N(function(e){let t=e.getBoundingClientRect(),i=t.bottom+8,r=Math.max(160,Math.min(560,window.innerHeight-i-16));return{top:i,left:Math.min(Math.max(16,t.left-10),window.innerWidth-300-16),maxHeight:r}}(S.current))};return e(),window.addEventListener("resize",e),window.addEventListener("scroll",e,!0),()=>{window.removeEventListener("resize",e),window.removeEventListener("scroll",e,!0)}},[E,b]);let A=(0,n.useCallback)(()=>{E?(y(!1),null==g||g(!1),s&&s()):(y(!0),null==g||g(!0))},[s,E,g]),k=!h&&E&&!b&&C?(0,a.createPortal)((0,r.jsx)("div",{ref:j,className:x("color-picker-wrapper"),"data-testid":"color-picker-popup",style:{to
1p:C.top,left:C.left,width:300,maxHeight:C.maxHeight},children:(0,r.jsx)("div",{className:"p-3",children:(0,r.jsx)(f.J,{color:l,setColor:_,disableAlpha:i,padding:!1,compact:!0})})}),document.body):null;return(0,r.jsxs)("span",{className:x("colorCircleWrapper"),ref:S,children:[(0,r.jsx)("span",{className:x("colorCircle",{readonly:h}),style:{width:w,height:w,lineHeight:w,boxShadow:"".concat(l," 0px 0px 0px ").concat(E?"3":w/2,"px inset")},onClick:h?void 0:A,"data-testid":u,children:E&&s&&(0,r.jsx)(o.VPh,{fontSize:18})}),!h&&b&&(0,r.jsx)(m.i,{visible:E,onClose:()=>{y(!1),null==g||g(!1)},color:l,onChange:t,onRemove:s,disableAlpha:i}),k]})};var g=i(43034),v=i(78958),b=i(13699),E=i(50085),y=i(12524),w=i.n(y),S=i(93795),j=i(41753);let C=e=>{let{colors:t,gradientDirection:i,onOpen:n,"data-testid":a}=e,o=t.length>0,l=null!=i?i:S.DEFAULT_GRADIENT_DIRECTION,s=t.length>1?(0,j.Q)(t,l):t[0],d=o?"".concat(t.length," colour").concat(t.length>1?"s":""):"Transparent";return(0,r.jsxs)("button",{type:"button",onClick:n,"data-testid":a,className:w()("relative flex h-14 w-full touch-manipulation items-center justify-between overflow-hidden rounded-xl","border border-gray-300 transition-colors hover:border-gray-400","focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500"),style:{background:o?s:"repeating-conic-gradient(#d4d4d4 0% 25%, #ffffff 0% 50%) 50% / 16px 16px"},children:[(0,r.jsx)("span",{className:"ml-3 rounded-md bg-black/45 px-2 py-1 text-xs font-medium text-white",children:d}),(0,r.jsxs)("span",{className:"flex h-full items-center gap-1.5 bg-black/45 pl-3 pr-3.5 text-sm font-medium text-white",children:[(0,r.jsx)(E.Z,{className:"h-4 w-4"}),"Edit"]})]})},N=e=>{let{title:t,colorArray:i,setColorArray:a,disableAlpha:o,canBeTransparent:l=!1,gradientDirection:s,setGradientDirection:d,lightArrow:u,palettes:p,target:m,"data-testid":f,defaultColor:x}=e,h=(0,c.d)(),[E,y]=(0,n.useState)(!1),{setShownTab:w}=(0,n.useContext)(g.q5),S=(0,n.useCallback)(()=>{h?y(!0):w(v.e.colorStopsPicker,{target:m})},[h,w,m]),j=t?(0,r.jsx)("p",{className:"mb-3 text-sm text-gray-900",children:t}):null;return(0,r.jsxs)(r.Fragment,{children:[j,(0,r.jsx)(C,{colors:i,gradientDirection:s,onOpen:S,"data-testid":f}),h&&(0,r.jsx)(b.g,{visible:E,onClose:()=>y(!1),title:t,colors:i,onColorsChange:a,disableAlpha:o,canBeTransparent:l,gradientDirection:s,onGradientDirectionChange:d,defaultColor:x,palettes:p,lightArrow:u,"data-testid":"".concat(f,"-editor")})]})};i(88745),i(32193),i(73100),i(90317),i(29020),i(12443),i(27974)},81582:function(e,t,i){"use strict";i.d(t,{h:function(){return l}});var r=i(2784);let n="wv-recent-colors";function a(e){let t=e.trim().toUpperCase();return 7===t.length?"".concat(t,"FF"):t}function o(e){return/^#[0-9A-F]{6}([0-9A-F]{2})?$/.test(e.trim().toUpperCase())}function l(){let[e,t]=(0,r.useState)([]),i=(0,r.useRef)(null);(0,r.useEffect)(()=>{t(function(){try{let e=window.localStorage.getItem(n);if(!e)return[];let t=JSON.parse(e);if(!Array.isArray(t))return[];return t.filter(e=>"string"==typeof e&&o(e)).slice(0,12)}catch(e){return[]}}())},[]),(0,r.useEffect)(()=>()=>{i.current&&clearTimeout(i.current)},[]);let l=(0,r.useCallback)(e=>{if(!o(e))return;let i=a(e);t(e=>{let t=[i,...e.filter(e=>a(e)!==i)].slice(0,12);return!function(e){try{window.localStorage.setItem(n,JSON.stringify(e))}catch(e){}}(t),t})},[]);return{recentColors:e,rememberColor:(0,r.useCallback)(e=>{i.current&&clearTimeout(i.current),i.current=setTimeout(()=>l(e),600)},[l])}}},97065:function(e,t,i){"use strict";i.d(t,{k:function(){return o}});var r=i(52322);i(2784);var n=i(21353),a=i(19994);let o=e=>{let{theme:t,className:i,size:o}=e;return(0,r.jsx)(n.z,{theme:t||"primary",onClick:()=>{window.location.href="/editor"},"aria-label":"New design",icon:a.Zw4,iconSize:22,className:i,size:o,children:(0,r.jsx)("span",{className:"ml-1",children:"New design"})})}},16991:function(e,t,i){"use strict";i.d(t,{Xz:function(){return y},FX:function(){return b.F}});var r=i(52322),n=i(2784),a=i(21749),o=i(54073),l=i.n(o),s=i(62995),d=i(3741),c=i(53093),u=i(48025),p=i(38986);let m=new Set([p.BG_COLOR_OBJECT_NAME,p.BG_IMAGE_OBJECT_NAME,p.LEFT_RECT_OBJECT_NAME,p.RIGHT_RECT_OBJECT_NAME,p.TOP_RECT_OBJECT_NAME,p.BOTTOM_RECT_OBJECT_NAME,p.FRAME_OBJECT_NAME]);function f(e){return Object.keys(e)}class x{setLineMargin(e){this.aligningLineMargin=e}drawSign(e,t){let{ctx:i}=this;
1i.lineWidth=.5,i.strokeStyle=this.aligningLineColor,i.beginPath(),i.moveTo(e-2,t-2),i.lineTo(e+2,t+2),i.moveTo(e+2,t-2),i.lineTo(e-2,t+2),i.stroke()}drawLine(e,t,i,r){let{ctx:n}=this,o=this.canvas.viewportTransform||[1,0,0,1,0,0],l=a.fabric.util.transformPoint(new a.fabric.Point(e,t),o),s=a.fabric.util.transformPoint(new a.fabric.Point(i,r),o);n.save(),n.lineWidth=this.aligningLineWidth,n.strokeStyle=this.aligningLineColor,n.beginPath(),n.moveTo(l.x,l.y),n.lineTo(s.x,s.y),n.stroke(),this.drawSign(l.x,l.y),this.drawSign(s.x,s.y),n.restore()}drawVerticalLine(e){let t=this.getObjDraggingObjCoords(this.activeObj);f(t).some(i=>1e-4>Math.abs(t[i].x-e.x))&&this.drawLine(e.x,Math.min(e.y1,e.y2),e.x,Math.max(e.y1,e.y2))}drawHorizontalLine(e){let t=this.getObjDraggingObjCoords(this.activeObj);f(t).some(i=>1e-4>Math.abs(t[i].y-e.y))&&this.drawLine(Math.min(e.x1,e.x2),e.y,Math.max(e.x1,e.x2),e.y)}isInRange(e,t){return Math.abs(Math.round(e)-Math.round(t))<=this.aligningLineMargin/this.canvas.getZoom()}clearLinesMeta(){this.verticalLines.length=0,this.horizontalLines.length=0}getObjDraggingObjCoords(e){e.aCoords||e.setCoords();let t=e.aCoords;if(!(null==t?void 0:t.tl)||!(null==t?void 0:t.br)){let t=e.getCenterPoint();return{tl:t,tr:t,br:t,bl:t,c:t}}let i=Object.keys(t),r=new a.fabric.Point((t.tl.x+t.br.x)/2,(t.tl.y+t.br.y)/2),n=r.x-e.getCenterPoint().x,o=r.y-e.getCenterPoint().y;return i.reduce((e,i)=>{let r=t[i];return{...e,[i]:new a.fabric.Point(r.x-n,r.y-o)}},{c:e.getCenterPoint()})}omitCoords(e,t){let i=Object.keys(e).filter(e=>"c"!==e);if("vertical"===t){let t=i[0],r=i[0];return i.forEach(i=>{e[i].x<e[t].x&&(t=i),e[i].x>e[r].x&&(r=i)}),{[t]:e[t],[r]:e[r],c:e.c}}let r=i[0],n=i[0];return i.forEach(t=>{e[t].y<e[r].y&&(r=t),e[t].y>e[n].y&&(n=t)}),{[r]:e[r],[n]:e[n],c:e.c}}getObjMaxWidthHeightByCoords(e){var t;let{c:i,tl:r}=e,n=null!==(t=e.tr)&&void 0!==t?t:r;return{objHeight:2*Math.max(Math.abs(i.y-r.y),Math.abs(i.y-n.y)),objWidth:2*Math.max(Math.abs(i.x-r.x),Math.abs(i.x-n.x))}}calcCenterPointByACoords(e){return new a.fabric.Point((e.tl.x+e.br.x)/2,(e.tl.y+e.br.y)/2)}traverseAllObjects(e,t){let i=this.getObjDraggingObjCoords(e),r=[],n=[];for(let a=t.length;a--;)if(t[a]!==e){let o=t[a];o.setCoords();let l={...o.aCoords,c:o.getCenterPoint()},{objHeight:s,objWidth:d}=this.getObjMaxWidthHeightByCoords(l);f(i).forEach(t=>{let r=0!==o.angle?this.omitCoords(l,"horizontal"):l,a=(e,i)=>"c"===e?{x1:Math.min(l.c.x-d/2,i[t].x),x2:Math.max(l.c.x+d/2,i[t].x)}:{x1:Math.min(l[e].x,i[t].x),x2:Math.max(l[e].x,i[t].x)};f(r).forEach(r=>{if(this.isInRange(i[t].y,l[r].y)){let o=l[r].y,{x1:s,x2:d}=a(r,i),c=i[t].y-o;if(n.push(i.c.y-c),e.aCoords){let t=e.aCoords,i=a(r,{...t,c:this.calcCenterPointByACoords(t)});s=i.x1,d=i.x2,this.horizontalLines.push({y:o,x1:s,x2:d})}else this.horizontalLines.push({y:o,x1:s,x2:d})}})}),f(i).forEach(t=>{let n=0!==o.angle?this.omitCoords(l,"vertical"):l,a=(e,i)=>"c"===e?{y1:Math.min(n.c.y-s/2,i[t].y),y2:Math.max(n.c.y+s/2,i[t].y)}:{y1:Math.min(l[e].y,i[t].y),y2:Math.max(l[e].y,i[t].y)};f(n).forEach(n=>{if(this.isInRange(i[t].x,l[n].x)){let o=l[n].x,{y1:s,y2:d}=a(n,i),c=i[t].x-o;if(r.push(i.c.x-c),e.aCoords){let t=e.aCoords,i=a(n,{...t,c:this.calcCenterPointByACoords(t)});s=i.y1,d=i.y2,this.verticalLines.push({x:o,y1:s,y2:d})}else this.verticalLines.push({x:o,y1:s,y2:d})}})}),this.snap({activeObject:e,draggingObjCoords:i,snapXPoints:r,snapYPoints:n})}}snap(e){let t=(e,t)=>e.length?e.map(e=>({abs:Math.abs(t-e),val:e})).sort((e,t)=>e.abs-t.abs)[0].val:t,{activeObject:i,snapXPoints:r,draggingObjCoords:n,snapYPoints:o}=e;i.setPositionByOrigin(new a.fabric.Point(t(r,n.c.x),t(o,n.c.y)),"center","center"),i.setCoords()}clearGuidelineOverlay(){this.canvas.clearContext(this.ctx)}init(){this.canvas.on("mouse:down",this.handleMouseDown),this.canvas.on("mouse:up",this.handleMouseUp),this.canvas.on("mouse:wheel",this.handleMouseWheel),this.canvas.on("object:moving",this.handleObjectMoving),this.canvas.on("before:render",this.handleBeforeRender),this.canvas.on("after:render",this.handleAfterRender)}dispose(){this.disposed||(this.disposed=!0,this.canvas.off("mouse:down",this.handleMouseDown),this.canvas.off("mouse:up",this.handleMouseUp),this.canvas.off("mouse:wheel",this.handleMouseWheel),this.canvas.off("object:moving",this.handleObjectMoving),this.canvas.off("before:render",this.handleBeforeRender),this.canvas.off("after:render",this.handleAfterRender),this.clearLinesMeta())}constructor(e,t){var i,r,n;this.verticalLines=[],this.horizontalLines=[],this.disposed=!1,this.handleMouseDown=()=>{this.clearLinesMeta()},this.handleMouseUp=()=>{this.clearLinesMeta(),this.canvas.renderAll()},this.handleMouseWheel=()=>{this.clearLinesMeta()},this.handleObjectMoving=e=>{this.clearLinesMeta();let t=e.target;if(!t||!this.isDragSubject(t))return;this.activeObj=t;let i=this.canvas,r=this.canvas.getObjects().filter(e=>(function(e){if(e.wavevisualAlignmentGuide)return!1;let t="string"==typeof e.name?e.name.trim():"";return!(!t||m.has(t))&&(!!e.selectable||!!e.evented)})(e));i._currentTransform&&this.traverseAllObjects(t,r)},this.handleBeforeRender=()=>{this.clearGuidelineOverlay()},this.handleAfterRender=()=>{for(let e=this.verticalLines.length;e--;)this.drawVerticalLine(this.verticalLines[e]);for(let e=this.horizontalLines.length;e--;)this.drawHorizontalLine(this.horizontalLines[e]);this.canvas.calcOffset()},this.canvas=e,this.ctx=e.getSelectionContext(),this.aligningLineMargin=t.lineMargin,this.aligningLineWidth=null!==(i=t.lineWidth)&&void 0!==i?i:1,this.aligningLineColor=null!==(r=t.lineColor)&&void 0!==r?r:"#7C3AED",this.isDragSubject=null!==(n=t.isDragSubject)&&void 0!==n?n:()=>!0,this.activeObj=new a.fabric.Object}}function h(e,t){return{vc:"vc-".concat(e,"-").concat(t),hc:"hc-".concat(e,"-").concat(t),vl:"vl-".concat(e,"-").concat(t),ht:"ht-".concat(e,"-").concat(t),vr:"vr-".concat(e,"-").concat(t),hb:"hb-".concat(e,"-").concat(t)}}function g(e){return"string"==typeof e.name&&e.name.trim().length>0?e.name.trim():"activeSelection"===e.type||void 0!==a.fabric.ActiveSelection&&e instanceof a.fabric.ActiveSelection?"__activeSelection__":void 0}function v(e,t,i,r,n,o,l,s,d){if(!("function"==typeof e.getCenterPoint&&"function"==typeof e.getPointByOrigin&&"function"==typeof e.setPositionByOrigin&&"function"==typeof e.setCoords))return;if(void 0===o){let o=e.getCenterPoint();if(!Number.isFinite(o.x)||!Number.isFinite(o.y))return;let c=o.x,u=o.y,p=!1,m=!1;Math.abs(o.x-t)<s&&(c=t,p=!0),Math.abs(o.y-i)<s&&(u=i,m=!0),(p||m)&&(e.setPositionByOrigin(new a.fabric.Point(c,u),"center","center"),e.setCoords()),p?d.showLine(r,t,0,0,l.getHeight()):d.removeLine(r),m?d.showLine(n,0,i,l.getWidth(),0):d.removeLine(n);return}let c=e.getPointByOrigin("lefttop"===o?"left":"right","lefttop"===o?"top":"bottom");if(!Number.isFinite(c.x)||!Number.isFinite(c.y))return;let u=c.x,p=c.y,m=!1,f=!1;Math.abs(c.x-t)<s&&(u=t,m=!0),Math.abs(c.y-i)<s&&(p=i,f=!0),(m||f)&&(e.setPositionByOrigin(new a.fabric.Point(u,p),"lefttop"===o?"left":"right","lefttop"===o?"top":"bottom"),e.setCoords()),m?d.showLine(r,t,0,0,l.getHeight()):d.removeLine(r),f?d.showLine(n,0,i,l.getWidth(),0):d.removeLine(n)}var b=i(11474);let E=(0,n.lazy)(()=>i.e(7281).then(i.bind(i,87281)).then(e=>({default:e.CanvasHotKeys})));class y extends n.Component{componentDidMount(){this.mountCanvas()}componentDidUpdate(e){(e.offsetLeft!==this.props.offsetLeft||e.offsetTop!==this.props.offsetTop||e.wrapperW
1idth!==this.props.wrapperWidth||e.wrapperHeight!==this.props.wrapperHeight||e.ratioToReference!==this.props.ratioToReference||e.static!==this.props.static)&&(this.rerenderCanvas(),this.scheduleRemeasureAfterLayout()),this.props.static!==e.static&&this.state.canvas instanceof a.fabric.Canvas&&this.state.canvas.discardActiveObject().requestRenderAll()}componentWillUnmount(){let{canvas:e}=this.state;if(e){var t;e instanceof a.fabric.Canvas&&y.cancelActiveTransform(e),null===(t=this.alignmentGuidelines)||void 0===t||t.dispose(),this.alignmentGuidelines=void 0,this.props.disableObjectAligning||e.off("object:moving",this.onObjectMoving),e.off("object:modified"),e.off("selection:created"),e.off("selection:updated"),e.off("selection:cleared"),e.off("mouse:up"),e.off("mouse:down"),e.off("mouse:move"),e.off("mouse:out"),window.removeEventListener("resize",this.debouncedRerender),this.debouncedRerender.cancel(),null!=this.layoutRetryRaf&&(cancelAnimationFrame(this.layoutRetryRaf),this.layoutRetryRaf=void 0),this.windowMouseLeaveHandler&&window.removeEventListener("mouseleave",this.windowMouseLeaveHandler),this.visibilityChangeHandler&&window.document.removeEventListener("visibilitychange",this.visibilityChangeHandler),this.setState({canvas:void 0}),this.isDisposed=!0}}render(){let{children:e,id:t,static:i,wrapperWidth:o,wrapperHeight:l}=this.props,{canvas:s}=this.state,u={canvas:s||new a.fabric.StaticCanvas(null),onRegistered:this.onRegistered,mountObject:this.mountObject,unmountObject:this.unmountObject,updateObjectZIndex:this.updateObjectZIndex};return s&&d.featureFlags.debugSDK&&(0,c.a3)(u),(0,r.jsxs)(b.F.Provider,{value:u,children:[!i&&(0,r.jsx)(n.Suspense,{fallback:null,children:(0,r.jsx)(E,{})}),(0,r.jsxs)("div",{ref:this.wrapperRef,className:i&&o&&l?"":"w-full h-full",style:i&&o&&l?{width:"".concat(o,"px"),height:"".concat(l,"px"),imageRendering:"auto"}:{},children:[(0,r.jsx)("canvas",{ref:this.canvasRef,id:t}),s&&e]})]})}constructor(e){var t;super(e),t=this,this.registeredObjects=new Set,this.isSet=!1,this.snapZone=5,this.alignLines={},this.objectZindexMap=new Map,this.isDisposed=!1,this.removeLine=e=>{let{canvas:t}=this.state;t&&this.alignLines[e]&&(t.remove(this.alignLines[e]),delete this.alignLines[e])}
1,this.showLine=(e,t,i,r,n)=>{let{canvas:o}=this.state;if(!o||this.alignLines[e])return;let l=new a.fabric.Line([0,n,r,0],{left:t,top:i,backgroundColor:"#7C3AED",strokeWidth:1,name:e,selectable:!1,evented:!1});(function(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];e.wavevisualAlignmentGuide=t})(l),l.moveTo(20),this.alignLines[e]=l,o.add(l)},this.mouseUp=e=>{let t=e.target;if(!t)return;let i=g(t);if(i){var r;r=this.removeLine,Object.values(h(i,"canvas")).forEach(r)}},this.onObjectMoving=e=>{let t=e.target,{canvas:i}=this.state;if(!t||!i)return;let r=g(t);if(!r)return;let n={showLine:this.showLine,removeLine:this.removeLine};!function(e,t,i,r,n,a){let{offsetLeft:o,offsetTop:l,objectAlignPadding:s}=r,{frameWidth:d,frameHeight:c}=function(e,t){var i,r;let n=e.getWidth(),a=e.getHeight(),{offsetLeft:o,offsetTop:l}=t;return{frameWidth:null!==(i=t.frameWidth)&&void 0!==i?i:n-2*o,frameHeight:null!==(r=t.frameHeight)&&void 0!==r?r:a-2*l}}(t,r),u=h(i,"canvas");v(e,o+d/2,l+c/2,u.vc,u.hc,void 0,t,n,a),v(e,o+s,l+s,u.vl,u.ht,"lefttop",t,n,a),v(e,o+d-s,l+c-s,u.vr,u.hb,"rightbottom",t,n,a)}(t,i,r,this.props,this.snapZone,n)},this.rerenderCanvas=()=>{var e,t,i,r,n;let a,o;let{canvas:l}=this.state,{static:d,wrapperWidth:c,wrapperHeight:u,staticPixelRatio:p=2}=this.props;if(!this.canvasRef.current){(0,s.logError)(Error("some shit went down on Fabric/Canvas"));return}if(d&&c&&u)a=c,o=u;else{let i=(null===(t=this.wrapperRef)||void 0===t?void 0:null===(e=t.current)||void 0===e?void 0:e.getBoundingClientRect())||{width:0,height:0};a=i.width,o=i.height}if(0===a||0===o)return;let m=!l||a!==l.getWidth()||o!==l.getHeight();if(m&&d&&this.canvasRef.current){let e=a*p,t=o*p;this.canvasRef.current.width=e,this.canvasRef.current.height=t,this.canvasRef.current.style.width="".concat(a,"px"),this.canvasRef.current.style.height="".concat(o,"px");let i=this.canvasRef.current.getContext("2d");i&&(i.scale(p,p),i.imageSmoothingEnabled=!0,i.imageSmoothingQuality="high")}else m&&this.canvasRef.current&&(this.canvasRef.current.height=o,this.canvasRef.current.width=a);l&&(m&&(l.setWidth(a),l.setHeight(o),this.snapZone=a<480?3:5,null===(i=this.alignmentGuidelines)||void 0===i||i.setLineMargin(this.snapZone),null===(r=(n=this.props).onReady)||void 0===r||r.call(n,l)),y.safeCalcOffset(l),l.requestRenderAll())},this.debouncedRerender=l()(this.rerenderCanvas,1e3/60),this.registerCanvasListeners=()=>{let{canvas:e}=this.state,{static:t}=this.props;if(e&&!t){!this.props.disableObjectAligning&&e instanceof a.fabric.Canvas&&(this.alignmentGuidelines=new x(e,{lineMargin:this.snapZone,lineWidth:1,lineColor:"#7C3AED",isDragSubject:e=>!!g(e)}),this.alignmentGuidelines.init(),e.on("object:moving",this.onObjectMoving)),this.props.onObjectSelected&&(e.on("selection:created",t=>this.props.onObjectSelected&&this.props.onObjectSelected(t,e._activeObject)),e.on("selection:updated",t=>this.props.onObjectSelected&&this.props.onObjectSelected(t,e._activeObject))),this.props.onSelectionCleared&&e.on("selection:cleared",this.props.onSelectionCleared),e.on("object:modified",e=>{let{target:t}=e;if(t&&!this.isDisposed){var i,r;null===(i=(r=this.props).onObjectChanged)||void 0===i||i.call(r,t)}}),e.on("mouse:up",this.mouseUp),e.on("mouse:out",()=>{e instanceof a.fabric.Canvas&&e._activeObject&&y.cancelActiveTransform(e)});{let t=()=>{e instanceof a.fabric.Canvas&&e._activeObject&&y.cancelActiveTransform(e)};window.addEventListener("mouseleave",t),this.windowMouseLeaveHandler=t}}},this.onRegistered=e=>{this.registeredObjects.add(e)},this.mountObject=function(e){let{zIndex:i}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!t.isDisposed){if(!e.name){(0,s.logError)("Canvas:mountObject:Object name is required");return}if(!t.state.canvas){(0,s.logError)("Canvas:unmountObject:Canvas is not mounted");return}t.objectZindexMap.set(e.name,i||0),u.P.addObjectToCanvas(t.state.canvas,e),u.P.sortCanvasObjectsByZindex(t.state.canvas,t.objectZindexMap),t.state.canvas instanceof a.fabric.Canvas&&(y.safeCalcOffset(t.state.canvas),t.state.canvas.requestRenderAll()),t.registeredObjects.delete(e.name),0!==t.registeredObjects.size||(setTimeout(()=>{if(!t.isDisposed){var e;null===(e=t.state.canvas)||void 0===e||e.requestRenderAll()}},1e3),t.isSet||(t.isSet=!0,t.registerCanvasListeners())),t.props.debug&&console.info("mou
1ntObject",u.P.getAllObjectNames(t.state.canvas),t.objectZindexMap)}},this.unmountObject=e=>{if(this.isDisposed)return;if(!e.name){(0,s.logError)("Canvas:unmountObject:Object name is required");return}if(!this.state.canvas){(0,s.logError)("Canvas:unmountObject:Canvas is not mounted");return}this.state.canvas instanceof a.fabric.Canvas&&y.isObjectUnderActiveTransform(this.state.canvas,e)&&y.cancelActiveTransform(this.state.canvas),this.state.canvas instanceof a.fabric.Canvas&&this.state.canvas._activeObject&&(this.state.canvas._activeObject===e||this.state.canvas._activeObject.name===e.name)&&this.state.canvas.discardActiveObject();let t=e.group;this.objectZindexMap.delete(e.name),u.P.removeAllObjectsByName(this.state.canvas,e.name),t&&"function"==typeof t.getObjects?u.P.sortSiblingObjectsByZindex(t.getObjects(),this.objectZindexMap):u.P.sortCanvasObjectsByZindex(this.state.canvas,this.objectZindexMap),this.state.canvas.requestRenderAll(),this.props.debug&&console.info("unmountObject",u.P.getAllObjectNames(this.state.canvas),this.objectZindexMap)},this.updateObjectZIndex=(e,t)=>{!this.isDisposed&&this.state.canvas&&(this.objectZindexMap.set(e,t),u.P.sortContainerForObjectName(this.state.canvas,e,this.objectZindexMap),this.state.canvas.requestRenderAll())},this.mountCanvas=()=>{var e,t,i;let{static:r,wrapperWidth:n,wrapperHeight:o,staticPixelRatio:l=2}=this.props,s=this.props.defaultCanvas||(r?new a.fabric.StaticCanvas(this.props.id,{preserveObjectStacking:!0}):new a.fabric.Canvas(this.props.id,{preserveObjectStacking:!0,uniScaleKey:"shiftKey"}));if(y.ensureInteractiveCanvasDefaults(s),r&&n&&o&&this.canvasRef.current){let e=n*l,t=o*l;this.canvasRef.current.width=e,this.canvasRef.current.height=t,this.canvasRef.current.style.width="".concat(n,"px"),this.canvasRef.current.style.height="".concat(o,"px"),s.setWidth(n),s.setHeight(o);let i=this.canvasRef.current.getContext("2d");i&&(i.scale(l,l),i.imageSmoothingEnabled=!0,i.imageSmoothingQuality="high"),y.safeCalcOffset(s)}r?(this.setState({canvas:s}),null===(e=(t=this.props).onReady)||void 0===e||e.call(t,s)):this.setState({canvas:s},()=>{var e,t;this.rerenderCanvas(),null===(e=(t=this.props).onReady)||void 0===e||e.call(t,s)}),null===(i=window)||void 0===i||i.addEventListener("resize",this.debouncedRerender),this.visibilityChangeHandler=()=>{"visible"===document.visibilityState&&s.requestRenderAll()},window.document.addEventListener("visibilitychange",this.visibilityChangeHandler)},this.scheduleRemeasureAfterLayout=()=>{let{static:e}=this.props;e||(null!=this.layoutRetryRaf&&cancelAnimationFrame(this.layoutRetryRaf),this.layoutRetryRaf=window.requestAnimationFrame(()=>{this.layoutRetryRaf=void 0,this.rerenderCanvas()}))},this.canvasRef=n.createRef(),this.wrapperRef=n.createRef(),this.state={}}}y.ensureInteractiveCanvasDefaults=e=>{e instanceof a.fabric.Canvas&&!e.uniScaleKey&&(e.uniScaleKey="shiftKey")},y.cancelActiveTransform=e=>{e._currentTransform&&(e._currentTransform=void 0,e.requestRenderAll())},y.isObjectUnderActiveTransform=(e,t)=>{var i;let r=null===(i=e._currentTransform)||void 0===i?void 0:i.target;return!!r&&(r===t||r.name===t.name)},y.safeCalcOffset=e=>{var t;(null===(t=e.lowerCanvasEl)||void 0===t?void 0:t.parentElement)&&e.calcOffset()}},11474:function(e,t,i){"use strict";i.d(t,{F:function(){return a},j:function(){return o}});var r=i(2784),n=i(21749);let a=(0,r.createContext)({canvas:new n.fabric.StaticCanvas(null),onRegistered:()=>null,mountObject:()=>null,unmountObject:()=>null,updateObjectZIndex:()=>null}),o=()=>{let e=(0,r.useContext)(a);if(!e)throw Error("useCanvasContext must be used within an CanvasContextProvider");return e}},71414:function(e,t,i){"use strict";i.d(t,{i:function(){return S}});var r=i(2784),n=i(21749),a=i(18149),o=i.n(a),l=i(13888),s=i.n(l),d=i(19458),c=i(44074),u=i(96335),p=i(58904),m=i(64253),f=i(91162),x=i(89291),h=i(63596),g=i(74194),v=i(59571),b=i(14890),E=i(71651),y=i(16991),w=i(36810);class S extends r.PureComponent{getWaveformObjects(){return(0,c.isDottedBarsStyle)(this.props.waveformConfig.style)?(0,v.B)(this.props,1):(0,g.v)(this.props,1)}recreate(){let{clip:e}=this.props,t=(0,b.a)(this.props.waveformConfig.glow);this.soundWaveGroup=new n.fabric.Group(this.getWaveformObjects(),{...(0,u.rE)(this.props),snapAngle:90,snapThreshold:5,lockScalingFlip:!0,name:this.name,...t?{shadow:t.shadow}:{}}),e&&this.soundWaveGroup.set("clipPath",new n.fabric.Rect({width:e.width,height:e.height,scaleX:1/(this.props.scaleX||1),scaleY:1/(this.props.scaleY||1),top:0,left:0,originX:"center",originY:"center"})),this.context.mountObject(this.soundWaveGroup,{zIndex:this.props.zIndex})}syncFabricAttrsFromProps(e){this.soundWaveGroup&&((0,p.v)({fields:(0,u.$A)(),object:this.soundWaveGroup,prevProps:e,props:this.props,canvas:this.context.canvas}),"number"==typeof this.props.zIndex&&this.props.zIndex!==e.zIndex&&this.context.updateObjectZIndex(this.name,this.props.zIndex))}updateWaveformDataOnly(){if((0,c.isDottedBarsStyle)(this.props.waveformConfig.style)&&this.soundWaveGroup){(0,f.t)(this.soundWaveGroup,this.props),this.props.top&&this.soundWaveGroup.set("top",this.props.top),this.context.canvas.requestRenderAll();return}let e=this.getWaveformObjects();this.soundWaveGroup.remove(...this.soundWaveGroup.getObjects()),this.soundWaveGroup.addWithUpdate(...e),this.props.top&&this.soundWaveGroup.set("top",this.props.top),this.context.canvas.requestRenderAll()}recreateWithOptionalCenterPin(e){this.soundWaveGroup&&(this.context.unmountObject(this.soundWaveGroup),this.context.onRegistered(this.name)),this.recreate(),e&&this.soundWaveGroup&&((0,E.q0)(this.soundWaveGroup,e,(0,E.fi)(this.props.waveformConfig)),this.context.canvas.requestRenderAll())}handleUpdate(e){let t=s()(this.props,"audioFileName","waveformConfig","canvasAspectRatio"),i=(0,m.getWaveformLayoutKey)(this.props.waveformConfig);if(null===this.prevLayoutKey||!o()(i,this.prevLayoutKey)){this.prevConfig=t,this.prevLayoutKey=i;let r=(0,E.wS)(e.waveformConfig,this.props.waveformConfig)&&this.soundWaveGroup?(0,E.su)(this.soundWaveGroup,(0,E.fi)(e.waveformConfig)):void 0;this.recreateWithOptionalCenterPin(r);return}let r=(0,h.i)({prevProps:e,nextProps:this.props,prevLayoutKey:this.prevLayoutKey});switch(o()(t,this.prevConfig)||(this.prevConfig=t),r.type){case"RECREATE":{let t=(0,E.wS)(e.waveformConfig,this.props.waveformConfig)&&this.soundWaveGroup?(0,E.su)(this.soundWaveGroup,(0,E.fi)(e.waveformConfig)):void 0;this.recreateWithOptionalCenterPin(t);return}case"REPAINT_COLORS":this.soundWaveGroup&&((0,c.isDottedBarsStyle)(this.props.waveformConfig.style)?(0,f.Jd)(this.soundWaveGroup,this.props.waveformConfig):(0,x.updateSoundWaveColorsInPlace)(this.soundWaveGroup,this.props.waveformConfig),this.soundWaveGroup.setCoords(),this.context.canvas.requestRenderAll());return;case"RESHAPE_DATA":this.soundWaveGroup&&this.updateWaveformDataOnly();return;case"SYNC_ATTRS":case"UPDATE_CENTER_IMAGE_POSITION":this.syncFabricAttrsFromProps(e);return;default:throw Error("Unexpected waveform update intent: ".concat(JSON.stringify(r)))}}componentDidMount(){this.context.onRegistered(this.name),this.recreate(),this.prevLayoutKey=(0,m.getWaveformLayoutKey)(this.props.waveformConfig),this.prevConfig=s()(this.props,"audioFileName","waveformConfig","canvasAspectRatio")}componentDidUpdate(e){this.handleUpdate(e)}componentWillUnmount(){this.context.unmountObject(this.soundWaveGroup)}render(){return null}constructor(e){super(e),this.prevConfig={waveformConfig:{},audioFileName:"",canvasAspectRatio:d.AspectRatio["2/1"]},this.prevLayoutKey=null,this.name=e.name||(0,w.l)()}}S.contextType=y.FX},48025:function(e,t,i){"use strict";i.d(t,{P:function(){return o}});var r=i(18997),n=i(21749);function a(e){let t=[];return!function e(t,i){t.forEach(t=>{if(i(t),"group"===t.type&&"function"==typeof t.getObjects){let r=t.getObjects();(null==r?void 0:r.length)&&e(r,i)}})}(e,e=>{t.push(e)}),t}let o={addObjectToCanvas(e,t){if(!t.name){(0,r.H)("Canvas:mountObject:Object name is required");return}this.findObjectByName(e,t.name)||(e.add(t),this._setCanvasRecursive(e,t))},_setCanvasRecursive(e,t){t.canvas||(t.canvas=e),t instanceof n.fabric.Group&&t.getObjects().forEac
1h(t=>this._setCanvasRecursive(e,t))},removeObject(e,t){let i=t.group;if(i&&"function"==typeof i.remove){i.remove(t),i.setCoords();return}e.remove(t)},removeAllObjectsByName(e,t){this.getAllObjectsByName(e,t).forEach(t=>{this.removeObject(e,t)})},sortSiblingObjectsByZindex(e,t){[...e].sort((e,i)=>((e.name?t.get(e.name):0)||0)-((i.name?t.get(i.name):0)||0)).forEach((e,t)=>{e.moveTo(t)})},sortCanvasObjectsByZindex(e,t){this.sortSiblingObjectsByZindex(e.getObjects(),t)},sortContainerForObjectName(e,t,i){let r=this.findObjectByName(e,t);if(!r){this.sortCanvasObjectsByZindex(e,i);return}let n=r.group;if(n&&"function"==typeof n.getObjects){this.sortSiblingObjectsByZindex(n.getObjects(),i);return}this.sortCanvasObjectsByZindex(e,i)},findObjectByName:(e,t)=>a(e.getObjects()).find(e=>e.name===t),getAllObjectsByName:(e,t)=>a(e.getObjects()).filter(e=>e.name===t),getObjectsByNamePrefix:(e,t)=>a(e.getObjects()).filter(e=>e.name&&e.name.startsWith(t)),getAllObjectNames:e=>a(e.getObjects()).map(e=>e.name).filter(Boolean)}},85858:function(e,t,i){"use strict";i.d(t,{bK:function(){return a},f9:function(){return n}});let r=null;function n(e){r={name:e,expiresAt:Date.now()+5e3}}function a(e){if(!r||r.name!==e)return!1;let t=Date.now()<=r.expiresAt;return r=null,t}},36810:function(e,t,i){"use strict";function r(){let e=Date.now().toString(36),t=Math.random().toString(36).substring(2,8);return"".concat(e,"-").concat(t)}i.d(t,{l:function(){return r}})},48201:function(e,t,i){"use strict";i.d(t,{i:function(){return l}});var r=i(52322);i(2784);var n=i(7355),a=i(16572),o=i(71406);let l=e=>{var t,i,l,s;let{defaultValue:d}=e,c=(0,n.aC)(),u=(0,a.Di)((null===(t=c.userDetails)||void 0===t?void 0:t.subscriptions)||[]);return c.isLoggedIn?(0,r.jsxs)("div",{className:"inline-flex flex-col w-72",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("span",{className:"text-sm font-normal text-gray-600",children:"Logged in as"}),(0,r.jsxs)("span",{className:"px-2.5 py-0.5 inline-flex items-center gap-1 text-xs font-semibold bg-blue-50 text-blue-600 rounded-md",children:[(0,r.jsx)(o.E6I,{}),u&&(0,r.jsx)("span",{children:"Unlimited"}),!u&&(null===(i=c.userDetails)||void 0===i?void 0:i.credit)&&(null===(l=c.userDetails)||void 0===l?void 0:l.credit)]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2 justify-between",children:[(0,r.jsx)("span",{className:"text-base font-medium truncate",children:null===(s=c.userDetails)||void 0===s?void 0:s.email}),c.isAdmin&&(0,r.jsx)("span",{className:"px-2 py-0.5 text-xs font-medium bg-violet-100 text-violet-800 rounded-full",children:"admin"})]})]}):(0,r.jsx)("span",{children:d||"Navigation"})}},94133:function(e,t,i){"use strict";i.d(t,{p:function(){return a}});var r=i(52322);i(2784);var n=i(64603);let a=e=>{let{fontSize:t,className:i}=e;return(0,r.jsx)(n.frZ,{className:"animate-spin ".concat(i||""),fontSize:t})}},46620:function(e,t,i){"use strict";i.d(t,{E:function(){return a}});var r=i(52322),n=i(2784);let a=e=>{let{percent:t,className:i,fakePlays:a}
1=e,[o,l]=(0,n.useState)(t);return(0,n.useEffect)(()=>l(t),[t]),(0,n.useEffect)(()=>{let e=!0,t=(a||[]).find(e=>e.percent>o);if(t)return setTimeout(()=>{e&&l(t.percent)},t.timeout),()=>{e=!1}},[o,a]),(0,r.jsx)("div",{className:"flex w-full h-4 overflow-hidden text-xs rounded-md bg-gray-200 ".concat(i),children:(0,r.jsx)("div",{"data-testid":"progress-bar",style:{width:"".concat(o,"%")},className:"flex flex-col justify-center text-center text-white shadow-none bg-violet-600 whitespace-nowrap transition-all duration-700 relative",children:(0,r.jsxs)("span",{className:"absolute inset-0 flex items-center justify-center text-xs font-semibold text-white",children:[Math.round(o),"%"]})})})}},30508:function(e,t,i){"use strict";i.d(t,{Z:function(){return u},z:function(){return p}});var r=i(52322);i(2784);var n=i(12524),a=i.n(n),o=i(99127),l=i(94307),s=i(54361),d=i(34646);let c={default:{paddingClass:"px-4 py-3",check:"inline",contentFullWidth:!1},compact:{paddingClass:"px-3 py-2",check:"inline",contentFullWidth:!1},tile:{paddingClass:"p-1.5",check:"none",contentFullWidth:!0},card:{paddingClass:"p-2.5",check:"corner",contentFullWidth:!0}},u=e=>{let{children:t,label:i,direction:n,spaceItems:o,className:d,...c}=e;return(0,r.jsxs)(l.Ee,{...c,className:a()({"space-y-2":(!n||"column"===n)&&o,"inline-flex flex-row":"row"===n,"space-x-2":"row"===n&&o},d),children:[i&&(0,r.jsx)(s.__,{className:"sr-only",children:i}),t]})},p=e=>{let{value:t,children:i,description:n,label:u,appearance:p="default",className:m,rounded:f,...x}=e,{paddingClass:h,check:g,contentFullWidth:v}=c[p];return(0,r.jsx)(l.Y8,{...x,value:t,className:e=>{let{hover:t,checked:i,disabled:r}=e;return a()("relative flex shadow-md focus:outline-none border touch-manipulation",h,{"ring-2 ring-white ring-opacity-60 ring-offset-2 ring-offset-indigo-300":t&&!i&&!r,"bg-white border-indigo-400":!i,"bg-indigo-900/75 text-white border-indigo-900":i,"rounded-lg":f,"cursor-not-allowed opacity-60":r,"cursor-pointer":!r},m)},children:e=>{let{checked:t,disabled:l}=e;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex min-w-0 w-full items-center justify-between",children:[(0,r.jsxs)("div",{className:a()("items-center text-sm",{"min-w-0 w-full":v}),children:[u&&(0,r.jsx)(s.__,{as:"p",className:a()("font-medium",{"text-white":t,"text-gray-900":!t&&!l,"text-gray-400":l}),children:u}),n&&(0,r.jsx)(d.dk,{as:"span",className:a()("inline",{"text-sky-100":t,"text-gray-500":!t&&!l,"text-gray-400":l}),children:n}),i]}),"inline"===g&&t&&(0,r.jsx)("div",{className:"shrink-0 text-white",children:(0,r.jsx)(o.mny,{size:20})})]}),"corner"===g&&t&&(0,r.jsx)("div",{className:"pointer-events-none absolute bottom-1.5 right-1.5 z-10 text-white drop-shadow-md","aria-hidden":!0,children:(0,r.jsx)(o.mny,{size:20})})]})}})};p.displayName="Radio.Button"},47389:function(e,t,i){"use strict";var r,n;i.d(t,{_:function(){return r}}),(n=r||(r={}))[n.main=0]="main",n[n.share=1]="share",n[n.login=2]="login",n[n.register=3]="register",n[n.forgotPassword=4]="forgotPassword",n[n.emailVerification=5]="emailVerification"},95949:function(e,t,i){"use strict";i.d(t,{EO:function(){return d},gx:function(){return a},q5:function(){return s}});var r=i(52322),n=i(2784);let a=["fontPicker","colorPicker","colorStopsPicker","effectsPicker"];function o(e){return a.includes(e)}let l="text",s=(0,n.createContext)({setShownTab:()=>null,shownTab:"",extraData:{},collapsed:!1,setCollapsed:()=>null,temporaryTabReturnTo:l,closeTemporaryTab:()=>null}),d=e=>{let{children:t}=e,[i,a]=(0,n.useState)(""),[d,c]=(0,n.useState)({}),[u,p]=(0,n.useState)(!1),[m,f]=(0,n.useState)(l),x=(0,n.useCallback)((e,t)=>{let r=o(e),n=o(i);r&&!n&&i?f(i):r||f(l),r&&p(!1),a(e),t&&c(t)},[i]),h=(0,n.useCallback)(()=>{a(m||l),f(l)},[m]),g=(0,n.useMemo)(()=>({shownTab:i,setShownTab:x,extraData:d,collapsed:u,setCollapsed:p,temporaryTabReturnTo:m,closeTemporaryTab:h}),[i,x,d,u,m,h]);return(0,r.jsx)(s.Provider,{value:g,children:t})}},43034:function(e,t,i){"use strict";i.d(t,{gx:function(){return p.gx},q5:function(){return p.q5},EO:function(){return p.EO},mQ:function(){return u},Ab:function(){return f}});var r=i(52322),n=i(2784),a=i(12524),o=i.n(a),l=i(54073),s=i.n(l),d=i(48943),c=i.n(d);let u=e=>{var t;let{className:i,data:a,tabPosition:l,tabClassName:d,lockTabWithKey:u,collapse:p,setCollapsed:m,shownTab:f,setShownTab:x,shownTabClassName:h}
1=e,[g,v]=(0,n.useState)(!1),[b,E]=(0,n.useState)(!1),[y,w]=(0,n.useState)(null),S=(0,n.useRef)(null),j="left"===l,C="top"===l,N=!!(u&&a[u]),_=u?a[u]:a[f];return(0,n.useEffect)(()=>{u&&a[u]&&x(u)},[a,u,x]),(0,n.useEffect)(()=>{let e;let t=()=>{e&&(v(e.scrollLeft>20),E(Math.ceil(e.scrollLeft+e.clientWidth)<e.scrollWidth-20))},i=s()(t,100);return S.current&&(e=S.current,t(),e.addEventListener("scroll",i,{passive:!0}),window.addEventListener("resize",i,{passive:!0})),()=>{null==e||e.removeEventListener("scroll",i),window.removeEventListener("resize",i)}},[]),(0,r.jsxs)("div",{className:o()("flex w-full relative",i,{"flex-row":j,"flex-col":C}),children:[!N&&(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)("div",{className:"relative",onMouseLeave:p&&j?()=>w(null):void 0,children:[C&&g&&(0,r.jsx)("div",{className:"absolute left-0 inset-y-0 w-12 bg-gradient-to-r from-white to-white/30 z-10"}),C&&b&&(0,r.jsx)("div",{className:"absolute right-0 inset-y-0 w-12 bg-gradient-to-l from-white to-white/30 z-10"}),(0,r.jsx)("div",{className:o()("flex relative",{"flex-col":j,"flex-row overflow-x-auto max-w-full hide-scrollbar":C,"px-4":C}),ref:S,children:Object.entries(a).map(e=>{let[t,{header:i}]=e;return i?(0,r.jsx)("div",{"data-testid":"tab-".concat(t),onClick:()=>{j&&m?t===f?m(!p):(x(t),m(!1)):x(t)},onMouseEnter:p&&j?()=>w(t):void 0,className:o()("py-2 flex flex-col items-center cursor-pointer border-blue-600 w-20 shrink-0 touch-manipulation lg:py-3 select-none",d,{"text-blue-600 font-semibold bg-blue-50":t===f&&!p,"border-b-2":t===f&&C,"border-r-2 border-l-2":t===f&&j&&!p,"bg-gray-100":p&&y===t},t===f&&!p&&h),children:i},t):null})}),p&&y&&(null===(t=a[y])||void 0===t?void 0:t.content)&&(0,r.jsx)("div",{className:o()("absolute left-full top-0 bottom-0 bg-white border-l border-soft-border shadow-2xl z-50 overflow-auto",c().tabsContentWrapper),style:{width:334},children:(0,r.jsx)("div",{className:"px-6 sm:px-4 pt-4 pb-8",children:a[y].content})})]})}),!(p&&j)&&(0,r.jsx)("div",{className:o()("border-soft-border flex-grow md:overflow-auto",c().tabsContentWrapper,{"border-l border-r":j,"border-t":C}),children:(0,r.jsx)("div",{className:"animate-fade-in px-6 sm:px-4 pt-4 pb-14 md:pb-8",children:null==_?void 0:_.content})})]})};var p=i(95949),m=i(46979);function f(e){let{title:t}=e,{closeTemporaryTab:i}=(0,n.useContext)(p.q5);return(0,r.jsxs)("div",{className:"mb-4 flex items-center justify-between border-b border-gray-200 pb-3",children:[(0,r.jsx)("h2",{className:"text-sm font-semibold uppercase tracking-wide text-gray-700",children:t}),(0,r.jsx)("button",{type:"button",onClick:i,className:"rounded p-1 text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-700","aria-label":"Close",children:(0,r.jsx)(m.Z,{className:"h-5 w-5"})})]})}},63241:function(e,t,i){"use strict";i.d(t,{L:function(){return l}});var r=i(52322),n=i(2784),a=i(95468),o=i(46620);let l=e=>{var t,i;let{job:l}=e,s="".concat(null!==(t=null==l?void 0:l.name)&&void 0!==t?t:"",":").concat(null!==(i=null==l?void 0:l.startedAt)&&void 0!==i?i:""),d=(0,n.useRef)({jobKey:s,percent:0});
1d.current.jobKey!==s&&(d.current={jobKey:s,percent:0});let c="number"==typeof(null==l?void 0:l.progressPercent)?l.progressPercent:0,u=Math.min(100,Math.max(d.current.percent,c));return d.current.percent=u,(0,r.jsxs)("div",{className:"space-y-1","data-testid":"transcription-progress",children:[(0,r.jsx)(o.E,{percent:u}),(0,r.jsxs)("p",{className:"text-xs text-gray-500",children:[function(e){let t=null==e?void 0:e.customStatus;return(0,a.RE)(t)?a.Ll[t]:"claimed"===t?"Starting":"Waiting to start"}(l),"…"]})]})}},7062:function(e,t,i){"use strict";i.d(t,{g:function(){return c}});var r=i(52322),n=i(2784),a=i(12524),o=i.n(a),l=i(12060),s=i(99127),d=i(46620);let c=e=>{let{className:t,children:i,customRequest:a,fileList:c,onPreview:u,showRemoveIcon:p,onRemove:m,listType:f,onFileListChange:x,...h}=e,g=(0,n.useRef)(null),[v,b]=(0,n.useState)(c||[]),E=c||v,y=x||b,w=(0,n.useCallback)((e,t)=>{let i=v.findIndex(t=>t.name===e.name);y([...v.slice(0,i),{...v[i],name:e.name,url:e.url,...t},...v.slice(i+1)])},[v,y]),S=(0,n.useCallback)(()=>{var e,t;let i=null==g?void 0:null===(t=g.current)||void 0===t?void 0:null===(e=t.files)||void 0===e?void 0:e[0];i&&(v.length?w(i,{status:"uploading",percent:1}):y([{...i,name:i.name,status:"uploading",percent:1}]),a({file:i,onProgress:e=>w(i,e),onSuccess:e=>{y([{...i,url:e.url,name:i.name,...e},...v])},onError:e=>{y([{...i,name:i.name,status:"error",...e},...v])}}))},[a,v,y,w]);return(0,r.jsxs)("div",{children:[(0,r.jsxs)("label",{className:o()(t,"flex w-full max-w-full cursor-pointer"),children:[(0,r.jsx)("input",{ref:g,type:"file",className:"sr-only",...h,onChange:S}),i]}),(0,r.jsx)("ul",{className:o()({"mt-4":!!(null==E?void 0:E.length)}),children:null==E?void 0:E.map(e=>{let t=(0,r.jsxs)(r.Fragment,{children:["list"===f?(0,r.jsx)(l.Ypb,{size:20,className:"inline-flex mr-1 w-7"}):(0,r.jsx)("img",{src:e.url,alt:"",width:80,height:80,draggable:!1,className:"inline-flex w-20 mr-2 overflow-hidden rounded object-cover"}),(0,r.jsx)("span",{className:"overflow-hidden text-ellipsis",style:{maxWidth:200},children:e.name}),p&&(0,r.jsx)(s.VPh,{onClick:t=>{if(t.stopPropagation(),m&&m(e),v.length){let t=v.findIndex(t=>t.name===e.name);b([...v.slice(0,t),...v.slice(t+1)])}},size:20,className:"absolute top-1 right-1"})]}),i=null;switch(e.status){case"error":case"done":default:i=t;break;case"uploading":i=(0,r.jsx)(d.E,{percent:e.percent||3})}return(0,r.jsx)("li",{className:o()("flex flex-row select-none mb-2 items-center relative",{"text-red-700 cursor-not-allowed":"error"===e.status,"text-gray-700 cursor-pointer hover:text-light-blue":"error"!==e.status}),onClick:()=>"done"===e.status&&u&&u(e),children:i},e.name)})})]})}},72301:function(e,t,i){"use strict";i.d(t,{n:function(){return x}});var r=i(52322),n=i(2784),a=i(3752);let o=()=>{let[e,t]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{let e=document.createElement("video");t("probably"===e.canPlayType('video/webm; codecs="vp09.00.10.08"')||"probably"===e.canPlayType('video/webm; codecs="vp9"'))},[]),e};var l=i(99127),s=i(12524),d=i.n(s),c=i(18997),u=i(34406);let p="string"==typeof u.env.NEXT_PUBLIC_VIDEO_PROXY_CACHE_BUST&&u.env.NEXT_PUBLIC_VIDEO_PROXY_CACHE_BUST.length>0?"?".concat(u.env.NEXT_PUBLIC_VIDEO_PROXY_CACHE_BUST):"?v=4";function m(e,t){return"".concat("https://image-server-proxy.wavevisual.workers.dev/videos","/").concat(e,".").concat(t).concat(p)}function f(e){if(!(e instanceof Error)&&!(e instanceof DOMException))return!1;let{name:t}=e;return"AbortError"===t||"NotAllowedError"===t||"string"==typeof e.message&&e.message.includes("interrupted by a call to pause")}let x=e=>{let{src:t,className:i,poster:s,autoplay:u=!1,hidePlayButton:p=!1,playOnHover:x=!0,fillContainer:h=!1,lazy:g=!1,aspectRatio:v}=e,b=(0,a.d)(),E=o(),y=(0,n.useRef)(null),w=(0,n.useRef)(null),[S,j]=n.useState(!1),[C,N]=(0,n.useState)(!1),[_,R]=(0,n.useState)(!g);(0,n.useEffect)(()=>{if(_)return;let e=w.current;if(!e||"undefined"==typeof IntersectionObserver){R(!0);return}let t=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&(R(!0),t.disconnect())},{rootMargin:"600px 0px"});return t.observe(e),()=>t.disconnect()},[_]),(0,n.useEffect)(()=>{N(!1)},[t]);let A=()=>{let e=y.current;e&&e.play().then(()=>{j(!0)}).catch(e=>{f(e)||(0,c.H)(e)})},k=()=>{y.current&&S&&(y.current.pause(),j(!1))};return(0,n.useEffect)(()=>{let e=y.current;e&&(e.muted=!0)},[t,_]),(0,n.useEffect)(()=>{let e=y.current;if(!e||!u||!_)return;let t=()=>{e.paused&&e.play().catch(e=>{f(e)||(0,c.H)(e)})};return e.readyState>=HTMLMediaElement.HAVE_FUTURE_DATA&&queueMicrotask(t),e.addEventListener("canplay",t),e.addEventListener("loadeddata",t),()=>{e.removeEventListener("canplay",t),e.removeEventListener("loadeddata",t)}},[u,t,_]),(0,r.jsxs)("span",{ref:w,className:d()("w-full relative justify-center items-center",i),onMouseEnter:!b&&x?A:void 0,onMouseLeave:!b&&x?k:void 0,onClickCapture:b?S?k:A:void 0,children:[(0,r.jsxs)("video",{className:d()("rounded-xl overflow-hidden w-full",!h&&"mx-auto 
1shadow-md max-w-sm md:max-w-md lg:max-w-lg",h&&"h-full object-cover",!h&&u&&"h-auto"),style:v?{aspectRatio:v}:void 0,autoPlay:u&&_,loop:!0,muted:!0,ref:y,playsInline:!0,preload:u&&_?"auto":"none",poster:_?s:void 0,onPlay:()=>j(!0),onPause:()=>j(!1),onError:()=>{if(E&&!C){N(!0);return}(0,c.H)(Error("Video playback failed: ".concat(t)))},children:[_&&E&&!C&&(0,r.jsx)("source",{src:m(t,"webm"),type:'video/webm; codecs="vp09.00.10.08"'}),_&&(0,r.jsx)("source",{src:m(t,"mp4"),type:"video/mp4"})]},"".concat(t,"-").concat(C?"mp4":"webm","-").concat(_?"in":"out")),!S&&!p&&(0,r.jsx)(l.sT9,{fontSize:60,className:"opacity-80 absolute z-10 text-gray-800"})]})}},70333:function(e,t,i){"use strict";i.d(t,{K:function(){return o}});var r=i(52322);i(2784);var n=i(42658);let a=(e,t)=>e?(0,r.jsxs)("svg",{width:t,height:t,viewBox:"0 0 14 14",fill:"currentColor","aria-hidden":!0,children:[(0,r.jsx)("rect",{x:"2",y:"1",width:"3.5",height:"12",rx:"1"}),(0,r.jsx)("rect",{x:"8.5",y:"1",width:"3.5",height:"12",rx:"1"})]}):(0,r.jsx)("svg",{width:t,height:t,viewBox:"0 0 14 14",fill:"currentColor","aria-hidden":!0,children:(0,r.jsx)("path",{d:"M3 1.5l9 5.5-9 5.5z"})}),o=e=>{let{isPlaying:t,canPlay:i,loop:o,onTogglePlay:l,onGoToStart:s,onToggleLoop:d,size:c="desktop",playButtonTestId:u,playAriaLabelPlaying:p="Pause",playAriaLabelPaused:m="Play"}=e,f="phone"===c,x=f?"size-9":"size-10",h=f?"size-5":"size-6";return(0,r.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,r.jsx)("button",{type:"button",onClick:s,disabled:!i,"aria-label":"Back to start",className:"flex ".concat(x," items-center justify-center rounded-full text-gray-900 transition-colors hover:bg-gray-100 disabled:cursor-default disabled:text-gray-300 disabled:opacity-100"),children:(0,r.jsx)(n.Sw4,{className:h,"aria-hidden":!0})}),(0,r.jsx)("button",{type:"button",onClick:l,disabled:!i,"aria-label":t?p:m,"data-testid":u,className:"flex ".concat(x," shrink-0 items-center justify-center rounded-full border-2 border-violet-600 bg-violet-600 text-white shadow-sm transition-colors hover:border-violet-500 hover:bg-violet-500 disabled:cursor-default disabled:border-gray-300 disabled:bg-gray-300 disabled:text-gray-500 disabled:opacity-100"),children:a(t,f?14:16)}),(0,r.jsx)("button",{type:"button",onClick:d,disabled:!i,"aria-label":"Loop","aria-pressed":o,className:"flex ".concat(x," items-center justify-center rounded-full transition-colors disabled:cursor-default disabled:text-gray-300 disabled:opacity-100 ").concat(o?"bg-violet-100 text-violet-700":"text-gray-900 hover:bg-gray-100"),children:(0,r.jsx)(n.yoO,{className:h,"aria-hidden":!0})})]})}},35954:function(e,t,i){"use strict";function r(e){return!Number.isFinite(e)||e<0?"0:00":"".concat(Math.floor(e/60),":").concat(Math.floor(e%60).toString().padStart(2,"0"))}i.d(t,{c:function(){return r}})},37690:function(e,t,i){"use strict";i.d(t,{B:function(){return n},C:function(){return l}});var r,n,a=i(78958);(r=n||(n={})).media="media",r[r.soundwave=a.e.soundwave]="soundwave",r[r.background=a.e.background]="background",r[r.text=a.e.text]="text",r.elements="elements",r[r.layers=a.e.layers]="layers",r[r.animation=a.e.animation]="animation",r.captions="captions",r.export="export",r[r.colorPicker=a.e.colorPicker]="colorPicker",r[r.fontPicker=a.e.fontPicker]="fontPicker",r[r.effectsPicker=a.e.effectsPicker]="effectsPicker";let o=new Set(Object.values(n)),l=e=>o.has(e)},69886:function(e,t,i){"use strict";i.d(t,{T:function(){return T}});var r=i(52322),n=i(2784),a=i(42670),o=i(19458),l=i(33237),s=i(63775),d=i(44074),c=i(3741),u=i(30508),p=i(16867),m=i(72301),f=i(9223),x=i(16378),h=i(33256),g=i(12524),v=i.n(g),b=i(91883),E=i(30118),y=i(118),w=i(17088);let S="track-effect-camera-shake";function j(e){var t,i,r,n;return{type:"cameraShake",intensity:null!==(t=null==e?void 0:e.intensity)&&void 0!==t?t:b.DEFAULT_CAMERA_SHAKE_CONFIG.intensity,frequency:null!==(i=null==e?void 0:e.frequency)&&void 0!==i?i:b.DEFAULT_CAMERA_SHAKE_CONFIG.frequency,audioReactive:null!==(r=null==e?void 0:e.audioReactive)&&void 0!==r?r:b.DEFAULT_CAMERA_SHAKE_CONFIG.audioReactive,seed:null!==(n=null==e?void 0:e.seed)&&void 0!==n?n:b.DEFAULT_CAMERA_SHAKE_CONFIG.seed}}function C(e,t){return{id:"clip-effect-camera-shake",startMs:0,durationMs:e.durationMs,effect:t}}function N(e){return null==e?void 0:e.effectTracks.flatMap(e=>e.clips).find(e=>"cameraShake"===e.effect.type)}function _(e){return e.effectTracks.some(e=>!e.muted&&e.clips.some(e=>!e.muted&&"cameraShake"===e.effect.type))}function R(e,t){let i=e.effectTracks.find(e=>e.id===S),r=N(e),n=(null==r?void 0:r.effect.type)==="cameraShake"?r.effect:j();return t?i?{...e,effectTracks:e.effectTracks.map(t=>{if(t.id!==S)return t;let i=t.clips.length>0?t.clips.map(e=>({...e,muted:!1})):[C(e,n)];return{...t,muted:!1,label:t.label||"Camera shake",clips:i}})}:{...e,effectTracks:[...e.effectTracks.filter(e=>e.id!==S),{id:S,kind:"effect",label:"Camera shake",clips:[C(e,n)]}]}:{...e,effectTracks:e.effectTracks.map(e=>e.id===S||e.clips.some(e=>
1"cameraShake"===e.effect.type)?{...e,muted:!0}:e)}}let A=()=>{var e,t,i;let{cameraShake:o,updateEditorState:l}=(0,E._i)(),{setNotSaved:s}=(0,y.r)(),d=(0,w.G)(e=>e.document),c=(0,w.G)(e=>e.patchDocument),u=N(d),p=(null==u?void 0:u.effect.type)==="cameraShake"?u.effect:j(),m=!!d&&_(d),f=(0,n.useCallback)(e=>{if(d){let{enabled:t,...i}=e;"boolean"==typeof t&&c(e=>R(e,t)),Object.keys(i).length>0&&c(e=>(function(e,t){let i=_(e)?e:R(e,!0);return{...i,effectTracks:i.effectTracks.map(e=>({...e,clips:e.clips.map(e=>"cameraShake"===e.effect.type?{...e,effect:{...e.effect,...t,type:"cameraShake"}}:e)}))}})(e,i)),s();return}l({cameraShake:{...null!=o?o:b.DEFAULT_CAMERA_SHAKE_CONFIG,...e}}),s()},[o,c,s,l,d]),g=d?m:(null==o?void 0:o.enabled)===!0,S=d?p.intensity:null!==(e=null==o?void 0:o.intensity)&&void 0!==e?e:b.DEFAULT_CAMERA_SHAKE_CONFIG.intensity,C=d?p.frequency:null!==(t=null==o?void 0:o.frequency)&&void 0!==t?t:b.DEFAULT_CAMERA_SHAKE_CONFIG.frequency,A=d?p.audioReactive:null!==(i=null==o?void 0:o.audioReactive)&&void 0!==i?i:b.DEFAULT_CAMERA_SHAKE_CONFIG.audioReactive;return(0,r.jsxs)("section",{className:"rounded-lg border border-gray-200 bg-white p-3 shadow-sm","data-testid":"camera-shake-control
1s",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium text-gray-900",children:(0,r.jsx)(a.Z,{id:"Editor.Animation.CameraShake"})}),(0,r.jsx)("p",{className:"mt-1 text-xs text-gray-600",children:(0,r.jsx)(a.Z,{id:"Editor.Animation.CameraShakeHint"})})]}),(0,r.jsxs)(h.rs,{checked:g,onChange:e=>f({...null!=o?o:b.DEFAULT_CAMERA_SHAKE_CONFIG,enabled:e}),"data-testid":"camera-shake-enabled",className:v()("relative inline-flex w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 focus-visible:ring-offset-2",g?"bg-indigo-600":"bg-gray-200"),children:[(0,r.jsx)("span",{className:"sr-only",children:"Toggle camera shake"}),(0,r.jsx)("span",{"aria-hidden":!0,className:v()("pointer-events-none inline-block h-4 w-4 rounded-full bg-white shadow ring-0 transition",g?"translate-x-6":"translate-x-0")})]})]}),g?(0,r.jsxs)("div",{className:"mt-4 space-y-4",children:[(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between text-xs text-gray-500",children:[(0,r.jsx)("span",{children:(0,r.jsx)(a.Z,{id:"Editor.Animation.CameraShakeIntensity"})}),(0,r.jsx)("span",{children:Math.round(S)})]}),(0,r.jsx)(x.i,{value:[S],onValueChange:e=>f({intensity:e[0]}),min:0,max:50,step:1,"aria-label":"Camera shake intensity","data-testid":"camera-shake-intensity"})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between text-xs text-gray-500",children:[(0,r.jsx)("span",{children:(0,r.jsx)(a.Z,{id:"Editor.Animation.CameraShakeFrequency"})}),(0,r.jsx)("span",{children:C.toFixed(1)})]}),(0,r.jsx)(x.i,{value:[C],onValueChange:e=>f({frequency:e[0]}),min:.1,max:5,step:.1,"aria-label":"Camera shake frequency","data-testid":"camera-shake-frequency"})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium text-gray-900",children:(0,r.jsx)(a.Z,{id:"Editor.Animation.CameraShakeAudioReactive"})}),(0,r.jsx)("p",{className:"mt-1 text-xs text-gray-600",children:(0,r.jsx)(a.Z,{id:"Editor.Animation.CameraShakeAudioReactiveHint"})})]}),(0,r.jsxs)(h.rs,{checked:A,onChange:e=>f({audioReactive:e}),"data-testid":"camera-shake-audio-reactive",className:v()("relative inline-flex w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 focus-visible:ring-offset-2",A?"bg-indigo-600":"bg-gray-200"),children:[(0,r.jsx)("span",{className:"sr-only",children:"Toggle audio-reactive camera shake"}),(0,r.jsx)("span",{"aria-hidden":!0,className:v()("pointer-events-none inline-block h-4 w-4 rounded-full bg-white shadow ring-0 transition",A?"translate-x-6":"translate-x-0")})]})]})]}):null]})};var k=i(82497);let I=()=>{var e,t,i;let{backgroundPulse:o,updateEditorState:l}=(0,E._i)(),{setNotSaved:s}=(0,y.r)(),d=(0,w.G)(e=>e.document),c=(0,n.useCallback)(e=>{l({backgroundPulse:{...null!=o?o:k.DEFAULT_BACKGROUND_PULSE_CONFIG,...e}}),s()},[o,s,l]),u=(null==o?void 0:o.enabled)===!0,p=null!==(e=null==o?void 0:o.scale)&&void 0!==e?e:k.DEFAULT_BACKGROUND_PULSE_CONFIG.scale,m=null!==(t=null==o?void 0:o.brightness)&&void 0!==t?t:k.DEFAULT_BACKGROUND_PULSE_CONFIG.brightness,f=null!==(i=null==o?void 0:o.audioReactive)&&void 0!==i?i:k.DEFAULT_BACKGROUND_PULSE_CONFIG.audioReactive;return d?null:(0,r.jsxs)("section",{className:"rounded-lg border border-gray-200 bg-white p-3 shadow-sm","data-testid":"background-pulse-controls",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium text-gray-900",children:(0,r.jsx)(a.Z,{id:"Editor.Animation.BackgroundPulse"})}),(0,r.jsx)("p",{className:"mt-1 text-xs text-gray-600",children:(0,r.jsx)(a.Z,{id:"Editor.Animation.BackgroundPulseHint"})})]}),(0,r.jsxs)(h.rs,{checked:u,onChange:e=>c({...null!=o?o:k.DEFAULT_BACKGROUND_PULSE_CONFIG,enabled:e}),"data-testid":"background-pulse-enabled",className:v()("relative inline-flex w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 focus-visible:ring-offset-2",u?"bg-indigo-600":"bg-gray-200"),children:[(0,r.jsx)("span",{className:"sr-only",children:"Toggle background pulse"}
1),(0,r.jsx)("span",{"aria-hidden":!0,className:v()("pointer-events-none inline-block h-4 w-4 rounded-full bg-white shadow ring-0 transition",u?"translate-x-6":"translate-x-0")})]})]}),u?(0,r.jsxs)("div",{className:"mt-4 space-y-4",children:[(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between text-xs text-gray-500",children:[(0,r.jsx)("span",{children:(0,r.jsx)(a.Z,{id:"Editor.Animation.BackgroundPulseScale"})}),(0,r.jsxs)("span",{children:[Math.round(100*p),"%"]})]}),(0,r.jsx)(x.i,{value:[p],onValueChange:e=>c({scale:e[0]}),min:0,max:.25,step:.01,"aria-label":"Background pulse extra scale","data-testid":"background-pulse-scale"})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between text-xs text-gray-500",children:[(0,r.jsx)("span",{children:(0,r.jsx)(a.Z,{id:"Editor.Animation.BackgroundPulseBrightness"})}),(0,r.jsxs)("span",{children:[Math.round(100*m),"%"]})]}),(0,r.jsx)(x.i,{value:[m],onValueChange:e=>c({brightness:e[0]}),min:0,max:.5,step:.01,"aria-label":"Background pulse brightness","data-testid":"background-pulse-brightness"})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-medium text-gray-900",children:(0,r.jsx)(a.Z,{id:"Editor.Animation.BackgroundPulseAudioReactive"})}),(0,r.jsx)("p",{className:"mt-1 text-xs text-gray-600",children:(0,r.jsx)(a.Z,{id:"Editor.Animation.BackgroundPulseAudioReactiveHint"})})]}),(0,r.jsxs)(h.rs,{checked:f,onChange:e=>c({audioReactive:e}),"data-testid":"background-pulse-audio-reactive",className:v()("relative inline-flex w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 focus-visible:ring-offset-2",f?"bg-indigo-600":"bg-gray-200"),children:[(0,r.jsx)("span",{className:"sr-only",children:"Toggle audio-reactive background pulse"}),(0,r.jsx)("span",{"aria-hidden":!0,className:v()("pointer-events-none inline-block h-4 w-4 rounded-full bg-white shadow ring-0 transition",f?"translate-x-6":"translate-x-0")})]})]})]}):null]})},z=[{value:"spectrum",labelId:"Editor.Animation.Spectrum",descriptionId:"Editor.Animation.SpectrumDescription"},{value:"timeline",labelId:"Editor.Animation.Timeline",descriptionId:"Editor.Animation.TimelineDescription"},{value:"recorder-style",labelId:"Editor.Animation.RecorderStyle",descriptionId:"Editor.Animation.RecorderStyleDescription"}],M="rounded-lg border border-gray-200 bg-white p-3 shadow-sm",D=e=>(0,d.isCircleSoundWaveStyle)(e)?"circle":e===o.SoundWaveStyle.horizontal_one_sided?"horizontal-one":(0,d.isDottedBarsStyle)(e)?(0,d.isMirroredSoundWaveStyle)(e)?"dotted-mirrored":"dotted":"horizontal",T=()=>{var e;let{animation:t,updateAnimation:i,waveformConfig:o}=(0,p.kX)(),h=null!==(e=null==t?void 0:t.style)&&void 0!==e?e:"spectrum",g=(0,s.normalizeSpectrumReactivity)(null==t?void 0:t.spectrumReactivity),v=(0,d.isCircleSoundWaveStyle)(null==o?void 0:o.style),b=(0,n.useMemo)(()=>v?z.filter(e=>"recorder-style"!==e.value):z,[v]),E=(0,l.animationStylePickerValue)(v&&(0,l.isRecorderAnimationStyle)(h)?"timeline":h),y="spectrum"===E,w=c.featureFlags.recorderSine&&!v&&(0,l.isRecorderAnimationStyle)(h),S=c.featureFlags.cameraShake,j=c.featureFlags.backgroundPulse,C=(0,n.useMemo)(()=>D(null==o?void 0:o.style),[null==o?void 0:o.style]),N=(0,n.useCallback)(e=>{i({style:e})},[i]),_=(0,n.useCallback)(e=>{if("recorder-style"===e&&c.featureFlags.recorderSine&&!(0,l.isRecorderAnimationStyle)(h)){N("recorder-sine");return}N((0,l.animationStyleFromPickerSelection)(e,h))},[N,h]);(0,n.useEffect)(()=>{c.featureFlags.recorderSine||"recorder-sine"!==h||N("recorder-style")},[N,h]);let R=(0,n.useCallback)(e=>{var r;i({style:null!==(r=null==t?void 0:t.style)&&void 0!==r?r:"spectrum",spectrumReactivity:(0,s.normalizeSpectrumReactivity)(e)})},[null==t?void 0:t.style,i]);return(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsxs)("section",{className:M,children:[(0,r.jsx)("p",{className:"mb-3 text-sm font-medium text-gray-900",children:(0,r.jsx)(a.Z,{id:"Editor.Animation.StyleSection",defaultMessage:"Animation style"})}),(0,r.jsx)("div",{className:"flex w-full",children:(0,r.jsx)(u.Z,{name:"select-animation-style",value:E,onChange:e=>_(e),label:"Select animation style",direction:"column",spaceItems:!0,className:"w-full space-y-2",children:(0,r.jsx)("div",{className:"grid w-full grid-cols-2 gap-2",children:b.map(e=>(0,r.jsxs)(u.z,{value:e.value,"data-testid":"animation-".concat(e.value),appearance:"card",rounded:!0,children:[(0,r.jsx)("div",{className:"w-full [&_video]:mx-0 [&_video]:max-w-full",children:(0,r.jsx)(m.n,{src:"editor-page/".concat(C,"-").concat(e.value),autoplay:!0,hidePlayButton:!0,playOnHover:!1,poster:(0,f._)({src:"/editor-page/".concat(C,"-").concat(e.value,".jpg"),width:750})})}),(0,r.jsxs)("div",{className:"mt-2 flex flex-col items-start",children:[(0,r.jsx)("span",{className:"text-sm font-bold",children:(0,r.jsx)(a.Z,{id:e.labelId})}),(0,r.jsx)("span",{className:"mt-1 text-xs",children:(0,r.jsx)(a.Z,{id:e.descriptionId})})]})]},e.value))})})}),(0,r.jsx)("p",{className:"mt-3 text-xs text-gray-600",children:(0,r.jsx)(a.Z,{id:"Editor.Animation.PickerHint"})})]}),w?(0,r.jsxs)("section",{className:M,"data-testid":"animation-recorder-look-panel",children:[(0,r.jsx)("p",{className:"text-sm font-medium text-gray-900",children:(0,r.jsx)(a.Z,{id:"Editor.Animation.RecorderLook"})}),(0,r.jsx)("p",{className:"mt-1 mb-3 text-xs text-gray-600",children:(0,r.jsx)(a.Z,{id:"Editor.Animation.RecorderLookHint"})}),(0,r.jsx)(u.Z,{name:"select-recorder-look",value:h,onChange:e=>N(e),label:"Select recorder look",className:"w-full",children:(0,r.jsxs)("div",{className:"grid w-full grid-cols-2 gap-2",children:[(0,r.jsx)(u.z,{value:"recorder-style","data-testid":"animation-recorder-style-look",appearance:"compact",rounded:!0,children:(0,r.jsx)(a.Z,{id:"Editor.Animation.RecorderLookBars"})}),(0,r.jsx)(u.z,{value:"recorder-sine","data-testid":"animation-recorder-sine",appearance:"compact",rounded:!0,children:(0,r.jsx)(a.Z,{id:"Editor.Animation.RecorderLookSine"})})]})})]}):null,y?(0,r.jsxs)("section",{className:M,"data-testid":"animation-spectrum-reactivity-panel",children:[(0,r.jsx)("p",{className:"text-sm font-medium text-gray-900",children:(0,r.jsx)(a.Z,{id:"Editor.Animation.SpectrumReactivity"})}),(0,r.jsx)("p",{className:"mt-1 mb-3 text-xs text-gray-600",children:(0,r.jsx)(a.Z,{id:"Editor.Animation.SpectrumReactivityHint"})}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between text-xs text-gray-500",children:[(0,r.jsx)("span",{children:(0,r.jsx)(a.Z,{id:"Editor.Animation.SpectrumReactivitySmooth"})}),(0,r.jsx)("span",{children:(0,r.jsx)(a.Z,{id:"Editor.Animation.SpectrumReactivityReactive"})})]}),(0,r.jsx)(x.i,{value:[g],onValueChange:e=>R(e[0]),min:0,max:100,step:1,"aria-label":"Spectrum reactivity","data-testid":"animation-spectrum-reactivity"})]})]}):null,j?(0,r.jsx)(I,{}):null,S?(0,r.jsx)(A,{}):null]})}},62214:function(e,t,i){"use strict";let r,n,a;i.d(t,{q:function(){return O}});var o=i(52322),l=i(2784),s=i(42670),d=i(71680),c=i(15644),u=i(75590);let p=e=>{let{children:t,waitBeforeShow:i=500}=e,[r,n]=(0,l.useState)(!1);return(0,l.useEffect)(()=>{let e=setTimeout(()=>{n(!0)},i);return()=>clearTimeout(e)},[i]),r?t:null};var m=i(21353),f=i(40457),x=i(71414),h=i(16991),g=i(19458),v=i(64281);let b=["audio/webm;codecs=opus","audio/webm","audio/mp4","audio/mp4;codecs=mp4a.40.2","audio/mp4;codecs=aac","video/mp4"];function E(e){if(e instanceof Error)return e;if(null!=e&&"object"==typeof e&&"message"in e){let t=String(e.message);if(t)return Error(t)}return Error("string"==typeof e?e:"Recording failed")}function y(){}let w=y,S=!1,j=[],C=e=>{r=e},N=e=>{w=e},_=async()=>{let e;j=[];try{e=await navigator.mediaDevices.getUserMedia({audio:!0,video:!1})}catch(e){throw E(e)}let t=new(window.AudioContext||window.webkitAudioContext),i=t.createAnalyser(),o=t.createMediaStreamSource(e);try{n=function(e){let t=function(){if("undefined"!=typeof MediaRecorder&&"function"==typeof MediaRecorder.isTypeSupp
1orted){for(let e of b)if(MediaRecorder.isTypeSupported(e))return e}}();try{if(t)return new MediaRecorder(e,{mimeType:t});return new MediaRecorder(e)}catch(t){return new MediaRecorder(e)}}(e)}catch(t){throw e.getTracks().forEach(e=>e.stop()),E(t)}n.ondataavailable=e=>{j.push(e.data)},n.onerror=e=>{S=!1;let t="error"in e?e.error:void 0,i=t instanceof DOMException?t:null,r=i?Error(i.message||i.name||"MediaRecorder failed"):Error("MediaRecorder failed");w(r)};try{n.start()}catch(t){throw e.getTracks().forEach(e=>e.stop()),E(t)}i.fftSize=1024;let l=new Float32Array(1024);o.connect(i),S=!0,a=setInterval(function(){if(S&&(i.getFloatTimeDomainData(l),l.length>0)){let e=(0,v.hZ)(l,{boostBy:3,granularity:1024});r(e)}},100)},R=()=>(S=!1,void 0!==a&&(clearInterval(a),a=void 0),n&&"inactive"!==n.state)?new Promise((e,t)=>{n.onstop=()=>e(),n.onerror=e=>{let i="error"in e?e.error:void 0,r=i instanceof DOMException?i:null;t(r?Error(r.message||r.name||"MediaRecorder failed"):Error("MediaRecorder failed"))},n.stop()}):Promise.resolve(),A=()=>new Blob(j,{type:(null==n?void 0:n.mimeType)||"audio/webm"}),k=e=>e.size<1024;var I=i(38986),z=i(92428),M=i(40258);class D extends l.Component{componentWillUnmount(){var e;this.isDisposed=!0,null===(e=this.resizeObserver)||void 0===e||e.disconnect(),window.removeEventListener("resize",this.updateCanvasSize),N(y),R()}componentDidMount(){this.updateCanvasSize(),this.previewRef.current&&"undefined"!=typeof ResizeObserver?(this.resizeObserver=new ResizeObserver(this.updateCanvasSize),this.resizeObserver.observe(this.previewRef.current)):window.addEventListener("resize",this.updateCanvasSize),C(async e=>{let t=this.getWaveformConfig();this.setState({data:(0,z.computeShownWaveformData)({waveformData:e,waveformConfig:t,width:t.reference.width,audioFileName:this.audioFileName,source:g.SourceType.AUDIO})})}),N(e=>{this.isDisposed||this.setState({recording:!1,errorMessage:e.message})})}render(){let e=!this.state.recording&&this.state.data.length>0,t=this.state.canvasWidth>0&&this.state.canvasHeight>0;return(0,o.jsx)("div",{className:"flex flex-col items-center",children:(0,o.jsxs)("div",{ref:this.previewRef,className:"h-48 w-full my-2 border border-gray-300 rounded-md relative justify-center items-center flex",children:[t&&(0,o.jsx)(h.Xz,{offsetLeft:0,offsetTop:0,id:"recording-canvas",objectAlignPadding:0,onReady:this.onReady,wrapperWidth:this.state.canvasWidth,wrapperHeight:this.state.canvasHeight,staticPixelRatio:1,static:!0,children:this.state.data.length>0&&(0,o.jsx)(x.i,{name:"recording-soundwave",zIndex:2,audioFileName:this.audioFileName,waveformConfig:this.getWaveformConfig(),shownWaveformData:this.state.data,canvasAspectRatio:g.AspectRatio["2/1"],width:this.state.canvasWidth,height:this.state.canvasHeight,scaleX:1,scaleY:.5,originX:"center",originY:"center",top:Math.round(this.state.canvasHeight/2),left:Math.round(this.state.canvasWidth/2)})}),(0,o.jsxs)("div",{className:"absolute flex flex-col items-center gap-2",children:[(0,o.jsxs)("div",{className:"flex flex-row gap-2",children:[this.state.recording?(0,o.jsx)(m.z,{size:"large",theme:"light",icon:f.GDK,onClick:this.onStopRecording,children:"Stop"}):(0,o.jsxs)(m.z,{size:"large",theme:"blue",icon:f.q5W,onClick:async()=>{try{await _(),this.setState({recording:!0,errorMessage:void 0})}catch(t){let e=t instanceof Error?t.message:"Recording failed";this.setState({errorMessage:e})}},children:["Record",e?" again":""]}),e&&(0,o.jsx)(m.z,{size:"large",theme:"primary",onClick:()=>{let e=A();if(k(e)){this.setState({errorMessage:"Recording is empty or too short. Record again and wait a moment after stopping before saving."});return}this.props.onSave(e),this.props.hide()},children:"Save"})]}),this.state.errorMessage&&(0,o.jsx)("div",{className:"text-red-500 mt-2",children:this.state.errorMessage})]})]})})}constructor(e){super(e),this.canvas=null,this.previewRef=l.createRef(),this.isDisposed=!1,this.audioFileName="Recording ".concat((0,M.Z)(new Date,"dd-MM-yyyy HH:mm:ss")),this.getWaveformConfig=()=>({thickness:.5,space:0,waveColors:["#000000"],height:I.SAMPLE_HEIGHT,heightMultiplier:I.DEFAULT_HEIGHT_MULTIPLIER,reference:{width:this.state.canvasWidth||0,height:this.state.canvasHeight||0}}),this.updateCanvasSize=()=>{let e=this.previewRef.current;if(!e)return;let t=Math.round(e.clientWidth),i=Math.round(e.clientHeight);t<=0||i<=0||t===this.state.canvasWidth&&i===this.state.canvasHeight||this.setState({canvasWidth:t,canvasHeight:i})},this.onStopRecording=async()=>
1{try{await R(),this.setState({recording:!1})}catch(t){let e=t instanceof Error?t.message:"Recording failed";this.setState({recording:!1,errorMessage:e})}},this.onReady=e=>{this.canvas=e;let t=e.getWidth(),i=e.getHeight();(t!==this.state.canvasWidth||i!==this.state.canvasHeight)&&this.setState({canvasWidth:t,canvasHeight:i})},this.state={recording:!1,data:[],canvasWidth:0,canvasHeight:0},navigator.permissions.query({name:"microphone"}).then(e=>{"denied"===e.state&&this.setState({errorMessage:"Microphone permission denied"})}).catch(()=>{})}}var T=i(19487);function O(e){let{onSave:t,layout:i}=e,[r,n]=(0,l.useState)(!1);return(0,o.jsxs)("div",{className:"p-0",children:[(0,o.jsx)(T.Z,{icon:d.uYL,label:"Record",description:"Use your microphone",layout:i,iconBg:"bg-red-100 text-red-600",onClick:()=>n(!0),buttonProps:{"data-testid":"record-audio-button"}}),(0,o.jsxs)(c.Q,{open:r,onClose:()=>n(!1),className:"w-full md:w-2/3 lg:w-1/2 max-w-xl",dataTestId:"record-audio-modal",children:[(0,o.jsxs)(u.$N,{as:"h3",className:"text-base font-semibold leading-6 text-gray-900 flex items-center",children:[(0,o.jsx)(d.uYL,{className:"mr-2",fontSize:20}),(0,o.jsx)(s.Z,{id:"Editor.Source.RecordAudio"})]}),(0,o.jsx)(p,{waitBeforeShow:300,children:(0,o.jsx)(D,{hide:()=>n(!1),onSave:e=>{let i=function(e){var t;let i=(null===(t=e.split(";")[0])||void 0===t?void 0:t.trim().toLowerCase())||"";return i.includes("webm")?"webm":i.includes("mp4")?"m4a":i.includes("ogg")?"ogg":"dat"}(e.type||"audio/webm"),r=new File([e],"Recorded audio.".concat(i),{type:e.type||"audio/webm"});r.status="uploading",t({file:r,onProgress:()=>{r.status="uploading"},onSuccess:()=>{r.status="done"},onError:()=>{r.status="error"}})}})})]})]})}},19487:function(e,t,i){"use strict";i.d(t,{Z:function(){return o}});var r=i(52322);i(2784);var n=i(32434);function a(e){let{className:t}=e;return(0,r.jsx)("span",{className:"flex shrink-0 items-center justify-center rounded-full bg-blue-600 text-white shadow-sm ".concat(null!=t?t:""),"aria-hidden":!0,children:(0,r.jsx)(n.Z,{className:"h-3 w-3",strokeWidth:3})})}function o(e){let{icon:t,label:i,description:n,layout:o,iconBg:l,isSelected:s,onClick:d,buttonProps:c,asDiv:u}=e,p=function(e,t){let i="w-full cursor-pointer transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500",r=t?"border-blue-500 bg-blue-50 hover:bg-blue-100":"border-gray-200 bg-white hover:border-blue-400 hover:bg-blue-50";return"list"===e?"".concat(i," flex flex-row items-center gap-3 rounded-lg border px-4 py-3 text-left ").concat(r):"".concat(i," flex flex-col items-center justify-center gap-1 rounded-lg border p-4 text-center ").concat(r)}(o,s);if("list"===o){let e=(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"shrink-0 flex items-center justify-center rounded-xl p-2.5 ".concat(l),children:(0,r.jsx)(t,{size:26})}),(0,r.jsxs)("div",{className:"min-w-0 flex flex-col",children:[(0,r.jsx)("span",{className:"text-sm font-medium text-gray-900",children:i}),(0,r.jsx)("span",{className:"text-xs text-gray-500",children:n})]}),s&&(0,r.jsx)(a,{className:"ml-auto h-5 w-5"})]});return u?(0,r.jsx)("div",{className:p,children:e}):(0,r.jsx)("button",{type:"button",onClick:d,className:p,...c,children:e})}let m=(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"flex items-center justify-center rounded-xl p-2.5 mb-1 ".concat(l),children:(0,r.jsx)(t,{size:28})}),(0,r.jsx)("span",{className:"text-sm font-medium text-gray-900 leading-tight",children:i}),(0,r.jsx)("span",{className:"text-xs text-gray-500 leading-tight",children:n}),s&&(0,r.jsx)(a,{className:"absolute top-2 right-2 h-5 w-5"})]});return u?(0,r.jsx)("div",{className:"relative w-full",children:(0,r.jsx)("div",{className:p,children:m})}):(0,r.jsx)("div",{className:"relative w-full",children:(0,r.jsx)("button",{type:"button",onClick:d,className:p,...c,children:m})})}},37365:function(e,t,i){"use strict";i.d(t,{T:function(){return A}});var r=i(52322),n=i(2784),a=i(3752),o=i(42670),l=i(99127),s=i(7062),d=i(21353),c=i(30506),u=i(65089),p=i(15906),m=i(18997),f=i(96577),x=i.n(f),h=i(12524),g=i.n(h),v=i(96284),b=i(16867),E=i(52522),y=i(3420),w=i(26140),S=i(9223),j=i(92855),C=i(16378),N=i(18818),_=i(34610),R=i(67516);let A=()=>
1{let e=(0,a.d)(),{updateBackground:t,background:{colors:i,gradientDirection:f,imageURL:h,imageRect:A,imageResourceId:k,backgroundSize:I},editorSize:z,frameConfig:M}=(0,b.Dq)(),D=(0,_.v)(z,M),T=(0,c.G)(),{designId:O,saveEverything:F}=(0,E.hl)(),{resources:L}=(0,u.o0)(),P=(0,n.useMemo)(()=>{var e;let t=null!=h?h:k&&(null===(e=L[k])||void 0===e?void 0:e.publicURL);if(!t)return[];let i=new File([],"background-image",{type:"image/png"});return i.url=t,i.status="done",[i]},[h,k,L]),U=(null==A?void 0:A.width)?A.width/z.width:1,W=(null==A?void 0:A.scaleX)?100*A.scaleX*U*z.ratioToReference:100,B=(0,n.useCallback)(async e=>{if(!e.file)return;let i=O||await F();if(!i){(0,m.H)(Error("cannot get designId"));return}(0,p.$p)({designId:i,type:"image",onProgress(t){e.onProgress({percent:t},e.file)},onDownloadURL(i){e.onSuccess({status:"done",url:i},e.file),t({imageURL:i,imageRect:h&&null!=A?A:D,backgroundSize:h&&null!=I?I:"free"},!0)},onError(t,i){(0,m.H)(t,i),e.onError({response:(0,r.jsx)(o.Z,{id:(0,R.p)(t),values:{maxSize:p.Iv}})}),T.error((0,r.jsx)(o.Z,{id:(0,R.p)(t),values:{maxSize:p.Iv}}))}})(e.file)},[O,F,t,h,A,D,I,T]);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"p-0","data-testid":j.z.BG_COLOR_PICKER,children:(0,r.jsx)(y.e9,{canBeTransparent:!0,title:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(o.Z,{id:"Editor.Menu.Background.Colors"}),(0,r.jsx)(d.z,{theme:"link",onClick:()=>t({colors:[]}),className:"ml-4 text-sm",size:null,children:(0,r.jsx)(o.Z,{id:"Editor.Menu.Background.Transparent"})})]}),colorArray:i,setColorArray:e=>t({colors:e}),gradientDirection:f,setGradientDirection:e=>t({gradientDirection:e}),"data-testid":"color-picker-background",defaultColor:"#ffffff",target:"background"})}),(0,r.jsx)(v.i,{}),(0,r.jsxs)("div",{className:"mt-4 mb-6","data-testid":j.z.BG_IMAGE_PICKER,children:[(0,r.jsx)("p",{className:"mb-3 text-sm text-gray-900",children:(0,r.jsx)(o.Z,{id:"Editor.Menu.Background.Image"})}),(0,r.jsx)(s.g,{name:"image-file",customRequest:B,accept:N.mD.join(","),listType:"picture",showRemoveIcon:!0,className:"flex items-center justify-center w-full h-16 text-gray-900 border border-gray-400 border-dashed cursor-pointer rounded-md bg-gray-50 hover:text-violet-600 hover:border-violet-600",fileList:P,onPreview:e=>{t({imageURL:null==e?void 0:e.url,imageRect:D,backgroundSize:"free"},!0)},onRemove:e=>{var i;let r=null!=h?h:k&&(null===(i=L[k])||void 0===i?void 0:i.publicURL);(null==e?void 0:e.url)===r&&t({imageURL:null,imageRect:{},backgroundSize:null})},children:(0,r.jsxs)("div",{className:"flex flex-row items-center justify-center w-full",children:[(0,r.jsx)(l.aBR,{className:"text-2xl"}),(0,r.jsx)("span",{className:"ml-2",children:h?null!=e&&e?"Replace":"Replace image":(0,r.jsx)(o.Z,{id:"Editor.Background.Image"})})]})}),h&&"cover"!==I&&(0,r.jsxs)("div",{className:"mt-4",children:[(0,r.jsxs)("p",{className:"text-sm text-gray-900",children:["Zoom:",(0,r.jsxs)("span",{className:"ml-3 text-xs text-gray-500 md:text-sm",children:["(",(W/100).toFixed(2),"x)"]})]}),(0,r.jsx)(C.i,{value:[W],onValueChange:e=>"number"==typeof(null==e?void 0:e[0])&&t({imageRect:{...A,scaleX:e[0]/100/U/z.ratioToReference,scaleY:e[0]/100/U/z.ratioToReference}}),disabled:!1,min:10,max:300,step:2,className:"mt-2","aria-label":"Zoom slider"})]})]}),(0,r.jsx)(v.i,{}),(0,r.jsx)("p",{className:"mt-4 mb-3 text-sm text-gray-900",children:"Wallpapers"}),(0,r.jsx)("div",{className:"flex flex-wrap","data-testid":j.z.BG_WALLPAPERS,children:w.Sv.map(e=>{let i="/dreamy-gradients/".concat(e,".png"),n=null==h?void 0:h.includes(i);return(0,r.jsx)("div",{className:"w-1/3 relative px-0.5 py-1",children:(0,r.jsxs)("div",{className:g()("cursor-pointer rounded-lg touch-manipulation border shadow hover:shadow-md p-0.5 flex h-24",{"bg-indigo-900/75 border-indigo-800":n,"bg-white border-gray-400 hover:border-indigo-700":!n}),onClick:()=>{t({imageURL:(0,S._)({src:i,width:2048}),imageRect:{},backgroundSize:"cover"},!0),(0,m.Kz)("dreamy-gradient-click",{imageName:e})},children:[(0,r.jsx)(x(),{loader:S._,src:i,width:390,height:240,alt:"Template background: ".concat(e),draggable:!1,
1className:"flex-1 min-h-0 min-w-0 overflow-hidden rounded-md object-cover",style:{width:"100%",height:"100%"}}),n&&(0,r.jsx)(d.z,{theme:"danger",className:"absolute rounded-full top-0.5 right-0.5 p-0.5","aria-label":"Remove background","data-testid":j.z.TEMPLATE_BACKGROUND_REMOVE_BUTTON,size:null,onClick:e=>{e.stopPropagation(),t({imageURL:null,imageRect:{},backgroundSize:null})},rounded:!0,children:(0,r.jsx)(l.LHV,{className:"",fontSize:22})})]})},e)})})]})}},95978:function(e,t,i){"use strict";i.d(t,{a:function(){return c}});var r=i(52322),n=i(43034),a=i(2784),o=i(42670),l=i(21749),s=i(64818),d=i(16867);function c(){let{extraData:e}=(0,a.useContext)(n.q5),{elementType:t,objectName:i}=e,{updateTextLayer:c,textNodes:u}=(0,d.Gg)(),p=(0,a.useCallback)((e,r)=>{let n=new l.fabric.Color(e);r&&n.setAlpha(r);let a="#".concat(n.toHexa());"text"===t&&i&&c(i,{fillColor:a})},[t,i,c]),m=u.find(e=>e.name===i),f=(null==m?void 0:m.fillColor)||"#000000";return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.Ab,{title:(0,r.jsx)(o.Z,{id:"Editor.Menu.Text.Color",defaultMessage:"Color"})}),(0,r.jsx)(s.J,{color:f,setColor:p,disableAlpha:"text"===t,padding:!1,compact:!0,preview:(0,r.jsx)("span",{className:"flex-1 text-ellipsis text-xl",style:{color:f,fontFamily:null==m?void 0:m.fontFamily},children:null==m?void 0:m.text})})]})}},38372:function(e,t,i){"use strict";i.d(t,{e:function(){return eN}});var r=i(52322),n=i(2784),a=i(42670),o=i(83112),l=i(99127),s=i(32434),d=i(92244),c=i(41668),u=i(12524),p=i.n(u),m=i(19458),f=i(15297),x=i(14924),h=i(34444),g=i(72282),v=i(21353),b=i(68951),E=i(14084),y=i(30118),w=i(3438),S=i(52522),j=i(38420),C=i(93873),N=i(18997),_=i(23083);let R="wavevisual:exportUseCaseSurveyAnswered",A="wavevisual:exportUseCaseSurveyDismissed",k="wavevisual:exportUseCaseSurveyOfferedDesignIds";function I(e){try{return"true"===window.localStorage.getItem(e)}catch(e){return!1}}function z(e,t){try{window.localStorage.setItem(e,t?"true":"false")}catch(e){}}function M(e){try{let t=window.localStorage.getItem(e);if(!t)return[];let i=JSON.parse(t);return Array.isArray(i)?i.filter(e=>"string"==typeof e):[]}catch(e){return[]}}let D=[{id:"gift",label:"A gift for someone"},{id:"keepsake",label:"A keepsake for myself"},{id:"music",label:"My music or podcast"},{id:"event",label:"A wedding or event"},{id:"work",label:"Work or a client"},{id:"other",label:"Something else"}],T={work:"What kind of work? (optional)",other:"What was it for? (optional)"},O=e=>{let{designId:t,exportFileType:i,exportSize:a,onDismiss:o,className:l}
1=e,[s,d]=(0,n.useState)(null),[c,u]=(0,n.useState)(""),[m,f]=(0,n.useState)(!1),x=(0,n.useRef)(null),h=(0,n.useRef)(!1),g=D.find(e=>e.id===s),v=s?T[s]:void 0;(0,n.useEffect)(()=>{h.current||(h.current=!0,(0,N.Kz)("export_survey_shown",{survey_id:"export_use_case_v1",designId:t,exportFileType:i,exportSize:a}))},[t,i,a]),(0,n.useEffect)(()=>{if(v&&!m){var e;null===(e=x.current)||void 0===e||e.focus()}},[v,m]);let b=(e,r)=>(0,_.Ey)({surveyId:"export_use_case_v1",source:"export_modal",answerId:e.id,answerLabel:e.label,...r?{freeText:r}:{},...t?{designId:t}:{},...i?{exportFileType:i}:{},...a?{exportSize:a}:{}}).catch(e=>{(0,N.H)(e instanceof Error?e:Error("postSurveyResponseRequest failed"))}),E=e=>{s||(d(e.id),z(R,!0),(0,N.Kz)("export_survey_answered",{survey_id:"export_use_case_v1",answer_id:e.id,answer:e.label,designId:t,exportFileType:i,exportSize:a}),b(e))},y=()=>{let e=c.trim();e&&g&&(f(!0),(0,N.Kz)("export_survey_freetext_submitted",{survey_id:"export_use_case_v1",answer_id:g.id,text:e,designId:t}),b(g,e))};return(0,r.jsxs)("div",{className:p()("rounded-lg border border-gray-200 bg-white/70 p-3 text-left sm:p-4",l),"data-testid":"export-use-case-survey",children:[(0,r.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,r.jsx)("p",{className:"text-sm font-medium text-gray-700",children:s?"Thanks — that helps.":"Quick one: what did you make this for?"}),(0,r.jsx)("button",{type:"button",onClick:()=>{s||(z(A,!0),(0,N.Kz)("export_survey_dismissed",{survey_id:"export_use_case_v1",designId:t})),o()},"aria-label":s?"Close":"No thanks",className:"shrink-0 rounded px-1 text-xs text-gray-400 transition-colors hover:text-gray-600",children:"✕"})]}),!s&&(0,r.jsx)("div",{className:"mt-3 flex flex-wrap gap-2",children:D.map(e=>(0,r.jsx)("button",{type:"button",onClick:()=>E(e),className:"rounded-full border border-gray-300 px-3 py-1 text-xs text-gray-500 transition-colors hover:border-gray-400 hover:text-gray-700",children:e.label},e.id))}),v&&!m&&(0,r.jsxs)("div",{className:"mt-3 flex gap-2",children:[(0,r.jsx)("input",{ref:x,value:c,onChange:e=>u(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),y())},placeholder:v,className:"min-w-0 flex-1 rounded border border-gray-300 bg-transparent px-3 py-1.5 text-xs text-gray-600 placeholder:text-gray-400 focus:border-gray-400 focus:outline-none"}),(0,r.jsx)("button",{type:"button",onClick:y,className:"rounded border border-gray-400 px-3 py-1.5 text-xs text-gray-700 transition-colors hover:border-gray-600",children:"Send"})]})]})};var F=i(16378),L=i(7355),P=i(2431),U=i(92855),W=i(40381),B=i(60966),G=i(12544),H=i(43919),V=i(96647),Z=i(83327);function Y(e){if(void 0!==e)return .74*e+20}function q(e,t){let i=e.split(".");if(i.length<2)return null;let r=i[i.length-1];return r===m.ExportFileType.PNG||r===m.ExportFileType.JPG||r===m.ExportFileType.PDF||r===m.ExportFileType.SVG||r===m.ExportFileType.MP4||r===m.ExportFileType.GIF||r===m.ExportFileType.WEBM||r===m.ExportFileType.MOV||r===m.ExportFileType.MOV_PRORES?{job:t,fileType:r,jobName:e}:null}function K(e){return e===W.E.completed||e===W.E.cancelled||e===W.E.errored||e===W.E.timedout}let X=e=>{let{status:t}=e;switch(t){case W.E.cancelled:return(0,r.jsx)(a.Z,{id:"Editor.Export.JobEndedCancelled",defaultMessage:"Cancelled"});case W.E.errored:return(0,r.jsx)(a.Z,{id:"Editor.Export.JobEndedFailed",defaultMessage:"Failed"});case W.E.timedout:return(0,r.jsx)(a.Z,{id:"Editor.Export.JobEndedTimedOut",defaultMessage:"Timed out"});default:return null}};function J(e){switch(e){case W.E.completed:return"text-green-600";case W.E.errored:return"text-red-600";case W.E.cancelled:case W.E.timedout:return"text-amber-700";default:return"text-gray-500"}}function Q(e,t,i){return"".concat(i?"Video":"Design"," ").concat(e,".").concat((0,B.iF)(t))}let $=e=>{let{exportJobs:t}=e,{parentId:i,videoProjectId:o,designId:s}=(0,H.t)(),[d,c]=(0,n.useState)(null),[u,p]=(0,n.useState)(null),[f,x]=(0,n.useState)(!1),h=(0,n.useRef)(null),g=(0,n.useRef)({}),v=f?t:t.slice(0,5),b=t.length>5,E=(0,n.useCallback)((e,t)=>{var i;if(e.status!==W.E.inprogress||void 0===e.progressPercent)return K(e.status)&&delete g.current[t],null;let r=Y(e.progressPercent),n=Math.max(null!==(i=g.current[t])&&void 0!==i?i:0,r);return g.current[t]=n,n},[]),y=(0,n.useCallback)(async(e,t,r)=>{if(!i){(0,N.H)(Error("handleDownload:export parent id missing"));return}c(r),h.current=setTimeout(()=>{c(null),h.current=null},3e4);try{if("signedExportUrl"in e&&e.signedExportUrl){await (0,G.IG)(e.signedExportUrl,Q(i,t,!!o),{requireAttachmentDisposition:!0});return}if(o)throw Error("Video project export job is missing signedExportUrl");if(!s){(0,N.H)(Error("handleDownload:designId missing"));return}let r=function(e,t){if(!e.result)return null;try{let i=JSON.parse(e.result),r=Object.keys(i).find(e=>e.startsWith("".concat(t,":")));if(r){let e=r.split(":")[1];if(Object.values(m.ExportSize).includes(e))return e}}catch(e){(0,N.H)(Error("Failed to parse job result: ".concat(e)))}return null}(e,t)||m.ExportSize.large,n=await (0,_.po)(s,r,t,m.ExportMethod.v11);if(null==n?void 0:n.url)await (0,G.IG)(n.url,n.fileName||Q(s,t,!1),{requireAttachmentDisposition:!0});else throw Error("No download URL returned")}catch(e){(0,N.H)(e)}finally{h.current&&(clearTimeout(h.current),h.current=null),c(null)}},[s,i,o]),w=(0,n.useCallback)(async e=>{if(!i){(0,N.H)(Error("handleCancelExport:export parent id missing"));return}p(e);try{o?await (0,_.GO)({jobName:e},o):s?await (0,_.Vy)({jobName:e},s):(0,N.H)(Error("handleCancelExport:designId missing"))}catch(e){(0,N.H)(e)}finally{p(null)}},[s,i,o]);return 0===t.length?null:(0,r.jsxs)("div",{className:"mt-6",children:[(0,r.jsx)("p",{className:"mb-3 text-sm font-semibold text-gray-800",children:(0,r.jsx)(a.Z,{id:"Editor.Export.RecentExports",defaultMessage:"Recent Exports"})}),(0,r.jsx)("div",{className:"space-y-3",children:v.map(e=>{let{job:t,fileType:i,jobName:n}=e,o=E(t,n);return(0,r.jsxs)("div",{className:"border border-gray-200 rounded-lg p-3 hover:border-gray-300 transition-colors flex items-center gap-3",children:[(0,r.jsx)("div",{className:"relative w-16 h-16 shrink-0 bg-gray-100 rounded overflow-hidden",children:t.thumbnailUrl?(0,r.jsx)("img",{src:t.thumbnailUrl,alt:"".concat(i," export thumbnail"),width:64,height:64,draggable:!1,
1className:"h-full w-full object-cover",onError:e=>{let t=e.target;t.style.display="none",t.parentElement&&(t.parentElement.innerHTML='<div class="w-full h-full flex items-center justify-center text-gray-400 text-xs"></div>')}}):(0,r.jsx)("div",{className:"w-full h-full flex items-center justify-center text-gray-400 text-xs"})}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsxs)("div",{className:"min-w-0 flex flex-col capitalize",children:[(0,r.jsx)("span",{className:"text-sm font-medium text-gray-700 uppercase truncate",children:i===m.ExportFileType.MOV_PRORES?"MOV ProRes":i}),K(t.status)&&t.status!==W.E.completed&&(0,r.jsx)("div",{className:"text-xs truncate ".concat(J(t.status)),children:(0,r.jsx)(X,{status:t.status})}),!K(t.status)&&t.customStatus&&(0,r.jsx)("div",{className:"text-xs truncate ".concat(J(t.status)),title:t.customStatus,children:t.customStatus})]}),null!==o&&(0,r.jsx)("div",{className:"mt-2 h-1.5 bg-gray-200 rounded-full overflow-hidden",children:(0,r.jsx)("div",{className:"h-full bg-violet-500 transition-all duration-300",style:{width:"".concat(Math.min(100,Math.max(0,o)),"%")}})}),(t.status===W.E.inprogress||t.status===W.E.queued)&&(0,r.jsx)("div",{className:"mt-2",children:(0,r.jsx)(Z.z,{type:"button",variant:"outline",size:"sm",onClick:()=>w(n),disabled:u===n,loading:u===n,"aria-label":"Cancel export",className:"shrink-0",children:(0,r.jsx)(a.Z,{id:"Editor.Export.CancelExport",defaultMessage:"Cancel export"})})}),(0,r.jsxs)("div",{className:"flex-1 min-w-0 flex-row flex",children:[t.status===W.E.queued&&(t.createdAt||t.startedAt)&&(0,r.jsxs)("div",{className:"text-xs text-gray-500 mt-1",children:["Queued"," ",(0,V.Z)(new Date(t.createdAt||t.startedAt||0),new Date,{addSuffix:!0})]}),t.status===W.E.inprogress&&t.startedAt&&(0,r.jsxs)("div",{className:"text-xs text-gray-500 mt-1",children:["Started"," ",(0,V.Z)(new Date(t.startedAt),new Date,{addSuffix:!0})]}),K(t.status)&&(t.exitedAt||t.updatedAt)&&(0,r.jsx)("div",{className:"text-xs text-gray-500 mt-1",children:(0,V.Z)(new Date(t.exitedAt||t.updatedAt||0),new Date,{addSuffix:!0})})]}),t.status===W.E.completed&&"signedExportUrl"in t&&t.signedExportUrl&&(0,r.jsxs)(Z.z,{variant:"link",size:"sm",onClick:()=>y(t,i,n),disabled:d===n,loading:d===n,"aria-label":"Download ".concat(i," export"),className:"shrink-0 h-auto p-0 mt-1 gap-1 text-xs",children:[d!==n&&(0,r.jsx)(l.RFS,{className:"w-3.5 h-3.5"}),d===n?"Downloading generated file":"Download generated file"]})]})]},n)})}),b&&(0,r.jsx)(Z.z,{variant:"link",size:"sm",onClick:()=>x(!f),className:"mt-3 px-0",children:f?"Show less":"Show all"})]})};var ee=i(96284),et=i(46620);let ei=()=>{let{parentId:e}=(0,H.t)(),{currentJobName:t,exportStatus:i}=(0,b.p)(),a=(0,P.YZ)(e=>e.designJobs),o=(0,n.useRef)(0);(0,n.useEffect)(()=>{t&&"pending"===i||(o.current=0)},[t,i]);let l=(0,n.useMemo)(()=>{if(!t||!e)return null;let i=a[t];if(i){if(i.status===W.E.inprogress&&void 0!==i.progressPercent){let e=Y(i.progressPercent),t=Math.max(o.current,e);return o.current=t,t}return null}},[t,a,e]),s=(0,n.useMemo)(()=>null===l?[{percent:10,timeout:1e3},{percent:14,timeout:1400},{percent:21,timeout:2e3},{percent:25,timeout:1600},{percent:33,timeout:1500},{percent:43,timeout:1900},{percent:51,timeout:2100},{percent:55,timeout:1500},{percent:57,timeout:1300},{percent:61,timeout:1800},{percent:66,timeout:2500},{percent:73,timeout:1800},{percent:78,timeout:2200},{percent:81,timeout:2300},{percent:85,timeout:2500},{percent:88,timeout:3500},{percent:90,timeout:3e3},{percent:94,timeout:3e3}]:void 0,[l]);return"pending"!==i?null:(0,r.jsx)("div",{className:"flex items-center h-6",children:(0,r.jsx)(et.E,{percent:null!=l?l:5,fakePlays:s})})};var er=i(59637);let en=e=>{let{type:t,className:i,children:n}=e,a="error"===t,o=p()({"border-red-400 bg-red-50 text-red-800":a,"border-yellow-400 bg-yellow-50 text-yellow-700":!a}),s=p()("h-5 w-5",{"text-red-400":a,"text-yellow-400":!a}),d=a?l.LHV:l.ELj;return(0,r.jsx)("div",{className:p()("border px-3 py-2 w-full rounded-lg",o,i),children:(0,r.jsxs)("div",{className:"flex",children:[(0,r.jsx)("div",{className:"shrink-0",children:(0,r.jsx)(d,{className:s,"aria-hidden":"true"})}),(0,r.jsx)("div",{className:"ml-3 text-sm",children:n})]})})};var ea=i(61796),eo=i(45228),el=i(82423);let es=eo.R9/60,ed=e=>{let{effectiveDuration:t}=e;return(0,r.jsxs)(en,{type:"warning",className:"mt-2",children:["Video export is limited to ",es," minutes. Your audio duration (",t?(0,el.L)(t):"N/A",") exceeds this limit. Trim your audio, or request a limit extension below."]})};var ec=i(99433),eu=i(86767),ep=i(83553),em=i(70082),ef=i(17088),ex=i(3741);function eh(e){if(!e||"object"!=typeof e||!Object.prototype.hasOwnProperty.call(e,"code"))return;let t=e.code;return"string"==typeof t&&t.length>0?t:void 0}function eg(e){var t;if(!e||"object"!=typeof e)return!1;let i=eh(e);return 403===e.status||"permission-denied"===i||/403|forbidden|permission/i.test(String(null!==(t=e.message)&&void 0!==t?t:""))}function ev(e){if(!e||"object"!=typeof e)return;let t=e.status;return"number"==typeof t?t:void 0}let eb="EXPORT_SIGNED_URL_TIMEOUT";async function eE(e){let{jobName:t,designId:i,exportFileType:r,parentCollection:n}=e,a=function(e){if(e===m.ExportFileType.MP4||e===m.ExportFileType.WEBM||e===m.ExportFileType.MOV||e===m.ExportFileType.MOV_PRORES)return P.u0}(r);n&&"designs"!==n?await P.YZ.getState().waitForDesignJobCompletion(t,i,a,n):void 0===a?await P.YZ.getState().waitForDesignJobCompletion(t,i):await P.YZ.getState().waitForDesignJobCompletion(t,i,a);let o=()=>{var e;
1let i=P.YZ.getState().designJobs[t];return null!==(e=null==i?void 0:i.signedExportUrl)&&void 0!==e?e:null},l=o();if(l)return{url:l,fileName:"Design ".concat(i,".").concat((0,B.iF)(r))};let s=Date.now()+8e3;for(;Date.now()<s;)if(await (0,eu.wait)(500),l=o())return{url:l,fileName:"Design ".concat(i,".").concat((0,B.iF)(r))};throw Object.assign(Error("Download URL (signedExportUrl) not available for job ".concat(t," after ").concat(8e3,"ms")),{code:eb})}function ey(){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"mb-2 h-3 w-16 animate-pulse rounded bg-gray-200"}),(0,r.jsx)("div",{className:"h-10 w-full animate-pulse rounded-lg bg-gray-200"})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"mb-2 h-3 w-14 animate-pulse rounded bg-gray-200"}),(0,r.jsx)("div",{className:"flex mt-4 mb-6",children:(0,r.jsx)("div",{className:"h-2 w-full animate-pulse rounded-full bg-gray-200"})}),(0,r.jsx)("div",{className:"h-4 w-32 animate-pulse rounded bg-gray-200"})]}),(0,r.jsx)(ee.i,{}),(0,r.jsx)("div",{className:"h-10 w-full animate-pulse rounded-xl bg-gray-200"})]})}i(69448);var ew=i(1825);function eS(e,t){return!!e&&(t===m.ExportFileType.PDF||t===m.ExportFileType.SVG||"motion"===(0,x.i)(t))}let ej=e=>{let{labelId:t,paidCrownTitle:i}=e;return(0,r.jsxs)("span",{className:"inline-flex items-center gap-2",children:[(0,r.jsx)(a.Z,{id:t}),i&&(0,r.jsx)(l.Xrf,{className:"h-3.5 w-3.5 shrink-0 text-amber-600","aria-hidden":!0,title:i})]})},eC=e=>{let{labelId:t,descriptionId:i,Icon:n,selected:o,paidCrownTitle:d}=e;return(0,r.jsxs)("span",{className:"flex w-full flex-col gap-0.5",children:[(0,r.jsxs)("span",{className:"flex w-full items-center gap-2",children:[(0,r.jsx)(n,{className:"h-4 w-4 shrink-0 text-violet-700","aria-hidden":!0}),(0,r.jsxs)("span",{className:"inline-flex items-center gap-2",children:[(0,r.jsx)(a.Z,{id:t}),d&&(0,r.jsx)(l.Xrf,{className:"h-3.5 w-3.5 shrink-0 text-amber-600","aria-hidden":!0,title:d})]}),o&&(0,r.jsx)(s.Z,{className:"ml-auto h-4 w-4 text-violet-700","aria-hidden":!0})]}),i&&(0,r.jsx)("span",{className:"text-xs text-gray-500 pl-6",children:(0,r.jsx)(a.Z,{id:i})})]})},eN=e=>{var t,i,s;let{primaryActionSlot:u,allowedFileTypes:z}=e,D=(0,o.Z)(),T=D.formatMessage({id:"Editor.Export.PaidFormatHint",defaultMessage:"Premium"}),{designId:H}=(0,S.hl)(),V=(0,ef.G)(e=>{var t;return null===(t=e.document)||void 0===t?void 0:t.id}),{exportSize:Z,exportFileType:Y,showExportUseCaseSurvey:K,setShowExportUseCaseSurvey:X,downloadPhase:J,currentJobName:Q,lastDesignId:et,exportStatus:eo,exportErrorMessage:el,setExportSize:es,setExportFileType:eu,setCurrentJobName:eN,setLastDesignId:e_,resetDownloadState:eR}=(0,b.p)(),{canvasAspectRatio:eA}=(0,y._i)(),ek=(0,j.b)();(0,L.aC)();let eI=(0,E.s)(e=>e.isLoading),{permittedSizesForPngJpg:ez,selectableSizesForPngJpg:eM,isHybridExport:eD,downloadTypeOptions:eT,exceedsDurationLimit:eO,effectiveDuration:eF,isMp4DisabledByAudio:eL,isEmptyVideoProject:eP,videoExportBlockedNoticeId:eU,isPaid:eW,isSelectionFreeTier:eB}=(0,ec.d)({allowedFileTypes:z}),{downloadExport:eG}=function(){var e,t;let i=(0,o.Z)(),{isPaid:r}=(0,E.s)(),a=(0,L.aC)(),{designId:l}=(0,S.hl)(),{exportSize:s,exportFileType:d,setDownloadPhase:c,setCurrentJobName:u,setExportStatus:p,setExportErrorMessage:f,setShowExportUseCaseSurvey:x}=(0,b.p)(),{saveEverything:v,editMode:C}=(0,S.hl)(),{captions:z}=(0,y._i)(),D=(0,j.b)(),{canvasAspectRatio:T}=(0,y._i)(),O=(0,n.useMemo)(()=>(0,h.v)({aspectRatio:T,audioSource:D,landingPath:(0,g.Uy)()}),[T,D]),F=(0,n.useCallback)(e=>{var t,i,n;return!!(ex.featureFlags.exportUseCaseSurvey&&!(!e||I(R)||I(A))&&!M(k).includes(e)&&function(e){let{isPaidDesign:t,hasCredit:i,hasSubscription:r}=e;return t&&!i&&!r}({isPaidDesign:!!r,hasCredit:!!((null===(t=a.userDetails)||void 0===t?void 0:t.credit)&&a.userDetails.credit>0),hasSubscription:!!(null===(n=a.userDetails)||void 0===n?void 0:null===(i=n.subscriptions)||void 0===i?void 0:i.length)}))&&(!function(e){if(!e)return;let t=M(k);t.includes(e)||function(e,t){try{window.localStorage.setItem(e,JSON.stringify(t.slice(-50)))}catch(e){}}(k,[...t,e])}(e),window.setTimeout(()=>x(!0),1200),!0)},[null===(e=a.userDetails)||void 0===e?void 0:e.credit,null===(t=a.userDetails)||void 0===t?void 0:t.subscriptions,r,x]);return{downloadExport:(0,n.useCallback)(async()=>{var e,t,n,a,o;s||(0,N.H)(Error("downloadImage:exportSize missing")),u(null),f(null),c("generating"),p("pending");let x=(null===(e=ef.G.getState().document)||void 0===e?void 0:e.id)?(0,em.ng)(null===(t=ef.G.getState().document)||void 0===t?void 0:t.captionTracks):(0,em.Gx)(null!=z?z:null===(a=E.s.getState().designDocument)||void 0===a?void 0:null===(n=a.config)||void 0===n?void 0:n.captions);try{C!==ep.uz.Locked&&await v();let e=null===(o=ef.G.getState().document)||void 0===o?void 0:o.id,t=null!=e?e:l;if(!t)return c("idle"),p("idle"),(0,N.H)(Error("downloadImage: designId missing"));let i=m.ExportMethod.v11,n=s||m.ExportSize.large,a=e?await (0,_.mA)({size:n,fileType:d,method:i},e):await (0,_._e)({size:n,fileType:d,method:i},t);if(a.url){w.bJ({designId:t,exportFileType:d,exportSize:n,selectedSource:D,isPaid:r,...x,resolvedIntent:O.intent,intentScore:O.score,intentSource:O.source}),c("downloading"),await (0,G.IG)(a.url,a.fileName||"Design ".concat(t,".").concat((0,B.iF)(d)),{requireAttachmentDisposition:!0}),F(t),c("idle"),f(null),p("success");return}u(a.jobName);let h=await eE({jobName:a.jobName,designId:t,exportFileType:d,parentCollection:e?"video_projects":"designs"});w.bJ({designId:t,exportFileType:d,exportSize:n,selectedSource:D,isPaid:r,...x,resolvedIntent:O.intent,intentScore:O.score,intentSource:O.source}),c("downloading"),await (0,G.IG)(h.url,h.fileName||"Design ".concat(t,".").concat((0,B.iF)(d)),{requireAttachmentDisposition:!0}),F(t),c("idle"),f(null),p("success")}catch(e){if(eh(e)===P.IH){f(null),p("idle"),c("idle"),u(null);return}(0,N.H)(e),w.GC({...function(e){let t={};if(e&&"object"==typeof e&&("string"==typeof e.serverError&&e.serverError&&(t.server_error=e.serverError.slice(0,500)),"string"==typeof e.jobName&&e.jobName&&(t.job_name=e.jobName)),eg(e)){let i=ev(e);return{...t,...void 0!==i?{failure_code:"permission_denied",http_status:i}:{failure_code:"permission_denied"}}}let i=eh(e);if(void 0!==i){let r=ev(e);return{...t,...void 0!==r?{failure_code:i,http_status:r}:{failure_code:i}
1}}let r=ev(e);return void 0!==r?{...t,failure_code:"http_error",http_status:r}:{...t,failure_code:"unknown"}}(e),designId:l,exportFileType:d,exportSize:s||m.ExportSize.large,isPaid:r,selectedSource:D,...x}),f(function(e,t,i){if(eg(e))return t.formatMessage({id:"Editor.Export.ErrorPermission",defaultMessage:"You do not have permission to download this export."});let r=eh(e);if(void 0!==r&&e&&"object"==typeof e){if(r===P.um&&"number"==typeof e.timeoutMs){let r=Math.max(1,Math.round(e.timeoutMs/6e4));return e.timeoutMs===i?t.formatMessage({id:"Editor.Export.ErrorJobClientTimeoutVideo",defaultMessage:"Video export timed out after {minutes} minutes. Please try again."},{minutes:r}):t.formatMessage({id:"Editor.Export.ErrorJobClientTimeoutDefault",defaultMessage:"Export timed out after {minutes} minutes. Please try again."},{minutes:r})}if(r===eb)return t.formatMessage({id:"Editor.Export.ErrorSignedUrlTimeout",defaultMessage:"Download link was not ready. Please try again."});if(r===P.sA)return t.formatMessage({id:"Editor.Export.ErrorJobServerTimeout",defaultMessage:"Export timed out on our servers. Try a shorter clip or lower resolution."});if(r===P.G9)return t.formatMessage({id:"Editor.Export.ErrorJobServerFailed",defaultMessage:"Export failed. Please try again."});if(r===G.vQ)return t.formatMessage({id:"Editor.Export.ErrorDownloadHttp",defaultMessage:"Could not download the file. Please try again in a moment."})}let n=(e instanceof Error?e.message:"string"==typeof e?e:"").toLowerCase();return n.includes("failed to fetch")||n.includes("networkerror")||n.includes("load failed")||n.includes("fetch failed")?t.formatMessage({id:"Editor.Export.ErrorNetwork",defaultMessage:"Connection problem. Check your network and try again."}):n.includes("no id token")?t.formatMessage({id:"Editor.Export.ErrorSignIn",defaultMessage:"Sign in to download your export."}):n.includes("failed to download file")?t.formatMessage({id:"Editor.Export.ErrorDownloadHttp",defaultMessage:"Could not download the file. Please try again in a moment."}):n.includes("startexportrequest failed")||n.includes("startvideoprojectexportrequest failed")?t.formatMessage({id:"Editor.Export.ErrorStartExport",defaultMessage:"Could not start the export. Please try again."}):n.includes("downloaddesignrequest failed")?t.formatMessage({id:"Editor.Export.ErrorDownloadUrl",defaultMessage:"Could not get the download link. Please try again."}):t.formatMessage({id:"Editor.Export.ErrorGeneric",defaultMessage:"Export failed. Please try again."})}(e,i,P.u0)),p("error"),c("idle"),u(null)}},[z,l,O,d,s,C,i,r,v,D,u,c,f,p,F])}}(),eH=(0,P.YZ)(e=>e.designJobs),eV=(0,P.YZ)(e=>e.jobsSubscriptionError),eZ=(0,E.s)(e=>{var t;return null===(t=e.designDocument)||void 0===t?void 0:t.videoLimitExtensionRequestedAt}),[eY,eq]=(0,n.useState)(!1),[eK,eX]=(0,n.useState)(!1);(0,n.useEffect)(()=>{if(!eZ){eX(!1);return}let e=Date.parse(eZ);eX(!Number.isNaN(e)&&Date.now()-e<864e5)},[eZ]);let eJ=(0,n.useMemo)(()=>new Set(eT.map(e=>(0,x.i)(e.value))).size>1,[eT]),eQ=(0,n.useMemo)(()=>{var e;return null!==(e=eT.find(e=>e.value===Y))&&void 0!==e?e:eT[0]},[eT,Y]),e$=eS(eD,eQ.value)&&!eQ.disabled?T:void 0;(0,n.useEffect)(()=>{let e=null!=V?V:H;e&&(et&&et!==e&&eR(),et!==e&&(e_(e),eX(!1)))},[H,V,et,eR,e_]),(0,n.useEffect)(()=>{"pending"!==eo&&Q&&eN(null)},[eo,Q,eN]),(0,n.useEffect)(()=>{eD||Y!==m.ExportFileType.PNG&&Y!==m.ExportFileType.JPG||ez.includes(Z)||!(ez.length>0)||es(ez[0])},[Y,Z,ez,es,eD]);let e0=(0,C.P)(),e1=(0,n.useRef)(!1);(0,n.useEffect)(()=>{var e;if(e1.current)return;e1.current=!0;let t=(0,g.Uy)(),i=(0,h.v)({aspectRatio:eA,audioSource:ek,landingPath:t});w.IN({designId:null!==(e=null!=V?V:H)&&void 0!==e?e:void 0,aspectRatio:eA,audioSource:ek,landingPath:t,resolvedIntent:i.intent,intentScore:i.score,intentSource:i.source,candidateSignals:e0})},[]);let e2=(0,n.useMemo)(()=>(function(e){let t=[],i=Date.now(),r=i-12096e5;return Object.entries(e).forEach(e=>{let[n,a]=e;if(!n.startsWith("export-design-"))return;let o=a.updatedAt?new Date(a.updatedAt).getTime():null;if(a.status===W.E.completed||a.status===W.E.inprogress||a.status===W.E.queued){if(!(null!==o&&o>=r))return;let e=q(n,a);e&&t.push(e);return}if(a.status===W.E.cancelled||a.status===W.E.errored||a.status===W.E.timedout){let e=a.exitedAt?new Date(a.exitedAt).getTime():o;if(null==e||i-e>9e5)return;let r=q(n,a);r&&t.push(r)}}),t.sort((e,t)=>
1{let i=e.job.createdAt?new Date(e.job.createdAt).getTime():0;return(t.job.createdAt?new Date(t.job.createdAt).getTime():0)-i})})(eH),[eH]),e5="motion"===(0,x.i)(Y),e4=!!H&&e5&&eO,e3=!(H||V)||e5&&(eL||eO||eP),e8=async()=>{if(H&&!eY&&!eK){eq(!0);try{await (0,_.mk)({...null!=eF&&{effectiveDurationSeconds:eF},exportFileType:Y},H),eX(!0),(0,ew.e)({theme:"success",content:D.formatMessage({id:"Editor.Export.RequestLimitExtensionSuccess"})})}catch(r){var e;let t=String(null!==(e=null==r?void 0:r.message)&&void 0!==e?e:""),i=/429|rate.?limit|recently/i.test(t);(0,ew.e)({theme:i?"info":"error",content:D.formatMessage({id:i?"Editor.Export.RequestLimitExtensionRateLimited":"Editor.Export.RequestLimitExtensionError"})}),i&&eX(!0)}finally{eq(!1)}}};return eI?(0,r.jsx)(ey,{}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"mb-2 text-xs font-semibold capitalize tracking-wide text-gray-600",children:"File type"}),(0,r.jsxs)(er.h_,{children:[(0,r.jsx)(er.$F,{asChild:!0,children:(0,r.jsxs)("button",{type:"button","data-testid":U.z.SELECT_DOWNLOAD_TYPE_RADIO_GROUP,className:"flex w-full items-center justify-between rounded-lg border border-violet-500 bg-white px-3 py-2 text-left text-sm text-violet-900 shadow-sm transition-colors hover:border-violet-600 hover:bg-violet-50 disabled:cursor-not-allowed disabled:opacity-60",disabled:"pending"===eo,"aria-label":"Select download file type",children:[(0,r.jsxs)("span",{className:"flex items-center gap-2",children:[(0,r.jsx)(eQ.icon,{className:"h-4 w-4 shrink-0 text-violet-600","aria-hidden":!0}),(0,r.jsx)(ej,{labelId:eQ.labelId,paidCrownTitle:e$})]}),(0,r.jsx)(d.Z,{className:"h-4 w-4 text-violet-500","aria-hidden":!0})]})}),(0,r.jsx)(er.AW,{align:"start",className:"max-h-[min(32rem,var(--radix-dropdown-menu-content-available-height))] w-[var(--radix-dropdown-menu-trigger-width)] border-violet-500 bg-white py-1.5 shadow-lg",children:eT.map((e,t)=>{let i=(0,x.i)(e.value),o=eJ&&(0===t||i!==(0,x.i)(eT[t-1].value));return(0,r.jsxs)(n.Fragment,{children:[o&&t>0&&(0,r.jsx)("div",{className:"mx-2 my-1 h-px bg-violet-100","aria-hidden":!0}),o&&(0,r.jsx)(er.Ju,{className:"px-2 pb-1 pt-1.5 text-[11px] font-semibold uppercase tracking-wide text-gray-500",children:(0,r.jsx)(a.Z,{id:"motion"===i?"Editor.Export.GroupVideo":"Editor.Export.GroupImage"})}),(0,r.jsx)(er.Xi,{disabled:"pending"===eo||e.disabled,onSelect:()=>{if(e.disabled||"pending"===eo)return;let t=e.value,i=t===m.ExportFileType.SVG||t===m.ExportFileType.PDF?m.ExportSize.large:Z,r=eW||(t===m.ExportFileType.PNG||t===m.ExportFileType.JPG)&&ez.includes(i);eu(t),(t===m.ExportFileType.SVG||t===m.ExportFileType.PDF)&&es(m.ExportSize.large),eD&&w.xT({exportFileType:t,exportSize:i,isSelectionFreeTier:!!r})},"data-testid":"export-file-type-option-".concat(e.value),className:"rounded-md py-2.5 text-violet-900 focus:bg-violet-100 focus:text-violet-900",children:(0,r.jsx)(eC,{labelId:e.labelId,descriptionId:e.descriptionId,Icon:e.icon,selected:e.value===Y,paidCrownTitle:eS(eD,e.value)&&!e.disabled?T:void 0})})]},e.value)})})]}),e5&&eO&&(0,r.jsx)(ed,{effectiveDuration:eF}),e5&&eL&&(0,r.jsx)(en,{type:"warning",className:"mt-2",children:(0,r.jsx)(a.Z,{id:eU})})]}),(Y===m.ExportFileType.PNG||Y===m.ExportFileType.JPG)&&(0,r.jsxs)(r.Fragment,{children:[eD&&eM.length>1?(0,r.jsxs)("div",{className:"mt-6 mb-2 flex justify-between text-[11px] leading-tight",children:[(0,r.jsx)("span",{className:p()("font-medium",eB?"text-slate-700":"text-slate-400"),children:(0,r.jsx)(a.Z,{id:"Editor.Export.SliderLabelFree"})}),(0,r.jsx)("span",{className:p()(eB?"font-medium text-slate-400":"font-semibold text-violet-700"),children:(0,r.jsx)(a.Z,{id:"Editor.Export.SliderLabelFull"})})]}):(0,r.jsx)("p",{className:"mt-6 mb-2 text-xs font-semibold capitalize tracking-wide text-gray-600",children:"Quality"}),(0,r.jsx)("div",{className:"flex mt-4 mb-6",children:(0,r.jsx)(F.i,{onValueChange:e=>{let t=eM[Array.isArray(e)?e[0]:e];es(t),eD&&w.xT({exportFileType:Y,exportSize:t,isSelectionFreeTier:ez.includes(t)})},disabled:"pending"===eo,value:[Math.max(0,eM.indexOf(Z)>=0?eM.indexOf(Z):0)],min:0,max:Math.max(0,eM.length-1),"aria-label":"Export resolution slider"})}),(0,r.jsx)("div",{className:"gap-y-1 flex-col flex",children:(0,r.jsxs)("p",{className:"flex items-center justify-between w-full gap-1",children:[(0,r.jsx)("span",{children:"Pixels:"}),(0,r.jsxs)("span",{className:"flex items-center gap-1",children:[(0,f.h)(eA,m.Unit.pixel,eM.includes(Z)?Z:null!==(t=eM[0])&&void 0!==t?t:m.ExportSize.optimized),(0,r.jsx)(ea.u,{side:"left",content:(0,r.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,r.jsx)("span",{children:(0,f.h)(eA,m.Unit.cm,eM.includes(Z)?Z:null!==(i=eM[0])&&void 0!==i?i:m.ExportSize.optimized)}),(0,r.jsx)("span",{children:(0,f.h)(eA,m.Unit.inch,eM.includes(Z)?Z:null!==(s=eM[0])&&void 0!==s?s:m.ExportSize.optimized)})]}),children:(0,r.jsx)(c.Z,{className:"h-3.5 w-3.5 shrink-0 text-gray-400 hover:text-gray-600","aria-label":"Size in cm and inches"})})]})]})})]}),(0,r.jsx)(ee.i,{}),"error"===eo&&(0,r.jsx)(en,{type:"error",className:"mt-4",children:(0,r.jsx)("p",{className:"font-medium",children:null!=el?el:D.formatMessage({id:"Editor.Export.ErrorGeneric",defaultMessage:"Export failed. Please try again."})})}),(0,r.jsx)(ei,{}),V&&eV&&(0,r.jsx)(en,{type:"warning",className:"mt-4","data-testid":"export-jobs-subscription-error",children:(0,r.jsx)("p",{className:"font-medium",children:eV})}),(0,r.jsx)("div",{className:"flex items-center mt-2",children:e4?(0,r.jsx)(v.z,{theme:"primary",className:"rounded-xl",size:"normal",block:!0,onClick:e8,"data-testid":U.z.REQUEST_VIDEO_LIMIT_EXTENSION_BUTTON,icon:l.Dme,loading:eY,disabled:eK,children:eK?(0,r.jsx)(a.Z,{id:"Editor.Export.RequestLimitExtensionSent"}):(0,r.jsx)(a.Z,{id:"Editor.Export.RequestLimitExtension"})}):null!=u?u:(0,r.jsxs)(v.z,{theme:"primary",className:"rounded-xl",size:"normal",block:!0,onClick:eG,"data-testid":U.z.DOWNLOAD_BUTTON,icon:l.RFS,loading:"pending"===eo,disabled:e3,children:["generating"===J&&"Generating...","downloading"===J&&"Downloading...","idle"===J&&(0,r.jsx)(a.Z,{id:"Editor.Export.Export"})]})}),e2.length>0&&(0,r.jsx)(ee.i,{}),(0,r.jsx)($,{exportJobs:e2}),K&&(0,r.jsx)(O,{className:"mt-3",designId:null!=H?H:void 0,exportFileType:Y,exportSize:Z,onDismiss:()=>X(!1)})]})}},69448:function(e,t,i){"use strict";i.d(t,{d:function(){return a},s:function(){return n}});var r=i(19458);let n=[r.ExportFileType.MP4,r.ExportFileType.GIF,r.ExportFileType.WEBM,r.ExportFileType.MOV_PRORES,r.ExportFileType.MOV],a=[r.ExportSize.optimized,r.ExportSize["720p"],r.ExportSize.lowres,r.ExportSize.small,r.ExportSize.medium,r.ExportSize.large]},99433:function(e,t,i){"use strict";i.d(t,{d:function(){return j}});var r=i(2784),n=i(19458),a=i(14084),o=i(68951),l=i(7355),s=i(16572),d=i(65089),c=i(83096),u=i(30118),p=i(80920),m=i(3741),f=i(45539),x=i(72871),h=i(45228),g=i(19650),v=i(710),b=i(55886),E=i(17088),y=i(38719),w=i(51574),S=i(69448);function j(e){var t,i;let{designDocument:j,isPaid:C}=(0,a.s)(),{exportSize:N,exportFileType:_}=(0,o.p)(),R=(0,l.aC)(),{waveformConfig:A,waveforms:k}=(0,u._i)(),I=(0,p.Q5)(),{audioElement:z}=(0,c.FI)(),M=(0,d.dy)(),D=(0,E.G)(e=>e.document),T=D?(0,y.sT)(D):void 0,O=null==k?void 0:k.find(e=>e.id===I),F=null!==(i=null==O?void 0:O.trim)&&void 0!==i?i:null==A?void 0:A.trim,[L,P]=(0,r.useState)(()=>{let e=null==z?void 0:z.duration;return e&&Number.isFinite(e)&&e>0?e:null});(0,r.useEffect)(()=>
1{if(!z)return;let e=()=>{let{duration:e}=z;P(Number.isFinite(e)&&e>0?e:null)};return e(),z.addEventListener("loadedmetadata",e),z.addEventListener("durationchange",e),z.addEventListener("emptied",e),()=>{z.removeEventListener("loadedmetadata",e),z.removeEventListener("durationchange",e),z.removeEventListener("emptied",e)}},[z]);let U=(0,f.A)(f.T.FREE_PREVIEW_DOWNLOAD),W=(0,s.mv)((null===(t=R.userDetails)||void 0===t?void 0:t.subscriptions)||[]),B=W||m.featureFlags.freeDownloadsForReviews,G=(0,r.useMemo)(()=>x.$7,[]),H=(0,r.useMemo)(()=>{var e,t;return{paidAt:null!==(t=null!==(e=null==D?void 0:D.paidAt)&&void 0!==e?e:null==j?void 0:j.paidAt)&&void 0!==t?t:null}},[null==D?void 0:D.paidAt,null==j?void 0:j.paidAt]),V=!!(C||(null==D?void 0:D.paidAt)),Z=(0,r.useMemo)(()=>V||B?S.d:S.d.filter(e=>G.includes(e)),[V,B,G]),Y=(0,r.useMemo)(()=>{if(!L)return null;if(F&&"number"==typeof F.startRatio&&"number"==typeof F.endRatio&&F.startRatio>=0&&F.endRatio<=1&&F.startRatio<F.endRatio){let{startRatio:e,endRatio:t}=F;return(t-e)*L}return L},[L,F]),q=null!==Y&&Y>h.R9,K=function(e){var t;if(e.selectedAudioResourceType===w.CustomFileType.bucket)return!0;let i=null===(t=e.primaryMedia)||void 0===t?void 0:t.kind;return"audio"===i||"video"===i}({selectedAudioResourceType:null==M?void 0:M.type,primaryMedia:T}),X=!K,J=D?"Editor.Export.VideoNoMedia":"Editor.Export.VideoNoAudio",Q=null!=D&&!(D.durationMs>0),$=!!U&&!V&&!B,ee=(0,r.useMemo)(()=>{let t=(0,x.Zk)(H,{allowFreeDownload:B,freeTierSizes:G,size:n.ExportSize.large,fileType:n.ExportFileType.PDF}),i=(0,x.Zk)(H,{allowFreeDownload:B,freeTierSizes:G,size:n.ExportSize.large,fileType:n.ExportFileType.SVG}),r=!$&&!t,a=!$&&!i,o=[{value:n.ExportFileType.PDF,labelId:"Editor.Export.PDF",descriptionId:"Editor.Export.PDFDescription",disabled:r,icon:g.Z},{value:n.ExportFileType.PNG,labelId:"Editor.Export.PNG",descriptionId:"Editor.Export.PNGDescription",disabled:!1,icon:v.Z},{value:n.ExportFileType.JPG,labelId:"Editor.Export.JPG",descriptionId:"Editor.Export.JPGDescription",disabled:!1,icon:v.Z},{value:n.ExportFileType.SVG,labelId:"Editor.Export.SVG",descriptionId:"Editor.Export.SVGDescription",disabled:a,icon:v.Z},{value:n.ExportFileType.MP4,labelId:"Editor.Export.MP4",descriptionId:"Editor.Export.MP4Description",disabled:!K,icon:b.Z},{value:n.ExportFileType.GIF,labelId:"Editor.Export.GIF",descriptionId:"Editor.Export.GIFDescription",disabled:!K,icon:b.Z},{value:n.ExportFileType.WEBM,labelId:"Editor.Export.WEBM",descriptionId:"Editor.Export.WEBMDescription",disabled:!K,icon:b.Z},{value:n.ExportFileType.MOV_PRORES,labelId:"Editor.Export.MOVProRes",descriptionId:"Editor.Export.MOVProResDescription",disabled:!K,icon:b.Z},{value:n.ExportFileType.MOV,labelId:"Editor.Export.MOV",descriptionId:"Editor.Export.MOVDescription",disabled:!K,icon:b.Z}],l=null==e?void 0:e.allowedFileTypes;if(!l)return o;let s=new Set(l);return o.filter(e=>s.has(e.value))},[H,B,G,$,K,null==e?void 0:e.allowedFileTypes]),et=(0,r.useMemo)(()=>!!V||!!B||_!==n.ExportFileType.PDF&&_!==n.ExportFileType.SVG&&(_===n.ExportFileType.PNG||_===n.ExportFileType.JPG)&&Z.includes(N),[V,B,Z,_,N]),ei=(0,r.useMemo)(()=>V||B||et?{reason:null}:_===n.ExportFileType.PDF||_===n.ExportFileType.SVG?{reason:"file_type",message:_===n.ExportFileType.PDF?"PDF requires full resolution":"SVG requires full resolution"}:_!==n.ExportFileType.PNG&&_!==n.ExportFileType.JPG||Z.includes(N)?{reason:null}:{reason:"size",message:"Upgrade for full resolution export"},[V,B,et,_,N,Z]),er=$?S.d:Z;return{allowFreeDownload:B,freeTierSizes:G,permittedSizesForPngJpg:Z,selectableSizesForPngJpg:er,isHybridExport:$,downloadTypeOptions:ee,designDataForPermission:H,hasUnlimited:W,effectiveDuration:Y,exceedsDurationLimit:q,isMp4DisabledByAudio:X,isEmptyVideoProject:Q,videoExportBlockedNoticeId:J,isPaid:V,isSelectionFreeTier:et,selectionGateMetadata:ei}}},21369:function(e,t,i){"use strict";i.d(t,{z:function(){return r}});let r=(0,i(43841).U)(e=>({focusedCueIndex:null,previewTimeMs:0,dismissedRemoteCaptions:void 0,setFocusedCueIndex:t=>e({focusedCueIndex:t}),setPreviewTimeMs:t=>e({previewTimeMs:t}),dismissRemoteCaptions:t=>e({dismissedRemoteCaptions:t})}))},20177:function(e,t,i){"use strict";i.d(t,{I:function(){return x}});var r=i(52322),n=i(99127),a=i(21353),o=i(39097),l=i.n(o);i(2784);var s=i(42670),d=i(12524),c=i.n(d),u=i(15961),p=i(92855),m=i(63271),f=i(61872);let x=e=>{let{onCheckout:t,loading:i,price:o,label:d,screenName:x}=e,{blockCheckout:h,pendingUploads:g,saveFailed:v}=(0,f.X)({screenName:x});return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(m.R,{pendingUploads:g,saveFailed:v,className:"my-4"}),(0,r.jsxs)("div",{className:"flex flex-row items-center justify-between w-full gap-2",children:[(0,r.jsx)(a.z,{theme:"success",className:c()("w-52 md:w-48"),onClick:t,loading:i,icon:n.dx5,disabled:h,"data-testid":p.z.CHECKOUT_BUTTON,children:null!=d?d:(0,r.jsx)(s.Z,{id:"Editor.Export.ContinuePay"})}),(0,r.jsx)(u.g,{size:"small",label:"Price",className:"w-24",content:o||
1(0,r.jsx)("div",{className:"w-14 h-4 my-1 bg-gray-300 rounded animate-pulse"})})]}),(0,r.jsxs)("p",{className:"my-4 text-sm md:text-xs md:block",children:["By continuing with the checkout, you agree to our"," ",(0,r.jsx)(l(),{href:"/terms-and-conditions",prefetch:!1,legacyBehavior:!0,children:(0,r.jsx)("a",{className:"text-blue-500 no-underline hover:underline hover:text-pink-500",children:"terms and conditions"})}),"."]})]})}},63271:function(e,t,i){"use strict";i.d(t,{R:function(){return l}});var r=i(52322);i(2784);var n=i(42670),a=i(12524),o=i.n(a);let l=e=>{let{pendingUploads:t,saveFailed:i,className:a}=e;return t||i?(0,r.jsxs)("div",{className:o()("space-y-2",a),children:[t&&(0,r.jsx)("div",{className:"rounded-lg border border-yellow-300 bg-yellow-50 px-3 py-2 text-sm text-yellow-800",children:(0,r.jsx)(n.Z,{id:"Editor.DigitalCheckout.UploadPending",defaultMessage:"Some resources are still uploading. Please wait until they are done."})}),i&&(0,r.jsx)("div",{className:"rounded-lg border border-yellow-300 bg-yellow-50 px-3 py-2 text-sm text-yellow-800",children:(0,r.jsx)(n.Z,{id:"Editor.DigitalCheckout.SaveFailed",defaultMessage:"Couldn't save your design. Check your connection and try again."})})]}):null}},56197:function(e,t,i){"use strict";i.d(t,{s:function(){return h}});var r=i(52322),n=i(96284),a=i(21353),o=i(18997),l=i(16572),s=i(2784),d=i(15961),c=i(39097),u=i.n(c),p=i(71406),m=i(42670),f=i(63271),x=i(61872);function h(e){let{credit:t,onPay:i,loading:o,subscriptions:s,designId:c,compact:u,screenName:h}=e,v=t<=0,{blockCheckout:b,pendingUploads:E,saveFailed:y}=(0,x.X)({screenName:h});return(0,r.jsxs)(r.Fragment,{children:[!u&&(0,r.jsx)(n.i,{}),!v&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(f.R,{pendingUploads:E,saveFailed:y}),(0,r.jsxs)("div",{className:"flex flex-row items-center justify-between w-full",children:[(0,r.jsx)(a.z,{theme:"blue",onClick:i,icon:p.E6I,loading:o,className:"w-52 md:w-48",disabled:v||b,children:(0,r.jsx)(m.Z,{id:"Editor.Export.CheckoutWithCredit"})}),(0,r.jsx)(d.g,{className:"w-24",size:"small",label:"Current Credits",content:(0,l.YE)(t,s||[])})]})]}),v&&(0,r.jsx)(g,{designId:c})]})}function g(e){let{designId:t}=e;(0,s.useEffect)(()=>{(0,o.Kz)("checkout_upsell_shown")},[]);let i="/pricing?returnTo=".concat(encodeURIComponent(t?"/editor?id=".concat(t):"/editor"),"#credit-packs");return(0,r.jsx)("div",{className:"",children:(0,r.jsxs)(u(),{href:i,onClick:()=>{(0,o.Kz)("checkout_upsell_clicked")},className:"text-sm text-gray-600 hover:text-gray-800 transition-colors text-left gap-3 underline",children:[(0,r.jsx)(p.L9c,{className:"size-5 inline-block mr-2"}),"Need more designs? ",(0,r.jsx)("span",{className:"font-semibold",children:"Save up to 98% with credit packs"})," ","or subscribe to our ",(0,r.jsx)("span",{className:"font-semibold",children:"unlimited plan"})]})})}},61872:function(e,t,i){"use strict";i.d(t,{X:function(){return c}});var r=i(2784),n=i(65089),a=i(52522),o=i(118),l=i(83553),s=i(38420),d=i(3438);function c(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{screenName:t}=e,{pendingResourceCount:i}=(0,n.o0)(),{isPaid:c,designId:u,editMode:p}=(0,a.hl)(),m=(0,o.r)(e=>e.saveState),f=(0,s.b)(),x=!c&&i>0,h=m===o.S.ERRORED&&p!==l.uz.Locked,g=x||h,v=(0,r.useRef)(0),b=(0,r.useRef)(0);return(0,r.useEffect)(()=>{x&&d.Hu({reason:"pending_resources",designId:u,audioSource:f,screenName:t,pendingCount:i}),h&&d.Hu({reason:"save_error",designId:u,audioSource:f,screenName:t})},[x,h,u,f,t,i]),(0,r.useEffect)(()=>{if(!x)return;let e=v.current+1;v.current=e;let r=Date.now(),n=window.setTimeout(()=>{v.current===e&&d.fV({reason:"pending_resources",designId:u,audioSource:f,screenName:t,pendingCount:i,elapsedMs:Date.now()-r})},d.wH);return()=>{window.clearTimeout(n)}},[x,u,f,t,i]),(0,r.useEffect)(()=>{if(!h)return;let e=b.current+1;b.current=e;let i=Date.now(),r=window.setTimeout(()=>{b.current===e&&d.fV({reason:"save_error",designId:u,audioSource:f,screenName:t,elapsedMs:Date.now()-i})},d.LR);return()=>{window.clearTimeout(r)}},[h,u,f,t]),{blockCheckout:g,pendingUploads:x,saveFailed:h}}},88319:function(e,t,i){"use strict";i.d(t,{f:function(){return W}});var r=i(52322),n=i(2784),a=i(42670),o=i(23094),l=i(66548),s=i(16867),d=i(30118),c=i(52522),u=i(65089),p=i(38986),m=i(17488),f=i(84884),x=i(21066),h=i(39488),g=i(12524),v=i.n(g);let b=(0,n.createContext)(null),E=b.Provider,y=e=>{let{preview:t,label:i,onClick:a,actions:o,isSelected:l=!1}=e,s=(0,n.useContext)(b),d=(0,r.jsxs)(r.Fragment,{children:[s,(0,r.jsxs)("div",{className:"flex flex-1 min-w-0 items-center justify-center gap-3",children:[(0,r.jsx)("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center overflow-hidden rounded bg-white",children:t}),(0,r.jsx)("span",{className:"truncate",children:i})]})]}),c=v()("flex flex-1 min-w-0 items-center rounded-lg border-2 transition-all duration-200",l?"border-purple-600/25 bg-white/80 shadow-inner shadow-purple-500/10":"border-transparent hover:border-purple-400/45 hover:bg-white/50",!a&&"cursor-default");return(0,r.jsxs)("div",{"data-selected":l?"true":"false",className:v()("group flex w-full items-center gap-2 rounded-xl px-3 py-2.5 transition-all duration-200",l?"bg-purple-100 ring-2 ring-purple-500 ring-offset-2 ring-offset-gray-50 shadow-md shadow-purple-500/25":"bg-gray-100 hover:bg-gray-50/90"),children:[a?(0,r.jsx)("button",{className:c,type:"button",onClick:a,children:d}):(0,r.jsx)("div",{className:c,children:d}),o]})},w=e=>{let{onClick:t,disabled:i=!1,"aria-label":n,title:a,testId:o,children:l}=e;return(0,r.jsx)("button",{type:"button",onClick:t,disabled:i,"data-testid":o,className:"flex h-8 w-8 shrink-0 items-center justify-center rounded text-gray-600 hover:bg-gray-200 hover:text-gray-900 disabled:cursor-not-allowed disabled:opacity-50","aria-label":n,title:null!=a?a:n,children:l})},S=e=>{let{children:t}=e;return(0,r.jsx)("div",{className:"flex shrink-0 items-center",children:t})};var j=i(710),C=i(18818),N=i(3752);let _=e=>{let{onReplaceImage:t,isReplacing:i=!1,testId:a="replace-image-button"}=e,o=(0,n.useRef)(null),l=(0,N.d)(),s=(0,n.useCallback)(e=>{var t;e.stopPropagation(),null===(t=o.current)||void 0===t||t.click()},[]),d=(0,n.useCallback)(e=>{var i;let r=null===(i=e.target.files)||void 0===i?void 0:i[0];r&&(t(r),e.target.value="")},[t]);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("input",{ref:o,type:"file",accept:C.mD.join(","),className:"hidden","aria-hidden":!0,onChange:d}),(0,r.jsx)(w,{onClick:s,disabled:i,"aria-label":null!=l&&l?"Replace":"Replace image",testId:a,children:(0,r.jsx)(j.Z,{className:"h-4 w-4 shrink-0"})})]})};var R=i(99127);let A=e=>
1{let{onDelete:t,label:i="Delete layer",testId:n="delete-layer-button"}=e;return(0,r.jsx)(w,{onClick:e=>{e.stopPropagation(),t()},"aria-label":i,testId:n,children:(0,r.jsx)(R.VPh,{className:"h-4 w-4 shrink-0"})})},k=e=>{let t,{colors:i,imageUrl:n,onSelect:o,onReplaceImage:l,onDeleteImage:s,isReplacing:d=!1,isSelected:c}=e,u=!!(n&&l);if(n)t=(0,r.jsx)("img",{src:n,alt:"",width:40,height:40,draggable:!1,className:"h-full w-full object-cover"});else if(i.length>0){let e=1===i.length?i[0]:"linear-gradient(to right, ".concat(i.join(", "),")");t=(0,r.jsx)("div",{className:"w-full h-full",style:{background:e}})}else t=(0,r.jsx)("span",{className:"text-gray-500 text-xs",children:"BG"});let p=u?(0,r.jsxs)(S,{children:[(0,r.jsx)(_,{onReplaceImage:l,isReplacing:d,testId:"replace-background-image-button"}),s?(0,r.jsx)(A,{onDelete:s,label:"Remove background image",testId:"delete-background-image-button"}):null]}):null;return(0,r.jsx)(y,{preview:t,label:(0,r.jsx)(a.Z,{id:"Editor.Menu.Layers.PageBackground",defaultMessage:"Page background"}),onClick:null!=o?o:void 0,actions:p,isSelected:c})},I=e=>{let{imageId:t,imageUrl:i,isVideo:n=!1,onSelect:o,onReplaceImage:l,onDelete:s,isReplacing:d=!1,isSelected:c}=e;return(0,r.jsx)(y,{preview:i?(0,r.jsx)("img",{src:i,alt:"",width:40,height:40,draggable:!1,className:"h-full w-full object-cover"}):(0,r.jsx)("span",{className:"text-gray-500 text-xs",children:n?"Video":"Image"}),label:n?(0,r.jsx)(a.Z,{id:"Editor.Menu.Layers.VideoLayer",defaultMessage:"Video layer"}):(0,r.jsx)(a.Z,{id:"Editor.Menu.Layers.ImageLayer",defaultMessage:"Image layer"}),onClick:o,actions:(0,r.jsxs)(S,{children:[(0,r.jsx)(_,{onReplaceImage:l,isReplacing:d}),(0,r.jsx)(A,{onDelete:s,label:"Delete image layer"})]}),isSelected:c},t)},z=e=>{var t;let{node:i,onSelect:n,onDelete:a,displayLabel:o,isSelected:l}=e,s=o?null:i.text||"Text",d=null!=o?o:(0,r.jsx)("span",{className:"truncate text-gray-800",children:i.text||"Text layer"});return(0,r.jsx)(y,{preview:s?(0,r.jsx)("p",{className:"text-xs truncate max-w-full px-1",style:{color:i.fillColor,fontFamily:i.fontFamily,fontSize:Math.min(null!==(t=i.fontSize)&&void 0!==t?t:12,10)},children:s}):(0,r.jsx)("span",{className:"text-gray-500 text-xs px-1",children:"CC"}),label:d,onClick:n,actions:a?(0,r.jsx)(S,{children:(0,r.jsx)(A,{onDelete:a,label:"Delete text layer"})}):void 0,isSelected:l})},M=e=>{let t,{qr:i,onSelect:n,onDelete:o,isSelected:l}=e;return t=i.svg&&i.imported?i.svg.includes("viewBox")?(0,r.jsx)("span",{className:"w-full h-full flex items-center justify-center [&>svg]:max-w-full [&>svg]:max-h-full [&>svg]:w-auto [&>svg]:h-auto",style:{color:i.fillColor},dangerouslySetInnerHTML:{__html:i.svg}}):(0,r.jsx)("img",{src:"data:image/svg+xml;base64,".concat(window.btoa(i.svg)),alt:"",width:40,height:40,draggable:!1,className:"h-full w-full object-cover"}):(0,r.jsx)("span",{className:"text-gray-500 text-xs",children:"QR"}),(0,r.jsx)(y,{preview:t,label:(0,r.jsx)(a.Z,{id:"Editor.Menu.QR.Title"}),onClick:n,actions:(0,r.jsx)(S,{children:(0,r.jsx)(A,{onDelete:o,label:"Delete QR code"})}),isSelected:l})},D=e=>{let{label:t,canvasObject:i,onSelect:n,onDelete:a,isSelected:o}=e;return(0,r.jsx)(y,{preview:i?(0,r.jsx)("img",{src:i.toDataURL({format:"png"}),alt:"",width:40,height:40,draggable:!1,className:"h-full w-full object-cover"}):(0,r.jsx)("span",{className:"text-gray-500 text-xs",children:"Wave"}),label:t,onClick:n,actions:a?(0,r.jsx)(S,{children:(0,r.jsx)(A,{onDelete:a,label:"Delete sound wave"})}):void 0,isSelected:o})};var T=i(82851),O=i(40457);function F(e){let{id:t,type:i,children:n,disableLayerReorder:a=!1}=e,o="background"!==i,{attributes:s,listeners:d,setNodeRef:c,transform:u,transition:p,isDragging:m}=(0,l.nB)({id:t,disabled:!o||a}),f={transform:T.ux.Transform.toString(u),transition:p,opacity:m?.5:1},x=o?(0,r.jsx)("span",{className:"shrink-0 touch-none rounded p-1 cursor-grab text-gray-500 active:cursor-grabbing",onClick:e=>e.stopPropagation(),...s,...d,"aria-label":"Drag to reorder layer",children:(0,r.jsx)(O._4k,{size:18})}):(0,r.jsx)("span",{className:"invisible shrink-0 rounded p-1","aria-hidden":!0,
1children:(0,r.jsx)(O._4k,{size:18})});return(0,r.jsx)("div",{ref:c,style:f,className:"flex items-center gap-2 w-full",children:(0,r.jsx)(E,{value:x,children:n})})}var L=i(48025),P=i(90204),U=i(40568);let W=()=>{var e,t;let{textNodes:i,images:g,waveforms:v,qr:b,background:E,requestObjectSelection:y,updateImageLayer:w,updateTextLayer:S,updateWaveform:j,updateEditorState:C,removeImageLayer:N,removeTextLayer:_,removeWaveform:R,updateBackground:A}=(0,s.Eh)(),{captions:T}=(0,d._i)(),{updateQRCode:O}=(0,h.O)(),{replaceAssetImage:W,replaceBackgroundImage:B,isReplacing:G}=(0,x.b)(),H=(0,n.useCallback)(e=>t=>{W(e,t)},[W]),V=(0,n.useCallback)(e=>()=>{N(e)},[N]),Z=(0,n.useCallback)(e=>()=>{_(e)},[_]),Y=(0,n.useCallback)(e=>()=>{R(e)},[R]),q=(0,n.useCallback)(()=>{A({imageURL:null,imageRect:{},backgroundSize:null})},[A]),K=(0,n.useCallback)(()=>{O({imported:!1})},[O]),X=(null!==(e=null==v?void 0:v.length)&&void 0!==e?e:0)>1,{canvas:J}=(0,c.hl)(),{resources:Q}=(0,u.o0)(),$=(0,f.l)(e=>e.selectedObjectNames),ee=(0,n.useMemo)(()=>new Set($),[$]),et=$.length>1,ei=(0,n.useMemo)(()=>(g||[]).filter(e=>"asset"===e.kind),[g]),er=(0,n.useCallback)(e=>{var t,i,r,n,a,o,l,s,d;return(0,P.PM)(e)?null!==(l=null!==(o=null!==(a=null!==(n=e.posterUrl)&&void 0!==n?n:e.posterResourceId&&(null===(i=Q[e.posterResourceId])||void 0===i?void 0:i.publicURL))&&void 0!==a?a:e.url)&&void 0!==o?o:e.resourceId&&(null===(r=Q[e.resourceId])||void 0===r?void 0:r.publicURL))&&void 0!==l?l:null:null!==(d=null!==(s=e.url)&&void 0!==s?s:e.resourceId&&(null===(t=Q[e.resourceId])||void 0===t?void 0:t.publicURL))&&void 0!==d?d:null},[Q]),en=(0,n.useCallback)(e=>J?L.P.findObjectByName(J,e):void 0,[J]),ea=(0,n.useMemo)(()=>(function(e){let{imageNodes:t,textNodes:i,waveforms:r,qr:n}=e,a=new Map;if(t.forEach(e=>{var t,i,r;a.set(e.id,null!==(r=null!==(i=null===(t=e.rect)||void 0===t?void 0:t.zIndex)&&void 0!==i?i:e.zIndex)&&void 0!==r?r:2)}),i.forEach(e=>{var t;a.set(e.name,null!==(t=e.zIndex)&&void 0!==t?t:m.TEXT_NODE_ZINDEX_BASE)}),r.forEach(e=>{var t,i;a.set(e.id,null!==(i=null===(t=e.rect)||void 0===t?void 0:t.zIndex)&&void 0!==i?i:2)}),(null==n?void 0:n.imported)&&n.svg){var o;a.set(p.QRCODE_OBJECT_NAME,null!==(o=n.zIndex)&&void 0!==o?o:3)}return a})({imageNodes:ei,textNodes:i,waveforms:v||[],qr:b}),[ei,i,v,b]),eo=(0,n.useCallback)(e=>{if(e===p.BG_IMAGE_OBJECT_NAME||e===p.BG_COLOR_OBJECT_NAME)return 0;let t=ea.get(e);if("number"==typeof t)return t;if(!J)return -1;let i=L.P.getAllObjectNames(J).indexOf(e);return i>=0?i:-1},[ea,J]),el=null!==(t=J&&L.P.getObjectsByNamePrefix(J,p.WAVEFORM_NODE_PREFIX)[0])&&void 0!==t?t:en(p.SOUNDWAVE_OBJECT_NAME),es=(0,n.useMemo)(()=>(function(e){var t,i;let{waveforms:r,getObjectByName:n,waveformFallbackNode:a}=e;return r.length>0?r.map((e,t)=>({id:e.id,label:"Waveform ".concat(t+1),node:n(e.id)})):a?[{id:(null===(t=a.name)||void 0===t?void 0:t.startsWith(p.WAVEFORM_NODE_PREFIX))?a.name:p.SOUNDWAVE_OBJECT_NAME,label:(null===(i=a.name)||void 0===i?void 0:i.startsWith(p.WAVEFORM_NODE_PREFIX))?"Waveform 1":"Sound wave",node:a}]:[]})({waveforms:v||[],getObjectByName:en,waveformFallbackNode:el}),[v,en,el]),ed=(0,n.useMemo)(()=>({order:function(e,t){let{imageNodes:i,textNodes:r,waveformItems:n,qr:a}=e;return[{type:"background",key:"background",canvasIndex:t(p.BG_IMAGE_OBJECT_NAME)>=0?t(p.BG_IMAGE_OBJECT_NAME):t(p.BG_COLOR_OBJECT_NAME),selectable:!1},...i.map(e=>({type:"image",key:e.id,canvasIndex:t(e.id),selectable:!0})),...r.map(e=>({type:"text",key:e.name,canvasIndex:t(e.name),selectable:!0})),...n.map(e=>{let{id:i}=e;return{type:"waveform",key:i,canvasIndex:t(i),selectable:!0}}),...(null==a?void 0:a.imported)&&a.svg?[{type:"qr",key:p.QRCODE_OBJECT_NAME,canvasIndex:t(p.QRCODE_OBJECT_NAME),selectable:!0}]:[]].sort((e,t)=>t.canvasIndex-e.canvasIndex)}({imageNodes:ei,textNodes:i,captions:T,waveformItems:es.map(e=>{let{id:t}=e;return{id:t}}),qr:b},eo),keyToEntry:function(e){let{background:t,imageNodes:i,textNodes:n,captions:o,waveformItems:l,qr:s,resolveImageUrl:d,requestObjectSelection:c,onReplaceAssetImage:u,onReplaceBackgroundImage:m,onDeleteBackgroun
1dImage:f,onDeleteAssetImage:x,onDeleteTextNode:h,onDeleteWaveform:g,canDeleteWaveform:v,onDeleteQr:b,isReplacingImage:E}=e;return{background:{key:"background",render:e=>{var i,n;return(0,r.jsx)(k,{colors:null!==(i=null==t?void 0:t.colors)&&void 0!==i?i:[],imageUrl:null!==(n=null==t?void 0:t.imageURL)&&void 0!==n?n:null,onReplaceImage:m,onDeleteImage:f,isReplacing:E,isSelected:e},"background")}},...Object.fromEntries(i.map(e=>[e.id,{key:e.id,render:t=>(0,r.jsx)(I,{imageId:e.id,imageUrl:d(e),isVideo:(0,P.PM)(e),onSelect:()=>c(e.id),onReplaceImage:u(e.id),onDelete:x(e.id),isReplacing:E,isSelected:t},e.id)}])),...Object.fromEntries(n.map(e=>{let t=(0,U.isCaptionSlotLayerName)(e.name,o);return[e.name,{key:e.name,render:i=>(0,r.jsx)(z,{node:e,onSelect:()=>c(e.name),onDelete:t?void 0:h(e.name),displayLabel:t?(0,r.jsx)("span",{className:"truncate text-gray-800",children:(0,r.jsx)(a.Z,{id:"Editor.Menu.Layers.Captions",defaultMessage:"Captions"})}):void 0,isSelected:i},e.name)}]})),...Object.fromEntries(l.map(e=>{let{id:t,label:i,node:n}=e;return[t,{key:t,render:e=>(0,r.jsx)(D,{id:t,label:i,canvasObject:n,onSelect:()=>c(t),onDelete:v?g(t):void 0,isSelected:e},t)}]})),...Object.fromEntries((null==s?void 0:s.imported)&&s.svg?[[p.QRCODE_OBJECT_NAME,{key:p.QRCODE_OBJECT_NAME,render:e=>(0,r.jsx)(M,{qr:s,onSelect:()=>c(p.QRCODE_OBJECT_NAME),onDelete:b,isSelected:e},p.QRCODE_OBJECT_NAME)}]]:[])}}({background:E,imageNodes:ei,textNodes:i,captions:T,waveformItems:es,qr:b,resolveImageUrl:er,requestObjectSelection:y,onReplaceAssetImage:H,onReplaceBackgroundImage:B,onDeleteBackgroundImage:q,onDeleteAssetImage:V,onDeleteTextNode:Z,onDeleteWaveform:Y,canDeleteWaveform:X,onDeleteQr:K,isReplacingImage:G})}),[ei,i,T,es,b,E,eo,er,y,H,B,q,V,Z,Y,X,K,G]),ec=(0,o.Dy)((0,o.VT)(o.we,{activationConstraint:{distance:8}}),(0,o.VT)(o.Lg,{coordinateGetter:l.is})),eu=(0,n.useCallback)(e=>{let{active:t,over:r}=e;if(!r||t.id===r.id)return;let{order:n}=ed,a=n.findIndex(e=>e.key===t.id),o=n.findIndex(e=>e.key===r.id);-1!==a&&-1!==o&&a!==o&&function(e){let{newOrder:t,imageNodes:i,textNodes:r,waveforms:n,qr:a,updateImageLayer:o,updateTextLayer:l,updateWaveform:s,updateEditorState:d}=e,c=t.filter(e=>"background"!==e.type),u=c.length;
1c.forEach((e,t)=>{var c,p,f,x,h,g,v;let b=2+(u-1-t)*.01;switch(e.type){case"image":{let t=i.find(t=>t.id===e.key);Math.abs((null!==(f=null!==(p=null==t?void 0:null===(c=t.rect)||void 0===c?void 0:c.zIndex)&&void 0!==p?p:null==t?void 0:t.zIndex)&&void 0!==f?f:2)-b)>.001&&o(e.key,{zIndex:b,rect:{...(null==t?void 0:t.rect)||{},zIndex:b}});break}case"text":{let t=r.find(t=>t.name===e.key);Math.abs((null!==(x=null==t?void 0:t.zIndex)&&void 0!==x?x:m.TEXT_NODE_ZINDEX_BASE)-b)>.001&&l(e.key,{zIndex:b});break}case"waveform":{let t=n.find(t=>t.id===e.key);Math.abs((null!==(g=null==t?void 0:null===(h=t.rect)||void 0===h?void 0:h.zIndex)&&void 0!==g?g:2)-b)>.001&&s(e.key,{rect:{...(null==t?void 0:t.rect)||{},zIndex:b}});break}case"qr":Math.abs((null!==(v=null==a?void 0:a.zIndex)&&void 0!==v?v:3)-b)>.001&&a&&d({qr:{...a,zIndex:b}})}})}({newOrder:(0,l.Rp)(n,a,o),imageNodes:ei,textNodes:i,waveforms:v||[],qr:b,updateImageLayer:w,updateTextLayer:S,updateWaveform:j,updateEditorState:C})},[ed,ei,i,v,b,w,S,j,C]),{order:ep,keyToEntry:em}=ed;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("p",{className:"text-xs font-semibold uppercase tracking-wider text-gray-400",children:"Layers"}),(0,r.jsx)(o.LB,{sensors:ec,collisionDetection:o.pE,onDragEnd:eu,children:(0,r.jsx)("div",{className:"space-y-2 mt-4",children:(0,r.jsx)(l.Fo,{items:ep.map(e=>e.key),strategy:l.qw,children:ep.map(e=>{let t=em[e.key];if(!t)return null;let i=ee.has(e.key)||"background"===e.key&&(ee.has(p.BG_IMAGE_OBJECT_NAME)||ee.has(p.BG_COLOR_OBJECT_NAME));return(0,r.jsx)(F,{id:e.key,type:e.type,disableLayerReorder:et,children:t.render(i)},e.key)})})})})]})}},39402:function(e,t,i){"use strict";i.d(t,{D5:function(){return w},DC:function(){return h},EP:function(){return v},MB:function(){return S},p1:function(){return x},zG:function(){return g}});var r=i(52322),n=i(2784),a=i(83112),o=i(42670),l=i(12524),s=i.n(l),d=i(99127),c=i(40457),u=i(71680),p=i(42658),m=i(32434),f=i(57284);let x=["print","video","social","other"],h={video:"Video",social:"Social",print:"Print",other:"Other"},g={video:"YouTube, widescreen, vertical & cinema",social:"Instagram, Facebook & LinkedIn",print:"Flyers, posters & documents",other:"Square, portrait & custom"};function v(e){let{useCase:t}=e,i="flex h-10 w-10 shrink-0 items-center justify-center rounded-xl text-white shadow-sm";switch(t){case"video":return(0,r.jsx)("div",{className:s()(i,"bg-gradient-to-br from-rose-500 via-orange-400 to-amber-300"),children:(0,r.jsx)(u.gmG,{className:"h-4 w-4 drop-shadow","aria-hidden":!0})});case"social":return(0,r.jsx)("div",{className:s()(i,"bg-gradient-to-br from-pink-500 to-rose-500"),children:(0,r.jsx)(u.qc7,{className:"h-4 w-4 drop-shadow","aria-hidden":!0})});case"print":return(0,r.jsx)("div",{className:s()(i,"bg-gradient-to-br from-indigo-500 to-violet-600"),children:(0,r.jsx)(d.Ypm,{className:"h-5 w-5 drop-shadow","aria-hidden":!0})});default:return(0,r.jsx)("div",{className:s()(i,"bg-gradient-to-br from-teal-500 to-emerald-600"),children:(0,r.jsx)(c.jnY,{className:"h-4 w-4 drop-shadow","aria-hidden":!0})})}}function b(e){let{preview:t}=e,i="flex h-[72px] w-full max-w-[80px] items-center justify-center rounded-xl bg-gray-100 shadow-inner";switch(t){case"videoLandscape":return(0,r.jsx)("div",{className:s()(i,"bg-gradient-to-br from-rose-500 via-orange-400 to-amber-300 text-white shadow-md"),children:(0,r.jsx)(u.gmG,{className:"h-7 w-7 drop-shadow","aria-hidden":!0})});case"vertical":return(0,r.jsx)("div",{className:s()(i,"bg-gradient-to-br from-violet-600 to-indigo-600 text-white shadow-md"),children:(0,r.jsx)(u.XEH,{className:"h-8 w-8 drop-shadow","aria-hidden":!0})});case"square":return(0,r.jsx)("div",{className:s()(i,"bg-gradient-to-br from-pink-500 to-rose-500 text-white shadow-md"),children:(0,r.jsx)(p.ItR,{className:"h-9 w-9 drop-shadow","aria-hidden":!0})});case"portrait":return(0,r.jsx)("div",{className:s()(i,"bg-gradient-to-br from-fuchsia-500 to-pink-500 text-white shadow-md"),children:(0,r.jsx)(p.$q2,{className:"h-9 w-9 drop-shadow","aria-hidden":!0})});case"print":return(0,r.jsx)("div",{className:s()(i,"bg-gradient-to-br from-indigo-500 to-violet-600 text-white shadow-md"),children:(0,r.jsx)(d.Ypm,{className:"h-8 w-8 drop-shadow","aria-hidden":!0})});default:return(0,r.jsx)("div",{className:s()(i,"bg-gradient-to-br from-teal-500 to-emerald-600 text-white shadow-md"),children:(0,r.jsx)(c.jnY,{className:"h-8 w-8 drop-shadow","aria-hidden":!0})})}}function E(e){let{preset:t,onSelect:i,selectedRatio:n}=e,a=(0,f.x0)(t),o=(0,f.OP)(t),l=void 0!==n&&t.ratio===n;return(0,r.jsxs)("button",{type:"button","data-testid":"size-preset-card-".concat(t.key),"aria-current":l?"true":void 0,onClick:()=>i(t),className:s()("group relative flex w-full flex-col gap-2 rounded-2xl p-2 text-center transition-colors duration-150",l?"bg-violet-100":"hover:bg-neutral-50/90","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-violet-500/45 focus-visible:ring-offset-2"),children:[l?(0,r.jsx)("span",{className:"absolute right-1 top-1 flex h-6 w-6 items-center justify-center rounded-full bg-violet-600 text-white shadow-sm ring-2 ring-white","aria-hidden":!0,
1children:(0,r.jsx)(m.Z,{className:"h-3.5 w-3.5",strokeWidth:2.5})}):null,(0,r.jsx)("div",{className:"mx-auto flex w-full max-w-[88px] items-center justify-center",children:(0,r.jsx)(b,{preview:a})}),(0,r.jsx)("span",{className:"text-sm font-semibold leading-tight text-gray-900",children:t.label}),(0,r.jsx)("span",{className:"text-xs font-normal text-gray-500",children:o})]})}function y(e){let{presets:t,onSelect:i,selectedRatio:n}=e;return(0,r.jsx)("ul",{className:"grid grid-cols-2 gap-x-3 gap-y-6 sm:grid-cols-3 md:grid-cols-4",role:"list",children:t.map(e=>(0,r.jsx)("li",{className:"min-w-0",children:(0,r.jsx)(E,{preset:e,onSelect:i,selectedRatio:n})},e.key))})}function w(e){let{activeUseCase:t,onUseCaseChange:i}=e;return(0,r.jsx)("div",{className:"flex gap-1",children:x.map(e=>(0,r.jsx)("button",{type:"button",onClick:()=>i(t===e?null:e),className:s()("rounded-full px-3 py-1 text-sm font-medium transition-colors",t===e?"bg-indigo-600 text-white":"text-gray-500 hover:bg-gray-100 hover:text-gray-800"),children:h[e]},e))})}function S(e){let t,{onSelect:i,currentRatio:l,className:c,searchInputId:u="size-preset-search",embedInScrollableParent:p=!1,activeUseCase:m,onUseCaseChange:x}=e,h=(0,a.Z)(),[g,v]=(0,n.useState)(""),[b,E]=(0,n.useState)(null),S=void 0!==m,j=S?m:b,C=(0,n.useMemo)(()=>{let e=(0,f.NO)(g,f.Nz,j),t=j?f.e_[j]:null;if(t){let i=e.findIndex(e=>e.ratio===t);if(i>0){let t=[...e];return t.unshift(t.splice(i,1)[0]),t}}return e},[j,g]);return t=0===C.length?(0,r.jsx)("p",{className:"py-8 text-center text-sm text-gray-500",children:(0,r.jsx)(o.Z,{id:"Editor.PreEditSizeSelector.noResults",defaultMessage:"No sizes match your search."})}):(0,r.jsx)(y,{presets:C,onSelect:i,selectedRatio:l}),(0,r.jsxs)("div",{className:s()("flex flex-col gap-4 text-left",c),children:[(0,r.jsxs)("div",{className:"relative text-left",children:[(0,r.jsx)("label",{htmlFor:u,className:"sr-only",children:(0,r.jsx)(o.Z,{id:"Editor.PreEditSizeSelector.searchLabel",defaultMessage:"Search canvas sizes"})}),(0,r.jsx)(d.RB5,{className:"pointer-events-none absolute left-3 top-1/2 h-5 w-5 -translate-y-1/2 text-gray-400","aria-hidden":!0}),(0,r.jsx)("input",{id:u,type:"search",value:g,onChange:e=>v(e.target.value),placeholder:h.formatMessage({id:"Editor.PreEditSizeSelector.searchPlaceholder",defaultMessage:"Search resize options"}),className:"w-full rounded-xl border border-gray-300 py-2.5 pl-10 pr-3 text-sm focus:border-indigo-500 focus:outline-none focus:ring-2 focus:ring-indigo-500"})]}),!S&&(0,r.jsx)(w,{activeUseCase:j,onUseCaseChange:S?e=>null==x?void 0:x(e):E}),(0,r.jsx)("div",{className:s()("pr-1 text-left",p?"min-h-0":"min-h-0 max-h-[min(55vh,420p
1x)] overflow-y-auto overscroll-contain sm:max-h-[min(60vh,480px)]"),children:t})]})}},85704:function(e,t,i){"use strict";i.d(t,{O:function(){return m}});var r=i(52322),n=i(2784),a=i(27099),o=i(15644),l=i(21353),s=i(38986),d=i(59909),c=i(16378);function u(e){return Math.max(-1,Math.min(1,e))}function p(e){return Math.min(s.CIRCLE_CENTER_IMAGE_ZOOM_MAX,Math.max(s.CIRCLE_CENTER_IMAGE_ZOOM_MIN,e))}function m(e){let{open:t,onClose:i,imageUrl:m,circleRadius:f,initialCenterImage:x,onApply:h,dataTestId:g}=e,[v,b]=(0,n.useState)(0),[E,y]=(0,n.useState)(0),[w,S]=(0,n.useState)(s.CIRCLE_CENTER_IMAGE_ZOOM_DEFAULT),[j,C]=(0,n.useState)(null),N=(0,n.useRef)(null);N.current=j;let _=(0,n.useRef)(w);_.current=w;let R=(0,n.useRef)(v),A=(0,n.useRef)(E);R.current=v,A.current=E;let k=(0,n.useRef)(null),I=(0,n.useRef)(!1),z=(0,n.useRef)(null),M=(0,n.useRef)(!1);(0,n.useEffect)(()=>{C(null)},[m]);let D=(0,n.useCallback)((e,t)=>{if((0,a.isCompleteCenterImageLayout)(x)&&x.width===e&&x.height===t&&f>0){let i=(0,a.normalizedPanZoomFromCircleCenterLayout)(e,t,f,x);b(i.offsetX),y(i.offsetY),S(p(i.zoom));return}b(0),y(0),S(s.CIRCLE_CENTER_IMAGE_ZOOM_DEFAULT)},[x,f]);(0,n.useEffect)(()=>{if(!t){M.current=!1,I.current=!1;return}I.current||(z.current=m,M.current=!1,b(0),y(0),S(s.CIRCLE_CENTER_IMAGE_ZOOM_DEFAULT)),I.current=t},[t,m]),(0,n.useEffect)(()=>{!t||M.current||!j||j.w<=0||j.h<=0||(M.current=!0,D(j.w,j.h))},[t,j,D]);let T=(0,n.useCallback)(e=>{var t;let i=p(null!==(t=e[0])&&void 0!==t?t:s.CIRCLE_CENTER_IMAGE_ZOOM_DEFAULT),r=_.current;if(i===r)return;let n=R.current,a=A.current,{w:o,h:l}=null!=j?j:{w:0,h:0};if(o>0&&l>0){let{offsetX:e,offsetY:t}=(0,d.rescaleCenterImageOffsetsForZoomChange)(n,a,o,l,160,r,i);b(e),y(t)}else{let e=r/i;b(u(n*e)),y(u(a*e))}S(i)},[j]);(0,n.useEffect)(()=>{t&&null!==z.current&&m!==z.current&&i()},[t,m,i]);let O=(0,n.useMemo)(()=>!j||j.w<=0||j.h<=0?null:(0,d.scaleForCircleCenterImage)(j.w,j.h,160,v,E,w),[j,v,E,w]),F="".concat((v+1)/2*100,"% ").concat((E+1)/2*100,"%"),L=(0,n.useCallback)(e=>{if(null==e.button||0===e.button){try{e.currentTarget.setPointerCapture(e.pointerId)}catch(e){}k.current={pointerId:e.pointerId,startX:e.clientX,startY:e.clientY,startOffsetX:v,startOffsetY:E}}},[v,E]),P=(0,n.useCallback)(e=>{let t=k.current;if(!t||e.pointerId!==t.pointerId)return;let i=_.current,r=e.clientX-t.startX,n=e.clientY-t.startY,a=N.current;if(a&&a.w>0&&a.h>0){let{excessX:e,excessY:o}=(0,d.scaleForCircleCenterImage)(a.w,a.h,160,0,0,i);b(u(t.startOffsetX-(e>0?r/e:0))),y(u(t.startOffsetY-(o>0?n/o:0)))}else{let e=160*i;b(u(t.startOffsetX-r/e)),y(u(t.startOffsetY-n/e))}},[]),U=(0,n.useCallback)(e=>{let t=k.current;if(t&&e.pointerId===t.pointerId){try{e.currentTarget.releasePointerCapture(e.pointerId)}catch(e){}k.current=null}},[]),W=null!=j&&j.w>0&&j.h>0&&f>0,B=(0,n.useCallback)(()=>{!j||j.w<=0||j.h<=0||f<=0||(h((0,a.circleCenterLayoutFromPanZoom)(j.w,j.h,f,v,E,p(w))),i())},[v,E,w,j,f,h,i]),G=(0,n.useCallback)(()=>{b(0),y(0),S(s.CIRCLE_CENTER_IMAGE_ZOOM_DEFAULT)},[]);return(0,r.jsx)(o.Q,{open:t,onClose:i,header:"Adjust center image",className:"max-w-lg sm:max-w-lg",dataTestId:g,children:(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsx)("p",{className:"text-sm text-gray-600",children:"Drag inside the circle to reposition. Zoom keeps the visible area stable so you can zoom in and then pan further. Changes apply only when you click Apply."}),(0,r.jsx)("div",{className:"flex justify-center",children:(0,r.jsx)("div",{role:"presentation",className:"touch-none select-none rounded-full border border-gray-200 bg-gray-100 shadow-inner cursor-grab active:cursor-grabbing",style:{width:320,height:320},onPointerDown:L,onPointerMove:P,onPointerUp:U,onPointerCancel:U,"data-testid":"center-image-crop-stage",children:(0,r.jsx)("div",{className:"relative h-full w-full overflow-hidden rounded-full",children:(0,r.jsx)("img",{src:m,alt:"",className:O?"absolute max-h-none max-w-none pointer-events-none select-none":"h-full w-full object-cover pointer-events-none",style:O&&j?{width:j.w*O.scaleX,height:j.h*O.scaleY,left:"calc(50% + ".concat(O.left,"px)"),top:"calc(50% + ".concat(O.top,"px)"),transform:"translate(-50%, -50%)"}:{objectPosition:F,transform:"scale(".concat(w,")"),transformOrigin:"center center"},draggable:!1,onLoad:e=>
1{let{naturalWidth:t,naturalHeight:i}=e.currentTarget;t>0&&i>0&&C({w:t,h:i})}})})})}),(0,r.jsxs)("div",{className:"flex flex-col gap-2 px-0",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-3 text-sm text-gray-700",children:[(0,r.jsx)("span",{children:"Zoom"}),(0,r.jsxs)("span",{className:"tabular-nums text-gray-500",children:[w.toFixed(2),"\xd7"]})]}),(0,r.jsx)(c.i,{value:[w],onValueChange:T,min:s.CIRCLE_CENTER_IMAGE_ZOOM_MIN,max:s.CIRCLE_CENTER_IMAGE_ZOOM_MAX,step:.05,"aria-label":"Center image zoom"})]}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-end gap-2 border-t border-gray-100 pt-2",children:[(0,r.jsx)(l.z,{type:"button",theme:"link",onClick:i,"data-testid":"center-image-crop-cancel",children:"Cancel"}),(0,r.jsx)(l.z,{type:"button",theme:"secondary-light",onClick:G,children:"Reset"}),(0,r.jsx)(l.z,{type:"button",theme:"primary",onClick:B,disabled:!W,"data-testid":"center-image-crop-apply",children:"Apply"})]})]})})}},8188:function(e,t,i){"use strict";i.d(t,{N:function(){return S},P:function(){return j}});var r=i(52322);i(2784);var n=i(33256),a=i(12524),o=i.n(a),l=i(42670),s=i(99127),d=i(38986),c=i(21353),u=i(19458),p=i(7496),m=i(21571),f=i(18204),x=i(55125),h=i(3420),g=i(92855),v=i(16378),b=i(82530),E=i(60665),y=i(44074);let w="rounded-lg border border-gray-200 bg-white p-3 shadow-sm",S=()=>{var e,t;let{updateWaveformConfig:i,waveformConfig:a}=(0,p.d)(),c=(0,m.g)(),{onChangeStyle:S,styleValue:C}=(0,f.K)();return(0,r.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,r.jsxs)("section",{className:w,children:[(0,r.jsx)("p",{className:"mb-3 text-sm font-medium text-gray-900",children:"Soundwave Style"}),(0,r.jsx)("div",{className:"flex w-full",children:(0,r.jsx)(x.R,{value:C,onChange:S})})]}),(0,r.jsx)("section",{className:w,children:(0,r.jsx)(h.e9,{title:(0,r.jsx)(l.Z,{id:"Editor.Menu.Colors.Wave"}),colorArray:a.waveColors,disableAlpha:!0,setColorArray:e=>i({waveColors:e}),gradientDirection:a.waveGradientDirection,lightArrow:!0,setGradientDirection:c.waveGradientDirectionPicker&&a.style!==u.SoundWaveStyle.horizontal_bezier?e=>i({waveGradientDirection:e}):void 0,"data-testid":g.z.COLOR_PICKER_WAVE,defaultColor:"#000000",target:"wave"})}),(0,r.jsxs)("section",{className:w,children:[(0,r.jsx)("p",{className:"mb-3 text-sm font-medium text-gray-900",children:(0,r.jsx)(l.Z,{id:"Editor.Menu.Style.SectionBars"})}),(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)(j,{value:a.thickness,onReset:()=>i({thickness:(0,b.eB)(a.style)}),resetTestId:g.z.SOUNDWAVE_THICKNESS_RESET,valueTestId:g.z.SOUNDWAVE_THICKNESS_VALUE,label:(0,r.jsx)(l.Z,{id:"Editor.Menu.Style.Thickness"})}),(0,r.jsx)(v.i,{value:[(0,b.jv)(a.thickness,a.style)],onValueChange:e=>{i({thickness:(0,b.j9)({sliderValue:e[0],style:a.style})})},disabled:!1,min:(0,b.A7)(a.style),max:(0,b.km)(a.style),step:1,"aria-label":"Thickness slider"})]}),!(0,y.isRadialPolygonSoundWaveStyle)(a.style)&&(0,r.jsxs)("div",{children:[(0,r.jsx)(j,{value:a.space,onReset:()=>i({space:(0,y.isCircleSoundWaveStyle)(a.style)?d.DEFAULT_CIRCLE_SPACE:d.DEFAULT_SPACE}),resetTestId:g.z.SOUNDWAVE_SPACE_RESET,valueTestId:g.z.SOUNDWAVE_SPACE_VALUE,label:(0,r.jsx)(l.Z,{id:"Editor.Menu.Style.Space"})}),(0,r.jsx)(v.i,{value:[a.space],onValueChange:e=>i({space:e[0]}),disabled:!1,min:0,max:(0,y.isCircleSoundWaveStyle)(a.style)?d.MAX_CIRCLE_BAR_SPACE:d.MAX_HORIZONTAL_BAR_SPACE,"aria-label":"Space slider"})]}),((0,y.isHorizontalBarStyle)(a.style)||(0,y.isDottedBarsStyle)(a.style))&&(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)("div",{children:[(0,r.jsx)(j,{value:"".concat(Math.round((null!==(e=a.heightMultiplier)&&void 0!==e?e:1)*100),"%"),onReset:()=>i({heightMultiplier:d.DEFAULT_HEIGHT_MULTIPLIER}),resetTestId:g.z.SOUNDWAVE_HEIGHT_RESET,valueTestId:g.z.SOUNDWAVE_HEIGHT_VALUE,label:(0,r.jsx)(l.Z,{id:"Editor.Menu.Style.Height"})}),(0,r.jsx)(v.i,{"aria-label":"Height slider",value:[null!==(t=a.heightMultiplier)&&void 0!==t?t:1],onValueChange:e=>i({heightMultiplier:e[0]}),disabled:!1,min:d.MIN_HEIGHT_MULTIPLIER,max:d.MAX_HEIGHT_MULTIPLIER,step:.05})]})}),(0,y.isCircleSoundWaveStyle)(a.style)&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{"data-testid":g.z.SOUNDWAVE_CIRCLE_BAR_HEIGHT_SLIDER,children:[(0,r.jsx)(j,{value:a.circleBarHeight,onReset:()=>i({circleBarHeight:d.DEFAULT_CIRCLE_BAR_HEIGHT}),valueTestId:g.z.SOUNDWAVE_CIRCLE_BAR_HEIGHT_VALUE,label:"Bar length"}),(0,r.jsx)(v.i,{value:[a.circleBarHeight||0],onValueChange:e=>
1i({circleBarHeight:e[0]}),disabled:!1,min:d.MIN_CIRCLE_BAR_LENGTH,max:d.MAX_CIRCLE_BAR_LENGTH,"aria-label":"Circle bar length slider",step:2})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(j,{value:a.circleRadius,onReset:()=>i({circleRadius:d.DEFAULT_CIRCLE_RADIUS}),valueTestId:g.z.SOUNDWAVE_CIRCLE_RADIUS_VALUE,label:"Circle radius"}),(0,r.jsx)(v.i,{value:[a.circleRadius||0],onValueChange:e=>i({circleRadius:e[0]}),disabled:!1,min:d.MIN_CIRCLE_RADIUS,max:d.MAX_CIRCLE_RADIUS,"aria-label":"Circle radius slider",step:4})]})]}),(0,E.canShowRoundedBarsToggle)(a)&&(0,r.jsxs)("div",{className:"flex items-center justify-between gap-3 border-t border-gray-100 pt-3",children:[(0,r.jsx)("span",{className:"text-sm font-medium text-gray-900",children:"Rounded bars"}),(0,r.jsxs)(n.rs,{checked:!0===a.roundedBars,onChange:e=>i({roundedBars:e}),"data-testid":g.z.SOUNDWAVE_ROUNDED_BARS_TOGGLE,"data-ph-no-autocapture":!0,className:o()("relative inline-flex w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 focus-visible:ring-offset-2",a.roundedBars?"bg-indigo-600":"bg-gray-200"),children:[(0,r.jsx)("span",{className:"sr-only",children:"Toggle rounded waveform bars"}),(0,r.jsx)("span",{"aria-hidden":!0,className:o()("pointer-events-none inline-block h-4 w-4 rounded-full bg-white shadow ring-0 transition",a.roundedBars?"translate-x-6":"translate-x-0")})]})]})]})]}),a.style!==u.SoundWaveStyle.horizontal_bezier&&(0,r.jsxs)("section",{className:"rounded-lg border border-gray-200 bg-white p-3 shadow-sm",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,r.jsx)("span",{className:"text-sm font-medium text-gray-900",children:"Shadow"}),(0,r.jsxs)(n.rs,{checked:null!=a.glow,onChange:e=>{e?i({glow:{color:d.DEFAULT_SOUNDWAVE_GLOW_COLOR,blur:d.DEFAULT_SOUNDWAVE_GLOW_BLUR}}):i({glow:null})},"data-testid":g.z.SOUNDWAVE_GLOW_TOGGLE,"data-ph-no-autocapture":!0,className:o()("relative inline-flex w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 focus-visible:ring-offset-2",null!=a.glow?"bg-indigo-600":"bg-gray-200"),children:[(0,r.jsx)("span",{className:"sr-only",children:"Toggle waveform shadow"}),(0,r.jsx)("span",{"aria-hidden":!0,className:o()("pointer-events-none inline-block h-4 w-4 rounded-full bg-white shadow ring-0 transition",null!=a.glow?"translate-x-6":"translate-x-0")})]})]}),(()=>{let e=a.glow;return null==e?null:(0,r.jsxs)("div",{className:"space-y-4 border-t border-gray-100 py-3",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"mb-2 text-sm text-gray-700",children:"Shadow color"}),(0,r.jsx)(h.zH,{color:e.color,disableAlpha:!0,onChange:t=>i({glow:{...e,color:t}}),"data-testid":g.z.SOUNDWAVE_GLOW_COLOR})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(j,{value:e.blur,onReset:()=>i({glow:{...e,blur:d.DEFAULT_SOUNDWAVE_GLOW_BLUR}}),label:"Blur"}),(0,r.jsx)(v.i,{value:[e.blur],onValueChange:t=>i({glow:{...e,blur:t[0]}}),min:d.MIN_SOUNDWAVE_GLOW_BLUR,max:d.MAX_SOUNDWAVE_GLOW_BLUR,"aria-label":"Shadow blur"})]})]})})()]}),u.SoundWaveStyle.horizontal_simple===a.style&&(0,r.jsx)("div",{className:"p-0",children:(0,r.jsxs)("a",{href:"https://help.wavevisual.com/using-the-sound-wave-editor/0c22f781-04d8-40fa-aa1e-f6bcdfa34075/customizing-the-wave-style/b40b94ed-92ff-444f-bf8f-ae3f54840d7b",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center mt-3 text-sm text-gray-600 border-b border-gray-400 cursor-pointer hover:text-gray-700 hover:border-gray-600",children:["Learn more about these settings",(0,r.jsx)(s.ocf,{className:"inline-flex ml-2 text-lg","aria-hidden":!0})]})})]})},j=e=>{let{value:t,onReset:i,label:n,valueTestId:a,resetTestId:o}=e;return(0,r.jsxs)("p",{className:"mb-1 text-sm text-gray-900 flex justify-between items-center",children:[(0,r.jsx)("span",{children:n}),(0,r.jsxs)("span",{className:"ml-3 text-sm text-gray-500 md:text-sm",children:[(0,r.jsxs)("span",{"data-testid":a,children:["(",t,")"]}),(0,r.jsx)(c.z,{theme:"link",onClick:i,className:"text-sm","data-testid":o,children:(0,r.jsx)(l.Z,{id:"Editor.Menu.Style.Re
1set"})})]})]})}},55125:function(e,t,i){"use strict";i.d(t,{R:function(){return u}});var r=i(52322);i(2784);var n=i(96577),a=i.n(n),o=i(30508),l=i(92855),s=i(9223),d=i(8960);let c={maxWidth:"100%",height:"auto"};function u(e){let{value:t,onChange:i,className:n}=e,u=(0,d.b)();return(0,r.jsx)(o.Z,{name:l.z.SELECT_SOUNDWAVE_STYLE,"data-testid":l.z.SELECT_SOUNDWAVE_STYLE,value:t,onChange:i,direction:"column",spaceItems:!0,className:null!=n?n:"space-y-2",children:(0,r.jsx)("div",{className:"grid grid-cols-2 gap-2",children:u.map(e=>(0,r.jsx)(o.z,{value:e.style,appearance:"tile",rounded:!0,children:(0,r.jsx)(a(),{loader:s._,src:e.src,width:360,height:180,alt:e.alt,draggable:!1,className:"overflow-hidden rounded-md",style:c})},e.style))})})}},8960:function(e,t,i){"use strict";i.d(t,{N:function(){return a},b:function(){return o}});var r=i(19458),n=i(3741);let a=[{style:r.SoundWaveStyle.horizontal_simple,src:"/editor-page/horizontal-thumbnail.jpg",alt:"Horizontal soundwave thumbnail"},{style:r.SoundWaveStyle.horizontal_one_sided,src:"/editor-page/horizontal-one-thumbnail4.jpg",alt:"One-sided horizontal soundwave thumbnail"},{style:r.SoundWaveStyle.circle_simple,src:"/editor-page/circle-simple-thumbnail.png",alt:"Circle soundwave thumbnail"},{style:r.SoundWaveStyle.circle_smooth,src:"/editor-page/circle-smooth-thumbnail3.png",alt:"Circular smooth soundwave thumbnail"},{style:r.SoundWaveStyle.dotted_bars,src:"/editor-page/dotted-horizontal-thumbnail3.jpg",alt:"Dotted soundwave thumbnail"},{style:r.SoundWaveStyle.dotted_bars_mirrored,src:"/editor-page/dotted-mirrored-thumbnail4.jpg",alt:"Mirrored dotted soundwave thumbnail"},{style:r.SoundWaveStyle.horizontal_bezier,src:"/editor-page/circle-soundwave-thumbnail3.png",alt:"Bezier soundwave thumbnail",featureFlag:"bezierSoundwave"}];function o(){return a.filter(e=>!e.featureFlag||n.featureFlags[e.featureFlag])}},78958:function(e,t,i){"use strict";var r,n;i.d(t,{e:function(){return r}}),(n=r||(r={})).source="source",n.soundwave="soundwave",n.dimensions="dimensions",n.background="background",n.text="text",n.export="export",n.digitalCheckout="digitalCheckout",n.print="print",n.qr="qr",n.templates="templates",n.colorPicker="colorPicker",n.colorStopsPicker="colorStopsPicker",n.fontPicker="fontPicker",n.effectsPicker="effectsPicker",n.layers="layers",n.animation="animation",n.captions="captions"},99106:function(e,t,i){"use strict";i.d(t,{M:function(){return d}});var r=i(52322);i(2784);var n=i(42670),a=i(78742),o=i(16378),l=i(12524),s=i.n(l);function d(e){let{name:t,shadow:i,onUpdate:l}=e,d=null==i,c=null!=i?i:a.eu;return(0,r.jsxs)("div",{className:"mb-6 flex w-full flex-col",children:[(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,r.jsx)("button",{type:"button",onClick:()=>l({shadow:null}),className:s()("flex min-h-[3rem] flex-col items-center justify-center rounded-lg border-2 bg-white transition-colors",d?"border-indigo-500 ring-2 ring-indigo-500 ring-offset-1":"border-gray-300 hover:border-gray-400"),"aria-pressed":d,"aria-label":"No effect","data-testid":"text-effects-none-".concat(t),children:(0,r.jsx)("span",{className:"text-base font-medium text-gray-900",children:"Ag"})}),(0,r.jsx)("button",{type:"button",onClick:()=>d&&l({shadow:{...a.eu}}),className:s()("flex min-h-[3rem] flex-col items-center justify-center rounded-lg border-2 bg-white transition-colors",d?"border-gray-300 hover:border-gray-400":"border-indigo-500 ring-2 ring-indigo-500 ring-offset-1"),"aria-pressed":!d,"aria-label":"Shadow effect","data-testid":"text-effects-shadow-".concat(t),children:(0,r.jsx)("span",{className:"text-base font-medium text-gray-900",style:{textShadow:"".concat(a.eu.offsetX,"px ").concat(a.eu.offsetY,"px ").concat(a.eu.blur,"px ").concat(a.eu.color)},children:"Ag"})})]}),null!=i&&(0,r.jsxs)("div",{className:"mt-4 space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("p",{className:"mb-2 text-sm text-gray-800",children:[(0,r.jsx)(n.Z,{id:"Editor.Menu.Text.ShadowBlur",defaultMessage:"Blur"}),(0,r.jsxs)("span",{className:"ml-2 text-xs text-gray-500",children:["(",c.blur,"px)"]})]}),(0,r.jsx)(o.i,{"aria-label":"Text shadow blur",value:[c.blur],onValueChange:e=>{let t=Array.isArray(e)?e[0]:e;l({shadow:{...c,blur:t}})},min:0,max:40,step:1})]}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("p",{className:"mb-2 text-sm text-gray-800",children:[(0,r.jsx)(n.Z,{id:"Editor.Menu.Text.ShadowOffsetX",defaultMessage:"Offset X"}),(0,r.jsxs)("span",{className:"ml-2 text-xs text-gray-500",children:["(",c.offsetX,"px)"]})]}),(0,r.jsx)(o.i,{"aria-label":"Text shadow offset X",value:[c.offsetX],onValueChange:e=>{let t=Array.isArray(e)?e[0]:e;l({shadow:{...c,offsetX:t}})},min:-24,max:24,step:1})]}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("p",{className:"mb-2 text-sm text-gray-800",children:[(0,r.jsx)(n.Z,{id:"Editor.Menu.Text.ShadowOffsetY",defaultMessage:"Offset Y"}),(0,r.jsxs)("span",{className:"ml-2 text-xs text-gray-500",children:["(",c.offsetY,"px)"]})]}),(0,r.jsx)(o.i,{"aria-label":"Text shadow offset Y",value:[c.offsetY],onValueChange:e=>{let t=Array.isArray(e)?e[0]:e;l({shadow:{...c,offsetY:t}})},min:-24,max:24,step:1})]})]})]})}},32656:function(e,t,i){"use strict";i.d(t,{x:function(){return y}});var r=i(52322),n=i(2784),a=i(42670),o=i(99127),l=i(93580),s=i(40568),d=i(21353),c=i(16867),u=i(30118),p=i(85858);let m=e=>{let{node:t,onSelect:i}=e,{removeTextLayer:n}=(0,c.Gg)(),{name:a,text:l,fontFamily:s,fillColor:u}=t;return(0,r.jsxs)("div",{className:"flex items-center gap-2 rounded-md border border-gray-200 bg-gray-50 px-3 py-2",children:[(0,r.jsxs)("button",{type:"button",onClick:i,className:"flex flex-1 min-w-0 items-center gap-2 text-left",children:[(0,r.jsx)("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center overflow-hidden rounded border border-gray-100 bg-white p-0.5","aria-hidden":!0,
1children:(0,r.jsx)("span",{className:"line-clamp-2 max-h-full w-full break-words text-center text-[6px] font-medium leading-tight",style:{color:u,fontFamily:s},children:l||"Text"})}),(0,r.jsx)("span",{className:"truncate text-sm text-gray-800",children:l||"Text layer"})]}),(0,r.jsx)(d.z,{onClick:()=>n(a),theme:"danger",size:"small",className:"shrink-0","aria-label":"Remove text",children:(0,r.jsx)(o.VPh,{className:"h-4 w-4"})})]})};var f=i(12524),x=i.n(f),h=i(78742);let g=[{label:"Heading",text:"Add a heading",fontFamily:"Open Sans",fontSize:56,fillColor:"#111111","data-testid":"add-heading-button"},{label:"Subheading",text:"Add a subheading",fontFamily:"Open Sans",fontSize:40,fillColor:"#555555"},{label:"Body text",text:"Add a little bit of body text",fontFamily:"Open Sans",fontSize:24,fillColor:"#777777"}],v=[{label:"Elegant",text:"Elegant title",fontFamily:"Dancing Script",fontSize:48,fillColor:"#2C3E50"},{label:"Display",text:"Display text",fontFamily:"Oswald",fontSize:52,fillColor:"#222222",shadow:h.eu},{label:"Playful",text:"Playful!",fontFamily:"Bangers",fontSize:56,fillColor:"#E74C3C"},{label:"Brush",text:"Brush style",fontFamily:"Permanent Marker",fontSize:40,fillColor:"#333333",shadow:h.eu},{label:"Modern Bold",text:"Bold headline",fontFamily:"Montserrat",fontSize:56,fillColor:"#111111"},{label:"Soft Accent",text:"Soft accent",fontFamily:"Caveat",fontSize:36,fillColor:"#6C63FF"},{label:"Retro",text:"Retro vibe",fontFamily:"Krona One",fontSize:40,fillColor:"#1A1A2E",shadow:h.eu},{label:"Flowing",text:"Flowing text",fontFamily:"Cookie",fontSize:42,fillColor:"#E67E22"},{label:"Editorial",text:"Editorial serif",fontFamily:"Playfair Display",fontSize:48,fillColor:"#1A1A1A",shadow:h.eu},{label:"Minimal",text:"Minimal clean",fontFamily:"Inter",fontSize:44,fillColor:"#0F172A"},{label:"Vibrant",text:"Vibrant pop",fontFamily:"Poppins",fontSize:48,fillColor:"#7C3AED"},{label:"Script Pop",text:"Script pop",fontFamily:"Lobster",fontSize:48,fillColor:"#DB2777"},{label:"Casual",text:"Casual notes",fontFamily:"Indie Flower",fontSize:40,fillColor:"#0D9488"},{label:"Pixel",text:"Pixel art",fontFamily:"Silkscreen",fontSize:32,fillColor:"#15803D"},{label:"Tropical",text:"Tropical vibes",fontFamily:"Pacifico",fontSize:40,fillColor:"#EA580C"},{label:"Newspaper",text:"Newspaper style",fontFamily:"Merriweather",fontSize:38,fillColor:"#1E293B"}],b=e=>{let{preset:t,onClick:i,layout:n}=e,{label:a,text:o,fontFamily:l,fontSize:s,fillColor:d,shadow:c,"data-testid":u}=t,p={fontFamily:l,color:d,fontSize:"basic"===n?Math.round(12+(s-24)/32*9):Math.min(26,Math.max(14,Math.round(.42*s))),lineHeight:1.2,...c&&c?{textShadow:"".concat(c.offsetX,"px ").concat(c.offsetY,"px ").concat(c.blur,"px ").concat(c.color)}:{}};return(0,r.jsx)("button",{type:"button",onClick:i,"data-testid":u,"aria-label":a,className:"w-full rounded-lg border border-gray-200 bg-gray-50 p-2 text-left transition-colors hover:border-gray-400 hover:bg-white",children:(0,r.jsx)("div",{className:"flex min-h-[40px] items-center justify-center overflow-hidden rounded-md bg-white p-2",children:(0,r.jsx)("span",{className:x()("block max-w-full text-center leading-tight",{"scale-110":"Cookie"===l||"Caveat"===l||"Indie Flower"===l||"Lobster"===l}),style:p,children:o})})})};var E=i(3438);let y=()=>{let{textNodes:e,addTextLayer:t,requestObjectSelection:i,loadFonts:f}=(0,c.Gg)(),{captions:x}=(0,u._i)(),h=e.filter(e=>!(0,s.isCaptionSlotLayerName)(e.name,x));(0,n.useEffect)(()=>{f(l.Qg)},[]);let y=e=>()=>{let r=t(e);(0,p.f9)(r),i(r)},w=(e,t)=>()=>{E.tw({section:t,presetLabel:e.label}),y(function(e){let t={text:e.text,fontSize:e.fontSize,fontFamily:e.fontFamily,fillColor:e.fillColor};return e.shadow&&(t.shadow={...e.shadow}),t}(e))()};return(0,r.jsxs)(r.Fragment,{children:[h.map(e=>(0,r.jsxs)(n.Fragment,{children:[(0,r.jsx)(m,{node:e,onSelect:()=>i(e.name)}),(0,r.jsx)("hr",{className:"border-soft-border my-4"})]},e.name)),(0,r.jsxs)(d.z,{onClick:y({}),theme:"blue",block:!0,size:"normal",className:"mx-auto",children:[(0,r.jsx)(o.dEn,{fontSize:24,className:"mr-2"}),(0,r.jsx)(a.Z,{id:"Editor.Text.Add"})]}),(0,r.jsx)("p",{className:"mb-2 mt-4 text-sm font-semibold text-gray-800",children:(0,r.jsx)(a.Z,{id:"Editor.Menu.Text.BasicStyles",defaultMessage:"Basic text styles"})}),(0,r.jsx)("div",{className:"mt-2 flex flex-col gap-1.5",children:g.map(e=>(0,r.jsx)(b,{layout:"basic",preset:e,onClick:w(e,"basic")},e.label))}),(0,r.jsx)("p",{className:"mb-2 mt-4 text-sm font-semibold text-gray-800",children:(0,r.jsx)(a.Z,{id:"Editor.Menu.Text.FontCombinations",defaultMessage:"Font combinations"})}),(0,r.jsx)("div",{className:"mt-2 flex flex-col gap-2",children:v.map(e=>(0,r.jsx)(b,{layout:"combo",preset:e,onClick:w(e,"combo")},e.label))})]})}},70312:function(e,t,i){"use strict";i.d(t,{D:function(){return d}});var r=i(52322),n=i(2784),a=i(42670),o=i(43034),l=i(99106),s=i(16867);function d(){var e;let{extraData:t}=(0,n.useContext)(o.q5),{textNodes:i,updateTextLayer:d}=(0,s.Gg)(),c=null!==(e=null==t?void 0:t.objectName)&&void 0!==e?e:"",u=i.find(e=>e.name===c);return u?(0,r.jsxs)("div",{className:"flex flex-col",children:[(0,r.jsx)(o.Ab,{title:(0,r.jsx)(a.Z,{id:"Editor.Menu.Text.Effects",defaultMessage:"Effects"})}),(0,r.jsx)(l.M,{name:c,shadow:u.shadow,onUpdate:e=>d(c,e)})]}):(0,r.jsxs)("div",{className:"flex flex-col",children:[(0,r.jsx)(o.Ab,{title:(0,r.jsx)(a.Z,{id:"Editor.Menu.Text.Effects",defaultMessage:"Effects"})}),(0,r.jsxs)("div",{className:"p-4 text-sm text-gray-500",children:[(0,r.jsx)(a.Z,{id:"Editor.Menu.Text.Effects",defaultMessage:"Effects"})," — ",(0,r.jsx)(a.Z,{id:"Editor.Menu.Text.SelectTextFirst",defaultMessage:"Select a text element first"})]})]})}},6804:function(e,t,i){"use strict";i.d(t,{n:function(){return p}});var r=i(52322),n=i(2784),a=i(65254),o=i(32434),l=i(12524),s=i.n(l),d=i(93580),c=i(32172),u=i(16867);function p(e){let{objectName:t,currentFontFamily:i,currentFontSize:l=24,onSelect:p}=e,{textNodes:m,updateTextLayer:f,loadFonts:x}=(0,u.Gg)(),h=m.find(e=>e.name===t);(0,n.useEffect)(()=>{x(d.Qg)},[x]);let g=e=>{let i={fontFamily:e};if("Cookie"===e){let e=h?(0,c._4)(h):l;Object.assign(i,h?(0,c.O2)(h,1.5*e):{fontSize:1.5*e})}f(t,i),null==p||p()};return(0,r.jsx)("div",{className:"flex flex-col gap-0.5",children:d.B8.map(e=>{let{value:t,fontName:n}=e;return(0,r.jsxs)("button",{type:"button",className:s()("flex w-full items-center gap-2 rounded-md px-3 py-2 text-left text-sm transition-colors hover:bg-gray-100",t===i&&"bg-gray-100 font-medium"),onClick:()=>g(t),children:[(0,r.jsx)(a.Z,{className:"h-4 w-4 shrink-0 text-gray-600","aria-hidden":!0}),(0,r.jsx)("span",{style:{fontFamily:n},className:s()("flex-1 text-base",{"text-lg":"Cookie"===n||"Caveat"===n}),children:n}),t===i&&(0,r.jsx)(o.Z,{className:"h-4 w-4 text-gray-700","aria-hidden":!0})]},t)})})}},69095:function(e,t,i){"use strict";i.d(t,{S:function(){return d}});var r=i(52322),n=i(2784),a=i(42670),o=i(43034),l=i(6804),s=i(16867);function d(){var e;let{extraData:t}=(0,n.useContext)(o.q5),{textNodes:i}=(0,s.Gg)(),d=null!==(e=null==t?void 0:t.objectName)&&void 0!==e?e:"",c=i.find(e=>e.name===d);return c?(0,r.jsxs)("div",{className:"flex flex-col",children:[(0,r.jsx)(o.Ab,{title:(0,r.jsx)(a.Z,{id:"Editor.Menu.Text.Font",defaultMessage:"Font"})}),(0,r.jsx)(l.n,{objectName:d,currentFontFamily:c.fontFamily,currentFontSize:c.fontSize})]}):(0,r.jsxs)("div",{className:"flex flex-col",children:[(0,r.jsx)(o.Ab,{title:(0,r.jsx)(a.Z,{id:"Editor.Menu.Text.Font",defaultMessage:"Font"})}),(0,r.jsxs)("div",{className:"p-4 text-sm text-gray-500",children:[(0,r.jsx)(a.Z,{id:"Editor.Menu.Text.Font",defaultMessage:"Font"})," — ",(0,r.jsx)(a.Z,{id:"Editor.Menu.Text.SelectTextFirst",defaultMessage:"Select a text element first"})]})]})}},45885:function(e,t,i){"use strict";i.d(t,{T:function(){return s}});var r=i(52322),n=i(2784),a=i(59637);let o=[6,8,10,12,14,16,18,21,24,28,32,36,42,48,56,64,72,96,120,160];function l(e){return Math.min(160,Math.max(8,e))}function s(e){let{value:t,onChange:i,disabled:s,compact:d}
1=e,[c,u]=(0,n.useState)(String(t)),[p,m]=(0,n.useState)(!1);(0,n.useEffect)(()=>{u(String(t))},[t]);let f=(0,n.useCallback)(e=>{let t=l(e);i(t),u(String(t))},[i]),x=e=>{f(e),m(!1)};if(s)return null;let h=d?"h-7 w-7":"h-8 w-8";return(0,r.jsxs)("div",{className:"flex shrink-0 items-center gap-0.5 rounded-md border border-gray-300 bg-gray-100",children:[(0,r.jsx)("button",{type:"button","aria-label":"Decrease font size",className:"flex ".concat(h," items-center justify-center rounded-l-md text-gray-700 hover:bg-gray-200 disabled:opacity-50"),onClick:()=>f(t-4),disabled:t<=8,"data-ph-no-autocapture":!0,children:"−"}),(0,r.jsxs)(a.h_,{open:p,onOpenChange:m,children:[(0,r.jsx)(a.$F,{asChild:!0,children:(0,r.jsx)("input",{type:"number",min:8,max:160,step:4,value:c,onChange:e=>{let t=e.target.value;u(t);let r=parseInt(t,10);Number.isNaN(r)||i(l(r)),m(!1)},onBlur:()=>{let e=parseInt(c,10);Number.isNaN(e)||e<8||e>160?u(String(t)):f(e)},onKeyDown:e=>{"Enter"===e.key&&e.target.blur()},className:"".concat(h," ").concat(d?"w-10":"w-12"," border-0 bg-transparent text-center text-sm font-medium focus:bg-blue-50 focus:outline-none [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none"),"aria-label":"Font size (click for presets)","aria-haspopup":"menu"})}),(0,r.jsx)(a.AW,{align:"start",alignOffset:d?-28:-32,className:"max-w-64 min-w-24 overflow-auto",children:o.map(e=>(0,r.jsx)(a.Xi,{onSelect:()=>x(e),className:t===e?"bg-blue-50 font-medium":"",children:e},e))})]}),(0,r.jsx)("button",{type:"button","aria-label":"Increase font size",className:"flex ".concat(h," items-center justify-center rounded-r-md text-gray-700 hover:bg-gray-200 disabled:opacity-50"),onClick:()=>f(t+4),disabled:t>=160,"data-ph-no-autocapture":!0,children:"+"})]})}},52015:function(e,t,i){"use strict";i.d(t,{p:function(){return ea},E:function(){return en}});var r=i(52322),n=i(2784),a=i(44074),o=i(84884),l=i(38986),s=i(30118),d=i(52522),c=i(83553),u=i(28687),p=i(65254),m=i(16867),f=i(3752),x=i(95949),h=i(78958),g=i(12361),v=i(92244),b=i(42658),E=i(15343),y=i(54789),w=i(59637);let S=["left","right","top","bottom","center","middle"],j={left:"Left",right:"Right",top:"Top",bottom:"Bottom",center:"Center",middle:"Middle"},C={left:b.yvT,right:b.jjK,top:b.qs_,bottom:b.Taw,center:b.sVK,middle:b.y$C};function N(e){let{selectedElement:t,canvasAspectRatio:i,ratioToReference:a,onPositionChange:o,compact:l=!1}=e,s=(0,n.useCallback)(e=>{let r=E.ReferenceDimensions[i];if(!r)return;let n=r.width,l=r.height,s=(0,y._)(i),{left:d,top:c}=function(e,t,i,r,n,a){let o=n/2,l=a/2;switch(e){case"left":return{left:r+o,top:i/2};case"right":return{left:t-r-o,top:i/2};case"top":return{left:t/2,top:r+l};case"bottom":return{left:t/2,top:i-r-l};default:return{left:t/2,top:i/2}}}(e,n,l,s,t.getScaledWidth()/a,t.getScaledHeight()/a);o(d,c)},[i,a,t,o]);return(0,r.jsxs)(w.h_,{children:[(0,r.jsx)(w.$F,{asChild:!0,children:(0,r.jsxs)("button",{type:"button","aria-label":"Position on canvas","aria-haspopup":"menu",className:"flex items-center gap-1.5 rounded-md border border-gray-300 bg-white px-2.5 py-1.5 text-sm text-gray-700 shadow-sm transition-colors hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1 ".concat(l?"h-8 gap-1 px-2":"h-9"),children:[(0,r.jsx)(g.Z,{className:l?"h-3.5 w-3.5":"h-4 w-4","aria-hidden":!0}),(0,r.jsx)("span",{className:"whitespace-nowrap",children:"Position"}),(0,r.jsx)(v.Z,{className:"text-gray-500 ".concat(l?"h-3 w-3":"h-4 w-4"),"aria-hidden":!0})]})}),(0,r.jsx)(w.AW,{align:"start",className:"min-w-[10rem]",children:S.map(e=>{let t=C[e];return(0,r.jsxs)(w.Xi,{onSelect:()=>s(e),className:"cursor-pointer",children:[(0,r.jsx)(t,{className:"mr-2 h-4 w-4 shrink-0","aria-hidden":!0}),j[e]]},e)})})]})}var _=i(45885),R=i(79130),A=i.n(R),k=i(43034),I=i(6968),z=i(95058),M=i.n(z);let D=A().bind(M()),T=e=>{let{"data-testid":t,readonly:i,color:a,objectName:o,size:l}=e,s=(0,f.d)(),d=null!=l?l:s?26:32,c=(0,n.useRef)(null),{setShownTab:u}
1=(0,n.useContext)(k.q5),[p,m]=(0,n.useState)(!1),x=(0,n.useCallback)(()=>{s&&o?m(!0):u(h.e.colorPicker,{elementType:"text",objectName:o})},[s,o,u]);return(0,r.jsxs)("span",{className:D("colorCircleWrapper"),ref:c,children:[(0,r.jsx)("span",{className:D("colorCircle",{readonly:i}),style:{width:d,height:d,lineHeight:d,boxShadow:"".concat(a," 0px 0px 0px ").concat(d/2,"px inset")},onClick:i?void 0:x,"data-testid":t}),s&&o&&(0,r.jsx)(I.i,{visible:p,onClose:()=>m(!1),objectName:o})]})};var O=i(42670),F=i(46979),L=i(17835),P=i(6804);function U(e){let{visible:t,onClose:i,objectName:n,currentFontFamily:a,currentFontSize:o=24}=e;return(0,r.jsx)(L.dy,{open:t,onOpenChange:e=>!e&&i(),children:(0,r.jsxs)(L.sc,{className:"flex max-h-[75vh] flex-col overflow-hidden rounded-t-xl px-0",children:[(0,r.jsxs)("div",{className:"flex shrink-0 flex-row items-center justify-between gap-2 border-b border-gray-200 px-5 py-3",children:[(0,r.jsx)(L.iI,{className:"text-lg font-semibold leading-none tracking-tight",children:(0,r.jsx)(O.Z,{id:"Editor.Menu.Text.Font",defaultMessage:"Font"})}),(0,r.jsx)(L.uh,{asChild:!0,children:(0,r.jsx)("button",{type:"button",className:"-mr-1 flex h-8 w-8 shrink-0 items-center justify-center rounded text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-700","aria-label":"Close",children:(0,r.jsx)(F.Z,{className:"h-5 w-5"})})})]}),(0,r.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto px-5 pb-8 pt-4","data-vaul-no-drag":!0,style:{touchAction:"pan-y"},children:(0,r.jsx)(P.n,{objectName:n,currentFontFamily:a,currentFontSize:o,onSelect:i})})]})})}var W=i(99106);function B(e){let{visible:t,onClose:i,objectName:n,shadow:a,onUpdate:o}=e;return(0,r.jsx)(L.dy,{open:t,onOpenChange:e=>!e&&i(),children:(0,r.jsxs)(L.sc,{className:"flex max-h-[75vh] flex-col overflow-hidden rounded-t-xl px-0",children:[(0,r.jsxs)("div",{className:"flex shrink-0 flex-row items-center justify-between gap-2 border-b border-gray-200 px-5 py-3",children:[(0,r.jsx)(L.iI,{className:"text-lg font-semibold leading-none tracking-tight",children:(0,r.jsx)(O.Z,{id:"Editor.Menu.Text.Effects",defaultMessage:"Effects"})}),(0,r.jsx)(L.uh,{asChild:!0,children:(0,r.jsx)("button",{type:"button",className:"-mr-1 flex h-8 w-8 shrink-0 items-center justify-center rounded text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-700","aria-label":"Close",children:(0,r.jsx)(F.Z,{className:"h-5 w-5"})})})]}),(0,r.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto px-5 pb-8 pt-4","data-vaul-no-drag":!0,style:{touchAction:"pan-y"},children:(0,r.jsx)(W.M,{name:n,shadow:a,onUpdate:o})})]})})}var G=i(78742),H=i(32172);function V(e){let{selectedElementKit:t,variant:i="full"}=e,{textNodes:a,updateTextLayer:o,canvasAspectRatio:l,editorSize:s}=(0,m.Gg)(),{setShownTab:d}=(0,n.useContext)(x.q5),c=(0,f.d)(),[u,g]=(0,n.useState)(!1),[v,b]=(0,n.useState)(!1),E=t.name,y=a.find(e=>e.name===E),w=(0,n.useCallback)(()=>{c?g(!0):d(h.e.fontPicker,{objectName:E})},[c,E,d]),S=(0,n.useCallback)(()=>{c?b(!0):d(h.e.effectsPicker,{objectName:E})},[c,E,d]),j=(0,n.useCallback)((e,t)=>{o(E,{left:e,top:t})},[E,o]);if(!y)return null;let{fontSize:C=24,fontFamily:R="Open Sans",fillColor:A="#000000",lockFillColor:k,shadow:I}=y,z="mini"===i;return(0,r.jsxs)("div",{className:z?"flex min-w-max shrink-0 items-center gap-2":"flex items-center gap-3",children:[(0,r.jsx)(N,{selectedElement:t,canvasAspectRatio:l,ratioToReference:s.ratioToReference,onPositionChange:j,compact:z}),(0,r.jsx)(_.T,{value:(0,H._4)(y),onChange:e=>o(E,(0,H.O2)(y,e)),compact:z}),!k&&(0,r.jsx)(T,{color:A,"data-testid":"toolkit-color-circle",objectName:E}),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{type:"button",onClick:S,className:"flex shrink-0 items-center gap-1.5 rounded-md border border-gray-300 bg-white p-1.5 text-xs text-gray-900 hover:bg-gray-50 ".concat(z?"min-w-0 max-w-[5rem]":"gap-2 px-3 sm:py-2 text-sm"),"aria-label":"Effects",children:(0,r.jsx)("span",{className:"font-medium",style:{textShadow:"".concat(G.eu.offsetX,"px ").concat(G.eu.offsetY,"px ").concat(G.eu.blur,"px ").concat(G.eu.color)},children:"Ag"})}),c&&(0,r.jsx)(B,{visible:v,onClose:()=>b(!1),objectName:E,shadow:I,onUpdate:e=>o(E,e)})]}),(0,r.jsxs)("button",{type:"button",onClick:w,className:"flex shrink-0 items-center gap-1.5 rounded-md border border-gray-300 bg-white text-sm hover:bg-gray-50 ".concat(z?"min-w-0 max-w-[7rem] px-2 py-1":"gap-2 px-3 py-1.5"),"aria-label":"Select font",children:[(0,r.jsx)(p.Z,{className:"h-4 w-4 shrink-0 text-gray-600"}),(0,r.jsx)("span",{style:{fontFamily:R},className:z?"min-w-0 truncate max-w-20":"max-w-24 truncate",children:R})]}),c&&(0,r.jsx)(U,{visible:u,onClose:()=>g(!1),objectName:E,currentFontFamily:R,currentFontSize:C})]})}var Z=i(710),Y=i(21066),q=i(18818);function K(e){let{kind:t,variant:i}=e,a="asset"===t?e.layerId:void 0,{replaceAssetImage:l,replaceBackgroun
1dImage:s,isReplacing:d}=(0,Y.b)(),{canvasAspectRatio:c,editorSize:u,updateImageLayer:p,images:f}=(0,m._2)(),x=(0,o.l)(e=>e.selectedElement),h=(0,n.useCallback)((e,t)=>{if(!a)return;let i=(null!=f?f:[]).find(e=>e.id===a);p(a,{rect:{...null==i?void 0:i.rect,left:e,top:t}})},[a,f,p]),g="Replace",v=(0,n.useRef)(null),b=(0,n.useCallback)(()=>{var e;null===(e=v.current)||void 0===e||e.click()},[]),E=(0,n.useCallback)(e=>{var i;let r=null===(i=e.target.files)||void 0===i?void 0:i[0];r&&("background"===t?s(r):a&&l(a,r),e.target.value="")},[t,a,l,s]),y="mini"===(null!=i?i:"full");return(0,r.jsxs)("div",{className:y?"flex min-w-max shrink-0 items-center gap-2":"flex items-center gap-3",children:[(0,r.jsx)("input",{ref:v,type:"file",accept:q.mD.join(","),className:"hidden","aria-hidden":!0,onChange:E}),"asset"===t&&x&&(0,r.jsx)(N,{selectedElement:x,canvasAspectRatio:c,ratioToReference:u.ratioToReference,onPositionChange:h,compact:y}),(0,r.jsxs)("button",{type:"button",onClick:b,disabled:d,className:"flex shrink-0 items-center gap-1.5 rounded-md border border-gray-300 bg-white text-sm hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed ".concat(y?"min-w-0 px-2 py-1":"gap-2 px-3 py-1.5"),"aria-label":g,children:[(0,r.jsx)(Z.Z,{className:"h-4 w-4 shrink-0 text-gray-600"}),(0,r.jsx)("span",{className:y?"min-w-0 truncate max-w-20":"",children:g})]})]})}var X=i(99127),J=i(51401),Q=i(80920),$=i(18672),ee=i(94133),et=i(46620),ei=i(85704);function er(e){var t,i;let a,{variant:s="full"}=e,{updateWaveformNode:d,waveformConfig:c}=(0,J.O)(),u=(0,o.l)(e=>e.selectedObjectNames),p=(0,Q.kH)(),{uploadCenterImage:m,removeCenterImage:f,isUploading:x,uploadProgress:h}=(0,$.d)(),[g,v]=(0,n.useState)(!1),[b,E]=(0,n.useState)(null),y=(0,n.useRef)(null),w=1===u.length&&u[0].startsWith(l.WAVEFORM_NODE_PREFIX)?u[0]:void 0,S=w?p.find(e=>e.id===w):void 0,j=(0,n.useCallback)(e=>{var t;let i=null===(t=e.target.files)||void 0===t?void 0:t[0];i&&w&&m(w,i),e.target.value=""},[w,m]),C=!!(null==S?void 0:null===(t=S.centerImage)||void 0===t?void 0:t.url),N=b?p.find(e=>e.id===b):void 0,_=null==N?void 0:N.centerImage,R=()=>{v(!1),E(null)};if(!(null==S?void 0:S.id))return null;let A="mini"===s,k=A?"flex min-w-0 shrink-0 items-center gap-1.5 rounded-md border border-gray-300 bg-white px-2 py-1 text-xs text-gray-900 hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50":"flex shrink-0 items-center gap-2 rounded-md border border-gray-300 bg-white px-3 py-1.5 text-sm text-gray-900 hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50";return a=x?(0,r.jsxs)("div",{className:A?"flex min-w-0 max-w-full shrink-0 items-center gap-2 text-xs text-gray-700":"flex flex-wrap items-center gap-2 text-sm text-gray-700",children:[(0,r.jsx)(ee.p,{className:"shrink-0 text-indigo-600",fontSize:A?18:20}),(0,r.jsx)("span",{className:A?"max-w-[6rem] truncate":"",children:(0,r.jsx)(O.Z,{id:"Editor.CenterImage.Uploading",defaultMessage:"Uploading…"})}),"number"==typeof h&&(0,r.jsx)("div",{className:A?"w-16 min-w-0":"w-28 min-w-0",children:(0,r.jsx)(et.E,{percent:Math.min(100,Math.max(0,h)),className:"h-1.5"})})]}):C?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{type:"button",className:k,onClick:()=>{var e;return null===(e=y.current)||void 0===e?void 0:e.click()},children:"Replace"}),(0,r.jsx)("button",{type:"button",className:A?"flex min-w-0 shrink-0 items-center gap-1 rounded-md border border-indigo-600 bg-indigo-600 px-2.5 py-1 text-xs font-medium text-white hover:bg-indigo-700 disabled:cursor-not-allowed disabled:opacity-50":"flex shrink-0 items-center gap-2 rounded-md border border-indigo-600 bg-indigo-600 px-3 py-1.5 text-sm font-medium text-white hover:bg-indigo-700 disabled:cursor-not-allowed disabled:opacity-50",onClick:()=>{E(null!=w?w:null),v(!0)},children:(0,r.jsx)("span",{className:A?"max-w-[4.5rem] truncate":"",children:"Adjust crop"})}),(0,r.jsx)("button",{type:"button",className:k,"data-testid":"center-image-toolkit-remove",onClick:()=>{w&&(b===w&&R(),f(w))},children:"Remove"})]}):(0,r.jsxs)("button",{type:"button",className:k,onClick:()=>{var e;return null===(e=y.current)||void 0===e?void 0:e.click()},children:[(0,r.jsx)(X.rJU,{className:"h-4 w-4 shrink-0 text-gray-600","aria-hidden":!0}),(0,r.jsx)("span",{className:A?"max-w-[5.5rem] truncate":"",children:"Center photo"})]}),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("input",{ref:y,type:"file",accept:"image/*",className:"hidden","aria-hidden":!0,onChange:j}),(0,r.jsx)("div",{className:A?"flex min-w-max shrink-0 items-center gap-2":"flex flex-wrap items-center gap-3","data-testid":"center-image-toolkit",role:x?"status":void 0,"aria-busy":x||void 0,children:a}),g&&b&&(null==_?void 0:_.url)&&(0,r.jsx)(ei.O,{open:g,onClose:R,imageUrl:_.url,circleRadius:null!==(i=null==c?void 0:c.circleRadius)&&void 0!==i?i:0,initialCenterImage:_,onApply:e=>{if(!b)return;let t=Q.$X.getState().waveforms.find(e=>e.id===b);(null==t?void 0:t.centerImage)&&d(b,{centerImage:{...t.centerImage,...e}})}},b)]})}
1function en(e,t,i,r){if(void 0===r||r===c.uz.Locked||!(0,a.isCircleSoundWaveStyle)(i)||!e||1!==t.length)return!1;let n=e.name;return"string"==typeof n&&n.startsWith(l.WAVEFORM_NODE_PREFIX)}function ea(e){let{variant:t="full"}=e,i=(0,o.l)(e=>e.selectedElement),n=(0,o.l)(e=>e.selectedObjectNames),{waveformConfig:a}=(0,s._i)(),{editMode:c}=(0,d.hl)();if(!i)return null;let p=en(i,n,a.style,c),m=(0,u.isEditorTextSelection)(i),f=!!((null==i?void 0:i.name)&&"string"==typeof i.name&&i.name.startsWith(l.IMAGE_LAYER_OBJECT_NAME_PREFIX)),x=(null==i?void 0:i.name)===l.BG_IMAGE_OBJECT_NAME;if(!p&&!m&&!f&&!x)return null;let h="mini"===t;return(0,r.jsxs)("div",{className:h?"hide-scrollbar flex h-10 min-w-0 max-w-full items-center justify-start gap-3 overflow-x-auto overflow-y-hidden rounded-lg border border-gray-200 bg-white px-2 py-1 shadow-sm":"absolute top-2 left-1/2 z-10 flex h-12 w-fit -translate-x-1/2 items-center gap-2 rounded-xl border border-gray-200/50 bg-white px-4 py-2 shadow-lg","data-testid":"selection-toolbar",children:[p&&(0,r.jsx)(er,{variant:t}),m&&(0,r.jsx)(V,{selectedElementKit:i,variant:t}),f&&(0,r.jsx)(K,{kind:"asset",layerId:i.name,variant:t}),x&&(0,r.jsx)(K,{kind:"background",variant:t})]})}},57284:function(e,t,i){"use strict";i.d(t,{Iy:function(){return a},NO:function(){return l},Nz:function(){return o},OP:function(){return d},e_:function(){return n},x0:function(){return s}});var r=i(19458);let n={video:r.AspectRatio["16/9"],social:r.AspectRatio["1/1"],print:r.AspectRatio["3/2"],other:r.AspectRatio["3/2"]},a={[r.AspectRatio["16/9"]]:"video",[r.AspectRatio["3/1"]]:"video",[r.AspectRatio["2/1"]]:"video",[r.AspectRatio["1/1"]]:"social",[r.AspectRatio["4/5"]]:"social",[r.AspectRatio["9/16"]]:"video",[r.AspectRatio["297/210"]]:"print",[r.AspectRatio["210/297"]]:"print",[r.AspectRatio["22/17"]]:"print",[r.AspectRatio["17/22"]]:"print",[r.AspectRatio["27/35"]]:"print",[r.AspectRatio["11/14"]]:"print",[r.AspectRatio["4/3"]]:"print",[r.AspectRatio["5/4"]]:"print",[r.AspectRatio["3/2"]]:"print",[r.AspectRatio["2/3"]]:"print",[r.AspectRatio["1/2"]]:"print"},o=[{key:"print-3-2",label:"Print Landscape",ratio:r.AspectRatio["3/2"],useCases:["print"],keywords:["print","3:2","3/2","landscape","photo"]},{key:"print-2-3",label:"Print Portrait",ratio:r.AspectRatio["2/3"],useCases:["print"],keywords:["print","2:3","2/3","portrait","photo"]},{key:"a4-horizontal",label:"A4 Landscape",ratio:r.AspectRatio["297/210"],useCases:["print"],keywords:["a4","landscape","document","flyer"],ratioLabel:"297 \xd7 210 mm"},{key:"a4-vertical",label:"A4 Portrait",ratio:r.AspectRatio["210/297"],useCases:["print"],keywords:["a4","portrait","document","poster"],ratioLabel:"210 \xd7 297 mm"},{key:"letter-vertical",label:"US Letter Portrait",ratio:r.AspectRatio["17/22"],useCases:["print"],keywords:["letter","us letter","8.5x11","8.5 x 11","printer"],ratioLabel:"8.5 \xd7 11 in"},{key:"letter-horizontal",label:"US Letter Landscape",ratio:r.AspectRatio["22/17"],useCases:["print"],keywords:["letter","us letter","8.5x11","landscape","printer"],ratioLabel:"11 \xd7 8.5 in"},{key:"print-2-1",label:"Wide",ratio:r.AspectRatio["2/1"],useCases:["print","video"],keywords:["print","video","2:1","2/1","panoramic","banner","wide"]},{key:"print-1-2",label:"Print Tall",ratio:r.AspectRatio["1/2"],useCases:["print"],keywords:["print","1:2","1/2","tall","poster"]},{key:"print-1-1",label:"Print Square",ratio:r.AspectRatio["1/1"],useCases:["print"],keywords:["print","1:1","square"]},{key:"photo-print",label:"Photo Print",ratio:r.AspectRatio["27/35"],useCases:["print"],keywords:["photo","print"],ratioLabel:"2.7 \xd7 3.5 in"},{key:"photo-11x14",label:"Photo 11\xd714",ratio:r.AspectRatio["11/14"],useCases:["print"],keywords:["photo","print"],ratioLabel:"11 \xd7 14 in"},{key:"photo-5x4",label:"Photo 5\xd74",ratio:r.AspectRatio["5/4"],useCases:["print"],keywords:["photo","print"],ratioLabel:"5 \xd7 4 in"},{key:"classic",label:"Classic",ratio:r.AspectRatio["4/3"],useCases:["print","other"],keywords:["classic","4:3","4/3"]},{key:"youtube",label:"YouTube Video",ratio:r.AspectRatio["16/9"],useCases:["video"],keywords:["youtube","widescreen","hd","tv"]},{key:"cinema",label:"Cinema",ratio:r.AspectRatio["2/1"],useCases:["video"],keywords:["cinema","wide","banner"]},{key:"ultrawide",label:"Ultra Wide",ratio:r.AspectRatio["3/1"],useCases:["video"],keywords:["ultrawide","banner","wide"]},{key:"youtube-shorts",label:"YouTube Shorts",ratio:r.AspectRatio["9/16"],useCases:["social","video"],keywords:["youtube","shorts","vertical"]},{key:"instagram-reel",label:"Instagram Reel",ratio:r.AspectRatio["9/16"],useCases:["social"],keywords:["instagram","reel","vertical","story"]},{key:"tiktok",label:"TikTok",ratio:r.AspectRatio["9/16"],useCases:["social"],keywords:["tiktok","vertical","story"]},{key:"instagram-post",label:"Instagram Post",ratio:r.AspectRatio["1/1"],useCases:["social"],keywords:["instagram","square","feed","social"]},{key:"instagram-portrait",label:"Instagram Portrait",ratio:r.AspectRatio["4/5"],useCases:["social"],keywords:["instagram","4:5","4/5","portrait","feed","instagram post","social"]},{key:"facebook-video",label:"Facebook Video",ratio:r.AspectRatio["1/1"],useCases:["social"],keywords:["facebook","square","social","video"]},{key:"linkedin-post",label:"LinkedIn Post",ratio:r.AspectRatio["1/1"],useCases:["social"],keywords:["linkedin","square","social","post"]},{key:"standard",label:"Standard",ratio:r.AspectRatio["3/2"],useCases:["other"],keywords:["standard","photo"]},{key:"portrait",label:"Portrait",ratio:r.AspectRatio["2/3"],useCases:["other"],keywords:["portrait","poster"]}];function l(e,t,i){let r=t;i&&(r=r.filter(e=>e.useCases.includes(i)));let n=e.trim().toLowerCase();return n?r.filter(e=>[e.label,e.key.replace(/-/g," "),e.ratio.replace(/\//g,":"),e.ratio,...e.keywords].join(" ").toLowerCase().includes(n)):r}function s(e){let{ratio:t,useCases:i}=e;return t===r.AspectRatio["9/16"]?"vertical":t===r.AspectRatio["16/9"]||t===r.AspectRatio["3/1"]||t===r.AspectRatio["2/1"]&&i.includes("video")?"videoLandscape":t===r.AspectRatio["1/1"]?"square":t===r.AspectRatio["4/5"]?"portrait":t===r.AspectRatio["210/297"]||t===r.AspectRatio["297/210"]||t===r.AspectRatio["17/22"]||t===r.AspectRatio["22/17"]?"print":t===r.AspectRatio["1/2"]?"portrait":t===r.AspectRatio["4/3"]?"photo":i.includes("print")?"print":"photo"}function d(e){var t;return null!==(t=e.ratioLabel)&&void 0!==t?t:e.ratio.replace(/\//g," \xd7 ")}r.AspectRatio["3/1"],r.AspectRatio["3/2"],r.AspectRatio["2/1"],r.AspectRatio["16/9"],r.AspectRatio["5/4"],r.AspectRatio["4/3"],r.AspectRatio["1/1"],r.AspectRatio["4/5"],r.AspectRatio["9/16"],r.AspectRatio["2/3"],r.AspectRatio["1/2"],r.AspectRatio["27/35"],r.AspectRatio["11/14"],r.AspectRatio["297/210"],r.AspectRatio["210/297"],r.AspectRatio["17/22"],r.AspectRatio["22/17"]},7496:function(e,t,i){"use strict";i.d(t,{d:function(){return o}});var r=i(2784),n=i(30118),a=i(16867);function o(){let e=(0,a.Sq)(),t=(0,a.RN)(),{updateWaveformConfig:i,waveformConfig:o}=(0,n._i)(),l=(0,r.useCallback)(t=>{(null==e?void 0:e.updateWaveformConfig)?e.updateWaveformConfig(t):i(t)},[e,i]);return{waveformConfig:e?t.waveformConfig:o,updateWaveformConfig:l}}},51401:function(e,t,i){"use strict";i.d(t,{O:function(){return o}});var r=i(2784),n=i(30118),a=i(16867);function o(){let e=(0,a.Sq)(),t=(0,a.RN)(),i=(0,n._i)(),o=(0,r.useCallback)((t,r)=>{if(null==e?void 0:e.updateWaveformNode){e.updateWaveformNode(t,r);return}i.updateWaveform(t,r)},[e,i]),l=(0,r.useCallback)(function(t,r){let n=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(null==e?void 0:e.updateWaveformNode){var a;let o=null===(a=r.rect)||void 0===a?void 0:a.zIndex;e.updateWaveformNode(t,{...r.rect?{rect:r.rect}:{},...r.trim?{trim:r.trim}:{},...void 0!==r.centerImage?{centerImage:r.centerImage}:{},...void 0!==o?{zIndex:o}:{}},n);let l=function(e){let t={};return void 0!==e.shownWaveformData&&(t.shownWaveformData=e.shownWaveformData),void 0!==e.waveformData&&(t.waveformData=e.waveformData),Object.keys(t).length>0?t:null}(r);l&&i.updateWaveform(t,l,!1);return}i.updateWaveform(t,r,n)},[e,i]);return{waveforms:t.waveforms,waveformConfig:t.waveformConfig,updateWaveformNode:o,updateWaveform:l}}},18204:function(e,t,i){"use strict";i.d(t,{K:function(){return d}});var r=i(2784),n=i(19458),a=i(48169),o=i(30118),l=i(16867),s=i(118);function d(e){let t=null==e?void 0:e.onApplied,i=(0,l.Sq)(),d=(0,l.RN)(),{updateEditorState:c,waveformConfig:u,waveformData:p,canvasAspectRatio:m,audioFileName:f,selectedSource:x,selectedWaveformId:h,waveforms:g}=(0,o._i)(),{setNotSaved:v}=(0,s.r)();return{onChangeStyle:(0,r.useCallback)(e=>{(null==i?void 0:i.applyWaveformStyle)?i.applyWaveformStyle(e):(c((0,a.Im)({nextStyle:e,waveformConfig:u,canvasAspectRatio:m,waveforms:g,selectedWaveformId:h,waveformData:p,selectedSource:x,audioFileName:f})),requestAnimationFrame(()=>{requestAnimationFrame(()=>
1{v()})})),null==t||t()},[i,f,m,t,x,h,v,c,u,p,g]),styleValue:d.waveformConfig.style||n.SoundWaveStyle.horizontal_simple}}},96284:function(e,t,i){"use strict";i.d(t,{i:function(){return o}});var r=i(52322);i(2784);var n=i(12524),a=i.n(n);let o=e=>{let{className:t}=e;return(0,r.jsx)("hr",{className:a()("my-4 text-gray-500",t)})}},17835:function(e,t,i){"use strict";i.d(t,{dy:function(){return s},iI:function(){return m},sc:function(){return p},uh:function(){return c}});var r=i(52322),n=i(2784),a=i(4360),o=i(12524),l=i.n(o);let s=a.dy.Root;a.dy.Trigger;let d=a.dy.Portal,c=a.dy.Close,u=n.forwardRef((e,t)=>{let{className:i,...n}=e;return(0,r.jsx)(a.dy.Overlay,{ref:t,className:l()("fixed inset-0 z-50 bg-black/40",i),...n})});u.displayName=a.dy.Overlay.displayName;let p=n.forwardRef((e,t)=>{let{className:i,children:n,...o}=e;return(0,r.jsxs)(d,{children:[(0,r.jsx)(u,{}),(0,r.jsx)(a.dy.Content,{ref:t,className:l()("fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border border-gray-200 bg-white",i),...o,children:n})]})});p.displayName="DrawerContent";let m=n.forwardRef((e,t)=>{let{className:i,...n}=e;return(0,r.jsx)(a.dy.Title,{ref:t,className:l()("text-lg font-semibold leading-none tracking-tight",i),...n})});m.displayName=a.dy.Title.displayName,n.forwardRef((e,t)=>{let{className:i,...n}=e;return(0,r.jsx)(a.dy.Description,{ref:t,className:l()("text-sm text-gray-500",i),...n})}).displayName=a.dy.Description.displayName},59637:function(e,t,i){"use strict";i.d(t,{$F:function(){return p},AW:function(){return m},Ju:function(){return x},Xi:function(){return f},h_:function(){return u}});var r=i(52322),n=i(2784),a=i(25676),o=i(76206),l=i(32434),s=i(35224),d=i(12524),c=i.n(d);let u=a.fC,p=a.xz;a.ZA,a.Uv,a.Tr,a.Ee,n.forwardRef((e,t)=>{let{className:i,inset:n,children:l,...s}=e;return(0,r.jsxs)(a.fF,{ref:t,className:c()("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",n&&"pl-8",i),...s,children:[l,(0,r.jsx)(o.Z,{className:"ml-auto h-4 w-4"})]})}).displayName=a.fF.displayName,n.forwardRef((e,t)=>{let{className:i,...n}=e;return(0,r.jsx)(a.tu,{ref:t,className:c()("z-50 min-w-[8rem] max-h-60 overflow-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",i),...n})}).displayName=a.tu.displayName;let m=n.forwardRef((e,t)=>{let{className:i,sideOffset:n=4,...o}=e;return(0,r.jsx)(a.Uv,{children:(0,r.jsx)(a.VY,{ref:t,sideOffset:n,className:c()("z-50 min-w-[8rem] max-h-60 overflow-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",i),...o})})});m.displayName=a.VY.displayName;let f=n.forwardRef((e,t)=>{let{className:i,inset:n,...o}=e;return(0,r.jsx)(a.ck,{ref:t,className:c()("relative flex cursor-pointer select-none items-center rounded-sm px-2 py-3 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",n&&"pl-8",i),...o})});f.displayName=a.ck.displayName,n.forwardRef((e,t)=>{let{className:i,children:n,checked:o,...s}=e;return(0,r.jsxs)(a.oC,{ref:t,className:c()("relative flex cursor-default select-none items-center rounded-sm py-3 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",i),checked:o,...s,children:[(0,r.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,r.jsx)(a.wU,{children:(0,r.jsx)(l.Z,{className:"h-4 w-4"})})}),n]})}).displayName=a.oC.displayName,n.forwardRef((e,t)=>
1{let{className:i,children:n,...o}=e;return(0,r.jsxs)(a.Rk,{ref:t,className:c()("relative flex cursor-default select-none items-center rounded-sm py-3 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",i),...o,children:[(0,r.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,r.jsx)(a.wU,{children:(0,r.jsx)(s.Z,{className:"h-2 w-2 fill-current"})})}),n]})}).displayName=a.Rk.displayName;let x=n.forwardRef((e,t)=>{let{className:i,inset:n,...o}=e;return(0,r.jsx)(a.__,{ref:t,className:c()("px-2 py-1.5 text-sm font-semibold",n&&"pl-8",i),...o})});x.displayName=a.__.displayName,n.forwardRef((e,t)=>{let{className:i,...n}=e;return(0,r.jsx)(a.Z0,{ref:t,className:c()("-mx-1 my-1 h-px bg-muted",i),...n})}).displayName=a.Z0.displayName},16378:function(e,t,i){"use strict";i.d(t,{i:function(){return s}});var r=i(52322),n=i(2784),a=i(79037),o=i(12524),l=i.n(o);let s=n.forwardRef((e,t)=>{let{className:i,variant:n="default","aria-label":o,"aria-labelledby":s,...d}=e,c="export"===n;return(0,r.jsxs)(a.fC,{ref:t,className:l()("relative flex w-full touch-none select-none items-center",i),...d,children:[(0,r.jsx)(a.fQ,{className:l()("relative h-2 w-full grow cursor-pointer overflow-hidden rounded-full",c?"bg-violet-200/90":"bg-indigo-600/20"),children:(0,r.jsx)(a.e6,{className:l()("absolute h-full",c?"bg-violet-600":"bg-indigo-600")})}),(0,r.jsx)(a.bU,{"aria-label":o,"aria-labelledby":s,className:l()("bg-background block h-5 w-5 cursor-grab rounded-full border shadow transition-colors focus-visible:outline-none focus-visible:ring-1 disabled:pointer-events-none disabled:opacity-50 active:cursor-grabbing active:shadow-md",c?"border-violet-400 focus-visible:ring-violet-400 active:border-violet-500":"border-indigo-300 focus-visible:ring-ring active:border-indigo-400")})]})});s.displayName=a.fC.displayName},61796:function(e,t,i){"use strict";i.d(t,{u:function(){return m}});var r=i(52322),n=i(2784),a=i(35345),o=i(12524),l=i.n(o);let s=a.zt,d=a.fC,c=a.xz,u=n.forwardRef((e,t)=>{let{className:i,sideOffset:n=4,...o}=e;return(0,r.jsx)(a.VY,{ref:t,sideOffset:n,className:l()("z-50 overflow-hidden rounded-md bg-slate-800/90 px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 max-w-[300px]",i),...o})});u.displayName=a.VY.displayName;let p=Symbol.for("react.forward_ref"),m=e=>{let{children:t,content:i,side:a="top",className:o}=e;return(0,r.jsx)(s,{children:(0,r.jsxs)(d,{children:[(0,r.jsx)(c,{asChild:!0,children:n.isValidElement(t)&&function(e){let{type:t}=e;return"string"==typeof t||"object"==typeof t&&null!==t&&t.$$typeof===p}(t)?t:(0,r.jsx)("span",{className:"inline-flex",tabIndex:0,children:t})}),(0,r.jsx)(u,{side:a,className:o,children:(0,r.jsx)("div",{children:i})})]})})}},29350:function(e,t,i){"use strict";i.d(t,{J:function(){return q}});var r=i(2784),n=i(83112),a=i(19458),o=i(27818),l=i(92428),s=i(86767),d=i(18997),c=i(38986),u=i(40805),p=i(59134),m=i(64281),f=i(3438),x=i(52522),h=i(30118),g=i(65089),v=i(83096),b=i(62487),E=i(118),y=i(17088),w=i(80920),S=i(44041),j=i(34747),C=i(61966),N=i(3741),_=i(52438),R=i(61019),A=i(23083),k=i(69525),I=i(40381),z=i(25139),M=i(2431);async function D(e,t){if(!e)return;try{await (0,A.Df)({type:z.du.CONVERT_AUDIO},e)}catch(e){(0,d.H)(e);return}let i=t.toLowerCase();if(i.endsWith(".mp3")||i.endsWith(".wav"))return;let r="".concat(z.es).concat(e);try{return await M.YZ.getState().waitForDesignJobCompletion(r,e,void 0,"video_projects")}catch(t){(0,d.H)(t);let e=(0,R.wG)(t);if(e)return{result:e,status:I.E.errored,name:r,startedAt:new Date().toISOString(),schemaVersion:""};return}}var T=i(67516),O=i(51574),F=i(15906),L=i(90204),P=i(24498);async function U(e){let t;
1let{designId:i,file:r,videoUrl:n,videoResourceId:a,canvasAspectRatio:o,images:l,addImageLayer:s,updateImageLayer:d,upsertResource:u}=e,p=await (0,P.z)(r),m="poster_".concat(c.SOURCE_VIDEO_LAYER_OBJECT_NAME),f=new File([p],"".concat(r.name,".poster.jpg"),{type:"image/jpeg"});await new Promise((e,r)=>{(0,F.$p)({designId:i,type:"image",onProgress:()=>void 0,onDone:async(i,r,n)=>{let a={type:O.CustomFileType.bucket,pathInBucket:i,name:f.name};u(m,a),n&&(t=await n(),u(m,{...a,publicURL:t})),e()},onError:e=>r(e)})(f)});let x={...(0,L.hT)(n,a,o),posterResourceId:m,...t?{posterUrl:t}:{}};(0,L.h)(l)?d(c.SOURCE_VIDEO_LAYER_OBJECT_NAME,x,!1):s(x)}var W=i(49058),B=i(6332),G=i(38719),H=i(67638);function V(e,t,i,r){let n=((null==e?void 0:e.trim)?{...e,trim:{startRatio:0,endRatio:1}}:void 0)||e,o=(0,l.computeShownWaveformData)({waveformData:r,waveformConfig:n,width:e.reference.width,audioFileName:t,source:i});return(0,p.y)({waveformData:r,shownWaveformData:o,status:a.EditorStatus.LOADED,selectedSource:i,audioFileName:t,waveformConfig:n})}function Z(e){return 0===e.length||e.every(e=>void 0===e)}async function Y(e){let t;if("publicURL"in e&&e.publicURL?t=e.publicURL:e.type===O.CustomFileType.bucket&&e.pathInBucket&&(t=(await (0,A.sH)(e.pathInBucket)).url),!t)throw Error("Converted audio URL is missing");let i=await fetch(t);if(!i.ok)throw Error("Could not download converted audio: ".concat(i.status));return{blob:await i.blob(),url:t}}function q(){let e=(0,n.Z)(),t=(0,h._i)(),i=(0,w.Q5)(),l=(0,x.hl)(),p=(0,g.o0)(),A=(0,E.r)(),I=(0,v.FI)(),z=(0,b.L)(),M=(0,S.G)();return{uploadAudio:(0,r.useCallback)(async(r,n)=>{var x,h,g,v,b,E,S,F,L,P,q,K,X,J,Q;let $;let{updateEditorState:ee,setAudioTrimming:et,waveformConfig:ei,addImageLayer:er,updateImageLayer:en,removeImageLayer:ea,images:eo,canvasAspectRatio:el}=t,{saveEverything:es,designId:ed}=l,{setNotSaved:ec}=A,{setPlayableURL:eu,setPlayerStatus:ep}=I,{startConvertAudio:em}=z,{uploadAudioFile:ef,setAudioBlob:ex,upsertResource:eh,getResources:eg}=p,ev=null==n?void 0:null===(x=n.videoEditorPrimaryMedia)||void 0===x?void 0:x.applyWaveformData,eb=null!==(h=null==n?void 0:n.onProgress)&&void 0!==h?h:()=>null,eE=null!==(g=null==n?void 0:n.onStatus)&&void 0!==g?g:()=>null,ey=null!==(v=null==n?void 0:n.onSuccess)&&void 0!==v?v:()=>null,ew=null!==(b=null==n?void 0:n.onError)&&void 0!==b?b:()=>null,eS="video"===(0,C.hE)(r),ej=(e,t)=>{var i;let n=(0,_.classifyClientConvertAudioFailure)(e);f.yI({designId:t,failure_reason:n,media_kind:eS?"video":"audio",source:"client",input_format:null===(i=r.name.split(".").pop())||void 0===i?void 0:i.toLowerCase(),error_code:e.slice(0,200),is_system_failure:(0,_.isConvertAudioSystemFailureReason)(n)})},eC=(0,C.Vo)(r);if(eC){let t="MAX_SIZE_EXCEEDED"===eC?"Alert.Upload.MAX_SIZE_EXCEEDED":"UNSUPPORTED_FILE_FORMAT"===eC?N.featureFlags.videoSourceUpload?"Alert.Upload.UNSUPPORTED_FILE_FORMAT_WITH_VIDEO":"Alert.Upload.UNSUPPORTED_FILE_FORMAT":"Error.InvalidAudioFile",i=e.formatMessage({id:t,defaultMessage:t},{maxSize:"100MB"});M.error(i,void 0,5e3),ej(eC),ew(Error(eC));return}let eN=!!(null==n?void 0:n.videoEditorPrimaryMedia),e_=!!eS&&(null!==(E=null==n?void 0:n.videoIncludeVisuals)&&void 0!==E?E:!!eN||N.featureFlags.canvasVideoLayers),eR=!1;if(eS){let t=null!==(S=null==n?void 0:n.videoProbe)&&void 0!==S?S:await (0,W.A)(r),i=(0,B.UH)({probe:t,includeVisuals:e_,silentVideoLayers:eN||null!=y.G.getState().document});if("reject"===i.kind){if("invalid_container"===i.reason){let t=e.formatMessage({id:"Error.VideoInvalidContainer",defaultMessage:_.CONVERT_AUDIO_INVALID_VIDEO_CONTAINER_MESSAGE});M.error(t,void 0,5e3),ej("VIDEO_INVALID_CONTAINER"),ew(Error("VIDEO_INVALID_CONTAINER"));return}let t=e.formatMessage({id:"Error.VideoHasNoAudioTrack",defaultMessage:_.CONVERT_AUDIO_NO_AUDIO_IN_VIDEO_MESSAGE});M.error(t,void 0,5e3),ej("VIDEO_HAS_NO_AUDIO_TRACK"),ew(Error("VIDEO_HAS_NO_AUDIO_TRACK"));return}eR="visuals_only"===i.kind}eS&&(null==n?void 0:n.videoSourceUploadTracking)&&f.ji({...n.videoSourceUploadTracking,designId:ed||void 0,include_visuals:e_});let eA=(e,t,i)=>{(null==n?void 0:n.videoSourceUploadTracking)&&f.MY({...n.videoSourceUploadTracking,designId:t,include_visual
1s:e_,outcome:e,source_video_layer:i})},ek=null!=i?i:"__pending_audio_upload__",eI=ek,ez=(e,t)=>{j._.getState().setProgress(eI,{progress:e,phase:t.phase,label:t.label,description:t.description}),eb(e),eE({...t,percent:e})},eM=()=>{j._.getState().clearUpload(eI),eI!==ek&&j._.getState().clearUpload(ek)},eD=e=>{eM(),ew(e)},eT=e=>{if(e&&e!==eI){let t=j._.getState().uploads[eI];j._.getState().clearUpload(eI),eI=e,t&&j._.getState().setProgress(eI,t)}},eO=()=>eS?e.formatMessage({id:"Editor.Source.UploadStatus.UploadingVideo",defaultMessage:"Uploading video..."}):e.formatMessage({id:"Editor.Source.UploadStatus.UploadingAudio",defaultMessage:"Uploading audio..."}),eF=i?"".concat(c.AUDIO_ORIGINAL_FILE_ID,"_").concat(i):c.AUDIO_ORIGINAL_FILE_ID;eS||ex(eF,r);let eL=URL.createObjectURL(r),eP=eS&&e_?"video":"audio",eU=eR?{}:(0,H.WM)(t.captions);if(ee({status:a.EditorStatus.LOADING,...eU},!1),f.hj(a.SourceType.AUDIO),ep(o.c.loading),eS&&!e_&&(null==n||null===(L=n.videoEditorPrimaryMedia)||void 0===L||null===(F=L.clearPrimary)||void 0===F||F.call(L),(null==eo?void 0:eo.some(e=>e.id===c.SOURCE_VIDEO_LAYER_OBJECT_NAME))&&ea(c.SOURCE_VIDEO_LAYER_OBJECT_NAME)),eS&&e_&&!eR?eu(void 0):eS||eu(eL),ez(10,{phase:"uploading",label:eO()}),!eS){try{ez(20,{phase:"uploading",label:eO()}),$=await (0,m.t4)(r)}catch(i){(0,d.H)(i,{extra:{fileName:r.name}}),ee({status:a.EditorStatus.LOADED},!1);let t=e.formatMessage({id:"Error.InvalidAudioFile"},{maxSize:"100MB"});M.error(t,void 0,5e3),ej(i instanceof Error?i.message:"Upload failed",ed),eD(i instanceof Error?i:Error("Upload failed"));return}if(Z($)){ee({status:a.EditorStatus.LOADED},!1);let t=e.formatMessage({id:"Error.InvalidAudioFile"},{maxSize:"100MB"});M.error(t,void 0,5e3),ej("CORRUPTED_FILE",ed),eD(Error("CORRUPTED_FILE"));return}}if((null==n?void 0:n.videoEditorPrimaryMedia)&&(!eS||e_)&&n.videoEditorPrimaryMedia.applyPreview({assetId:G.dx,kind:eP,url:eL,name:r.name,mimeType:r.type||void 0,waveformData:$}),$){let e;let t=V(ei,r.name,a.SourceType.AUDIO,$),n={waveformData:$,shownWaveformData:null!==(q=t.shownWaveformData)&&void 0!==q?q:[],audioFileName:r.name,selectedSource:a.SourceType.AUDIO,trim:{startRatio:0,endRatio:1}},o=w.$X.getState().waveforms;e=i?o.map(e=>e.id===i?{...e,...n}:e):o.length>0?o.map((e,t)=>0===t?{...e,...n}:e):[{...u.defaultEditorConfig.waveforms[0],...n}];let l=null!=i?i:null===(P=e[0])||void 0===P?void 0:P.id;eT(l),ec(),ee({...t,...eU,waveforms:e,...void 0!==l&&{selectedWaveformId:l},selectedSource:a.SourceType.AUDIO,audioFileName:r.name,status:a.EditorStatus.LOADED},!1),et(!1)}let eW=ed||await es();if(!eW){ee({status:a.EditorStatus.LOADED},!1);let t=e.formatMessage({id:"Error.InvalidAudioFile"},{maxSize:"100MB"});M.error(t,void 0,5e3),ej("Could not save design"),eD(Error("Could not save design"));return}if(eS&&!eR){let e;let t={audioFileName:r.name,selectedSource:a.SourceType.AUDIO},n=w.$X.getState().waveforms;e=i?n.map(e=>e.id===i?{...e,...t}:e):n.length>0?n.map((e,i)=>0===i?{...e,...t}:e):[{...u.defaultEditorConfig.waveforms[0],...t}];let o=null!=i?i:null===(K=e[0])||void 0===K?void 0:K.id;eT(o),ec(),ee({status:a.EditorStatus.LOADING,...eU,selectedSource:a.SourceType.AUDIO,audioFileName:r.name,waveforms:e,...void 0!==o&&{selectedWaveformId:o}},!1),et(!1),ez(30,{phase:"uploading",label:eO()})}else ez(30,{phase:"uploading",label:eO()});let eB=()=>{let e=w.$X.getState().waveforms;ee({waveforms:i?e.map(e=>e.id===i?{...e,audioResourceId:eF}:e):e.map((e,t)=>0===t?{...e,audioResourceId:eF}:e),audioResourceId:eF},!1),ec()};try{await new Promise((t,i)=>{ef({designId:eW,file:r,resourceId:eF,onProgress:e=>{ez(eS?.6*e+10:.5*e+40,{phase:"uploading",label:eO()})},onDone:async()=>{eR||eB(),t()},onError:(t,r)=>{(0,d.H)(t,r),ee({status:a.EditorStatus.LOADED},!1);let n=(0,T.p)(t),o=e.formatMessage({id:n},{maxSize:"100MB"});M.error(o,void 0,5e3),ej((null==t?void 0:t.message)||"Upload failed",eW),i(t)}})})}catch(e){eD(e instanceof Error?e:Error("Upload failed"));return}if((()=>{if(!(null==n?void 0:n.videoEditorPrimaryMedia))return;let e=eg()[eF];if(!e)return;let t="publicURL"in e&&e.publicURL?e.publicURL:eL,i=e.type===O.CustomFileType.bucket?e.pathInBucket:void 0;n.videoEditorPrimaryMedia.applyUploaded({assetId:G.dx,kind:eS&&!e_?"audio":eP,url:t,name:r.name,mimeType:r.type||void 0,pathInBucket:i,resourceId:eF})})(),eS&&e_){let t=null!==(J=null===(X=eg()[eF])||void 0===X?void 0:X.publicURL)&&void 0!==J?J:eL;
1try{await U({designId:eW,file:r,videoUrl:t,videoResourceId:eF,canvasAspectRatio:el,images:eo,addImageLayer:er,updateImageLayer:en,upsertResource:eh})}catch(t){(0,d.H)(t,{extra:{fileName:r.name,phase:"sourceVideoPoster"}}),M.error(e.formatMessage({id:"Error.InvalidAudioFile",defaultMessage:"Could not capture a poster from your video. Check upload bucket CORS."}),void 0,5e3),ej("POSTER_CAPTURE_FAILED",eW),eD(t instanceof Error?t:Error("POSTER_CAPTURE_FAILED"));return}}if(!eS){if(ez(100,{phase:"uploading",label:eO()}),eM(),ey(),null==n?void 0:n.videoEditorPrimaryMedia){let e=await (0,k.J)();e&&D(e,r.name);return}await (0,s.wait)(4e3),em(eW,r.name);return}if(eR){ee({status:a.EditorStatus.LOADED},!1),ep(o.c.paused),ez(100,{phase:"uploading",label:eO()}),eM(),M.info(e.formatMessage({id:"Editor.Source.VideoHasNoAudioVisualsOnly",defaultMessage:"This video has no sound, so the waveform was left unchanged. The clip is on the canvas as a video layer."}),void 0,7e3),ey(),eA("visuals_only",eW,e_);return}ez(85,{phase:"converting",label:e.formatMessage({id:"Editor.Source.UploadStatus.ConvertingVideo",defaultMessage:"Extracting audio from your video..."}),description:e.formatMessage({id:"Editor.Source.UploadStatus.ConvertingVideoDescription",defaultMessage:"Larger or high-bitrate videos can take a few minutes."})});let eG=(null==n?void 0:n.videoEditorPrimaryMedia)?await (0,k.J)():await es();if(!eG){ee({status:a.EditorStatus.LOADED},!1);let t=e.formatMessage({id:"Error.InvalidAudioFile"},{maxSize:"100MB"});M.error(t,void 0,5e3),ej("Could not save design"),eD(Error("AUDIO_CONVERSION_FAILED"));return}let eH=(null==n?void 0:n.videoEditorPrimaryMedia)?await D(eG,r.name):await em(eG,r.name),eV=function(e){if(null==e?void 0:e.result)try{let t=JSON.parse(e.result);if((null==t?void 0:t.type)===O.CustomFileType.bucket||(null==t?void 0:t.type)===O.CustomFileType.public||(null==t?void 0:t.type)===O.CustomFileType.spotify||(null==t?void 0:t.type)===O.CustomFileType.youtube)return t}catch(e){}}(eH);if(!eV){ee({status:a.EditorStatus.LOADED},!1);let t=(0,R.fK)(null==eH?void 0:eH.result),i=e.formatMessage({id:t,defaultMessage:(0,R.xF)(t)},{maxSize:"100MB"});M.error(i,void 0,5e3),eD(Error("AUDIO_CONVERSION_FAILED"));return}ez(95,{phase:"generating_waveform",label:e.formatMessage({id:"Editor.Source.UploadStatus.GeneratingWaveform",defaultMessage:"Generating waveform from extracted audio..."})});try{let{blob:t,url:o}=await Y(eV),l=await (0,m.Q_)(t);if(Z(l))throw Error("CORRUPTED_FILE");null==ev||ev(l),ex(c.AUDIO_CONVERTED_MP3_FILE_ID,t),eu(o);let s=V(ei,r.name,a.SourceType.AUDIO,l),d={waveformData:l,shownWaveformData:null!==(Q=s.shownWaveformData)&&void 0!==Q?Q:[],audioFileName:r.name,selectedSource:a.SourceType.AUDIO,audioResourceId:c.AUDIO_CONVERTED_MP3_FILE_ID,trim:{startRatio:0,endRatio:1}},u=w.$X.getState().waveforms,p=i?u.map(e=>e.id===i?{...e,...d}:e):u.map((e,t)=>0===t?{...e,...d}:e);ee({...s,...eU,waveforms:p,selectedSource:a.SourceType.AUDIO,audioFileName:r.name,audioResourceId:c.AUDIO_CONVERTED_MP3_FILE_ID,status:a.EditorStatus.LOADED},!1),ec(),ez(100,{phase:"generating_waveform",label:e.formatMessage({id:"Editor.Source.UploadStatus.GeneratingWaveform",defaultMessage:"Generating waveform from extracted audio..."})}),eM(),ey(),eA("extracted",eG,e_),(null==n?void 0:n.videoEditorPrimaryMedia)&&eS&&!e_&&n.videoEditorPrimaryMedia.applyUploaded({assetId:G.dx,kind:"audio",url:o,name:r.name,mimeType:"audio/mpeg",pathInBucket:eV.type===O.CustomFileType.bucket?eV.pathInBucket:void 0,resourceId:c.AUDIO_CONVERTED_MP3_FILE_ID})}catch(i){(0,d.H)(i,{extra:{fileName:r.name}}),ee({status:a.EditorStatus.LOADED},!1);let t=e.formatMessage({id:"Error.InvalidAudioFile"},{maxSize:"100MB"});M.error(t,void 0,5e3),ej(i instanceof Error?i.message:"Upload failed",eG),eD(i instanceof Error?i:Error("Upload failed"))}},[e,t,i,l,A,I,z,p,M])}}},18672:function(e,t,i){"use strict";i.d(t,{d:function(){return f}});var r=i(2784),n=i(83112),a=i(15906),o=i(51574),l=i(18997),s=i(52522),d=i(51401),c=i(27099),u=i(65089),p=i(44041),m=i(67516);function f(){let e=(0,n.Z)(),{designId:t,saveEverything:i}=(0,s.hl)(),{updateWaveformNode:f,waveformConfig:x}=(0,d.O)(),{upsertResource:h}=(0,u.o0)(),g=(0,p.G)(),[v,b]=(0,r.useState)(!1),[E,y]=(0,r.useState)(null);return{uploadCenterImage:(0,r.useCallback)(async(r,n)=>{let s=null!=t?t:await i();if(!s){(0,l.H)(Error("Cannot get designId for center image upload"));return}b(!0),y(0);let d="image_".concat(Date.now(),"_").concat(Math.random().toString(36).slice(2,9));(0,a.$p)({designId:s,type:"image",onProgress:e=>y(e),onDone:async(e,t,i)=>{var a;let l=i?await i():"";h(d,{type:o.CustomFileType.bucket,pathInBucket:e,name:n.name,publicURL:l});let s=null!==(a=null==x?void 0:x.circleRadius)&&void 0!==a?a:0,u=(e,t)=>
1{let i=e>0&&t>0&&s>0?(0,c.defaultCircleCenterImageLayout)(e,t,s):void 0;f(r,{centerImage:i?{resourceId:d,url:l,...i}:{resourceId:d,url:l}}),b(!1),y(null)};if("undefined"!=typeof Image&&l){let e=new Image;e.onload=()=>{u(e.naturalWidth,e.naturalHeight)},e.onerror=()=>{u(0,0)},e.src=l}else u(0,0)},onError:(t,i)=>{(0,l.H)(t,i),b(!1),y(null),g.error(e.formatMessage({id:(0,m.p)(t),defaultMessage:"Upload failed"},{maxSize:a.Iv}))}})(n)},[t,i,f,h,g,e,null==x?void 0:x.circleRadius]),removeCenterImage:(0,r.useCallback)(e=>{f(e,{centerImage:void 0})},[f]),isUploading:v,uploadProgress:E}}},19382:function(e,t,i){"use strict";i.d(t,{l:function(){return n}});var r=i(2784);function n(e,t){let[i,n]=(0,r.useState)(null),a=()=>{if(null===i)return;n(null);let r=Number(i);""!==i.trim()&&Number.isFinite(r)&&r!==e&&t(r)};return{value:null!=i?i:String(e),onChange:e=>n(e.target.value),onBlur:a,onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),a()):"Escape"===e.key&&n(null)}}}},2877:function(e,t,i){"use strict";i.d(t,{U:function(){return E}});var r=i(2784),n=i(22581),a=i(3741),o=i(18997);let l="wavevisual:experiment:".concat(n.Iq),s={variant:void 0,ready:!1},d=s,c=!1,u=new Set;function p(e){return"control"===e||"test"===e}function m(e){d=e,u.forEach(e=>e())}function f(){var e;let t=null===(e=a.featureFlags.posthogOverrides)||void 0===e?void 0:e.digitalDownloadPrice;return p(t)?t:void 0}function x(e){d.ready||(!function(e){try{window.localStorage.setItem(l,e)}catch(e){}}(e),m({variant:e,ready:!0}))}function h(){let e=f();e&&e!==d.variant&&m({variant:e,ready:!0})}function g(){return d}function v(){return s}function b(e){return u.add(e),()=>{u.delete(e)}}function E(){!function(){if(c)return;c=!0,window.addEventListener("featureFlagsChanged",h);let e=f();if(e){m({variant:e,ready:!0});return}let t=function(){try{let e=new URLSearchParams(window.location.search).get("override"),[t,i]=(null!=e?e:"").split(":");return t===n.Iq&&p(i)?i:void 0}catch(e){return}}();if(t){x(t);return}let i=function(){try{let e=window.localStorage.getItem(l);return p(e)?e:void 0}catch(e){return}}();if(i){m({variant:i,ready:!0});return}!function(){let e=setTimeout(()=>x("control"),8e3),t=()=>{clearTimeout(e),x("control")};Promise.resolve().then(()=>(0,o.sO)()).then(i=>{if(!(null==i?void 0:i.onFeatureFlags)){t();return}i.onFeatureFlags((r,a,o)=>
1{if(!d.ready){if(null==o?void 0:o.errorsLoading){t();return}clearTimeout(e),x("test"===i.getFeatureFlag(n.Iq)?"test":"control")}})}).catch(t)}()}();let{variant:e,ready:t}=(0,r.useSyncExternalStore)(b,g,v);return(0,r.useMemo)(()=>({product:(0,n.QZ)(e),ready:t}),[e,t])}},359:function(e,t,i){"use strict";i.d(t,{U:function(){return p}});var r=i(12436),n=i.n(r),a=i(2784),o=i(15343),l=i(19458),s=i(38986),d=i(21749),c=i(52522),u=i(30118);let p=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:30,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:900,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,p=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,{updateEditorState:m,canvasAspectRatio:f,editorSize:x,frameConfig:h}=(0,u._i)(),{canvas:g}=(0,c.hl)(),v=(0,a.useCallback)(async()=>{var n,a,c;let u;let{current:v}=e;if(!v)return;let b=v.getBoundingClientRect(),E=b.width||(null==g?void 0:g.getWidth())||s.DEFAULT_EDITOR_WIDTH,y=b.height||(null==g?void 0:g.getHeight())||s.DEFAULT_EDITOR_HEIGHT,w=Math.max(0,y-r-p),S=w>i+t?i:w-t;if(f===l.AspectRatio["1/1"])S=u=Math.min(S,i,E-t);else{let e=(null===(n=o.ReferenceDimensions[f])||void 0===n?void 0:n.width)||o.ReferenceDimensions[l.AspectRatio["2/1"]].width,r=(null===(a=o.ReferenceDimensions[f])||void 0===a?void 0:a.height)||o.ReferenceDimensions[l.AspectRatio["2/1"]].height;S=Math.round((u=Math.min(S*e/r,i,E-t))*r/e)}let j=r+Math.round((w-S)/2),C=Math.round((E-u)/2),N=u/(null!==(c=o.ReferenceDimensions[f])&&void 0!==c?c:o.ReferenceDimensions[l.AspectRatio["2/1"]]).width;(u!==x.width||S!==x.height||j!==h.offsetTop||C!==h.offsetLeft)&&(m({editorSize:{width:u,height:S,ratioToReference:N},frameConfig:{wrapperWidth:E,wrapperHeight:y,offsetTop:j,offsetLeft:C,ratioToReference:N}},!1),d.fabric.Object.prototype.set({cornerSize:E>480?14:10}))},[e,g,i,t,r,p,f,x,h.offsetTop,h.offsetLeft,m]),b=(0,a.useMemo)(()=>n()(v,250),[v]);return(0,a.useEffect)(()=>(window.addEventListener("resize",b),b(),()=>{window.removeEventListener("resize",b),b.cancel()}),[b]),(0,a.useEffect)(()=>{let t=e.current;if(!t||"undefined"==typeof ResizeObserver)return;let i=new ResizeObserver(b);return i.observe(t),()=>i.disconnect()},[e,b]),null}},93873:function(e,t,i){"use strict";i.d(t,{P:function(){return c}});var r=i(5632),n=i(30118),a=i(83096),o=i(14084),l=i(17088),s=i(70082),d=i(86337);function c(){var e,t,i,c;let u=(0,r.useRouter)(),{captions:p,animation:m}=(0,n._i)(),{audioElement:f}=(0,a.FI)(),x=(0,o.s)(e=>e.designDocument),h=(0,l.G)(e=>e.document);if(null==h?void 0:h.id)return(0,s.ng)(h.captionTracks);let g="string"==typeof(null==u?void 0:null===(e=u.query)||void 0===e?void 0:e.templateId)?u.query.templateId:void 0,v=(null==f?void 0:f.currentSrc)||(null==f?void 0:f.src),b=null==f?void 0:f.duration;return{...(0,s.Gx)(null!=p?p:null==x?void 0:null===(t=x.config)||void 0===t?void 0:t.captions),source_template_id:null!==(i=null==x?void 0:x.sourceTemplateId)&&void 0!==i?i:g,animation_style:null!==(c=null==m?void 0:m.style)&&void 0!==c?c:"none",has_played_preview:(0,d.Mq)(v),audio_duration_seconds:null!=b&&Number.isFinite(b)&&b>0?Math.round(b):void 0}}},21571:function(e,t,i){"use strict";i.d(t,{g:function(){return a}});var r=i(2784),n=i(3741);function a(){let[e,t]=(0,r.useState)(0);return(0,r.useEffect)(()=>{let e=e=>{e.key===n.FEATURE_FLAG_OVERRIDES_STORAGE_KEY&&t(e=>e+1)},i=()=>{t(e=>e+1)};return window.addEventListener("storage",e),window.addEventListener("featureFlagsChanged",i),()=>{window.removeEventListener("storage",e),window.removeEventListener("featureFlagsChanged",i)}},[]),(0,r.useMemo)(()=>{let e=(0,n.getBaseFeatureFlags)(),t=(0,n.getFeatureFlagOverrides)();return t?(0,n.deepMerge)(e,t):e},[e])}},3752:function(e,t,i){"use strict";i.d(t,{d:function(){return n}});var r=i(2784);let n=()=>{let[e,t]=(0,r.useState)(null);return(0,r.useEffect)(()=>{let e=()=>{t(window.innerWidth<1024)};return e(),window.addEventListener("resize",e,{passive:!0}),()=>{window.removeEventListener("resize",e)}},[]),e}},45539:function(e,t,i){"use strict";i.d(t,{A:function(){return s},T:function(){return n}});var r,n,a=i(2784),o=i(3741),l=i(18997);function s(e){let[t,i]=(0,a.useState)();return(0,a.useEffect)(()=>{let t=async()=>{var t,r;if("free-preview-download"===e&&(null===(t=o.featureFlags.posthogOverrides)||void 0===t?void 0:t.freePreviewDownload)!==void 0){i(!!o.featureFlags.posthogOverrides.freePreviewDownload&&"on");return}if("pre-edit-size-selector"===e&&(null===(r=o.featureFlags.posthogOverrides)||void 0===r?void 0:r.preEditSizeSelector)!==void 0){i(o.featureFlags.posthogOverrides.preEditSizeSelector);return}let n=(await (0,l.sO)()).getFeatureFlag(e);if("pre-edit-size-selector"===e){i("blocker"===n?"blocker":"control");return}i(n)};t();let r=()=>{t()},n=e=>{e.key===o.FEATURE_FLAG_OVERRIDES_STORAGE_KEY&&t()};return window.addEventListener("featureFlagsChanged",r),window.addEventListener("storage",n),(
1)=>{window.removeEventListener("featureFlagsChanged",r),window.removeEventListener("storage",n)}},[e]),t}(r=n||(n={})).FREE_PREVIEW_DOWNLOAD="free-preview-download",r.PRE_EDIT_SIZE_SELECTOR="pre-edit-size-selector"},67491:function(e,t,i){"use strict";i.d(t,{L:function(){return s}});var r=i(2784),n=i(96014),a=i(17088),o=i(38719),l=i(34826);function s(){let e=(0,a.G)(e=>e.applyPrimaryMedia),t=(0,a.G)(e=>e.clearPrimaryMedia),i=(0,a.G)(e=>e.setPrimaryAssetWaveformData),{setMedia:s}=(0,n.r)(),{uploadSourceMedia:d}=(0,l.t)(),c=(0,r.useRef)(),u=(0,r.useCallback)(t=>{e(t,{resetCaptions:!0}),s(t.url,t.kind,t.durationMs&&t.durationMs>0?{durationSeconds:t.durationMs/1e3}:void 0)},[e,s]),p=(0,r.useCallback)(()=>{c.current&&(URL.revokeObjectURL(c.current),c.current=void 0),t(),s(void 0,"audio")},[t,s]);return{uploadPrimaryMedia:(0,r.useCallback)(async e=>{await d(e,{videoEditorPrimaryMedia:{clearPrimary:p,applyPreview:e=>{c.current&&c.current!==e.url&&URL.revokeObjectURL(c.current),e.url.startsWith("blob:")&&(c.current=e.url),u({...e,assetId:o.dx})},applyUploaded:e=>{c.current&&e.url!==c.current&&(URL.revokeObjectURL(c.current),c.current=void 0),u(e)},applyWaveformData:e=>{i(e)}}})},[d,u,p,i]),clearPrimaryMediaUpload:p}}},21066:function(e,t,i){"use strict";i.d(t,{b:function(){return f}});var r=i(2784),n=i(83112),a=i(15906),o=i(51574),l=i(18997),s=i(52522),d=i(30118),c=i(65089),u=i(44041),p=i(34610),m=i(67516);function f(){let e=(0,n.Z)(),{designId:t,saveEverything:i}
1=(0,s.hl)(),{updateImageLayer:f,updateBackground:x,background:h,editorSize:g,frameConfig:v}=(0,d._i)(),{upsertResource:b}=(0,c.o0)(),E=(0,u.G)(),[y,w]=(0,r.useState)(!1);return{replaceAssetImage:(0,r.useCallback)(async(r,n,s)=>{let d=null!=t?t:await i();if(!d){var c;(0,l.H)(Error("Cannot get designId for image replace")),null==s||null===(c=s.onError)||void 0===c||c.call(s,Error("Could not save design"));return}w(!0);let u="image_".concat(Date.now(),"_").concat(Math.random().toString(36).slice(2,9));(0,a.$p)({designId:d,type:"image",onProgress:()=>void 0,onDone:async(e,t,i)=>{var a;let l=i?await i():"";b(u,{type:o.CustomFileType.bucket,pathInBucket:e,name:n.name,publicURL:l}),f(r,{resourceId:u,url:l}),w(!1),null==s||null===(a=s.onSuccess)||void 0===a||a.call(s)},onError:(t,i)=>{var r;(0,l.H)(t,i),w(!1),E.error(e.formatMessage({id:(0,m.p)(t),defaultMessage:"Upload failed"},{maxSize:a.Iv})),null==s||null===(r=s.onError)||void 0===r||r.call(s,t)}})(n)},[t,i,f,b,E,e]),replaceBackgroundImage:(0,r.useCallback)(async(r,n)=>{let o=null!=t?t:await i();if(!o){var s;(0,l.H)(Error("Cannot get designId for background image replace")),null==n||null===(s=n.onError)||void 0===s||s.call(n,Error("Could not save design"));return}w(!0),(0,a.$p)({designId:o,type:"image",onProgress:()=>void 0,onDownloadURL:e=>{var t,i,r;x({imageURL:e,imageRect:null!==(i=null==h?void 0:h.imageRect)&&void 0!==i?i:(0,p.v)(g,v),backgroundSize:null!==(r=null==h?void 0:h.backgroundSize)&&void 0!==r?r:"free"},!0),w(!1),null==n||null===(t=n.onSuccess)||void 0===t||t.call(n)},onError:(t,i)=>{var r;(0,l.H)(t,i),w(!1),E.error(e.formatMessage({id:(0,m.p)(t),defaultMessage:"Upload failed"},{maxSize:a.Iv})),null==n||null===(r=n.onError)||void 0===r||r.call(n,t)}})(r)},[t,i,x,h,g,v,E,e]),isReplacing:y}}},34826:function(e,t,i){"use strict";i.d(t,{t:function(){return u}});var r=i(2784),n=i(61966),a=i(49058),o=i(21571),l=i(29350),s=i(39440),d=i(17088),c=i(3438);function u(){let{uploadAudio:e}=(0,l.J)(),{videoSourceUpload:t,canvasVideoLayers:i}=(0,o.g)(),u=(0,s.A)(e=>e.requestChoice),p=(0,d.G)(e=>null!=e.document);return{uploadSourceMedia:(0,r.useCallback)(async(r,o)=>{let l,s;let d=!!(null==o?void 0:o.videoEditorPrimaryMedia)||p,m=d?"video_editor":"editor",f=i||d,x=!!d||i;if(t&&"video"===(0,n.hE)(r)){var h;l=await (0,a.A)(r);let e=(null===(h=r.name.split(".").pop())||void 0===h?void 0:h.toLowerCase())||void 0,t=l.ok,i=!l.ok&&!d,n=f&&!i&&(l.ok||"no_audio"===l.reason),o="implicit";if(n){c.VC({surface:m,has_audio:t,input_format:e});try{let i=await u(r,{hasAudio:l.ok});x="audio-and-visuals"===i,o=t?i:"visuals-only",s={surface:m,choice:o,has_audio:t,input_format:e},c.BY(s)}catch(i){c.lH({surface:m,has_audio:t,input_format:e});return}}else s={surface:m,choice:o="implicit",has_audio:t,input_format:e}}return e(r,{...o,videoIncludeVisuals:x,videoProbe:l,videoSourceUploadTracking:s})},[e,p,t,i,u])}}},85603:function(e,t,i){"use strict";i.d(t,{w:function(){return N}});var r=i(52322),n=i(2784),a=i(12524),o=i.n(a),l=i(42670),s=i(99127),d=i(92244),c=i(46979),u=i(30118),p=i(118),m=i(52522),f=i(17088),x=i(83553),h=i(3752),g=i(39402),v=i(57284),b=i(3438),E=i(15343),y=i(84649),w=i(17835),S=i(59637),j=i(14806),C=i.n(j);let N=()=>{var e;let{editMode:t}=(0,m.hl)(),{updateEditorState:i,canvasAspectRatio:a,waveforms:j,textNodes:N,qr:_,images:R}=(0,u._i)(),{setNotSaved:A}=(0,p.r)(),k=(0,f.G)(e=>e.patchDocument),I=(0,f.G)(e=>null!=e.document),z=null!==(e=(0,h.d)())&&void 0!==e&&e,[M,D]=(0,n.useState)(!1),[T,O]=(0,n.useState)(!1),[F,L]=(0,n.useState)(null),P=t!==x.uz.Locked,U=(0,n.useCallback)(e=>{let t=(0,y.$E)({oldAspectRatio:a,newAspectRatio:e,waveforms:null!=j?j:[],textNodes:null!=N?N:[],qr:_,images:R});if(i({canvasAspectRatio:e,...t}),I){let t=E.ReferenceDimensions[e];t&&k(e=>({...e,width:t.width,height:t.height}))}A()},[i,A,a,j,N,_,R,I,k]),W=(0,n.useCallback)((e,t)=>{U(e.ratio),b.j1(e.ratio,t,{preset_key:e.key,use_case:v.Iy[e.ratio]}),"dropdown"===t?O(!1):D(!1)},[U]);if(!P)return null;let B=(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(s.o3n,{className:"h-5 w-5 shrink-0","aria-hidden":!0}),(0,r.jsx)("span",{className:"ml-2 hidden text-sm font-semibold tracking-tight whitespace-nowrap sm:inline",children:(0,r.jsx)(l.Z,{id:"Editor.Header.Resize",defaultMessage:"Resize"})}),(0,r.jsx)(d.Z,{className:"hidden h-4 w-4 shrink-0 opacity-95 transition-transform duration-200 group-data-[state=open]:rotate-180 lg:ml-1.5 lg:block","aria-hidden":!0})]});return z?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{type:"button",onClick:()=>{D(!0),b.WT("drawer")},className:o()("group",C().trigger,"mr-2"),"aria-label":"Resize",children:B}),(0,r.jsx)(w.dy,{open:M,onOpenChange:e=>!e&&D(!1),children:(0,r.jsxs)(w.sc,{className:"flex max-h-[75vh] flex-col overflow-hidden rounded-t-xl px-0",children:[(0,r.jsxs)("div",{className:"flex shrink-0 flex-row items-center justify-between gap-2 border-b border-gray-200 px-4 py-2",children:[(0,r.jsx)(w.iI,{className:"sr-only",children:(0,r.jsx)(l.Z,{id:"Editor.Menu.Dimensions",defaultMessage:"Canvas Size"})}),(0,r.jsx)(g.D5,{activeUseCase:F,onUseCaseChange:L}),(0,r.jsx)(w.uh,{asChild:!0,children:(0,r.jsx)("button",{type:"button",className:"-mr-1 flex h-8 w-8 shrink-0 items-center justify-center rounded text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-700","aria-label":"Close",children:(0,r.jsx)(c.Z,{className:"h-5 w-5"})})})]}),(0,r.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto p-4",children:(0,r.jsx)(g.MB,{searchInputId:"drawer
1-size-preset-search",currentRatio:a,onSelect:e=>W(e,"drawer"),activeUseCase:F,onUseCaseChange:L})})]})})]}):(0,r.jsxs)(S.h_,{open:T,onOpenChange:e=>{O(e),e&&b.WT("dropdown")},children:[(0,r.jsx)(S.$F,{asChild:!0,children:(0,r.jsx)("button",{type:"button",className:o()("group",C().trigger,"mr-2"),"aria-label":"Resize",children:B})}),(0,r.jsxs)(S.AW,{align:"start",sideOffset:8,className:"flex w-[min(440px,92vw)] min-w-[320px] max-w-[440px] max-h-[min(70vh,640px)] flex-col overflow-hidden rounded-xl border-0 bg-white p-0 text-gray-900 shadow-2xl",style:{boxShadow:"0 24px 64px -14px rgba(0,0,0,0.4), 0 14px 36px -10px rgba(0,0,0,0.26), 0 4px 10px rgba(0,0,0,0.12)",zIndex:1e3},children:[(0,r.jsx)("div",{className:"shrink-0 border-b border-gray-200 bg-white px-3 py-2",children:(0,r.jsx)(g.D5,{activeUseCase:F,onUseCaseChange:L})}),(0,r.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain p-3",children:(0,r.jsx)(g.MB,{embedInScrollableParent:!0,searchInputId:"header-size-preset-search",currentRatio:a,onSelect:e=>W(e,"dropdown"),activeUseCase:F,onUseCaseChange:L})})]})]})}},78683:function(e,t,i){"use strict";i.d(t,{F:function(){return T}});var r=i(52322),n=i(2784),a=i(42670),o=i(71680),l=i(99127),s=i(70606),d=i(39097),c=i.n(d),u=i(40457),p=i(21353),m=i(7355),f=i(64907),x=i(42307),h=i(52745),g=i(61367),v=i(12524),b=i.n(v),E=i(52522),y=i(95747),w=i(3438);let S=()=>{let e=(0,n.useRef)(null),t=(0,n.useCallback)(()=>{e.current&&(e.current.select(),e.current.setSelectionRange(0,99999),document.execCommand("copy"))},[e]);return(0,r.jsxs)("div",{className:"flex flex-col p-4",children:[(0,r.jsxs)(p.z,{theme:"blue",className:"w-full mb-2 rounded",onClick:()=>{w.XR("facebook"),window.open("https://www.facebook.com/sharer.php?s=100&p[url]=".concat(encodeURIComponent(window.location.href)))},children:[(0,r.jsx)(l.s5I,{fontSize:24,className:"mr-2"}),(0,r.jsx)(a.Z,{id:"Share.Facebook"})]}),(0,r.jsxs)(p.z,{theme:"info",className:"w-full my-2 rounded",onClick:()=>{w.XR("twitter"),window.open("https://twitter.com/intent/tweet?text=".concat(window.location.href))},children:[(0,r.jsx)(l.wod,{fontSize:24,className:"mr-2"}),(0,r.jsx)(a.Z,{id:"Share.Twitter"})]}),(0,r.jsxs)("div",{className:"flex flex-row items-center justify-between w-full my-2 text-black bg-gray-200 border-0 rounded shadow cursor-pointer",onClick:()=>{t(),w.XR("copy")},children:[(0,r.jsx)("input",{type:"text",value:window.location.href,readOnly:!0,className:"w-full p-2 ml-2 bg-transparent",ref:e,"aria-label":"Shareable page URL"}),(0,r.jsxs)("span",{className:"inline-flex gray-button normal-button",children:[(0,r.jsx)(l.AOF,{fontSize:24,className:"bg-gray-100"}),(0,r.jsx)(a.Z,{id:"Share.Copy"})]})]})]})};var j=i(16484);let C=e=>{let{theme:t,className:i}=e,{designId:a}=(0,E.hl)(),o=(0,n.useCallback)(()=>{a&&(window.location.href="/editor?templateId=d-".concat(a))},[a]);return(0,r.jsx)(p.z,{theme:t||"primary",onClick:o,"aria-label":"Duplicate current design",icon:j.xfS,className:i,children:(0,r.jsx)("span",{className:"ml-2",children:"Duplicate current design"})})};var N=i(97065),_=i(78958),R=i(37690),A=i(14846),k=i.n(A),I=i(47389),z=i(3741),M=i(16572),D=i(45539);let T=e=>{var t;let{hide:i,content:d,setContent:v,setShownTab:w,variant:j="default"}=e,{isPaid:A,designId:T}=(0,E.hl)(),O=(0,m.aC)(),F=(0,M.mv)((null===(t=O.userDetails)||void 0===t?void 0:t.subscriptions)||[]),L=(0,D.A)(D.T.FREE_PREVIEW_DOWNLOAD),P=(0,y.Q)(e=>e.authWallReason),U=(0,y.Q)(e=>e.clearAuthWallReason),W=()=>{U(),v(I._.main),i()};return(0,n.useEffect)(()=>{d===I._.login||d===I._.register||U()},[d,U]),(0,r.jsxs)(r.Fragment,{children:[d===I._.main&&(0,r.jsxs)("ul",{className:"items-center justify-end flex-1 w-full p-2 list-none",children:[(0,r.jsx)("li",{className:"py-2 text-base lg:text-sm border-blue-300 lg:hidden",children:(0,r.jsxs)(p.z,{theme:"link","aria-label":"Download",onClick:()=>{"video"===j?w(R.B.export):w(A||F||z.featureFlags.freeDownloadsForReviews||"on"===L?_.e.export:_.e.digitalCheckout),i()},children:[(0,r.jsx)(u.eEq,{className:k().sidesheetItemIcon}),(0,r.jsx)(a.Z,{id:"Editor.Menu.Export"})]})}),"video"!==j&&!A&&z.featureFlags.enablePrinting&&(0,r.jsx)("li",{className:b()(k().sidesheetItem,"lg:hidden"),children:(0,r.jsxs)(p.z,{theme:"link","aria-label":"Print",onClick:()=>{w(_.e.print),i()},children:[(0,r.jsx)(l.MbD,{className:k().sidesheetItemIcon}),"Print"]})}),(0,r.jsx)("li",{className:b()(k().sidesheetItem,"lg:border-none"),children:(0,r.jsxs)(p.z,{theme:"link","aria-label":"Share",onClick:()=>v(I._.share),className:"w-full",children:[(0,r.jsx)(l.x2q,{className:k().sidesheetItemIcon}),(0,r.jsx)(a.Z,{id:"Nav.Share"}),(0,r.jsx)(o.Dli,{className:"ml-auto",fontSize:20})]})}),T&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("li",{className:k().sidesheetItem,children:(0,r.jsx)(N.k,{theme:"link"})},"editor-new-design"),(0,r.jsx)("li",{className:k().sidesheetItem,children:(0,r.jsx)(C,{theme:"link"})},"editor-duplicate")]}),"loading"===O.status&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("li",{className:"py-2 border-t border-blue-300",children:(0,r.jsx)("div",{className:"w-1/3 h-6 m-2 bg-blue-200 animate-pulse"})}),(0,r.jsx)("li",{className:"py-2 border-t border-blue-300",children:(0,r.jsx)("div",{className:"w-1/3 h-6 m-2 bg-blue-200 animate-pulse"})}),(0,r.jsx)("li",{className:"py-2 border-t border-blue-300",children:(0,r.jsx)("div",{className:"w-1/3 h-6 m-2 bg-blue-200 animate-pulse"})})]}),(0,r.jsx)("div",{className:"px-3 mt-2",children:(0,r.jsx)("h6",{className:"mb-1 text-sm font-semibold",children:"Navigation"})}),(0,r.jsx)("hr",{className:"mb-2 border-gray-300"}),(0,r.jsx)("li",{className:"py-2 text-base lg:text-sm border-b",children:(0,r.jsx)(c(),{href:"/my-designs",prefetch:!1,legacyBehavior:!0,children:(0,r.jsxs)(p.z,{theme:"link","aria-label":"Your designs",children:[(0,r.jsx)(l.MbD,{className:k().sidesheetItemIcon}),(0,r.jsx)(a.Z,{id:"MyDesigns.Title"})]})})}),O.isLoggedIn&&(0,r.jsx)("li",{className:k().sidesheetItem,children:(0,r.jsx)(c(),{href:"/my-account",prefetch:!1,legacyBehavior:!0,"aria-label":"Your account",children:(0,r.jsxs)(p.z,{theme:"link",children:[(0,r.jsx)(o.m3W,{className:k().sidesheetItemIcon}),(0,r.jsx)(a.Z,{id:"Nav.MyAccount"})]})})}),!O.isLoggedIn&&O.isFetched&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("li",{className:"py-2 text-base lg:text-sm",children:(0,r.jsxs)(p.z,{theme:"link",onClick:()=>v(I._.login),"aria-label":"Sign in",className:"w-full",children:[(0,r.jsx)(o.IPB,{className:k().sidesheetItemIcon}),(0,r.jsx)(a.Z,{id:"Auth.SignIn"}),(0,r.jsx)(o.Dli,{className:"ml-auto",fontSize:18})]})}),(0,r.jsx)("li",{className:k().sidesheetItem,children:(0,r.jsxs)(p.z,{theme:"link",onClick:()=>v(I._.register),"aria-label":"Register",className:"w-full",children:[(0,r.jsx)(s.BR5,{className:k().sidesheetItemIcon}),(0,r.jsx)(a.Z,{id:"Auth.Register"}),(0,r.jsx)(o.Dli,{className:"ml-auto",fontSize:20})]})})]}),(0,r.jsx)("li",{className:k().sidesheetItem,children:(0,r.jsx)(c(),{href:"/#pricing",prefetch:!1,legacyBehavior:!0,"aria-label":"Pricing",children:(0,r.jsxs)(p.z,{theme:"link",onClick:i,children:[(0,r.jsx)(s.FXG,{className:k().sidesheetItemIcon}),(0,r.jsx)(a.Z,{id:"Nav.Pricing"})]})})}),(0,r.jsx)("li",{className:k().sidesheetItem,children:(0,r.jsx)(c(),{href:"/",prefetch:!1,legacyBehavior:!0,children:(0,r.jsxs)(p.z,{theme:"link",children:[(0,r.jsx)(l.V9Z,{className:k().sidesheetItemIcon}),(0,r.jsx)(a.Z,{id:"Nav.Home"})]})})}),(0,r.jsx)("li",{className:k().sidesheetItem,children:(0,r.jsx)(c(),{href:"/#faq",prefetch:!1,legacyBehavior:!0,children:(0,r.jsxs)(p.z,{theme:"link",children:[(0,r.jsx)(l.znh,{className:k().sidesheetItemIcon}),(0,r.jsx)(a.Z,{id:"Nav.FAQ"})]})})}),O.isLoggedIn&&O.isFetched&&(0,r.jsx)("li",{className:k().sidesheetItem,children:(0,r.jsxs)(p.z,{theme:"link",onClick:O.signOut,"aria-label":"Sign out",children:[(0,r.jsx)(o.fHX,{className:k().sidesheetItemIcon}),(0,r.jsx)(a.Z,{id:"Auth.SignOut"})]})})]}),d===I._.share&&(0,r.jsx)(S,{}),d===I._.login&&(0,r.jsxs)("div",{className:"px-5",children:["template_save"===P&&(0,r.jsxs)("div",{className:"my-4 flex gap-3 rounded-lg border border-violet-200 bg-vi
1olet-50 p-3",children:[(0,r.jsx)(o.kUi,{className:"mt-0.5 shrink-0 text-violet-600",size:18,"aria-hidden":!0}),(0,r.jsx)("p",{className:"text-sm font-medium text-violet-900",children:(0,r.jsx)(a.Z,{id:"Templates.AuthWall.Message"})})]}),(0,r.jsx)(f._,{switchToRegister:()=>v(I._.register),switchToForgotPassword:()=>v(I._.forgotPassword),close:W,withGoogle:!0})]}),d===I._.register&&(0,r.jsxs)("div",{className:"px-5",children:["template_save"===P&&(0,r.jsxs)("div",{className:"my-4 flex gap-3 rounded-lg border border-violet-200 bg-violet-50 p-3",children:[(0,r.jsx)(o.kUi,{className:"mt-0.5 shrink-0 text-violet-600",size:18,"aria-hidden":!0}),(0,r.jsx)("p",{className:"text-sm font-medium text-violet-900",children:(0,r.jsx)(a.Z,{id:"Templates.AuthWall.Message"})})]}),(0,r.jsx)(x.K,{switchToLogin:()=>v(I._.login),switchToVerification:()=>v(I._.emailVerification),withGoogle:!0,close:W})]}),d===I._.forgotPassword&&(0,r.jsx)("div",{className:"px-5",children:(0,r.jsx)(h.J,{switchToLogin:()=>v(I._.login)})}),d===I._.emailVerification&&(0,r.jsx)("div",{className:"px-5",children:(0,r.jsx)(g.U,{})})]})}},72657:function(e,t,i){"use strict";i.d(t,{B:function(){return b}});var r=i(52322),n=i(2784),a=i(99127),o=i(42670),l=i(16484),s=i(27818),d=i(94133),c=i(83096),u=i(92855),p=i(61796),m=i(80410),f=i(43821),x=i(32945),h=i(30118),g=i(80920);let v=e=>{let{playerStatus:t}=e;switch(t){case s.c.error:return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(p.u,{content:"This audio file is not supported by your browser",children:(0,r.jsx)(a.ocf,{className:"text-xl shrink-0 text-red-400"})}),(0,r.jsx)("span",{className:"ml-2 text-sm whitespace-nowrap hidden sm:inline",children:"Cannot play"})]});case s.c.paused:return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a.sT9,{className:"text-2xl shrink-0"}),(0,r.jsx)("span",{className:"ml-2 text-sm whitespace-nowrap hidden sm:inline",children:(0,r.jsx)(o.Z,{id:"Nav.Play"})})]});case s.c.playing:return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(l.xh,{className:"text-2xl shrink-0"}),(0,r.jsx)("span",{className:"ml-2 text-sm whitespace-nowrap hidden sm:inline",children:(0,r.jsx)(o.Z,{id:"Nav.Stop"})})]});case s.c.loading:return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(d.p,{fontSize:24,className:"shrink-0"}),(0,r.jsx)("span",{className:"ml-2 text-sm whitespace-nowrap hidden sm:inline",children:(0,r.jsx)(o.Z,{id:"Nav.Loading"})})]});default:return null}},b=()=>{var e;let{playerStatus:t,audioElement:i}=(0,c.FI)(),{waveformConfig:a}=(0,h._i)(),o=(0,g.e1)(),l=null!==(e=null==o?void 0:o.trim)&&void 0!==e?e:null==a?void 0:a.trim,d=t===s.c.playing,p=(0,n.useCallback)(()=>{if(i){if(d){if(!i.paused){let e=(0,f.sF)(i.duration,l),t=e?(0,f.x$)(i.currentTime,e):i.currentTime;i.pause(),x.EM.stop(),x.EM.setTime(t)}}else{var e;let t=(0,f.sF)(i.duration,l);i.currentTime=null!==(e=null==t?void 0:t.windowStart)&&void 0!==e?e:0,t?x.EM.setDuration(t.windowDuration):i.duration&&!Number.isNaN(i.duration)&&Number.isFinite(i.duration)&&x.EM.setDuration(i.duration),i.play(),x.EM.play()}}},[i,d,l]);return(0,m.e)(i)?(0,r.jsx)("button",{className:"flex items-center px-2.5 py-2 rounded-lg bg-violet-600 text-white border border-white/40 hover:bg-violet-500 disabled:opacity-50 h-[40px]",onClick:p,disabled:t===s.c.loading||t===s.c.error,"data-testid":u.z.PLAYER_ACTION_BUTTON,children:(0,r.jsx)(v,{playerStatus:t})}):null}},8752:function(e,t,i){"use strict";i.d(t,{k:function(){return p}});var r=i(52322),n=i(38986);i(2784);var a=i(71680),o=i(42670),l=i(61796),s=i(83096),d=i(65089),c=i(80920),u=i(92855);let p=()=>{let{externalURL:e,fileName:t}=(0,s.FI)(),{audioFileName:i,audioResourceId:p}=(0,c.e1)()||{},m=(0,d.Wf)(p||n.AUDIO_ORIGINAL_FILE_ID),f=(null==m?void 0:m.name)||i||t;return(0,r.jsx)(l.u,{side:"bottom",content:(0,r.jsx)(o.Z,{id:"Editor.Spotify.CannotPlayPreviewTooltip"}),children:(0,r.jsxs)("a",{rel:"nofollow noreferrer",className:"flex flex-row items-center text-blue-50 hover:bg-violet-500 p-2 rounded-lg",target:"_blank","data-testid":u.z.SPOTIFY_EXTERNAL_URL,href:e||(null==m?void 0:m.publicURL),children:[(0,r.jsx)(a.l4C,{className:"mr-2 text-2xl lg:text-lg"}),(0,r.jsx)("span",{className:"hidden lg:inline-flex","data-testid":u.z.SPOTIFY_FILE_NAME,children:f}),(0,r.jsx)("span",{className:"inline-flex text-lg lg:hidden",children:(0,r.jsx)(o.Z,{id:"Nav.Play"})})]})})}},75630:function(e,t,i){"use strict";i.d(t,{Q:function(){return y}});var r,n,a=i(52322),o=i(2784),l=i(83112),s=i(42670),d=i(99127),c=i(61796),u=i(118);function p(){return(p=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e}).apply(null,arguments)}var m=function(e){return o.createElement("svg",p({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none"},e),r||(r=o.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M11 3a6 6 0 0 0-5.99 5.661A5.627 5.627 0 0 0 7 19.5v.001h10V19.5a5.625 5.625 0 0 0 2.67-10.506l-1.114 1.114a4.126 4.126 0 0 1-1.806 7.891V18h-9.5v-.002a4.125 4.125 0 0 1-.681-8.21 4.5 4.5 0 0 1 8.549-2.606l1.116-1.117A6 6 0 0 0 11 3m7.631 4.91a.75.75 0 1 0-1.053-1.068L10.67 13.75l-1.93-1.93a.75.75 0 1 0-1.088 1.03l-.001.002 2.444 2.445a.75.75 0 0 0 1.11.037v.001l7.425-7.424Z",clipRule:"evenodd"})))};function f(){return(f=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e}).apply(null,arguments)}var x=function(e){return o.createElement("svg",f({xmlns:"http://www.w3.org/2000/svg",width:24,height:24,fill:"none"},e),n||(n=o.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M11 3a6 6 0 0 0-5.99 5.661A5.627 5.627 0 0 0 7 19.5v.001h10V19.5a5.625 5.625 0 0 0 2.67-10.506l-1.114 1.114a4.126 4.126 0 0 1-1.806 7.891V18h-9.5v-.002a4.125 4.125 0 0 1-.681-8.21 4.5 4.5 0 0 1 8.549-2.606l1.116-1.117A6 6 0 0 0 11 3",clipRule:"evenodd"})))},h=i(94133),g=i(12524),v=i.n(g),b=i(52522),E=i(83553);let y=e=>{let{className:t}=e,i=(0,l.Z)(),{saveState:r}=(0,u.r)(),{editMode:n}=(0,b.hl)(),o=n===E.uz.Locked,p=o&&(r===u.S.ERRORED||r===u.S.NOTSAVED||r===u.S.SAVING)?u.S.SAVED:r,f=(()=>
1{if(o)return{icon:(0,a.jsx)(m,{className:"w-6 h-6"}),messageId:"Editor.Header.ViewOnlySaved",tooltipId:"Editor.Header.ViewOnlySavedDesc",className:"text-green-100"};switch(p){case u.S.SAVED:return{icon:(0,a.jsx)(m,{className:"w-6 h-6"}),messageId:"Editor.Header.Saved",className:"text-green-100"};case u.S.NOTSAVED:return{icon:(0,a.jsx)(x,{className:"w-6 h-6"}),messageId:"Editor.Header.Unsaved",className:"text-white"};case u.S.SAVING:return{icon:(0,a.jsx)(h.p,{className:"w-6 h-6"}),messageId:"Editor.Header.Saving",className:"text-white"};case u.S.ERRORED:return{icon:(0,a.jsx)(d.ocf,{className:"ml-2 text-lg"}),messageId:"Editor.Header.Errored",tooltipId:"Editor.Header.ErrorredDesc",className:"text-red-300",showMessage:!0};default:return null}})();return f?(0,a.jsxs)("span",{className:v()("text-sm inline-flex items-center flex-row",f.className,t),children:[f.showMessage&&(0,a.jsx)(s.Z,{id:f.messageId}),(0,a.jsx)(c.u,{content:i.formatMessage({id:f.tooltipId||f.messageId}),children:f.icon})]}):null}},28179:function(e,t,i){"use strict";i.d(t,{N:function(){return r}});let r={originX:"center",originY:"center",scaleX:.25,scaleY:.25,width:256,height:256,fillColor:"#000000"}},87767:function(e,t,i){"use strict";i.d(t,{a:function(){return a}});var r=i(2784);let n={initQRCode:()=>null,fetchQRCode:()=>null,updateQRCode:()=>null,codeState:i(19458).QRCodeState.initial,generatedSVG:null},a=(0,r.createContext)(n)},57855:function(e,t,i){"use strict";i.d(t,{G:function(){return g},O:function(){return h.O}});var r=i(52322),n=i(2784),a=i(19458),o=i(15343),l=i(18997),s=i(23083),d=i(90655),c=i(28179),u=i(118),p=i(52522),m=i(54789),f=i(83553),x=i(87767),h=i(39488);let g=e=>{let{children:t}=e,{qr:i,updateEditorState:h,canvasAspectRatio:g}=(0,d._)(),v=(0,n.useMemo)(()=>(null==i?void 0:i.svg)?window.btoa(i.svg):null,[null==i?void 0:i.svg]),[b,E]=(0,n.useState)(v?a.QRCodeState.success:a.QRCodeState.initial),{setNotSaved:y}=(0,u.r)(),{saveEverything:w,designId:S,editMode:j}=(0,p.hl)(),C=j!==f.uz.Locked;(0,n.useEffect)(()=>{v&&b===a.QRCodeState.initial&&E(a.QRCodeState.success)},[v,b]);let N=(0,n.useCallback)(e=>{h({qr:{imported:!1,fillColor:c.N.fillColor,...i,...null!=e?e:{}}}),y()},[i,y,h]),_=(0,n.useCallback)(function(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],i=arguments.length>2?arguments[2]:void 0,r=o.ReferenceDimensions[g],{updatedLinks:n,...l}=e||{},s={...c.N,...l||{},imported:t,...void 0!==i?{destinationLinkId:i}:{}},d=(0,m._)(g);s.left=d+s.width*s.scaleX/2,s.top=r.height-(d+s.height*s.scaleY/2),h({qr:s,links:n}),E(a.QRCodeState.success),t&&y()},[g,y,h]),R=(0,n.useCallback)(async(e,t)=>{let r;E(a.QRCodeState.loading);let n=!0;try{r=null!=S?S:await w()}catch(e){(0,l.H)(e);return}if(!r){(0,l.H)(Error("cannot fetch designId"));return}let o=await (0,s.q5)(r,e,t);if(n)return o?(E(a.QRCodeState.success),_(o,!!C||(null==i?void 0:i.imported),e)):E(a.QRCodeState.errored),()=>{n=!1}},[S,w,_,null==i?void 0:i.imported,C]),A=(0,n.useMemo)(()=>({codeState:b,initQRCode:_,fetchQRCode:R,updateQRCode:N,generatedSVG:v}),[b,R,_,N,v]);return(0,r.jsx)(x.a.Provider,{value:A,children:t})}},39488:function(e,t,i){"use strict";i.d(t,{O:function(){return a}});var r=i(2784),n=i(87767);let a=()=>{let e=(0,r.useContext)(n.a);if(!e)throw Error("useQRContext must be used within a QRProvider");return e}},61189:function(e,t,i){"use strict";i.d(t,{E:function(){return a},g:function(){return o}});var r=i(52322);i(2784);var n=i(82066);let a=new n.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1,refetchOnReconnect:!1,retry:3,retryDelay:500}}});function o(e){let{children:t}=e;return(0,r.jsx)(n.QueryClientProvider,{client:a,children:t})}},4842:function(e,t,i){"use strict";i.d(t,{T:function(){return T}});var r=i(52322),n=i(18997),a=i(18818),o=i(3741),l=i(83553),s=i(2784),d=i(42670),c=i(71680),u=i(15906),p=i(52522),m=i(30118),f=i(16867),x=i(65089),h=i(44041);let g=()=>{(0,s.useEffect)(()=>{if(window)return["dragenter","dragover","dragleave","drop"].forEach(t=>{window.addEventListener(t,e,!1)}),()=>{["dragenter","dragover","dragleave","drop"].forEach(t=>{window.removeEventListener(t,e,!1)})};function e(e){e.preventDefault(),e.stopPropagation()}},[])};var v=i(34826),b=i(67491),E=i(17088),y=i(4085),w=i(74932),S=i(61966),j=i(49058),C=i(6332),N=i(51574),_=i(64820),R=i(24498);async function A(e){var t;let{designId:i,file:r,rect:n,addImageLayer:a,updateImageLayer:o,upsertResource:l,onProgress:s,onComplete:d,onError:c}=e,p="video_".concat(Date.now(),"_").concat(Math.random().toString(36).slice(2,9)),m="poster_".concat(p),f=URL.createObjectURL(r),x=a({kind:"asset",mediaKind:"video",resourceId:p,url:f,rect:{...n,zIndex:null!==(t=null==n?void 0:n.zIndex)&&void 0!==t?t:_.DEFAULT_NEW_ASSET_IMAGE_ZINDEX},visible:!0});s(x,0,f);let h=new File([await (0,R.z)(r)],"".concat(r.name,".poster.jpg"),{type:"image/jpeg"});return await new Promise((e,t)=>
1{(0,u.$p)({designId:i,type:"image",onProgress:()=>void 0,onDone:async(t,i,r)=>{let n={type:N.CustomFileType.bucket,pathInBucket:t,name:h.name};l(m,n);let a=r?await r():void 0;a&&l(m,{...n,publicURL:a}),o(x,{posterResourceId:m,...a?{posterUrl:a}:{}},!1),e()},onError:e=>t(e)})(h)}),new Promise((e,t)=>{(0,u.$p)({designId:i,type:"audio",onProgress:e=>s(x,e,f),onDone:async(t,i,n)=>{let a=n?await n():"";URL.revokeObjectURL(f),l(p,{type:N.CustomFileType.bucket,pathInBucket:t,name:r.name,publicURL:a}),o(x,{url:a},!1),d(x),e(x)},onError:e=>{URL.revokeObjectURL(f),c(x,f,e),t(e)}})(r)})}var k=i(51004),I=i(67516),z=i(52438);function M(e){var t;if(e.type.startsWith("image/"))return!0;let i=null!==(t=e.name.toLowerCase().split(".").pop())&&void 0!==t?t:"";return a.mD.some(e=>e.toLowerCase().replace(".","")===i)}function D(e){var t;if(e.type.startsWith("video/"))return!0;let i=null!==(t=e.name.toLowerCase().split(".").pop())&&void 0!==t?t:"";return a.eX.some(e=>e.toLowerCase().replace(".","")===i)}function T(){g();let{uploadSourceMedia:e}=(0,v.t)(),{uploadPrimaryMedia:t}=(0,b.L)(),i=!!(0,E.G)(e=>e.document),a=(0,p.hl)(),o=(0,m._i)(),{addImageLayer:l,updateImageLayer:c,removeImageLayer:S,requestObjectSelection:j}=(0,f._2)(),{designId:C,saveEverything:N}=a,{upsertResource:_}=(0,x.o0)(),R=(0,h.G)(),{setProgress:M,removePlaceholder:D}=(0,w.Y)();(0,s.useEffect)(()=>()=>{let{placeholders:e}=w.Y.getState();Object.values(e).forEach(e=>URL.revokeObjectURL(e.objectUrl))},[]);let T=(0,s.useCallback)(async function(e,t){var i,a;let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,p=null!=C?C:await N();if(!p){(0,n.H)(Error("Cannot get designId for image drop"));return}let m=(0,y.J)(null!==(i=null==t?void 0:t.clientX)&&void 0!==i?i:0,null!==(a=null==t?void 0:t.clientY)&&void 0!==a?a:0,o,s);try{await (0,k.n)({designId:p,file:e,rect:m,addImageLayer:l,updateImageLayer:c,upsertResource:_,onProgress:(e,t,i)=>M(e,t,i),onComplete:e=>{D(e),j(e)},onError:(e,t,i)=>{(0,n.H)(i),URL.revokeObjectURL(t),S(e),D(e),R.error((0,r.jsx)(d.Z,{id:(0,I.p)(i),values:{maxSize:u.Iv}}))}})}catch(e){(0,n.H)(e instanceof Error?e:Error(String(e)))}},[C,N,o,l,c,S,_,j,R,M,D]),F=(0,s.useCallback)(async function(e,t){var i,a;let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,p=null!=C?C:await N();if(!p){(0,n.H)(Error("Cannot get designId for video drop"));return}let m=(0,y.J)(null!==(i=null==t?void 0:t.clientX)&&void 0!==i?i:0,null!==(a=null==t?void 0:t.clientY)&&void 0!==a?a:0,o,s);try{await A({designId:p,file:e,rect:m,addImageLayer:l,updateImageLayer:c,upsertResource:_,onProgress:(e,t,i)=>M(e,t,i),onComplete:e=>{D(e),j(e)},onError:(e,t,i)=>{(0,n.H)(i),URL.revokeObjectURL(t),S(e),D(e),R.error((0,r.jsx)(d.Z,{id:(0,I.p)(i),values:{maxSize:u.Iv}}))}})}catch(e){(0,n.H)(e instanceof Error?e:Error(String(e)))}},[C,N,o,l,c,S,_,j,R,M,D]),L=(0,s.useCallback)(()=>{R.error((0,r.jsx)(d.Z,{id:"Error.VideoHasNoAudioTrack",defaultMessage:z.CONVERT_AUDIO_NO_AUDIO_IN_VIDEO_MESSAGE}))},[R]);return(0,r.jsx)(O,{designState:a,uploadAudio:i?t:e,uploadImage:T,uploadVideoAsset:F,isVideoEditor:i,onSilentVideoRejected:L})}class O extends s.Component{componentDidMount(){this.reinitListeners()}componentWillUnmount(){this.unloadListeners()}componentDidUpdate(e){e.designState.editMode!==this.props.designState.editMode&&this.reinitListeners()}render(){let{isDraggingFile:e}=this.state,{editMode:t}=this.props.designState;return e?(0,r.jsx)("div",{className:"w-full h-full bg-white/80 absolute top-0 left-0 z-30 p-8 md:p-12",children:(0,r.jsxs)("div",{className:"border-2 border-violet-600 border-dashed w-full h-full rounded-xl justify-center items-center flex flex-col",children:[(0,r.jsx)(c.Qvc,{className:"text-8xl text-violet-600 animate-bounce"}),(0,r.jsx)("span",{className:"text-xl font-bold mb-4",children:"Drop file to upload"}),t!==l.uz.Locked&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"font-semibold mb-1",children:"Accepted file formats:"}),(0,r.jsxs)("span",{className:this.props.uploadImage?"mb-1":"",children:[(0,r.jsx)("span",{className:"font-bold",children:"Audio:"})," ",a.Hn.join(" ")]}),o.featureFlags.videoSourceUpload&&(0,r.jsxs)("span",{className:this.props.uploadImage?"mb-1":"",children:[(0,r.jsx)("span",{className:"font-bold",children:"Video:"})," ",a.eX.join(" ")]}),this.props.uploadImage&&(0,r.jsxs)("span",{children:[(0,r.jsx)("span",{className:"font-bold",children:"Image:"})," ",a.mD.join(" ")]})]})]})}):null}constructor(e){super(e),this.dragDepth=0,this.dragoverHandler=e=>{e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy")},this.routeSingleVideoDrop=async(e,t)=>{if(this.props.uploadVideoAsset){let i=await (0,j.A)(e);if((0,C.j_)({probe:i,silentVideoLayers:!!this.props.isVideoEditor})){this.props.uploadVideoAsset(e,t,0);return}}await this.props.uploadAudio(e)},this.routeVideoAssetDrop=async(e,t,i)=>{var r,n,a,o;if(!this.props.isVideoEditor){let t=await (0,j.A)(e);if(!t.ok&&"no_audio"===t.reason){null===(a=(o=this.props).onSilentVideoRejected)||void 0===a||a.call(o,e);return}}await (null===(r=(n=this.props).uploadVideoAsset)||void 0===r?void 0:r.call(n,e,t,i))},this.dropHandler=e=>{var t,i,r,a;e.preventDefault(),this.dragDepth=0,this.setState({isDraggingFile:!1});let o=Array.from(null!==(i=null===(t=e.dataTransfer)||void 0===t?void 0:t.files)&&void 0!==i?i:[]);if(0===o.length||this.props.designState.editMode===l.uz.Locked)return;let s=o.filter(M),d=o.filter(D),c=o.filter(S.OS);if(1===c.length&&0===s.length&&1===d.length&&D(c[0])){let t=c[0];(0,n.Kz)("file_drop",{fileName:t.name,extension:null===(r=t.name)||void 0===r?void 0:r.substring(t.name.lastIndexOf(".")+1).toLowerCase()});let i={clientX:e.clientX,clientY:e.clientY};this.routeSingleVideoDrop(t,i).catch(e=>{(0,n.H)(e instanceof Error?e:Error(String(e)))});return}let u=!!this.props.uploadVideoAsset&&d.length>0;if(u){let t={clientX:e.clientX,clientY:e.clientY};d.forEach((e,i)=>{var r;
1(0,n.Kz)("file_drop",{fileName:e.name,extension:null===(r=e.name)||void 0===r?void 0:r.substring(e.name.lastIndexOf(".")+1).toLowerCase()}),this.routeVideoAssetDrop(e,t,i).catch(e=>{(0,n.H)(e instanceof Error?e:Error(String(e)))})})}if(this.props.uploadImage&&s.length>0){let{uploadImage:t}=this.props,i={clientX:e.clientX,clientY:e.clientY};s.forEach((e,r)=>{var a;(0,n.Kz)("file_drop",{fileName:e.name,extension:null===(a=e.name)||void 0===a?void 0:a.substring(e.name.lastIndexOf(".")+1).toLowerCase()}),t(e,i,r)});return}let p=u?c.find(e=>!D(e)):c[0];p&&((0,n.Kz)("file_drop",{fileName:p.name,extension:null===(a=p.name)||void 0===a?void 0:a.substring(p.name.lastIndexOf(".")+1).toLowerCase()}),this.props.uploadAudio(p))},this.dragleaveHandler=()=>{this.dragDepth--,0===this.dragDepth&&this.setState({isDraggingFile:!1})},this.dragenterHandler=()=>{0===this.dragDepth&&this.setState({isDraggingFile:!0}),this.dragDepth++},this.unloadListeners=()=>{window.document.removeEventListener("dragover",this.dragoverHandler),window.document.removeEventListener("dragleave",this.dragleaveHandler),window.document.removeEventListener("drop",this.dropHandler),window.document.removeEventListener("dragenter",this.dragenterHandler)},this.reinitListeners=()=>{this.unloadListeners(),this.props.designState.editMode!==l.uz.Locked&&(window.document.addEventListener("dragover",this.dragoverHandler,!1),window.document.addEventListener("dragleave",this.dragleaveHandler),window.document.addEventListener("drop",this.dropHandler,!1),window.document.addEventListener("dragenter",this.dragenterHandler))},this.state={isDraggingFile:!1}}}},4085:function(e,t,i){"use strict";i.d(t,{J:function(){return a}});var r=i(52305),n=i(15343);function a(e,t,i){var a;let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,{editorSize:l,frameConfig:s,canvasAspectRatio:d}=i,c=null!==(a=n.ReferenceDimensions[d])&&void 0!==a?a:{width:900,height:600},u={left:c.width/2,top:c.height/2,width:200,height:200,scaleX:1,scaleY:1,originX:"center",originY:"center"},p="undefined"!=typeof document?document.getElementById("waveform-canvas"):null;if(!p)return u;let m=p.getBoundingClientRect(),f=e-m.left,x=t-m.top;if(f<0||x<0||f>m.width||x>m.height)return u;let h=24*o;return(0,r.convertActualToReferenceObject)({left:f+h,top:x+h,width:200,height:200,scaleX:1,scaleY:1,originX:"center",originY:"center"},l.ratioToReference,s)}},96014:function(e,t,i){"use strict";i.d(t,{h:function(){return n},r:function(){return a}});var r=i(2784);let n=(0,r.createContext)({videoElement:null,mediaType:null,duration:0,currentTime:0,isPlaying:!1,loop:!1,setLoop:()=>void 0,setMedia:()=>void 0,seek:()=>void 0,play:()=>void 0,pause:()=>void 0});function a(){return(0,r.useContext)(n)}},2803:function(e,t,i){"use strict";i.d(t,{Sq:function(){return a},mD:function(){return n}});var r=i(2784);let n=(0,r.createContext)(null);function a(){return(0,r.useContext)(n)}},16867:function(e,t,i){"use strict";i.d(t,{lD:function(){return p},GS:function(){return w},kX:function(){return A},Dq:function(){return _},Sq:function(){return r.Sq},_2:function(){return N},Eh:function(){return R},RN:function(){return j},Gg:function(){return C}});var r=i(2803),n=i(52322),a=i(2784),o=i(48169),l=i(74591),s=i(30118),d=i(80920),c=i(118);function u(){let e=(0,s._i)(),t=(0,d.$X)(e=>e.waveforms),{setNotSaved:i}=(0,c.r)(),r=(0,a.useMemo)(()=>(0,l.GX)({...e,waveforms:t}),[e.background,e.canvasAspectRatio,e.captions,e.cameraShake,e.backgroundPulse,e.animation,e.editorSize,e.frameConfig,e.images,e.qr,e.shownWaveformData,e.soundwaveRect,e.textNodes,e.waveformConfig,t]),n=(0,a.useCallback)(r=>{e.updateEditorState((0,o.Im)({nextStyle:r,waveformConfig:e.waveformConfig,canvasAspectRatio:e.canvasAspectRatio,waveforms:t,selectedWaveformId:e.selectedWaveformId,waveformData:e.waveformData,selectedSource:e.selectedSource,audioFileName:e.audioFileName})),i()},[e,i,t]),u=(0,a.useCallback)(function(t,r){let n=!(arguments.length>2)||void 0===arguments[2]||arguments[2];r.rect&&(e.updateWaveform(t,{rect:r.rect},n),i())},[e,i]),p=(0,a.useCallback)(function(t,r){let n=!(arguments.length>2)||void 0===arguments[2]||arguments[2];e.updateWaveform(t,r,n),i()},[e,i]),m=(0,a.useCallback)(t=>{var r,n,a;e.updateEditorState({animation:{...e.animation,...t,style:null!==(a=null!==(n=t.style)&&void 0!==n?n:null===(r=e.animation)||void 0===r?void 0:r.style)&&void 0!==a?a:"spectrum"}}),i()},[e,i]);return(0,a.useMemo)(()=>({scene:r,addTextLayer:e.addTextNode,updateTextLayer:e.updateTextNode,removeTextLayer:e.removeTextNode,addImageLayer:e.addImageLayer,updateImageLayer:e.updateImageLayer,removeImageLayer:e.removeImageLayer,updateBackgroun
1d:e.updateBackground,updateWaveformConfig:e.updateWaveformConfig,updateWaveformLayer:u,updateWaveformNode:p,updateAnimation:m,applyWaveformStyle:n,undo:e.undo,redo:e.redo}),[n,e.addImageLayer,e.addTextNode,e.animation,e.redo,e.removeImageLayer,e.removeTextNode,e.undo,e.updateBackground,e.updateImageLayer,e.updateTextNode,e.updateWaveformConfig,m,u,p,r])}let p=e=>{let{children:t}=e,i=u();return(0,n.jsx)(r.mD.Provider,{value:i,children:t})};var m=i(64820),f=i(38986),x=i(40568),h=i(17088),g=i(65089),v=i(5981),b=i(98521);let E={colors:[]};var y=i(40805);let w=e=>{let{children:t}=e,i=(0,h.G)(e=>e.document),s=(0,h.G)(e=>e.patchDocument),p=(0,h.G)(e=>e.undo),w=(0,h.G)(e=>e.redo),S=(0,h.G)(e=>e.past.length>0),j=(0,h.G)(e=>e.future.length>0),{resources:C}=(0,g.o0)(),{setNotSaved:N}=(0,c.r)(),_=u(),R=(0,d.$X)(e=>e.waveforms),A=(0,a.useMemo)(()=>i?(0,l.PB)({document:i,resources:C}):_.scene,[_.scene,i,C]),k=(0,a.useCallback)(e=>{if(!i)return _.addTextLayer(e);let t=(0,l.DI)(e,{canvasAspectRatio:A.canvasAspectRatio,existingTextNodes:A.textNodes});return s(e=>{var i,r,n,a;
1return(0,b.$G)(e,{layerId:t.name,text:t.text,bounds:{left:null!==(i=t.left)&&void 0!==i?i:0,top:null!==(r=t.top)&&void 0!==r?r:0,width:null!==(n=t.width)&&void 0!==n?n:400,height:null!==(a=t.height)&&void 0!==a?a:80},fontFamily:t.fontFamily,fontSize:t.fontSize,fillColor:t.fillColor,zIndex:t.zIndex})}),N(),t.name},[_,i,s,A.canvasAspectRatio,A.textNodes,N]),I=(0,a.useCallback)((e,t,r)=>{if(!i){_.updateTextLayer(e,t,r);return}s(i=>(0,b.a_)(i,e,{...void 0!==t.text?{text:t.text}:{},...void 0!==t.fontFamily?{fontFamily:t.fontFamily}:{},...void 0!==t.fontSize?{fontSize:t.fontSize}:{},...void 0!==t.fillColor?{fillColor:t.fillColor}:{},...void 0!==t.zIndex?{zIndex:t.zIndex}:{},...void 0!==t.left?{left:t.left}:{},...void 0!==t.top?{top:t.top}:{},...void 0!==t.width?{width:t.width}:{},...void 0!==t.height?{height:t.height}:{}})),N()},[_,i,s,N]),z=(0,a.useCallback)(e=>{var t;let r=Object.values(null!==(t=null==i?void 0:i.captionTracks)&&void 0!==t?t:{}).some(t=>t.textNodeName===e);if(!(0,x.isCaptionSlotLayerName)(e)&&!r){if(!i){_.removeTextLayer(e);return}s(t=>(0,b.Uu)(t,e)),N()}},[_,i,s,N]),M=(0,a.useCallback)(e=>{var t,r,n,a,o,l,d,c;if(!i||!(0,b.TI)({id:null!==(r=e.id)&&void 0!==r?r:"",kind:null!==(n=e.kind)&&void 0!==n?n:"asset",mediaKind:e.mediaKind}))return _.addImageLayer(e);let u=null!==(a=A.images)&&void 0!==a?a:[];if(e.id&&u.some(t=>t.id===e.id))return s(t=>{let i=(0,b.i2)(t,e.id,(0,b.OS)(e));if(e.resourceId){var r;i=(0,b.oU)(i,e.resourceId,{kind:"image",url:null!==(r=e.url)&&void 0!==r?r:void 0})}return i}),N(),e.id;let p=null!==(o=e.id)&&void 0!==o?o:function(e){let t=(null!=e?e:[]).filter(e=>e.id.startsWith(f.IMAGE_LAYER_OBJECT_NAME_PREFIX)).map(e=>{let t=parseInt(e.id.slice(f.IMAGE_LAYER_OBJECT_NAME_PREFIX.length),10);return Number.isNaN(t)?-1:t}),i=t.length>0?Math.max(...t):-1;return"".concat(f.IMAGE_LAYER_OBJECT_NAME_PREFIX).concat(i+1)}(u),x=null!==(d=null!==(l=e.zIndex)&&void 0!==l?l:null===(t=e.rect)||void 0===t?void 0:t.zIndex)&&void 0!==d?d:m.DEFAULT_NEW_ASSET_IMAGE_ZINDEX,h={id:p,kind:"asset",visible:!0,zIndex:x,...e,rect:e.rect?{...e.rect,zIndex:null!==(c=e.rect.zIndex)&&void 0!==c?c:x}:e.rect};return s(e=>{let t=(0,b.MW)(e,(0,b.QL)(p,h));if(h.resourceId){var i;t=(0,b.oU)(t,h.resourceId,{kind:"image",url:null!==(i=h.url)&&void 0!==i?i:void 0})}return t}),N(),p},[_,i,s,A.images,N]),D=(0,a.useCallback)(function(e,t){var r;let n=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(!i){_.updateImageLayer(e,t,n);return}let a=null===(r=A.images)||void 0===r?void 0:r.find(t=>t.id===e);if(!a||!(0,b.TI)(a)){_.updateImageLayer(e,t,n);return}s(i=>{let r=(0,b.i2)(i,e,(0,b.OS)(t));if(t.resourceId){var n;r=(0,b.oU)(r,t.resourceId,{kind:"image",url:null!==(n=t.url)&&void 0!==n?n:void 0})}return r}),N()},[_,i,s,A.images,N]),T=(0,a.useCallback)(e=>{var t;if(!i){_.removeImageLayer(e);return}let r=null===(t=A.images)||void 0===t?void 0:t.find(t=>t.id===e);if(!r||!(0,b.TI)(r)){_.removeImageLayer(e);return}s(t=>(0,b.Uu)(t,e)),N()},[_,i,s,A.images,N]),O=(0,a.useCallback)(function(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];
1if(!i){_.updateBackground(e,t);return}s(t=>({...t,background:{...E,...t.background,...e}})),t&&N()},[_,i,s,N]),F=(0,a.useCallback)(e=>{var t;if(!i)return;let r={...A.waveformConfig,...e},n=null!==(t=A.waveforms[0])&&void 0!==t?t:R[0];s(e=>(0,v.bF)(e,r,n?{id:n.id,rect:n.rect}:void 0)),N()},[i,R,s,A.waveformConfig,A.waveforms,N]),L=(0,a.useCallback)(e=>{if(!i){_.updateWaveformConfig(e);return}F(e)},[_,i,F]),P=(0,a.useCallback)(e=>{if(!i){_.applyWaveformStyle(e);return}let{mergedConfig:t}=(0,o.fn)(A.waveformConfig,e,A.canvasAspectRatio);F(t)},[_,i,F,A.canvasAspectRatio,A.waveformConfig]),U=(0,a.useCallback)(function(e,t){let r=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(!i){_.updateWaveformLayer(e,t,r);return}t.rect&&(s(i=>(0,v.rS)(i,e,{rect:t.rect})),N())},[_,i,s,N]),W=(0,a.useCallback)(function(e,t){var r;let n=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(!i){_.updateWaveformNode(e,t,n);return}let a=null===(r=t.rect)||void 0===r?void 0:r.zIndex;s(i=>{var r,n;let o=(0,v.rS)(i,e,{...t,...void 0!==a?{zIndex:a}:{}});return(null===(r=t.centerImage)||void 0===r?void 0:r.resourceId)&&(o=(0,b.oU)(o,t.centerImage.resourceId,{kind:"image",url:null!==(n=t.centerImage.url)&&void 0!==n?n:void 0})),o}),N()},[_,i,s,N]),B=(0,a.useCallback)(e=>{if(!i){_.updateAnimation(e);return}s(t=>(function(e,t){var i,r,n,a,o;let l=null!==(r=null!==(i=e.animation)&&void 0!==i?i:y.defaultEditorConfig.animation)&&void 0!==r?r:{style:"spectrum"};return{...e,animation:{style:null!==(a=null!==(n=t.style)&&void 0!==n?n:l.style)&&void 0!==a?a:"spectrum",spectrumReactivity:null!==(o=t.spectrumReactivity)&&void 0!==o?o:l.spectrumReactivity}}})(t,e)),N()},[_,i,s,N]),G=(0,a.useMemo)(()=>({scene:A,addTextLayer:k,updateTextLayer:I,removeTextLayer:z,addImageLayer:M,updateImageLayer:D,removeImageLayer:T,updateBackgroun
1d:O,updateWaveformConfig:L,updateWaveformLayer:U,updateWaveformNode:W,updateAnimation:B,applyWaveformStyle:P,undo:S?p:null,redo:j?w:null}),[M,k,P,j,S,w,T,z,A,p,B,O,D,I,L,U,W]);return(0,n.jsx)(r.mD.Provider,{value:G,children:t})};var S=i(11080);function j(){let e=(0,r.Sq)(),t=(0,s._i)(),i=(0,d.$X)(e=>e.waveforms);return(0,a.useMemo)(()=>e?function(e,t){var i,r,n,a;let o=t.textNodes.find(e=>e.name===S.CAPTION_TEXT_NODE_NAME),l=o?[...e.textNodes.filter(e=>e.name!==S.CAPTION_TEXT_NODE_NAME),o]:e.textNodes,s=new Set((null!==(i=e.images)&&void 0!==i?i:[]).map(e=>e.id)),d=new Map((null!==(r=t.images)&&void 0!==r?r:[]).map(e=>[e.id,e])),c=(null!==(n=e.images)&&void 0!==n?n:[]).map(e=>{let t=d.get(e.id);if((null==t?void 0:t.url)&&!e.url){var i;return{...e,url:t.url,resourceId:null!==(i=e.resourceId)&&void 0!==i?i:t.resourceId}}return e});for(let e of null!==(a=t.images)&&void 0!==a?a:[])s.has(e.id)||c.push(e);return{...e,textNodes:l,images:c}}(e.scene,t):(0,l.GX)({...t,waveforms:i}),[e,t,i])}function C(){var e,t,i;let n=(0,r.Sq)(),a=(0,s._i)(),o=j();return{textNodes:o.textNodes,addTextLayer:null!==(e=null==n?void 0:n.addTextLayer)&&void 0!==e?e:a.addTextNode,updateTextLayer:null!==(t=null==n?void 0:n.updateTextLayer)&&void 0!==t?t:a.updateTextNode,removeTextLayer:null!==(i=null==n?void 0:n.removeTextLayer)&&void 0!==i?i:a.removeTextNode,canvasAspectRatio:o.canvasAspectRatio,editorSize:o.editorSize,requestObjectSelection:a.requestObjectSelection,loadFonts:a.loadFonts}}function N(){var e,t,i;let n=(0,r.Sq)(),a=(0,s._i)(),o=j();return{images:o.images,canvasAspectRatio:o.canvasAspectRatio,editorSize:o.editorSize,addImageLayer:null!==(e=null==n?void 0:n.addImageLayer)&&void 0!==e?e:a.addImageLayer,updateImageLayer:null!==(t=null==n?void 0:n.updateImageLayer)&&void 0!==t?t:a.updateImageLayer,removeImageLayer:null!==(i=null==n?void 0:n.removeImageLayer)&&void 0!==i?i:a.removeImageLayer,requestObjectSelection:a.requestObjectSelection}}function _(){var e;let t=(0,r.Sq)(),i=(0,s._i)(),n=j();return{background:n.background,editorSize:n.editorSize,frameConfig:n.frameConfig,updateBackgroun
1d:null!==(e=null==t?void 0:t.updateBackground)&&void 0!==e?e:i.updateBackground}}function R(){let e=C(),t=N(),i=_(),n=j(),o=(0,r.Sq)(),l=(0,s._i)(),d=(0,a.useCallback)((e,t)=>{if(null==o?void 0:o.updateWaveformNode){var i;let r=null===(i=t.rect)||void 0===i?void 0:i.zIndex;o.updateWaveformNode(e,{...t.rect?{rect:t.rect}:{},...t.trim?{trim:t.trim}:{},...void 0!==t.centerImage?{centerImage:t.centerImage}:{},...void 0!==r?{zIndex:r}:{}});return}l.updateWaveform(e,t)},[o,l]);return{textNodes:e.textNodes,images:t.images,waveforms:n.waveforms,qr:l.qr,background:i.background,requestObjectSelection:e.requestObjectSelection,addTextLayer:e.addTextLayer,updateTextLayer:e.updateTextLayer,removeTextLayer:e.removeTextLayer,addImageLayer:t.addImageLayer,updateImageLayer:t.updateImageLayer,removeImageLayer:t.removeImageLayer,updateBackground:i.updateBackground,updateWaveform:d,removeWaveform:l.removeWaveform,updateEditorState:l.updateEditorState}}function A(){var e;let t=(0,r.Sq)(),i=(0,s._i)(),n=j(),{setNotSaved:a}=(0,c.r)();return{animation:null!==(e=n.animation)&&void 0!==e?e:i.animation,updateAnimation:e=>{var r,n,o;if(null==t?void 0:t.updateAnimation){t.updateAnimation(e);return}i.updateEditorState({animation:{...i.animation,...e,style:null!==(o=null!==(n=e.style)&&void 0!==n?n:null===(r=i.animation)||void 0===r?void 0:r.style)&&void 0!==o?o:"spectrum"}}),a()},waveformConfig:n.waveformConfig}}},34747:function(e,t,i){"use strict";i.d(t,{_:function(){return r}});let r=(0,i(43841).U)(e=>({uploads:{},setProgress:(t,i)=>e(e=>({uploads:{...e.uploads,[t]:i}})),clearUpload:t=>e(e=>{let i={...e.uploads};return delete i[t],{uploads:i}})}))},95747:function(e,t,i){"use strict";i.d(t,{Q:function(){return a}});var r=i(43841);let n=null,a=(0,r.U)(e=>({authWallReason:null,requestAuthWall:t=>{e({authWallReason:null!=t?t:null}),null==n||n(t)},setRequestAuthWallHandler:e=>{n=e},clearAuthWallReason:()=>e({authWallReason:null})}))},68951:function(e,t,i){"use strict";i.d(t,{p:function(){return s}});var r=i(43841),n=i(19458);let a="wavevisual:lastExportFormat";function o(e,t){try{window.localStorage.setItem(a,JSON.stringify({fileType:e,size:t}))}catch(e){}}function l(){let{fileType:e,size:t}=function(){try{let e=window.localStorage.getItem(a);if(!e)return{fileType:n.ExportFileType.PDF,size:n.ExportSize.large};let t=JSON.parse(e);if(t&&"string"==typeof t.fileType&&"string"==typeof t.size)return{fileType:t.fileType,size:t.size}}catch(e){}return{fileType:n.ExportFileType.PDF,size:n.ExportSize.large}}();return{exportSize:t,exportFileType:e,showExportUseCaseSurvey:!1,downloadPhase:"idle",currentJobName:null,lastDesignId:null,exportStatus:"idle",exportErrorMessage:null}}let s=(0,r.U)(e=>({...l(),setExportSize:t=>e(e=>(o(e.exportFileType,t),{exportSize:t})),setExportFileType:t=>e(e=>{let i=t===n.ExportFileType.SVG||t===n.ExportFileType.PDF?n.ExportSize.large:e.exportSize;return o(t,i),{exportFileType:t,exportSize:i}}),setShowExportUseCaseSurvey:t=>e({showExportUseCaseSurvey:t}),setDownloadPhase:t=>e({downloadPhase:t}),setCurrentJobName:t=>e({currentJobName:t}),setLastDesignId:t=>e({lastDesignId:t}),setExportStatus:t=>e({exportStatus:t}),setExportErrorMessage:t=>e({exportErrorMessage:t}),resetDownloadState:()=>e(l())}))},84884:function(e,t,i){"use strict";i.d(t,{l:function(){return r}});let r=(0,i(43841).U)((e,t)=>({selectedElement:void 0,selectedObjectNames:[],setSelectedElement:(i,r)=>{let n=void 0===i?[]:void 0!==r&&r.length>0?r:"string"==typeof i.name&&i.name?[i.name]:null!=r?r:[],a=t();a.selectedElement===i&&function(e,t){if(e.length!==t.length)return!1;for(let i=0;i<e.length;i+=1)if(e[i]!==t[i])return!1;return!0}(a.selectedObjectNames,n)||e({selectedElement:i,selectedObjectNames:n})}}))},74932:function(e,t,i){"use strict";i.d(t,{Y:function(){return r}});let r=(0,i(43841).U)(e=>({placeholders:{},setProgress:(t,i,r)=>e(e=>({placeholders:{...e.placeholders,[t]:{progress:i,objectUrl:r}}})),clearPlaceholder:t=>e(e=>{let i={...e.placeholders};return delete i[t],{placeholders:i}}),removePlaceholder:t=>e(e=>{let i={...e.placeholders};return delete i[t],{placeholders:i}})}))},39440:function(e,t,i){"use strict";i.d(t,{A:function(){return r}});let r=(0,i(43841).U)((e,t)=>({pending:null,requestChoice:(t,i)=>new Promise((r,n)=>{e({pending:{fileName:t.name,hasAudio:(null==i?void 0:i.hasAudio)!==!1,resolve:r,reject:n}})}),confirm:i=>{let{pending:r}=t();
1r&&r.resolve(i),e({pending:null})},cancel:()=>{let{pending:i}=t();i&&i.reject(Error("VIDEO_SOURCE_UPLOAD_CANCELLED")),e({pending:null})}}))},70082:function(e,t,i){"use strict";i.d(t,{B8:function(){return m},Gx:function(){return d},HS:function(){return f},SQ:function(){return u},aB:function(){return s},ng:function(){return c},wP:function(){return p}});var r=i(21977),n=i(40568),a=i(11242),o=i(2431),l=i(33065);let s={has_captions:!1,caption_cue_count:0};function d(e){let t=(0,n.captionsConfigCueCount)(e);return{has_captions:t>0,caption_cue_count:t}}function c(e){let t=(0,a.Qo)(null!=e?e:void 0);return{has_captions:t>0,caption_cue_count:t}}function u(e){let t=function(e){let t=Array.isArray(e)?e[0]:e;return"1"===t||"true"===t||"0"!==t&&"false"!==t&&void 0}(e.hasCaptions),i=function(e){let t=Array.isArray(e)?e[0]:e;if(void 0===t||""===t)return;let i=Number.parseInt(t,10);return Number.isFinite(i)&&i>=0?i:void 0}(e.captionCueCount);if(void 0===t&&void 0===i)return;let r=null!=i?i:0;return{has_captions:null!=t?t:r>0,caption_cue_count:r}}function p(e,t){e.set("hasCaptions",t.has_captions?"1":"0"),e.set("captionCueCount",String(t.caption_cue_count))}function m(e){var t;if(e&&"object"==typeof e&&"code"in e){let{code:t}=e;if("string"==typeof t&&t.length>0)return t}return e instanceof Error&&/save the (design|project)/i.test(e.message)?"save_required":null!==(t=(0,l.R2)(e))&&void 0!==t?t:"unknown"}function f(e){return e&&"object"==typeof e?e instanceof r.ApiRequestError?{http_status:e.httpStatus,...e.serverMessage?{server_error:e.serverMessage}:{}}:e.code===o.G9?{...e.serverError?{server_error:e.serverError}:{},...e.jobName?{job_name:e.jobName}:{}}:(e.code===o.um||e.code===o.sA||e.code===o.IH)&&e.jobName?{job_name:e.jobName}:{}:{}}},24498:function(e,t,i){"use strict";async function r(e){let t=URL.createObjectURL(e);try{let e=document.createElement("video");e.muted=!0,e.playsInline=!0,t.startsWith("blob:")||(e.crossOrigin="anonymous"),await new Promise((i,r)=>{let n=()=>{e.removeEventListener("loadedmetadata",n),e.removeEventListener("error",a),i()},a=()=>{e.removeEventListener("loadedmetadata",n),e.removeEventListener("error",a),r(Error("POSTER_CAPTURE_FAILED"))};e.addEventListener("loadedmetadata",n),e.addEventListener("error",a),e.src=t,e.load()}),e.currentTime=0,await new Promise((t,i)=>{let r=()=>{e.removeEventListener("seeked",r),e.removeEventListener("error",n),t()},n=()=>{e.removeEventListener("seeked",r),e.removeEventListener("error",n),i(Error("POSTER_CAPTURE_FAILED"))};e.addEventListener("seeked",r),e.addEventListener("error",n)});let i=document.createElement("canvas");if(i.width=e.videoWidth,i.height=e.videoHeight,0===i.width||0===i.height)throw Error("POSTER_CAPTURE_FAILED");let r=i.getContext("2d");if(!r)throw Error("POSTER_CAPTURE_FAILED");r.drawImage(e,0,0);let n=await new Promise(e=>{i.toBlob(t=>e(t),"image/jpeg",.85)});if(!n)throw Error("POSTER_CAPTURE_FAILED");return n}finally{URL.revokeObjectURL(t)}}i.d(t,{z:function(){return r}})},59134:function(e,t,i){"use strict";i.d(t,{y:function(){return l}});var r=i(99686),n=i.n(r),a=i(84336),o=i.n(a);let l=e=>n()(e,o())},54789:function(e,t,i){"use strict";i.d(t,{_:function(){return n}});var r=i(15343);let n=e=>.05*r.ReferenceDimensions[e].width},80410:function(e,t,i){"use strict";function r(e){let t=null==e?void 0:e.src;return!!t&&""!==t&&"http://localhost/"!==t&&"http://localhost"!==t}i.d(t,{e:function(){return r}})},67638:function(e,t,i){"use strict";i.d(t,{Er:function(){return s},HV:function(){return d},WM:function(){return o},ZF:function(){return c},n:function(){return l}});var r=i(40568),n=i(21369),a=i(14084);function o(e){var t,i;let o=null===(i=a.s.getState().designDocument)||void 0===i?void 0:null===(t=i.config)||void 0===t?void 0:t.captions;if(!(0,r.captionsConfigCueCount)(e)&&!(0,r.captionsConfigCueCount)(o))return{};let l=n.z.getState();return l.setFocusedCueIndex(null),l.dismissRemoteCaptions(o),{captions:(0,r.emptyCaptionsConfig)()}}function l(e){if(!(0,r.captionsConfigCueCount)(e))return!1;let t=n.z.getState().dismissedRemoteCaptions;
1return!(0,r.captionsConfigsMatch)(e,t)}function s(e,t){return!(!l(t)||(0,r.captionsConfigCueCount)(e)>0&&!(0,r.captionsConfigsMatch)(e,t))}function d(){var e,t;let i=null===(t=a.s.getState().designDocument)||void 0===t?void 0:null===(e=t.config)||void 0===e?void 0:e.captions;if(!(0,r.captionsConfigCueCount)(i))return;let o=n.z.getState();o.setFocusedCueIndex(null),o.dismissRemoteCaptions(i)}function c(){let e=n.z.getState();void 0!==e.dismissedRemoteCaptions&&e.dismissRemoteCaptions(void 0)}},82530:function(e,t,i){"use strict";i.d(t,{A7:function(){return d},eB:function(){return c},j9:function(){return l},jv:function(){return s},km:function(){return u}});var r=i(44074),n=i(38986);let a=(e,t,i)=>Math.min(Math.max(e,t),i),o=e=>0===e?.5:e<=10?e:10+(e-10)*2,l=e=>{let{sliderValue:t,style:i}=e;if((0,r.isCircleSoundWaveStyle)(i))return a(0===t?.5:t,.5,n.MAX_CIRCLE_BAR_THICKNESS);let l=(0,r.isDottedBarsStyle)(i)?n.MIN_DOTTED_BAR_THICKNESS:.5;return a(o(t),l,n.MAX_HORIZONTAL_BAR_THICKNESS)},s=(e,t)=>(0,r.isCircleSoundWaveStyle)(t)||e<=10?.5===e?0:e:10+(e-10)/2,d=e=>(0,r.isDottedBarsStyle)(e)?n.MIN_DOTTED_BAR_THICKNESS:0,c=e=>(0,r.isCircleSoundWaveStyle)(e)?n.DEFAULT_CIRCLE_THICKNESS:(0,r.isDottedBarsStyle)(e)?n.DEFAULT_DOTTED_BAR_THICKNESS:n.DEFAULT_THICKNESS,u=e=>(0,r.isCircleSoundWaveStyle)(e)?n.MAX_CIRCLE_BAR_THICKNESS:15},51004:function(e,t,i){"use strict";i.d(t,{n:function(){return o}});var r=i(51574),n=i(15906),a=i(64820);async function o(e){var t;let{designId:i,file:o,rect:l,addImageLayer:s,updateImageLayer:d,upsertResource:c,onProgress:u,onComplete:p,onError:m}=e,f="image_".concat(Date.now(),"_").concat(Math.random().toString(36).slice(2,9)),x=URL.createObjectURL(o),h=s({kind:"asset",resourceId:f,url:x,rect:{...l,zIndex:null!==(t=null==l?void 0:l.zIndex)&&void 0!==t?t:a.DEFAULT_NEW_ASSET_IMAGE_ZINDEX},visible:!0});return u(h,0,x),new Promise((e,t)=>{(0,n.$p)({designId:i,type:"image",onProgress:e=>u(h,e,x),onDone:async(t,i,n)=>{let a=n?await n():"";URL.revokeObjectURL(x),c(f,{type:r.CustomFileType.bucket,pathInBucket:t,name:o.name,publicURL:a}),d(h,{url:a},!1),p(h),e(h)},onError:e=>{URL.revokeObjectURL(x),m(h,x,e),t(e)}})(o)})}},82423:function(e,t,i){"use strict";function r(e){if(!Number.isFinite(e)||Number.isNaN(e)||e<0)return"N/A";let t=Math.floor(e),i=Math.floor(t/3600),r=Math.floor(t%3600/60),n=(t%60).toString().padStart(2,"0");if(0===i){let e=r.toString().padStart(2,"0");return"".concat(e,":").concat(n)}let a=i.toString().padStart(2,"0"),o=r.toString().padStart(2,"0");return"".concat(a,":").concat(o,":").concat(n)}i.d(t,{L:function(){return r}})},45947:function(e,t,i){"use strict";i.r(t),i.d(t,{default:function(){return r._}});var r=i(9223)},16572:function(e,t,i){"use strict";i.d(t,{Di:function(){return d},YE:function(){return u},mv:function(){return s},p3:function(){return l},wW:function(){return c}});var r=i(78422),n=i(4172),a=i(29362);let o=e=>{var t;return null!==(t=e.wavevisual_subscription_state)&&void 0!==t?t:(0,a.j)({state:e.state,cancellation_effective_date:e.cancellation_effective_date})},l=e=>!!e.cancellation_effective_date&&o(e)!==n.WavevisualSubscriptionState.expired,s=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.some(e=>{if(e.subscription_plan!==r.SubscriptionPlan.unlimited)return!1;let t=o(e);return t===n.WavevisualSubscriptionState.active||t===n.WavevisualSubscriptionState.grace_period})},d=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.some(e=>e.subscription_plan===r.SubscriptionPlan.unlimited&&o(e)===n.WavevisualSubscriptionState.active)},c=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.find(e=>e.state===n.PaddleSubscriptionState.active)},u=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return s(t)?e>0?"Unlimited (also ".concat(e," credits)"):"Unlimited":e.toString()}},92855:function(e,t,i){"use strict";var r,n;i.d(t,{z:function(){return r}}),(n=r||(r={})).SELECT_SOUNDWAVE_STYLE="select-soundwave-style",n.COLOR_PICKER_WAVE="color-picker-wave",n.SOUNDWAVE_SPACE_VALUE="soundwave-space-value",n.SOUNDWAVE_SPACE_RESET="soundwave-space-reset",n.SOUNDWAVE_THICKNESS_VALUE="soundwave-thickness-value",n.SOUNDWAVE_THICKNESS_RESET="soundwave-thickness-reset",n.SOUNDWAVE_HEIGHT_VALUE="soundwave-height-value",n.SOUNDWAVE_HEIGHT_RESET="soundwave-height-reset",n.SOUNDWAVE_CIRCLE_RADIUS_VALUE="soundwave-circle-radius-value",n.SOUNDWAVE_CIRCLE_RADIUS_RESET="soundwave-circle-radius-reset",n.SOUNDWAVE_CIRCLE_BAR_HEIGHT_VALUE="soundwave-circle-bar-height-value",n.SOUNDWAVE_CIRCLE_BAR_HEIGHT_RESET="soundwave-circle-bar-height-reset",n.SOUNDWAVE_CIRCLE_BAR_HEIGHT_SLIDER="soundwave-circle-bar-height-slider",n.SOUNDWAVE_GLOW_TOGGLE="soundwave-glow-toggle",n.SOUNDWAVE_ROUNDED_BARS_TOGGLE="soundwave-rounded-bars-toggle",n.SOUNDWAVE_GLOW_COLOR="soundwave-glow-color",n.SOUNDWAVE_ROTATION_ANGLE_VALUE="soundwave-rotation-angle-value",n.SOUNDWAVE_ROTATION_ANGLE_SLIDER="soundwave-rotation-angle-slider",n.SPOTIFY_FILE_NAME="spotify-file-name",n.SPOTIFY_EXTERNAL_URL="spotify-external-url",n.PLAYER_ACTION_BUTTON="player-action-button",n.AUDIO_PLAYER_BAR="audio-player-bar",n.AUDIO_PLAYER_ACTION_BUTTON="audio-player-action-button",n.AUDIO_PLAYER_SEEK="audio-player-seek",n.AUDIO_PLAYER_CURRENT_TIME="audio-player-current-time",n.AUDIO_PLAYER_DURATION="audio-player-duration",n.CHECKOUT_PAGE_BACK_BUTTON="checkout-page-back-button",n.TEMPLATE_BACKGROUND_REMOVE_BUTTON="template-background-remove-button",n.EDITOR_PAGE_HEADER="editor-page-header",n.MY_DESIGNS_PAGE="my-designs-page",n.QR_CODE_GENERATE_BUTTON="qr-code-generate-button",n.BG_COLOR_PICKER="bg-color-picker",n.BG_IMAGE_PICKER="bg-image-picker",n.BG_WALLPAPERS="bg-wallpapers",n.SELECT_DOWNLOAD_TYPE_RADIO_GROUP="select-download-type-radio-group",n.DOWNLOAD_BUTTON="download-button",n.REQUEST_VIDEO_LIMIT_EXTENSION_BUTTON="request-video-limit-extension-button",n.CHECKOUT_BUTTON="checkout-button"},1825:function(e,t,i){"use strict";i.d(t,{e:function(){return l}});var r=i(56958),n=i(2784),a=i(99127),o=i(19994);let l=e=>{let{theme:t,content:i,ms:l,position:s="bottom"}=e,d=(0,n.createElement)("div",{className:"flex items-center"},(0,n.createElement)("div",{className:"shrink-0"},"error"===t?(0,n.createElement)(o.I2T,{className:"w-5 h-5 text-red-400"}):(0,n.createElement)(a.kA6,{className:"w-5 h-5 ".concat("success"===t?"text-green-400":"text-sky-500")})),(0,n.createElement)("div",{className:"ml-3 text-sm font-medium"},i)),c={duration:l||3e3,position:"top"===s?"top-center":"bottom-center",unstyled:!1,icon:null};switch(t){case"success":return r.Am.success(d,c);case"error":return r.Am.error(d,c);default:return r.Am.info(d,c)}}},3438:function(e,t,i){"use strict";i.d(t,{$B:function(){return G},BY:function(){return f},Cr:function(){return q},ES:function(){return d},GC:function(){return u},HV:function(){return B},Hu:function(){return j},IN:function(){return Y},KW:function(){return M},KX:function(){return z},LR:function(){return w},MY:function(){return g},N:function(){return Z},UH:function(){return A},VC:function(){return m},WT:function(){return D},XR:function(){return k},Yw:function(){return I},bJ:function(){return c},eD:function(){return N},e_:function(){return l},fV:function(){return C},g:function(){return W},gJ:function(){return H},hj:function(){return R},iA:function(){return U},j1:function(){return T},ji:function(){return h},kI:function(){return v},lH:function(){return x},nR:function(){return V},pI:function(){return s},tN:function(){return _},tw:function(){return P},uo:function(){return F},wH:function(){return S},xT:function(){return O},yI:function(){return p},yu:function(){return L}});var r=i(12436),n=i.n(r),a=i(18997),o=i(14067);async function l(e){var t,i;
1let{designId:r,productId:n,ecommerce:o,selectedSource:l,...s}=e,d={designId:r,productId:n,transaction_id:r,ecommerce:o,...s,audioSource:l};(0,a.Kz)("purchase",d),null===(i=window)||void 0===i||null===(t=i.$crisp)||void 0===t||t.push(["set","session:event",[[["product_bought",{designId:r,productId:n}]]]])}async function s(e){var t,i;let{productId:r,ecommerce:n,selectedSource:o,...l}=e;(0,a.Kz)("purchase",{productId:r,ecommerce:n,...l,audioSource:o}),null===(i=window)||void 0===i||null===(t=i.$crisp)||void 0===t||t.push(["set","session:event",[[["product_bought",{productId:r}]]]])}async function d(e){let{designId:t,selectedSource:i,eventParams:r,...n}=e,o={audioSource:i,designId:t,transaction_id:t,...r,...n};(0,a.Kz)("pay_with_credit",o)}async function c(e){let{designId:t,isPaid:i=!1,exportFileType:r,exportSize:n,selectedSource:o,resolvedIntent:l,intentScore:s,intentSource:d}=e;(0,a.Kz)("export",{audioSource:o,isPaid:i,exportFileType:r,exportSize:n,designId:t,resolved_intent:l,intent_score:s,intent_source:d})}function u(e){(0,a.Kz)("export_failed",e)}function p(e){(0,a.Kz)("convert_audio_failed",e)}function m(e){(0,a.Kz)("video_source_upload_choice_shown",e)}function f(e){(0,a.Kz)("video_source_upload_choice_selected",e)}function x(e){(0,a.Kz)("video_source_upload_choice_dismissed",e)}function h(e){(0,a.Kz)("video_source_upload_started",e)}function g(e){(0,a.Kz)("video_source_upload_completed",e)}let v=n()(e=>{(0,a.Kz)("applied_template",e)},2e3),b=new Set,E=new Map,y=new Set,w=6e4,S=12e4;function j(e){var t,i;let r="".concat(null!==(t=e.designId)&&void 0!==t?t:"",":").concat(e.reason);if(b.has(r))return;let n=Date.now();n-(null!==(i=E.get(r))&&void 0!==i?i:0)<2e3||(E.set(r,n),b.add(r),(0,a.Kz)("checkout_blocked",{reason:e.reason,designId:e.designId,audioSource:e.audioSource,screen_name:e.screenName,pending_count:e.pendingCount}))}function C(e){var t;let i="".concat(null!==(t=e.designId)&&void 0!==t?t:"",":").concat(e.reason);y.has(i)||(y.add(i),(0,a.Kz)("checkout_blocked_stuck",{reason:e.reason,designId:e.designId,audioSource:e.audioSource,screen_name:e.screenName,pending_count:e.pendingCount,elapsed_ms:e.elapsedMs}))}async function N(e){let{designId:t,productId:i,selectedSource:r,eventParams:n,ecommerce:o}=e,l={audioSource:r,designId:t,productId:i,transaction_id:t,ecommerce:o,...n};(0,a.Kz)("begin_checkout",l)}async function _(e){let t={screen_name:e,path_name:window.location.pathname};(0,a.Kz)("page_view",t),(await (await (0,o.getFirebase)()).getAnalytics()).logEvent("page_view",t)}async function R(e){(0,a.Kz)("change_source",{audioSource:e})}let A=n()(async()=>{(0,a.Kz)("change_config")},3e4),k=async e=>{(0,a.Kz)("share_design",{method:e})},I=n()(async()=>{(0,a.Kz)("undo",{})},5e3),z=n()(async()=>{(0,a.Kz)("redo",{})},5e3),M=async e=>{(0,a.Kz)("editor_start",{page_url:window.location.href,button_name:e})},D=async e=>{(0,a.Kz)("canvas_size_opened",{variant:e})},T=async(e,t,i)=>{(0,a.Kz)("canvas_size_selected",{aspectRatio:e,variant:t,...i})},O=e=>{(0,a.Kz)("export_selection_changed",e)},F=e=>{(0,a.Kz)("export_premium_gate_shown",null!=e?e:{})},L=e=>{(0,a.Kz)("export_premium_gate_cta_clicked",e)},P=e=>{(0,a.Kz)("text_style_preset_clicked",e)};function U(e){(0,a.Kz)("editor_entry",e)}function W(e){(0,a.Kz)("pre_edit_size_selector_shown",e)}function B(e){(0,a.Kz)("pre_edit_size_selector_completed",e)}function G(e){(0,a.Kz)("pre_edit_size_selector_skipped",e)}function H(e){(0,a.Kz)("transcription_started",e)}function V(e){(0,a.Kz)("transcription_completed",{...e,has_captions:e.caption_cue_count>0})}function Z(e){(0,a.Kz)("transcription_failed",e)}function Y(e){(0,a.Kz)("export_intent_resolved",{...e.candidateSignals,designId:e.designId,aspect_ratio:e.aspectRatio,audio_source:e.audioSource,landing_path:e.landingPath,resolved_intent:e.resolvedIntent,intent_score:e.intentScore,intent_source:e.intentSource})}function q(e){(0,a.Kz)("editor_tab_opened",{tab:e.tab,previous_tab:e.previousTab,designId:e.designId,aspect_ratio:e.aspectRatio,audio_source:e.audioSource,landing_path:e.landingPath,is_paid:e.isPaid})}},33065:function(e,t,i){"use strict";i.d(t,{P8:function(){return l},R2:function(){return o}});
1var r=i(21977),n=i(43328),a=i(2431);function o(e){if(e instanceof r.ApiRequestError){var t;let i=null!==(t=e.serverMessage)&&void 0!==t?t:"";return i.includes(":audio-not-found:")?"audio_missing":i.includes(":audio-not-downloadable:spotify:")?"audio_unsupported_spotify":i.includes(":audio-not-downloadable:youtube:")?"audio_unsupported_youtube":i.includes(":design-not-found:")||i.includes(":project-doesnt-exist:")?"design_not_found":i.includes(":not-authorized:")?"not_authorized":"http_".concat(e.httpStatus)}return e instanceof Error&&"No id token"===e.message?"not_signed_in":e instanceof TypeError?"network":void 0}function l(e){var t;let i=o(e);return(i?function(e){switch(e){case"audio_missing":return"Your audio is not saved yet. Wait for the upload to finish, save, and try again.";case"audio_unsupported_spotify":case"audio_unsupported_youtube":return"Spotify and YouTube tracks cannot be transcribed. Upload an audio or video file instead.";case"not_signed_in":case"not_authorized":return"We could not confirm your session. Reload the page and try again.";case"network":return"We could not reach the server. Check your connection and try again.";default:return}}(i):void 0)||((null==e?void 0:e.code)===a.G9?(0,n.Zd)(null!==(t=e.serverError)&&void 0!==t?t:e.message):(0,n.Zd)(void 0))}},12544:function(e,t,i){"use strict";i.d(t,{IG:function(){return o},vQ:function(){return r}});let r="EXPORT_DOWNLOAD_HTTP_ERROR";function n(e){try{let t=new URL(e),i=[...t.searchParams.keys()];return{host:t.host,pathname:t.pathname,hasResponseContentDispositionQuery:i.some(e=>"response-content-disposition"===e.toLowerCase()),queryParamCount:i.length}}catch(e){return{host:"(invalid-url)",pathname:"",hasResponseContentDispositionQuery:!1,queryParamCount:0}}}function a(e,t){let i=document.createElement("a");i.href=e,i.download=t,document.body.appendChild(i),i.click(),document.body.removeChild(i)}async function o(e,t,i){var o;let l=null!==(o=null==i?void 0:i.requireAttachmentDisposition)&&void 0!==o&&o;if(function(e){let t=function(e){try{let{searchParams:t}=new URL(e);for(let[e,i]of t.entries())if("response-content-disposition"===e.toLowerCase())return i;return null}catch(e){return null}}(e);return null!==t&&t.toLowerCase().startsWith("attachment")}(e)){console.log("[export][triggerBrowserDownload] branch=anchor-disposition-query",{fileName:t,url:n(e)}),a(e,t);return}if(l){console.log("[export][triggerBrowserDownload] branch=anchor-require-export",{fileName:t,url:n(e)}),a(e,t);return}console.log("[export][triggerBrowserDownload] branch=blob-fetch",{fileName:t,url:n(e)});let s=await fetch(e);if(!s.ok)throw console.error("[export][triggerBrowserDownload] blob-fetch non-OK",{status:s.status,statusText:s.statusText,url:n(e)}),Object.assign(Error("Failed to download file: ".concat(s.status," ").concat(s.statusText)),{code:r,status:s.status});let d=await s.blob(),c=window.URL.createObjectURL(d),u=document.createElement("a");u.href=c,u.download=t,document.body.appendChild(u),u.click(),document.body.removeChild(u),window.URL.revokeObjectURL(c)}},61966:function(e,t,i){"use strict";i.d(t,{OS:function(){return u},Vo:function(){return p},hE:function(){return c}});var r=i(15906),n=i(18818);let a=e=>{let t=e.lastIndexOf(".");return -1===t?"":e.substring(t).toLowerCase()},o=e=>e.map(e=>e.toLowerCase()),l=o(n.Hn),s=o(n.eX),d=()=>(0,n.ND)()?[...l,...s]:l,c=e=>{var t,i;let r=a(e.name),o=null!==(i=null===(t=e.type)||void 0===t?void 0:t.toLowerCase())&&void 0!==i?i:"",d=l.includes(r),c=(0,n.ND)()&&s.includes(r),u=".webm"===r;return o.startsWith("video/")?(0,n.ND)()&&(c||u)?"video":null:o.startsWith("audio/")?d||c?"audio":null:c?"video":d?"audio":null},u=e=>d().includes(a(e.name)),p=e=>e.size>r.jk?"MAX_SIZE_EXCEEDED":u(e)?null:"UNSUPPORTED_FILE_FORMAT"},98521:function(e,t,i){"use strict";i.d(t,{$G:function(){return l},MW:function(){return u},OS:function(){return m},QL:function(){return c},TI:function(){return x},Uu:function(){return f},a_:function(){return s},i2:function(){return p},oU:function(){return d}});var r=i(38986),n=i(99120),a=i(44324);function o(e,t,i){let{durationMs:r}=e;return{...e,tracks:e.tracks.map(e=>{var n;if(e.id!==t||(n=i.id,e.clips.some(e=>e.layers.some(e=>e.id===n))))return e;let a=e.clips.find(e=>0===e.layers.length);if(a)return{...e,clips:e.clips.map(e=>e.id===a.id?{...e,startMs:e.startMs,durationMs:e.durationMs||r,layers:[...e.layers,i]}:e)};let o={id:"".concat(t,"-clip-").concat(i.id),startMs:0,durationMs:r,layers:[i]};return{...e,clips:[...e.clips,o]}})}}function l(e,t){var i;let r={id:t.layerId,type:"text",text:t.text,fontFamily:t.fontFamily,fontSize:t.fontSize,fillColor:t.fillColor,zIndex:t.zIndex,bounds:null!==(i=t.bounds)&&void 0!==i?i:{left:80,top:80,width:400,height:80}};return o(e,a.Sd,r)}function s(e,t,i){return{...e,tracks:e.tracks.map(e=>({...e,clips:e.clips.map(e=>({...e,layers:e.layers.map(e=>{var r,n,a,o,l;return e.id!==t||"text"!==e.type?e:{...e,text:null!==(r=i.text)&&void 0!==r?r:e.text,fontFamily:null!==(n=i.fontFamily)&&void 0!==n?n:e.fontFamily,fontSize:null!==(a=i.fontSize)&&void 0!==a?a:e.fontSize,fillColor:null!==(o=i.fillColor)&&void 0!==o?o:e.fillColor,zIndex:null!==(l=i.zIndex)&&void 0!==l?l:e.zIndex,bounds:{...e.boun
1ds,...void 0!==i.left?{left:i.left}:{},...void 0!==i.top?{top:i.top}:{},...void 0!==i.width?{width:i.width}:{},...void 0!==i.height?{height:i.height}:{}}}})}))}))}}function d(e,t,i){let r=e.assets.assets[t];return{...e,assets:{assets:{...e.assets.assets,[t]:{...r,...i,id:t,kind:i.kind}}}}}function c(e,t){let{rect:i,resourceId:r,zIndex:a,visible:o}=t,l=i?(0,n.visualBoundsFromImageRect)(i):{left:0,top:0,width:200,height:200};return{id:e,type:"image",assetId:r,zIndex:null!=a?a:null==i?void 0:i.zIndex,hidden:!1===o,bounds:l}}function u(e,t){return function(e,t){let i=!1,r=e.tracks.map(e=>e.id!==a.JQ?e:{...e,clips:e.clips.map(e=>{let r=e.layers.findIndex(e=>e.id===t.id);if(r>=0){i=!0;let n=[...e.layers];return n[r]=t,{...e,layers:n}}return e})});return i?{...e,tracks:r}:o(e,a.JQ,t)}(e,t)}function p(e,t,i){return{...e,tracks:e.tracks.map(e=>({...e,clips:e.clips.map(e=>({...e,layers:e.layers.map(e=>{var r,n,a;return e.id!==t||"image"!==e.type?e:{...e,assetId:null!==(r=i.assetId)&&void 0!==r?r:e.assetId,zIndex:null!==(n=i.zIndex)&&void 0!==n?n:e.zIndex,hidden:null!==(a=i.hidden)&&void 0!==a?a:e.hidden,bounds:i.bounds?{...e.bounds,...i.bounds}:e.bounds}})}))}))}}function m(e){let t={};return void 0!==e.resourceId&&(t.assetId=e.resourceId),void 0!==e.zIndex&&(t.zIndex=e.zIndex),void 0!==e.visible&&(t.hidden=!1===e.visible),e.rect&&(t.bounds=(0,n.visualBoundsFromImageRect)(e.rect),void 0!==e.rect.zIndex&&(t.zIndex=e.rect.zIndex)),t}function f(e,t){return{...e,tracks:e.tracks.map(i=>{var r;if("overlay"!==i.kind)return i;let n=null===(r=a.qw.find(e=>e.trackId===i.id))||void 0===r?void 0:r.clipId,o=i.clips.flatMap(e=>{if(!e.layers.some(e=>e.id===t))return[e];let i=e.layers.filter(e=>e.id!==t);return i.length>0?[{...e,layers:i}]:e.id===n?[{...e,layers:[]}]:[]});return 0===o.length&&n?{...i,clips:[{id:n,startMs:0,durationMs:e.durationMs,layers:[]}]}:{...i,clips:o}})}}function x(e){return"background"!==e.kind&&"video"!==e.mediaKind&&e.id!==r.SOURCE_VIDEO_LAYER_OBJECT_NAME}},69525:function(e,t,i){"use strict";i.d(t,{G:function(){return s},J:function(){return u}});var r=i(86767),n=i(23083),a=i(17088),o=i(118),l=i(71861);function s(e){let t={...e.assets.assets},i=!1;return(Object.entries(t).forEach(e=>{let[r,n]=e;(0,l.x5)(n.url)&&(t[r]={...n,url:void 0},i=!0)}),i)?{...e,assets:{assets:t}}:e}async function d(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:15e3,t=Date.now(),i=async()=>{if(!(!a.G.getState().isLoading||Date.now()-t>e))return await (0,r.wait)(50),i()};return i()}let c=Promise.resolve();async function u(){let e=async()=>{var e,t,i;await d();let r=a.G.getState().document;if(!r)return;let l=s(r),c=await (0,n.TC)(l,l.id),u=null!==(t=null==c?void 0:c.id)&&void 0!==t?t:l.id;if(!u)return;let p=a.G.getState().document;return p&&!p.id&&a.G.getState().patchDocument(e=>({...e,id:u})),o.r.getState().setSaveState(o.S.SAVED),null!==(i=null===(e=a.G.getState().document)||void 0===e?void 0:e.id)&&void 0!==i?i:u},t=c.then(e,e);return c=t.then(()=>void 0,()=>void 0),t}},49058:function(e,t,i){"use strict";i.d(t,{A:function(){return c}});var r=i(44169),n=i(89459),a=i(28552);async function o(e){return new Promise((t,i)=>{let r=new FileReader;r.onload=()=>{t(new Uint8Array(r.result))},r.onerror=()=>{var e;i(null!==(e=r.error)&&void 0!==e?e:Error("Failed to read video file"))},r.readAsArrayBuffer(e)})}async function l(e){let t=await (0,a.u)(e.size,(t,i)=>o(e.slice(t,i)),"moov");return!t||t.end-t.start>33554432?null:o(e.slice(t.start,t.end))}async function s(e){if(e.size<=2097152)return o(e);let t=Math.min(e.size,262144),[i,r]=await Promise.all([o(e.slice(0,2097152)),o(e.slice(e.size-t))]),n=new Uint8Array(i.length+r.length);return n.set(i,0),n.set(r,i.length),n}async function d(e){if(0===e.size)return"unknown";if(function(e){let t=e.name.toLowerCase(),i=e.type.toLowerCase();return i.includes("mp4")||i.includes("quicktime")||t.endsWith(".mp4")||t.endsWith(".mov")||t.endsWith(".m4v")}(e)){let t=await l(e);return(0,r.q)(null!=t?t:await s(e))}return!function(e){let t=e.name.toLowerCase(),i=e.type.toLowerCase();return i.includes("webm")||i.includes("matroska")||t.endsWith(".webm")||t.endsWith(".mkv")}(e)?"unknown":(0,n.L)(await o(e.slice(0,Math.min(e.size,2097152))))}async function c(e){try{let t=await d(e);if("no_audio"===t)return{ok:!1,reason:"no_audio"};if("has_audio"===t)return{ok:!0}}catch(e){}let t=URL.createObjectURL(e);try{let e=document.createElement("video");
1e.preload="metadata",e.muted=!0,e.playsInline=!0,await new Promise((i,r)=>{let n=()=>{e.removeEventListener("loadedmetadata",n),e.removeEventListener("error",a),i()},a=()=>{e.removeEventListener("loadedmetadata",n),e.removeEventListener("error",a),r(Error("VIDEO_METADATA_FAILED"))};e.addEventListener("loadedmetadata",n),e.addEventListener("error",a),e.src=t,e.load()});let{audioTracks:i}=e;if(i)return i.length>0?{ok:!0}:{ok:!1,reason:"no_audio"};let{mozHasAudio:r}=e;if(!1===r)return{ok:!1,reason:"no_audio"};return{ok:!0}}catch(e){return{ok:!1,reason:"invalid_container"}}finally{URL.revokeObjectURL(t)}}},64281:function(e,t,i){"use strict";i.d(t,{Q_:function(){return s},S$:function(){return d},hZ:function(){return m},t4:function(){return l}});var r=i(62995),n=i(38986);let a=async e=>new Promise(t=>{let i=new window.FileReader;i.onload=function(){t(this.result)},i.readAsArrayBuffer(e)}),o=e=>new Promise((t,i)=>{new(window.AudioContext||window.webkitAudioContext)().decodeAudioData(e,t,i)});async function l(e){return s(e)}async function s(e){let t;let i=await a(e);if(!i)throw Error("Couldnt load audio file");try{t=await o(i)}catch(i){let t=e instanceof File?e.name:void 0;return(0,r.logError)(i,{extra:{fileName:t}}).catch(()=>void 0),[]}return p(c(t),1024)}async function d(e,t,i){let n;let l=await a(e);if(!l)throw Error("Couldnt load audio file");try{n=await o(l)}catch(i){let t=e instanceof File?e.name:void 0;return(0,r.logError)(i,{extra:{fileName:t}}).catch(()=>void 0),[]}let s=c(n),{length:d}=s[0],u=Math.floor(t*d),m=Math.min(d,Math.ceil(i*d)),f=Math.max(0,m-u);return 0===f?[]:p(s.map(e=>e.subarray(u,m)),Math.min(1024,f))}function c(e){return Array.from({length:Math.max(1,e.numberOfChannels||1)},(t,i)=>e.getChannelData(i))}function u(e,t){return e[Math.min(e.length-1,Math.floor(t*(e.length-1)))]}function p(e){var t;let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1024,{length:r}=null!==(t=e[0])&&void 0!==t?t:new Float32Array(0);if(0===r||i<=0)return[];let a=r/i,o=[];for(let t=0;t<i;t+=1){let i=Math.floor(t*a),n=Math.max(i+1,Math.min(r,Math.floor((t+1)*a))),l=0;for(let t=i;t<n;t+=1)for(let i=0;i<e.length;i+=1)l+=e[i][t]*e[i][t];let s=Math.sqrt(l/((n-i)*e.length));o.push(s>0?20*Math.log10(s):-1/0)}let l=o.filter(e=>e>-60).sort((e,t)=>e-t);if(0===l.length)return o.map(()=>n.SAMPLE_HEIGHT);let s=u(l,.98),d=Math.min(s-12,Math.max(u(l,.05),s-24));return o.map(e=>e<=-60?n.SAMPLE_HEIGHT:Math.floor(n.SAMPLE_HEIGHT-(.12+.88*Math.min(1,Math.max(0,(e-d)/(s-d)))**1.6)*n.SAMPLE_HEIGHT))}let m=(e,t)=>
1{var i;return f((e,i)=>{var r,a,o;let l=(a=i*(null!==(r=null==t?void 0:t.boostBy)&&void 0!==r?r:1),Math.max(0,Math.min(o=n.SAMPLE_HEIGHT,0+(o-0)*(a-0)/1)));return Math.floor(n.SAMPLE_HEIGHT-l)},null!==(i=null==t?void 0:t.granularity)&&void 0!==i?i:2048,e)};function f(e,t,i){let r=[],n=i.length/t;for(let t=0;t<i.length;t+=n){let a=Number.MAX_SAFE_INTEGER,o=Number.MIN_SAFE_INTEGER;i.slice(t,t+n).forEach(e=>{a=Math.min(a,e),o=Math.max(o,e)}),r.push(e(a,o))}return r}f.bind(null,(e,t)=>Math.floor((t+e)/2),2048)},15961:function(e,t,i){"use strict";i.d(t,{g:function(){return o}});var r=i(52322);i(2784);var n=i(12524),a=i.n(n);let o=e=>{let{label:t,content:i,className:n,size:o,loading:l,...s}=e;return o=o||"normal",(0,r.jsxs)("div",{className:a()("flex flex-col",n),...s,children:[(0,r.jsx)("span",{className:a()("flex font-bold w-full text-gray-400",{"text-sm":"small"!==o,"text-xs":"small"===o}),children:l?(0,r.jsx)("span",{className:"w-40 h-3 mt-1 bg-gray-400 rounded animate-pulse"}):t}),(0,r.jsx)("span",{className:a()("flex font-semibold w-full text-black",{"text-lg":"small"!==o,"text-base":"small"===o,"py-2":l}),children:l?(0,r.jsx)("span",{className:"w-24 h-4 bg-gray-500 rounded animate-pulse"}):i})]})}},46334:function(e,t,i){"use strict";i.d(t,{U:function(){return c}});var r=i(52322),n=i(2784),a=i(12524),o=i.n(a),l=i(28316),s=i(92671),d=i(68506);let c=e=>{let{children:t,visible:i,hide:a,header:c,innerClassName:u,disabledBackdropClick:p,onVisible:m,dataTestId:f,direction:x}=e,[h,g]=(0,n.useState)(!0);(0,d.i)(i),x=x||"vertical",(0,n.useEffect)(()=>{let e;return i&&m&&m(),i?g(!1):e=setTimeout(()=>g(!0),150),()=>{e&&clearTimeout(e)}},[m,i]);let v=(0,r.jsx)("div",{className:o()("w-full bg-black/40 fixed z-30 flex justify-center p-0 overflow-hidden",{"h-0":h,"h-full top-0":!h}),onClick:p?void 0:a,"data-testid":f,children:(0,r.jsxs)("div",{className:o()("transition-transform duration-400 ease-in-out transform w-full pb-10 lg:pb-2 max-h-screen overflow-y-auto bg-white shadow-md relative lg:absolute",u,{"translate-y-full lg:-translate-y-full":!i&&"vertical"===x,"translate-y-0 lg:translate-y-10":i&&"vertical"===x,"translate-x-full":!i&&"right"===x,"-translate-x-full":!i&&"left"===x,"translate-x-0":i&&("right"===x||"left"===x)}),onClick:e=>e.stopPropagation(),children:[(0,r.jsxs)("div",{className:"flex flex-row items-center py-3 px-4 h-16",children:[(0,r.jsx)("div",{className:"flex items-center w-full text-lg font-semibold",children:c}),(0,r.jsx)("button",{className:"flex",onClick:a,"aria-label":"Close popup",children:(0,r.jsx)(s.oHP,{fontSize:24})})]}),(0,r.jsx)("hr",{className:"border-gray-300"}),t]})});return l.createPortal(v,document.body)}},68506:function(e,t,i){"use strict";t.i=function(e){(0,r.useEffect)(()=>{let t=()=>{},i=document.querySelector("body");if(e&&i){let e=i.style.overflowY;t="hidden"===i.style.overflowY?()=>{}:()=>{i.style.overflowY=e},i.style.overflowY="hidden"}else t();return t},[e])};let r=i(2784)},78422:function(e,t){"use strict";var i,r,n,a,o,l,s,d;Object.defineProperty(t,"__esModule",{value:!0}),t.OrderType=t.SubscriptionPlan=t.SubscriptionStatus=t.PaymentMethod=void 0,(o=i||(t.PaymentMethod=i={})).paypal="paypal",o.credit="credit",o.paddle="paddle",o.admin="admin",o.stripe="stripe",(l=r||(t.SubscriptionStatus=r={}))[l.active=1]="active",l[l.cancelled=2]="cancelled",l[l.refunded=3]="refunded",(s=n||(t.SubscriptionPlan=n={})).basic="basic",s.starter="starter",s.business="business",s.pro="pro",s.unlimited="unlimited",(d=a||(t.OrderType=a={})).digital="digital",d.print="print",d.subscription="subscription",d.creditPack="creditPack",d.classroomReviewExport="classroomReviewExport",d.adminAssign="adminAssign"},4172:function(e,t){"use strict";var i,r,n,a;Object.defineProperty(t,"__esModule",{value:!0}),t.WavevisualSubscriptionState=t.PaddleSubscriptionState=void 0,(n=i||(t.PaddleSubscriptionState=i={})).active="active",n.cancelled="cancelled",n.refunded="refunded",n.deleted="deleted",(a=r||(t.WavevisualSubscriptionState=r={})).active="active",a.grace_period="grace_period",a.expired="expired"},75803:function(e,t){"use strict";var i,r;t.b=void 0,(r=i||(t.b=i={})).initial="init",r.loading="loading",r.inProgress="in-progress",r.processingPayment="processing",r.successful="success",r.errored="err"},8915:function(e,t){"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.mapTimes=void 0,t.isSameArray=function(e,t){if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(e[i]!==t[i])return!1;return!0},t.mapTimes=(e,t)=>{let i=[];for(let r=0;r<e;r++)i.push(t(r));return i}},60966:function(e,t,i){"use strict";t.bH=void 0,t.iF=function(e){return e===r.ExportFileType.MOV_PRORES?"mov":e.toLowerCase()};let r=i(19458);t.bH=["mp4","gif","webm","mov","mov-prores"]},18818:function(e,t,i){"use strict";t.mD=t.W6=t.eX=t.Hn=void 0,t.vT=function(){return r.featureFlags.videoSourceUpload?t.W6:t.Hn},t.ND=function(){return r.featureFlags.videoSourceUpload};let r=i(3741);t.Hn=[".wav",".aif",".aiff",".flac",".alac",".aac",".ogg",".mp3",".m4a",".webm",".WAV",".AIF",".AIFF",".FLAC",".ALAC",".AAC",".OGG",".MP3",".M4A",".WEBM"],t.eX=[".mp4",".mov",".MP4",".MOV"],t.W6=[...t.Hn,...t.eX],t.mD=[".jpg",".jpeg",".png",".gif"]},78742:function(e,t,i){"use strict";var r;t.ZE=t.eu=t.BF=void 0,(r=i(18149))&&r.__esModule,t.BF={subtle:{color:"rgba(0,0,0,0.35)",blur:4,offsetX:2,offsetY:2},medium:{color:"rgba(0,0,0,0.45)",blur:8,offsetX:4,offsetY:4},strong:{color:"rgba(0,0,0,0.55)",blur:12,offsetX:6,offsetY:6}},t.eu={color:"rgba(0,0,0,0.45)",blur:0,offsetX:2,offsetY:2},t.ZE=Object.entries(t.BF)},22581:function(e,t,i){"use strict";t.Iq=t.il=void 0,t.wM=a,t.ou=function(e){return!!(e.subscription||a(e))},t.QZ=function(e){let i=arguments.length>
11&&void 0!==arguments[1]?arguments[1]:r.isDevEnvironment,{mapped:n}=(0,t.il)(i);return"test"===e&&""!==n.digitalDownloadPriceTest.productId?n.digitalDownloadPriceTest:n.digitalDownload};let r=i(53665),n=i(78422);function a(e){return null!=e.creditPack||!!e.accountScopedCheckout}t.il=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:r.isDevEnvironment,t={digitalDownload:{name:"Personalized Sound Wave Art - Digital Download",description:"Digital downloading option for a custom sound wave art",price:{amount:"9.00",currencyCode:"USD"},productId:e?"15419":"650914"},digitalDownloadPriceTest:{name:"Personalized Sound Wave Art - Digital Download",description:"Digital downloading option for a custom sound wave art",price:{amount:"14.00",currencyCode:"USD"},productId:e?"92648":"930220"},classroomDesignReviewExport:{name:"Classroom Design Review & Export",description:"Teacher review + batch export for a classroom rollout (exact scope and pricing follow the customer quote).",price:{amount:"9.00",currencyCode:"USD"},accountScopedCheckout:!0,checkoutTypeLabel:"Classroom \xb7 Review & export",productId:e?"90074":"924992"},starterPlan:{name:"WaveVisual Starter Plan",subscription:{name:n.SubscriptionPlan.starter,credit:100,interval:"month"},price:{amount:"25.00",currencyCode:"USD"},productId:e?"13536":"658109"},businessPlan:{name:"WaveVisual Business Plan",subscription:{name:n.SubscriptionPlan.business,credit:250,interval:"month"},productId:e?"13537":"662371",price:{amount:"40.00",currencyCode:"USD"}},proPlan:{name:"WaveVisual Pro Plan",subscription:{name:n.SubscriptionPlan.pro,credit:1e3,interval:"month"},productId:e?"16662":"726618",price:{amount:"80.00",currencyCode:"USD"}},unlimitedPlan:{name:"WaveVisual Unlimited Plan",subscription:{name:n.SubscriptionPlan.unlimited,credit:0,interval:"month"},productId:e?"83304":"915794",price:{amount:"29.00",currencyCode:"USD"},iconPath:"/payment-icons/unlimited-icon-2.png"},starterAnnualPlan:{name:"WaveVisual Starter Plan (Annual)",subscription:{name:n.SubscriptionPlan.starter,credit:1200,interval:"year"},price:{amount:"120.00",currencyCode:"USD"},productId:e?"34917":"714301"},businessAnnualPlan:{name:"WaveVisual Business Plan (Annual)",subscription:{name:n.SubscriptionPlan.business,credit:3e3,interval:"year"},productId:e?"34916":"714293",price:{amount:"192.00",currencyCode:"USD"}},proAnnualPlan:{name:"WaveVisual Pro Plan (Annual)",subscription:{name:n.SubscriptionPlan.pro,credit:12e3,interval:"year"},productId:e?"34918":"726947",price:{amount:"384.00",currencyCode:"USD"}},unlimitedAnnualPlan:{name:"WaveVisual Unlimited Plan (Annual)",subscription:{name:n.SubscriptionPlan.unlimited,credit:0,interval:"year"},productId:e?"83305":"915795",price:{amount:"169.00",currencyCode:"USD"},iconPath:"/payment-icons/unlimited-icon-2.png"},creditPack100:{name:"100 Personalized Sound Wave Art Credits",description:"Credits to download 100 personalized sound waves digitally",price:{amount:"39.00",currencyCode:"USD"},productId:e?"40178":"801765",creditPack:100,iconPath:"/payment-icons/credit-pack-100.png"},creditPack250:{name:"250 Personalized Sound Wave Art Credits",description:"Credits to download 250 personalized sound waves digitally",price:{amount:"59.00",currencyCode:"USD"},productId:e?"40245":"801763",creditPack:250,iconPath:"/payment-icons/credit-pack-250.png"},creditPack1000:{name:"1000 Personalized Sound Wave Art Credits",description:"Credits to download 1000 personalized sound waves digitally",price:{amount:"149.00",currencyCode:"USD"},productId:e?"40246":"801764",creditPack:1e3,iconPath:"/payment-icons/credit-pack-1000.png"}};return{products:Object.values(t).filter(e=>""!==e.productId),mapped:t,product:{...t.digitalDownload,vat:0},vendorId:e?2586:123004}},t.Iq="digital-download-price"},95468:function(e,t){"use strict";t.Ll=t.aH=t.KK=void 0,t.RE=function(e){return"string"==typeof e&&e in t.aH},t.KK=12e5,t.aH={downloading:{start:3,end:3},converting:{start:6,end:6},loading_model:{start:10,end:10},transcribing:{start:12,end:90},saving:{start:92,end:92}}
1,t.Ll={downloading:"Downloading audio",converting:"Preparing audio",loading_model:"Loading speech model",transcribing:"Transcribing",saving:"Saving captions"}},48169:function(e,t,i){"use strict";t.fn=c,t.Im=function(e){var t,i,r,n,a;let{nextStyle:d,waveformConfig:u,canvasAspectRatio:p,waveforms:m,selectedWaveformId:f,waveformData:x,selectedSource:h,audioFileName:g}=e,{mergedConfig:v,rect:b}=c(u,d,p),E=(0,o.applyWaveformConfigToWaveformNodes)({waveforms:m,waveformConfig:v,rect:b}),y=null!==(r=m.find(e=>e.id===f))&&void 0!==r?r:m[0],w=y?(0,s.getWaveformDisplayTrim)(y,v):v.trim,S=(0,l.computeShownWaveformData)({waveformData:x,waveformConfig:v,trim:w,width:v.reference.width,audioFileName:g,source:h,fallback:null!==(a=null!==(n=null===(t=E.find(e=>e.id===f))||void 0===t?void 0:t.shownWaveformData)&&void 0!==n?n:null===(i=E[0])||void 0===i?void 0:i.shownWaveformData)&&void 0!==a?a:[]});return{waveforms:E,waveformConfig:v,shownWaveformData:S}};let r=i(19458),n=i(38986),a=i(15343),o=i(53438),l=i(92428),s=i(70429),d=i(44074);function c(e,t,i){let o,l;let s={...e};if(t===r.SoundWaveStyle.circle_simple||t===r.SoundWaveStyle.circle_smooth){let e=a.ReferenceDimensions[i];l=o=Math.min(e.height,e.width),s.thickness=n.DEFAULT_CIRCLE_THICKNESS,s.space=t===r.SoundWaveStyle.circle_smooth?0:n.DEFAULT_CIRCLE_SPACE,s.reference={width:n.SOUNDWAVE_CIRCLE_REFERENCE_HEIGHT,height:n.SOUNDWAVE_CIRCLE_REFERENCE_HEIGHT}}else l=n.SOUNDWAVE_REFERENCE_WIDTH,o=n.SOUNDWAVE_REFERENCE_HEIGHT,s.thickness=(0,d.isDottedBarsStyle)(t)?n.DEFAULT_DOTTED_BAR_THICKNESS:n.DEFAULT_THICKNESS,s.space=n.DEFAULT_SPACE,s.reference={width:n.SOUNDWAVE_REFERENCE_WIDTH,height:n.SOUNDWAVE_REFERENCE_HEIGHT};return{mergedConfig:{...s,style:t},rect:{height:o,width:l}}}},12609:function(e,t){"use strict";function i(e){var t,i,r,n;return{left:null!==(i=null!==(t=e.__cameraShakeRestLeft)&&void 0!==t?t:e.left)&&void 0!==i?i:0,top:null!==(n=null!==(r=e.__cameraShakeRestTop)&&void 0!==r?r:e.top)&&void 0!==n?n:0}}Object.defineProperty(t,"__esModule",{value:!0}),t.isLayoutGroup=function(e){return!!(e&&"group"===e.type)},t.getGroupLayoutOrigin=i,t.canvasAbsoluteToGroupLocal=function(e,t,r){let n=i(e);return{left:t-n.left,top:r-n.top}}},32172:function(e,t,i){"use strict";t.vm=void 0,t._4=function(e,i){var n;if((0,r.isCaptionSlotTextNode)(e,i)){let t=e.captionAnchorFontSize;if(null!=t&&Number.isFinite(t)&&t>0)return t}return null!==(n=e.fontSize)&&void 0!==n?n:t.vm},t.O2=function(e,t,i){return(0,r.isCaptionSlotTextNode)(e,i)?{captionAnchorFontSize:t,fontSize:t}:{fontSize:t}};let r=i(28687);t.vm=24},44169:function(e,t){"use strict";t.q=function(e){let t=new TextDecoder("latin1").decode(e);return i.some(e=>t.includes(e))?"has_audio":r.some(e=>t.includes(e))?"no_audio":"unknown"};let i=["soun","mp4a"],r=["vide","avc1","hvc1","hev1"]},63596:function(e,t,i){"use strict";var r=function(e){return e&&e.__esModule?e:{default:e}};t.i=function(e){let{prevProps:t,nextProps:i,prevLayoutKey:r}=e,u=(0,s.getWaveformLayoutKey)(i.waveformConfig);if(null===r||!(0,n.default)(u,r)||i.recreateOnDataChange&&!(0,l.isSameArray)(i.shownWaveformData,t.shownWaveformData))return{type:"RECREATE"};let p=(0,a.default)(t,c),m=(0,a.default)(i,c);if(!(0,n.default)(m,p))return(0,d.isOnlyWaveColorAppearanceChange)(t.waveformConfig,i.waveformConfig)?{type:"REPAINT_COLORS"}:i.recreateOnDataChange?{type:"RECREATE"}:{type:"RESHAPE_DATA"};if(!(0,l.isSameArray)(i.shownWaveformData,t.shownWaveformData))return i.recreateOnDataChange?{type:"RECREATE"}:{type:"RESHAPE_DATA"};if(!(0,n.default)(i.centerImage,t.centerImage)){let e=t.centerImage?{resourceId:t.centerImage.resourceId,url:t.centerImage.url}:void 0,r=i.centerImage?{resourceId:i.centerImage.resourceId,url:i.centerImage.url}:void 0;if(!(0,n.default)(e,r))return{type:"RECREATE"};if((0,o.isCircleSoundWaveStyle)(i.waveformConfig.style))return{type:"UPDATE_CENTER_IMAGE_POSITION"}}return{type:"SYNC_ATTRS"}};let n=r(i(18149)),a=r(i(13888)),o=i(44074),l=i(8915),s=i(64253),d=i(89291),c=["audioFileName","audioResourceId","waveformConfig","canvasAspectRatio"]},89459:function(e,t){"use strict";t.L=function(e){let t=0;for(;t<e.length;){let r=function(e,t){for(let r=t;r<=e.length-i.length;r+=1)if(e[r]===i[0]&&e[r+1]===i[1]&&e[r+2]===i[2]&&e[r+3]===i[3])return r;return -1}(e,t);if(r<0)break;let a=n(e,r,e.length),o=a?function(e,t){let i=[],r=t.dataStart;for(;r<t.dataEnd;){let a=n(e,r,t.dataEnd);if(!a||a.dataEnd<=r)break;
1if(174===a.id){let t=a.dataStart;for(;t<a.dataEnd;){let r=n(e,t,a.dataEnd);if(!r||r.dataEnd<=t)break;131===r.id&&i.push(function(e,t,i){let r=0;for(let n=t;n<i;n+=1)r=256*r+e[n];return r}(e,r.dataStart,r.dataEnd)),t=r.dataEnd}}r=a.dataEnd}return i}(e,a):[];if(o.length>0){if(o.includes(2))return"has_audio";return o.includes(1)?"no_audio":"unknown"}t=r+1}return"unknown"};let i=[22,84,174,107];function r(e,t,i){if(t>=e.length)return null;let r=e[t];if(0===r)return null;let n=1;for(;n<=8&&(r&128>>n-1)==0;)n+=1;if(n>8||t+n>e.length)return null;let a=i?r:r&255>>n,o=a===255>>n;for(let i=1;i<n;i+=1)a=256*a+e[t+i],255!==e[t+i]&&(o=!1);return{length:n,value:a,unknown:!i&&o}}function n(e,t,i){let n=r(e,t,!0);if(!n)return null;let a=r(e,t+n.length,!1);if(!a)return null;let o=t+n.length+a.length,l=a.unknown?i:Math.min(i,o+a.value);return o>i?null:{id:n.value,dataStart:o,dataEnd:l}}},14924:function(e,t,i){"use strict";t.i=function(e){switch(e){case r.ExportFileType.MP4:case r.ExportFileType.GIF:case r.ExportFileType.WEBM:case r.ExportFileType.MOV:case r.ExportFileType.MOV_PRORES:return"motion";case r.ExportFileType.PNG:case r.ExportFileType.JPG:case r.ExportFileType.PDF:case r.ExportFileType.SVG:return"still";default:throw Error("exportFormatFamily: unhandled ExportFileType ".concat(String(e)))}};let r=i(19458)},28552:function(e,t){"use strict";function i(e,t){return(e[t]<<24>>>0)+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3]}async function r(e,t,r){let n=0;for(let a=0;a<64&&n+8<=e;a+=1){let a=await t(n,Math.min(e,n+16));if(a.length<8)break;let o=i(a,0),l=String.fromCharCode(a[4],a[5],a[6],a[7]);if(1===o){if(a.length<16)return null;o=4294967296*i(a,8)+i(a,12)}else 0===o&&(o=e-n);if(o<8)break;if(l===r)return{start:n,end:Math.min(e,n+o)};n+=o}return null}t.u=r},34610:function(e,t,i){"use strict";t.v=function(e,t){if(!(e.width>0)||!(e.height>0)||!(e.ratioToReference>0))return{};
1let i=(0,r.getDefaultImageRectParams)(e.width,e.height,t.offsetTop,t.offsetLeft);return(0,n.convertActualToReferenceObject)(i,e.ratioToReference,t)};let r=i(54530),n=i(52305)},64253:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getWaveformLayoutKey=function(e){var t;let i={style:e.style,thickness:e.thickness,space:e.space,reference:e.reference,height:e.height,heightMultiplier:e.heightMultiplier,roundedBars:e.roundedBars,glow:null==(t=e.glow)?null:{color:t.color,blur:t.blur}};return(0,r.isCircleSoundWaveStyle)(e.style)?{...i,circleRadius:e.circleRadius,circleBarHeight:e.circleBarHeight}:i};let r=i(44074)},71651:function(e,t,i){"use strict";t.su=function(e,t){return t.mirrored?e.getCenterPoint():((0,n.refreshSoundWaveGroupLayoutBounds)(e),o(e,l(e)))},t.q0=function(e,t,i){if((0,n.refreshSoundWaveGroupLayoutBounds)(e),i.mirrored)e.setPositionByOrigin(t,"center","center");else{var r,a;let i=o(e,l(e));e.set({left:(null!==(r=e.left)&&void 0!==r?r:0)+(t.x-i.x),top:(null!==(a=e.top)&&void 0!==a?a:0)+(t.y-i.y)})}e.setCoords()},t.fi=s,t.wS=function(e,t){return s(e).mirrored===s(t).mirrored};let r=i(21749),n=i(50996),a=i(44074);function o(e,t){return r.fabric.util.transformPoint(t,e.calcTransformMatrix())}function l(e){var t;let i=(0,n.measureSoundWaveLocalVisualBounds)((0,n.getSoundWaveVisualObjects)(e.getObjects()));return i?(0,n.soundWaveGroupLocalAnchorPoint)(i,!1):new r.fabric.Point(0,(null!==(t=e.height)&&void 0!==t?t:0)/2)}function s(e){return{mirrored:(0,a.isMirroredSoundWaveStyle)(e.style)}}},84649:function(e,t,i){"use strict";t.$E=function(e){let t,i;let{oldAspectRatio:n,newAspectRatio:o,waveforms:l,textNodes:s,qr:d,images:c}=e;if(n===o)return{};let u=r.ReferenceDimensions[n],p=r.ReferenceDimensions[o],m=l.map(e=>({...e,rect:a(e.rect,u,p)})),f=s.map(e=>({...e,...a(e,u,p)}));(null==d?void 0:d.imported)&&null!=d.left&&null!=d.top&&(t={...d,...a(d,u,p)}),void 0!==c&&(i=c.map(e=>"background"!==e.kind&&e.rect?{...e,rect:a(e.rect,u,p)}:e));let x={waveforms:m,textNodes:f};return t&&(x.qr=t),void 0!==i&&(x.images=i),x};let r=i(15343);function n(e,t,i,r){return t>i?r:Math.min(i,Math.max(t,e))}function a(e,t,i){var r,a,o,l,s,d;let c=null!==(r=e.left)&&void 0!==r?r:0,u=null!==(a=e.top)&&void 0!==a?a:0,p=i.width/t.width*c,m=i.height/t.height*u,f=(null!==(o=e.width)&&void 0!==o?o:0)*(null!==(l=e.scaleX)&&void 0!==l?l:1),x=(null!==(s=e.height)&&void 0!==s?s:0)*(null!==(d=e.scaleY)&&void 0!==d?d:1),h=function(e,t,i){let r=null!=i?i:"left";return"center"===r?{min:t/2,max:e-t/2,degenerate:e/2}:"right"===r?{min:t,max:e,degenerate:e}:{min:0,max:e-t,degenerate:0}}(i.width,f,e.originX),g=function(e,t,i){let r=null!=i?i:"top";return"center"===r?{min:t/2,max:e-t/2,degenerate:e/2}:"bottom"===r?{min:t,max:e,degenerate:e}:{min:0,max:e-t,degenerate:0}}(i.height,x,e.originY);return{...e,left:n(p,h.min,h.max,h.degenerate),top:n(m,g.min,g.max,g.degenerate)}}},34444:function(e,t,i){"use strict";t.v=function(e){var t,i,l,s;if(null==e.audioSource||e.audioSource===r.SourceType.SPOTIFY||e.audioSource===r.SourceType.SEARCH)return{intent:"still",score:null,source:"veto"};let d=(null==(l=(t=e).landingPath)?o["/editor"]:null!==(s=o[l])&&void 0!==s?s:o["/editor"])+n[t.aspectRatio]+(null!=t.audioSource&&null!==(i=a[t.audioSource])&&void 0!==i?i:0),c="unknown";return d>=3?c="motion":d<=-2&&(c="still"),{intent:c,score:d,source:"weighted"}};let r=i(19458),n={[r.AspectRatio["9/16"]]:7,[r.AspectRatio["16/9"]]:4,[r.AspectRatio["4/5"]]:3,[r.AspectRatio["2/1"]]:2,[r.AspectRatio["1/1"]]:0,[r.AspectRatio["2/3"]]:0,[r.AspectRatio["5/4"]]:0,[r.AspectRatio["3/2"]]:0,[r.AspectRatio["1/2"]]:0,[r.AspectRatio["3/1"]]:-1,[r.AspectRatio["297/210"]]:-3,[r.AspectRatio["210/297"]]:-3,[r.AspectRatio["17/22"]]:-3,[r.AspectRatio["22/17"]]:-3,[r.AspectRatio["11/14"]]:-3,[r.AspectRatio["27/35"]]:-3,[r.AspectRatio["4/3"]]:-3},a={[r.SourceType.AUDIO]:1,[r.SourceType.SAMPLE]:-3},o={"/audiogram-maker":3,"/waveform-video-for-youtube":3,"/sound-wave-video":3,"/audio-waveform-generator":2,"/music-visualizer":2,"/editor":0,"/":-1,"/soundviz-alternative":-5}},6332:function(e,t){"use strict";t.UH=function(e){let{probe:t,includeVisuals:i,silentVideoLayers:r}=e;return t.ok||"invalid_container"!==t.reason?t.ok?{kind:"extract_audio",includeVisuals:i}:i&&r?{kind:"visuals_only"}:{kind:"reject",reason:"no_audio_for_waveform"}:{kind:"reject",reason:"invalid_container"}},t.j_=function(e){let{probe:t,silentVideoLayers:i}=e;return i&&!t.ok&&"no_audio"===t.reason}},58904:function(e,t,i){"use strict";var r;t.v=function(e){let{fields:t,props:i,prevProps:r,canvas:l,object:s,scaleToSize:d}=e,c=!1,{width:u,height:p}=i;
1d&&(void 0!==u||void 0!==p)&&(void 0!==p&&p>=(u||0)?s.scaleToHeight(p):void 0!==u&&u>=(p||0)&&s.scaleToWidth(u));let m=t.includes("left")&&void 0!==i.left&&!(0,a.default)(r.left,i.left),f=t.includes("top")&&void 0!==i.top&&!(0,a.default)(r.top,i.top);if((m||f)&&(0,o.isLayoutGroup)(s.group)){var x,h;let e=(0,o.getGroupLayoutOrigin)(s.group),t=m?i.left:(null!==(x=s.left)&&void 0!==x?x:0)+e.left,r=f?i.top:(null!==(h=s.top)&&void 0!==h?h:0)+e.top,n=(0,o.canvasAbsoluteToGroupLocal)(s.group,t,r);s.set({left:n.left,top:n.top}),c=!0}t.forEach(e=>{!("clip"===e||("left"===e||"top"===e)&&(0,o.isLayoutGroup)(s.group))&&(void 0===i[e]||(0,a.default)(r[e],i[e])||(s.set(e,i[e]),c=!0))});let g=r.fill||r.fillColor,v=i.fill||i.fillColor;if(v&&!(0,a.default)(g,v)&&(s.set("fill",i.fill||i.fillColor),c=!0),!(0,a.default)(r.clip,i.clip)){if(i.clip){let e=new n.fabric.Rect({width:i.clip.width,height:i.clip.height,scaleX:1/(s.scaleX||1),scaleY:1/(s.scaleY||1),top:0,left:0,originX:"center",originY:"center"});s.set("clipPath",e)}else s.set("clipPath",void 0);c=!0}c&&(s.setCoords(),l.requestRenderAll())};let n=i(21749),a=(r=i(18149))&&r.__esModule?r:{default:r},o=i(12609)},15297:function(e,t,i){"use strict";t.h=void 0;let r=i(19458),n={[r.AspectRatio["3/2"]]:{[r.Unit.cm]:{[r.ExportSize.optimized]:"3.33cm x 2.22cm",[r.ExportSize["720p"]]:"7.5cm x 5cm",[r.ExportSize["1080p"]]:"11.25cm x 7.5cm",[r.ExportSize.max1200]:"12.5cm x 8.33cm",[r.ExportSize.lowres]:"15cm x 10cm",[r.ExportSize.small]:"50.8cm x 33.85cm",[r.ExportSize.medium]:"76.2cm x 50.8cm",[r.ExportSize.large]:"101.6cm x 67.75cm"},[r.Unit.inch]:{[r.ExportSize.optimized]:"1.06in x 0.70in",[r.ExportSize["720p"]]:"2.4in x 1.6in",[r.ExportSize["1080p"]]:"3.6in x 2,4in",[r.ExportSize.max1200]:"4in x 2.66in",[r.ExportSize.lowres]:"4.8in x 3.2in",[r.ExportSize.small]:"20in x 13.3in",[r.ExportSize.medium]:"30in x 20in",[r.ExportSize.large]:"40in x 26.6in"},[r.Unit.pixel]:{[r.ExportSize.optimized]:"320px x 213px",[r.ExportSize["720p"]]:"720px x 480px",[r.ExportSize["1080p"]]:"1080px x 888px",[r.ExportSize.max1200]:"1200px x 800px",[r.ExportSize.lowres]:"1440px x 933px",[r.ExportSize.small]:"6000px x 4000px",[r.ExportSize.medium]:"9000px x 6000px",[r.ExportSize.large]:"12000px x 8000px"}},[r.AspectRatio["3/1"]]:{[r.Unit.cm]:{[r.ExportSize.optimized]:"3.33cm x 1.11cm",[r.ExportSize["720p"]]:"7.5cm x 2.5cm",[r.ExportSize["1080p"]]:"11.25cm x 3,75cm",[r.ExportSize.max1200]:"12.5cm x 4,16cm",[r.ExportSize.lowres]:"15cm x 5cm",[r.ExportSize.small]:"50.8cm x 16,88cm",[r.ExportSize.medium]:"76.2cm x 25.4cm",[r.ExportSize.large]:"101.6cm x 33,88cm"},[r.Unit.inch]:{[r.ExportSize.optimized]:"1.06in x 0.35in",[r.ExportSize["720p"]]:"2.4in x 0.8in",[r.ExportSize["1080p"]]:"3.6in x 1.2in",[r.ExportSize.max1200]:"4in x 1.33in",[r.ExportSize.lowres]:"4.8in x 1.6in",[r.ExportSize.small]:"20in x 6,7in",[r.ExportSize.medium]:"30in x 10in",[r.ExportSize.large]:"40in x 13.3in"},[r.Unit.pixel]:{[r.ExportSize.optimized]:"320px x 105px",[r.ExportSize["720p"]]:"720px x 240px",[r.ExportSize["1080p"]]:"1080px x 444px",[r.ExportSize.max1200]:"1200px x 400px",[r.ExportSize.lowres]:"1440px x 467px",[r.ExportSize.small]:"6000px x 2000px",[r.ExportSize.medium]:"9000px x 3000px",[r.ExportSize.large]:"12000px x 4000px"}},[r.AspectRatio["2/1"]]:{[r.Unit.cm]:{[r.ExportSize.optimized]:"3.33cm x 1.66cm",[r.ExportSize["720p"]]:"7.5cm x 3.75cm",[r.ExportSize["1080p"]]:"11.25cm x 5,625cm",[r.ExportSize.max1200]:"12.5cm x 6.25cm",[r.ExportSize.lowres]:"15cm x 7.5cm",[r.ExportSize.small]:"50.8cm x 25.4cm",[r.ExportSize.medium]:"76.2cm x 38cm",[r.ExportSize.large]:"101.6cm x 50.8cm"},[r.Unit.inch]:{[r.ExportSize.optimized]:"1.06in x 0.53in",[r.ExportSize["720p"]]:"2.4in x 1.2in",[r.ExportSize["1080p"]]:"3.6in x 1.8in",[r.ExportSize.max1200]:"4in x 2in",[r.ExportSize.lowres]:"4.8in x 2.4in",[r.ExportSize.small]:"20in x 10in",[r.ExportSize.medium]:"30in x 15in",[r.ExportSize.large]:"40in x 20in"},[r.Unit.pixel]:{[r.ExportSize.optimized]:"320px x 160px",[r.ExportSize["720p"]]:"720px x 360px",[r.ExportSize["1080p"]]:"1080px x 540px",[r.ExportSize.max1200]:"1200px x 600px",[r.ExportSize.lowres]:"1440px x 720px",[r.ExportSize.small]:"6000px x 3000px",[r.ExportSize.medium]:"9000px x 4500px",[r.ExportSize.large]:"12000px x 6000px"}},[r.AspectRatio["16/9"]]:{[r.Unit.cm]:{[r.ExportSize.optimized]:"3.33cm x 1.88cm",[r.ExportSize["720p"]]:"7.5cm x 4.22cm",[r.ExportSize["1080p"]]:"11.25cm x 6.33cm",[r.ExportSize.max1200]:"12.5cm x 7.03cm",[r.ExportSize.lowres]:"15cm x 8.44cm",[r.ExportSize.small]:"50.8cm x 28.58cm",[r.ExportSize.medium]:"76.2cm x 42.86cm",[r.ExportSize.large]:"101.6cm x 57.15cm"},[r.Unit.inch]:{[r.ExportSize.optimized]:"1.06in x 0.6in",[r.ExportSize["720p"]]:"2.4in x 1.35in",[r.ExportSize["1080p"]]:"3.6in x 2.02in",[r.ExportSize.max1200]:"4in x 2.25in",[r.ExportSize.lowres]:"4.8in x 2.7in",[r.ExportSize.small]:"20in x 11.25in",[r.ExportSize.medium]:"30in x 16.88in",[r.ExportSize.large]:"40in x 22.5in"},[r.Unit.pixel]:{[r.ExportSize.optimized]:"320px x 180px",[r.ExportSize["720p"]]:"720px x 405px",[r.ExportSize["1080p"]]:"1080px x 607px",[r.ExportSize.max1200]:"1200px x 675px",[r.ExportSize.lowres]:"1440px x 810px",[r.ExportSize.small]:"6000px x 3375px",[r.ExportSize.medium]:"9000px x 5062px",[r.ExportSize.large]:"12000px x 6750px"}},[r.AspectRatio["9/16"]]:{[r.Unit.cm]:{[r.ExportSize.optimized]:"3.33cm x 5.93cm",[r.ExportSize["720p"]]:"7.5cm x 13.33cm",[r.ExportSize["1080p"]]:"11.25cm x 20cm",[r.ExportSize.max1200]:"12.5cm x 22.22cm",[r.ExportSize.lowres]:"15cm x 26.67cm",[r.ExportSize.small]:"50.8cm x 90.31cm",[r.ExportSize.medium]:"76.2cm x 135.47cm",[r.ExportSize.large]:"101.6cm x 180.62cm"},[r.Unit.inch]:{[r.ExportSize.optimized]:"1.06in x 1.88in",[r.ExportSize["720p"]]:"2.4in x 4.27in",[r.ExportSize["1080p"]]:"3.6in x 6.4in",[r.ExportSize.max1200]:"4in x 7.11in",[r.ExportSize.lowres]:"4.8in x 8.53in",[r.ExportSize.small]:"20in x 35.56in",[r.ExportSize.medium]:"30in x 53.33in",[r.ExportSize.large]:"40in x 71.11in"},[r.Unit.pixel]:{[r.ExportSize.optimized]:"320px x 568px",[r.ExportSize["720p"]]:"720px x 1280px",[r.ExportSize["1080p"]]:"1080px x 1920px",[r.ExportSize.max1200]:"1200px x 2133px",[r.ExportSize.lowres]:"1440px x 2560px",[r.ExportSize.small]:"6000px x 10666px",[r.ExportSize.medium]:"9000px x 16000px",[r.ExportSize.large]:"12000px x 21333px"}},[r.AspectRatio["2/3"]]:{[r.Unit.cm]:{[r.ExportSize.optimized]:"3.33cm x 5cm",[r.ExportSize["720p"]]:"7.5cm x 11.25cm",[r.ExportSize["1080p"]]:"11.25cm x 16,88cm",[r.ExportSize.max1200]:"12.5cm x 18,75cm",[r.ExportSize.lowres]:"15cm x 22,5cm",[r.ExportSize.small]:"50.8cm x 76,2cm",[r.ExportSize.medium]:"76.2cm x 114,3cm",[r.ExportSize.large]:"101.6cm x 152,4cm"},[r.Unit.inch]:{[r.ExportSize.optimized]:"1.06in x 1.6in",[r.ExportSize["720p"]]:"2.4in x 3.6in",[r.ExportSize["1080p"]]:"3.6in x 5,4in",[r.ExportSize.max1200]:"4in x 6in",[r.ExportSize.lowres]:"4.8in x 7.2in",[r.ExportSize.small]:"20in x 30in",[r.ExportSize.medium]:"30in x 45in",[r.ExportSize.large]:"40in x 60in"},[r.Unit.pixel]:{[r.ExportSize.optimized]:"320px x 480px",[r.ExportSize["720p"]]:"720px x 1080px",[r.ExportSize["1080p"]]:"1080px x 1620px",[r.ExportSize.max1200]:"1200px x 1800px",[r.ExportSize.lowres]:"1440px x 2160px",[r.ExportSize.small]:"6000px x 9000px",[r.ExportSize.medium]:"9000px x 13500px",[r.ExportSize.large]:"12000px x 18000px"}},[r.AspectRatio["4/5"]]:{[r.Unit.cm]:{[r.ExportSize.optimized]:"320px x 400px",[r.ExportSize["720p"]]:"7.5cm x 9.38cm",[r.ExportSize["1080p"]]:"11.6cm x 14.5cm",[r.ExportSize.max1200]:"12.5cm x 15.63cm",[r.ExportSize.lowres]:"15cm x 18.75cm",[r.ExportSize.small]:"50.8cm x 63.5cm",[r.ExportSize.medium]:"76.2cm x 95.25cm",[r.ExportSize.large]:"101.6cm x 127cm"},[r.Unit.inch]:{[r.ExportSize.optimized]:"1.06in x 1,325in",[r.ExportSize["720p"]]:"2.4in x 3in",[r.ExportSize["1080p"]]:"3.6in x 4.5in",[r.ExportSize.max1200]:"4in x 5in",[r.ExportSize.lowres]:"4.8in x 6in",[r.ExportSize.small]:"20in x 25in",[r.ExportSize.medium]:"30in x 37.5in",[r.ExportSize.large]:"40in x 50in"},[r.Unit.pixel]:{[r.ExportSize.optimized]:"320px x 400px",[r.ExportSize["720p"]]:"720px x 900px",[r.ExportSize["1080p"]]:"1080px x 1350px",[r.ExportSize.max1200]:"1200px x 1500px",[r.ExportSize.lowres]:"1440px x 1800px",[r.ExportSize.small]:"7500px x 9375px",[r.ExportSize.medium]:"9000px x 11250px",[r.ExportSize.large]:"12000px x 15000px"}},[r.AspectRatio["5/4"]]:{[r.Unit.cm]:{[r.ExportSize.optimized]:"3.33cm x 2,67cm",[r.ExportSize["720p"]]:"7.5cm x 6cm",[r.ExportSize["1080p"]]:"11.25cm x 9cm",[r.ExportSize.max1200]:"12.5cm x 10cm",[r.ExportSize.lowres]:"15cm x 12cm",[r.ExportSize.small]:"40.8cm x 40.6cm",[r.ExportSize.medium]:"76.2cm x 61cm",[r.ExportSize.large]:"101.6cm x 81cm"},[r.Unit.inch]:{[r.ExportSize.optimized]:"1.06in x 0.85in",[r.ExportSize["720p"]]:"2.4in x 1.92in",[r.ExportSize["1080p"]]:"3.6in x 2.88in",[r.ExportSize.max1200]:"4in x 3.2in",[r.ExportSize.lowres]:"4.8in x 3.8in",[r.ExportSize.small]:"20in x 16in",[r.ExportSize.medium]:"30in x 24in",[r.ExportSize.large]:"40in x 32in"},[r.Unit.pixel]:{[r.ExportSize.optimized]:"320px x 256px",[r.ExportSize["720p"]]:"720px x 576px",[r.ExportSize["1080p"]]:"1080px x 864px",[r.ExportSize.max1200]:"1200px x 960px",[r.ExportSize.lowres]:"1440px x 1152px",[r.ExportSize.small]:"6000px x 4800px",[r.ExportSize.medium]:"9000px x 7200px",[r.ExportSize.large]:"12000px x 9600px"}},[r.AspectRatio["4/3"]]:{[r.Unit.cm]:{[r.ExportSize.optimized]:"3.33cm x 2.5cm",[r.ExportSize["720p"]]:"7.5cm x 5.63cm",[r.ExportSize["1080p"]]:"11.25cm x 8.44cm",[r.ExportSize.max1200]:"12.5cm x 9.38cm",[r.ExportSize.lowres]:"15cm x 11.25cm",[r.ExportSize.small]:"50.8cm x 38.1cm",[r.ExportSize.medium]:"76.2cm x 57.15cm",[r.ExportSize.large]:"101.6cm x 76.2cm"},[r.Unit.inch]:{[r.ExportSize.optimized]:"1.06in x 0.8in",[r.ExportSize["720p"]]:"2.4in x 1.8in",[r.ExportSize["1080p"]]:"3.6in x 2.7in",[r.ExportSize.max1200]:"4in x 3in",[r.ExportSize.lowres]:"4.8in x 3.6in",[r.ExportSize.small]:"20in x 15in",[r.ExportSize.medium]:"30in x 22.5in",[r.ExportSize.large]:"40in x 30in"},[r.Unit.pixel]:{[r.ExportSize.optimized]:"320px x 240px",[r.ExportSize["720p"]]:"720px x 540px",[r.ExportSize["1080p"]]:"1080px x 810px",[r.ExportSize.max1200]:"1200px x 900px",[r.ExportSize.lowres]:"1440px x 1080px",[r.ExportSize.small]:"6000px x 4500px",[r.ExportSize.medium]:"9000px x 6750px",[r.ExportSize.large]:"12000px x 9000px"}},[r.AspectRatio["1/1"]]:{[r.Unit.cm]:{[r.ExportSize.optimized]:"3.33cm x 3.33cm",[r.ExportSize["720p"]]:"7.5cm x 7.5cm",[r.ExportSize["1080p"]]:"11.25cm x 11.25cm",[r.ExportSize.max1200]:"12.5cm x 12.5cm",[r.ExportSize.lowres]:"15cm x 15cm",[r.ExportSize.small]:"40.8cm x 50.8cm",[r.ExportSize.medium]:"76.2cm x 76.2cm",[r.ExportSize.large]:"101.6cm x 101.6cm"},[r.Unit.inch]:{[r.ExportSize.optimized]:"1.06in x 1.06in",[r.ExportSize["720p"]]:"2.4in x 2.4in",[r.ExportSize["1080p"]]:"3.6in x 3.6in",[r.ExportSize.max1200]:"4in x 4in",[r.ExportSize.lowres]:"4.8in x 4.8in",[r.ExportSize.small]:"20in x 20in",[r.ExportSize.medium]:"30in x 30in",[r.ExportSize.large]:"40in x 40in"},[r.Unit.pixel]:{[r.ExportSize.optimized]:"320px x 320px",[r.ExportSize["720p"]]:"720px x 720px",[r.ExportSize["1080p"]]:"1080px x 1080px",[r.ExportSize.max1200]:"1200px x 1200px",[r.ExportSize.lowres]:"1440px x 1440px",[r.ExportSize.small]:"6000px x 6000px",[r.ExportSize.medium]:"9000px x 9000px",[r.ExportSize.large]:"12000px x 12000px"}},[r.AspectRatio["1/2"]]:{[r.Unit.cm]:{[r.ExportSize.optimized]:"3.33cm x 6.66cm",[r.ExportSize["720p"]]:"7.5cm x 15cm",[r.ExportSize["1080p"]]:"11.25cm x 22.5cm",[r.ExportSize.max1200]:"12.5cm x 25cm",[r.ExportSize.lowres]:"15cm x 30cm",[r.ExportSize.small]:"50.8cm x 101.6cm",[r.ExportSize.medium]:"76.2cm x 152.4cm",[r.ExportSize.large]:"101.6cm x 203.2cm"},[r.Unit.inch]:{[r.ExportSize.optimized]:"1.06in x 2.12in",[r.ExportSize["720p"]]:"2.4in x 4.8in",[r.ExportSize["1080p"]]:"3.6in x 7.2in",[r.ExportSize.max1200]:"4in x 8in",[r.ExportSize.lowres]:"4.8in x 9.6in",[r.ExportSize.small]:"20in x 40in",[r.ExportSize.medium]:"30in x 60in",[r.ExportSize.large]:"40in x 8
10in"},[r.Unit.pixel]:{[r.ExportSize.optimized]:"320px x 640px",[r.ExportSize["720p"]]:"720px x 1440px",[r.ExportSize["1080p"]]:"1080px x 2160px",[r.ExportSize.max1200]:"1200px x 2400px",[r.ExportSize.lowres]:"1440px x 2880px",[r.ExportSize.small]:"6000px x 12000px",[r.ExportSize.medium]:"9000px x 18000px",[r.ExportSize.large]:"12000px x 24000px"}},[r.AspectRatio["27/35"]]:{[r.Unit.cm]:{[r.ExportSize.optimized]:"3.33cm x 4.25cm",[r.ExportSize["720p"]]:"7.5cm x 9.53cm",[r.ExportSize["1080p"]]:"11.25cm x 14.3cm",[r.ExportSize.max1200]:"12.5cm x 16cm",[r.ExportSize.lowres]:"15cm x 19.1cm",[r.ExportSize.small]:"40.8cm x 51.92cm",[r.ExportSize.medium]:"76.2xm x 97cm",[r.ExportSize.large]:"101.6cm x 129.3cm"},[r.Unit.inch]:{[r.ExportSize.optimized]:"1.06in x 1.35in",[r.ExportSize["720p"]]:"2.4in x 3.07in",[r.ExportSize["1080p"]]:"3.6in x 4.6in",[r.ExportSize.max1200]:"4in x 5.1in",[r.ExportSize.lowres]:"4.8in x 6.1in",[r.ExportSize.small]:"20in x 25.5in",[r.ExportSize.medium]:"30in x 38.2in",[r.ExportSize.large]:"40in x 51in"},[r.Unit.pixel]:{[r.ExportSize.optimized]:"320px x 408px",[r.ExportSize["720p"]]:"720px x 917px",[r.ExportSize["1080p"]]:"1080px x 1375px",[r.ExportSize.max1200]:"1200px x 1530px",[r.ExportSize.lowres]:"1440px x 1835px",[r.ExportSize.small]:"6000px x 7640px",[r.ExportSize.medium]:"9000px x 11455px",[r.ExportSize.large]:"12000px x 15275cm"}},[r.AspectRatio["11/14"]]:{[r.Unit.cm]:{[r.ExportSize.optimized]:"3.33cm x 4.25cm",[r.ExportSize["720p"]]:"7.5cm x 9.53cm",[r.ExportSize["1080p"]]:"11.25cm x 14.3cm",[r.ExportSize.max1200]:"12.5cm x 16cm",[r.ExportSize.lowres]:"15cm x 19.1cm",[r.ExportSize.small]:"40.8cm x 51.92cm",[r.ExportSize.medium]:"76.2xm x 97cm",[r.ExportSize.large]:"101.6cm x 129.3cm"},[r.Unit.inch]:{[r.ExportSize.optimized]:"1.06in x 1.35in",[r.ExportSize["720p"]]:"2.4in x 3.07in",[r.ExportSize["1080p"]]:"3.6in x 4.6in",[r.ExportSize.max1200]:"4in x 5.1in",[r.ExportSize.lowres]:"4.8in x 6.1in",[r.ExportSize.small]:"20in x 25.5in",[r.ExportSize.medium]:"30in x 38.2in",[r.ExportSize.large]:"40in x 51in"},[r.Unit.pixel]:{[r.ExportSize.optimized]:"320px x 408px",[r.ExportSize["720p"]]:"720px x 917px",[r.ExportSize["1080p"]]:"1080px x 1375px",[r.ExportSize.max1200]:"1200px x 1530px",[r.ExportSize.lowres]:"1440px x 1835px",[r.ExportSize.small]:"6000px x 7640px",[r.ExportSize.medium]:"9000px x 11455px",[r.ExportSize.large]:"12000px x 15275cm"}},[r.AspectRatio["297/210"]]:{[r.Unit.cm]:{[r.ExportSize.optimized]:"3.33cm x 2.36cm",[r.ExportSize["720p"]]:"7.5cm x 5.31cm",[r.ExportSize["1080p"]]:"11.25cm x 7.96cm",[r.ExportSize.max1200]:"12.5cm x 8.84cm",[r.ExportSize.lowres]:"15cm x 10.61cm",[r.ExportSize.small]:"50.8cm x 35.9cm",[r.ExportSize.medium]:"76.2cm x 53.9cm",[r.ExportSize.large]:"101.6cm x 71.8cm"},[r.Unit.inch]:{[r.ExportSize.optimized]:"1.06in x 0.75in",[r.ExportSize["720p"]]:"2.4in x 1.7in",[r.ExportSize["1080p"]]:"3.6in x 2.55in",[r.ExportSize.max1200]:"4in x 2.83in",[r.ExportSize.lowres]:"4.8in x 3.4in",[r.ExportSize.small]:"20in x 14.1in",[r.ExportSize.medium]:"30in x 21.2in",[r.ExportSize.large]:"40in x 28.3in"},[r.Unit.pixel]:{[r.ExportSize.optimized]:"320px x 226px",[r.ExportSize["720p"]]:"720px x 509px",[r.ExportSize["1080p"]]:"1080px x 763px",[r.ExportSize.max1200]:"1200px x 848px",[r.ExportSize.lowres]:"1440px x 1018px",[r.ExportSize.small]:"6000px x 4242px",[r.ExportSize.medium]:"9000px x 6364px",[r.ExportSize.large]:"12000px x 8485px"}},[r.AspectRatio["210/297"]]:{[r.Unit.cm]:{[r.ExportSize.optimized]:"2.36cm x 3.33cm",[r.ExportSize["720p"]]:"5.31cm x 7.5cm",[r.ExportSize["1080p"]]:"7.96cm x 11.25cm",[r.ExportSize.max1200]:"8.84cm x 12.5cm",[r.ExportSize.lowres]:"10.61cm x 15cm",[r.ExportSize.small]:"35.9cm x 50.8cm",[r.ExportSize.medium]:"53.9cm x 76.2cm",[r.ExportSize.large]:"71.8cm x 101.6cm"},[r.Unit.inch]:{[r.ExportSize.optimized]:"0.75in x 1.06in",[r.ExportSize["720p"]]:"1.7in x 2.4in",[r.ExportSize["1080p"]]:"2.55in x 3.6in",[r.ExportSize.max1200]:"2.83in x 4in",[r.ExportSize.lowres]:"3.4in x 4.8in",[r.ExportSize.small]:"14.1in x 20in",[r.ExportSize.medium]:"21.2in x 30in",[r.ExportSize.large]:"28.3in x 40in"},[r.Unit.pixel]:{[r.ExportSize.optimized]:"226px x 320px",[r.ExportSize["720p"]]:"509px x 720px",[r.ExportSize["1080p"]]:"763px x 1080px",[r.ExportSize.max1200]:"848px x 1200px",[r.ExportSize.lowres]:"1018px x 1440px",[r.ExportSize.small]:"4242px x 6000px",[r.ExportSize.medium]:"6364px x 9000px",[r.ExportSize.large]:"8485px x 12000px"}},[r.AspectRatio["22/17"]]:{[r.Unit.cm]:{[r.ExportSize.optimized]:"3.33cm x 2.58cm",[r.ExportSize["720p"]]:"7.5cm x 5.8cm",[r.ExportSize["1080p"]]:"11.25cm x 8.7cm",[r.ExportSize.max1200]:"12.5cm x 9.7cm",[r.ExportSize.lowres]:"15cm x 11.6cm",[r.ExportSize.small]:"50.8cm x 39.3cm",[r.ExportSize.medium]:"76.2cm x 58.9cm",[r.ExportSize.large]:"101.6cm x 78.5cm"},[r.Unit.inch]:{[r.ExportSize.optimized]:"1.06in x 0.82in",[r.ExportSize["720p"]]:"2.4in x 1.85in",[r.ExportSize["1080p"]]:"3.6in x 2.8in",[r.ExportSize.max1200]:"4in x 3.1in",[r.ExportSize.lowres]:"4.8in x 3.7in",[r.ExportSize.small]:"20in x 15.5in",[r.ExportSize.medium]:"30in x 23.2in",[r.ExportSize.large]:"40in x 30.9in"},[r.Unit.pixel]:{[r.ExportSize.optimized]:"320px x 247px",[r.ExportSize["720p"]]:"720px x 556px",[r.ExportSize["1080p"]]:"1080px x 834px",[r.ExportSize.max1200]:"1200px x 927px",[r.ExportSize.lowres]:"1440px x 1113px",[r.ExportSize.small]:"6000px x 4636px",[r.ExportSize.medium]:"9000px x 6955px",[r.ExportSize.large]:"12000px x 9273px"}},[r.AspectRatio["17/22"]]:{[r.Unit.cm]:{[r.ExportSize.optimized]:"2.58cm x 3.33cm",[r.ExportSize["720p"]]:"5.8cm x 7.5cm",[r.ExportSize["1080p"]]:"8.7cm x 11.25cm",[r.ExportSize.max1200]:"9.7cm x 12.5cm",[r.ExportSize.lowres]:"11.6cm x 15cm",[r.ExportSize.small]:"39.3cm x 50.8cm",[r.ExportSize.medium]:"58.9cm x 76.2cm",[r.ExportSize.large]:"78.5cm x 101.6cm"},[r.Unit.inch]:{[r.ExportSize.optimized]:"0.82in x 1.07in",[r.ExportSize["720p"]]:"1.85in x 2.4in",[r.ExportSize["1080p"]]:"2.8in x 3.6in",[r.ExportSize.max1200]:"3.1in x 4in",[r.ExportSize.lowres]:"3.7in x 4.8in",[r.ExportSize.small]:"15.5in x 20in",[r.ExportSize.medium]:"23.2in x 30in",[r.ExportSize.large]:"30.9in x 40in"},[r.Unit.pixel]:{[r.ExportSize.optimized]:"247px x 320px",[r.ExportSize["720p"]]:"556px x 720px",[r.ExportSize["1080p"]]:"834px x 1080px",[r.ExportSize.max1200]:"927px x 1200px",[r.ExportSize.lowres]:"1113px x 1440px",[r.ExportSize.small]:"4636px x 6000px",[r.ExportSize.medium]:"6955px x 9000px",[r.ExportSize.large]:"9273px x 12000px"}}};t.h=(e,t,i)=>n[e][t][i]},89291:function(e,t,i){"use strict";
1var r=function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.isOnlyWaveColorsConfigChange=void 0,t.isOnlyWaveColorAppearanceChange=f,t.updateSoundWaveColorsInPlace=function(e,t){let{thickness:i,reference:r,waveColors:n,waveGradientDirection:a}=t;if(!(null==n?void 0:n.length))return;let m=null!=a?a:"to-right",f=e.getObjects(),x=f.find(e=>"polygon-sound-wave"===e.name&&"polygon"===e.type),h=f.find(e=>e.name===d.RADIAL_POLYGON_SOUND_WAVE_NAME);if(x||h){let e=(0,s.generateFillBackground)({width:r.width,height:c.SOUNDWAVE_REFERENCE_HEIGHT},n,m),i=null!=t.circleRadius&&null!=t.circleBarHeight?2*(t.circleRadius+t.circleBarHeight):r.width,o={width:i,height:i},d=(0,l.generateCircleSoundWaveFill)(o,n,{waveGradientDirection:a,referenceWidth:r.width}),u=f.find(e=>"polygon-sound-wave-progress"===e.name);if(x&&x.set("fill",e),h){var g,v,b;let e=null!==(g=h.pathOffset)&&void 0!==g?g:{x:0,y:0},t=(0,l.alignCircleFillToPolarOrigin)(d,{frameDimensions:o,polygonWidth:null!==(v=h.width)&&void 0!==v?v:o.width,polygonHeight:null!==(b=h.height)&&void 0!==b?b:o.height,pathOffsetX:e.x,pathOffsetY:e.y});h.set("fill",t),u&&u.set("fill",t)}else u&&u.set("fill",e);return}e.getObjects().forEach(e=>{var t,a,l,d;let f=e.name;if(null==f?void 0:f.match(p)){let l=null!==(t=e.left)&&void 0!==t?t:0,d=null!==(a=e.top)&&void 0!==a?a:0,u=(0,o.getPositionT)(l,d,r.width,c.SOUNDWAVE_REFERENCE_HEIGHT,m),p=n.length>1?(0,o.getColorAtT)(n,u):n[0];e.set("fill",(0,s.generateFillBackground)(i,[p]));return}let x=null==f?void 0:f.match(u);if(!x)return;let h=parseInt(x[1],10),g=null!==(l=e.top)&&void 0!==l?l:0,v=null!==(d=e.height)&&void 0!==d?d:0,b=(0,o.getPositionT)(h,g+v/2,r.width,c.SOUNDWAVE_REFERENCE_HEIGHT,m),E=n.length>1?(0,o.getColorAtT)(n,b):n[0];e.set("fill",(0,s.generateFillBackground)(i,[E]))})};let n=r(i(18149)),a=r(i(17620)),o=i(81234),l=i(68889),s=i(46301),d=i(41879),c=i(38986),u=/^sound-bar-(\d+)$/,p=/^sound-bar-(\d+)-(\d+)$/,m=["waveColors","waveGradientDirection"];function f(e,t){return!!e&&(!(0,n.default)(e.waveColors,t.waveColors)||e.waveGradientDirection!==t.waveGradientDirection)&&(0,n.default)((0,a.default)(e,m),(0,a.default)(t,m))}t.isOnlyWaveColorsConfigChange=f},50996:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getHorizontalRectBars=x,t.getSoundWaveVisualObjects=function(e){let t=x(e);return t.length?t:e.filter(e=>h(e))},t.measureSoundWaveLocalVisualBounds=g,t.soundWaveGroupLocalAnchorPoint=v,t.pinGroupLocalAnchorToCanvas=b,t.refreshSoundWaveGroupLayoutBounds=E,t.findPolygon=y,t.findRadialPolygon=w,t.findSoundWavePolygon=function(e){var t;return null!==(t=y(e))&&void 0!==t?t:w(e)},t.calculateNumBars=function(e){var t;if(!e)return 128;let i=w(e);if(null==i?void 0:null===(t=i.points)||void 0===t?void 0:t.length){let e=i.points.length/2;return C(i.points,e)?e-1:e}let r=y(e);if(r&&r.points){let e=(0,o.getHorizontalPolygonMeta)(r);return(null==e?void 0:e.numBars)?e.numBars:Math.floor(r.points.length/2/2)}let n=e.getObjects();if(n.some(e=>/^sound-bar-\d+-\d+$/.test(e.name))){let e=new Set;return n.forEach(t=>{var i;let r=null===(i=t.name)||void 0===i?void 0:i.match(/^sound-bar-(\d+)-/);r&&e.add(parseInt(r[1],10))}),e.size||128}let a=n.filter(e=>{var t,i;return null===(i=e.name)||void 0===i?void 0:null===(t=i.startsWith)||void 0===t?void 0:t.call(i,"sound-bar-")});return a.length>0?a.length:n.filter(e=>{var t,i;return"seeker-line"!==e.name&&!(null===(i=e.name)||void 0===i?void 0:null===(t=i.startsWith)||void 0===t?void 0:t.call(i,"freq-label-"))}).length||128},t.applyPolygonHeightsToCanvas=N,t.applyBarHeightsToCanvas=function(e){var t,i;let{barHeights:a,soundWaveGroup:c,referenceHeight:h,numBars:j,isCircleWaveform:_,circleRadius:R,circleBarHeight:A,heightMultiplier:k,height:I,spectrumPolygonBaselinePoints:z,roundedRectCorners:M,mirrored:D=!0,skipRender:T}=e,O=T?{requestRenderAll:()=>void 0}:e.canvas;if(!a.length||!c)return;let F=(0,n.getEffectiveHeightMultiplier)({heightMultiplier:k,height:I});if(w(c)){!function(e){let t;let{barHeights:i,soundWaveGroup:r,canvas:n,circleRadius:a=0,circleBarHeight:o=100,heightMultiplier:l=1,baselinePoints:c,numBars:p}=e,m=w(r),f=null!=c?c:null==m?void 0:m.points;if(!m||!i.length||!(null==f?void 0:f.length))return;m.set("objectCaching",!1);let x=f.length/2,h=C(f,x),g=h?x-1:x;t=i.length<=(null!=p?p:g)/2?[...i,...i.slice().reverse()]:i;let v=[],b=[];for(let e=0;e<g;e+=1){let i;let r=e/g*360;if(e>=t.length){let r=Math.floor(e/g*t.length);i=t[Math.min(r,t.length-1)]||0}else i=t[e];let n=Math.max(0,u(i,o,l));v.push(S(r,a+n)),b.push(S(r,a))}if(h&&v.length){var y;let e=Math.max(0,u(null!==(y=t[0])&&void 0!==y?y:0,o,l));v.push(S(360,a+e)),b.push(S(360,a))}let j=h?[S(0,a),...b.slice(0,-1).reverse()]:b.reverse();m.set("points",[...v,...j]),function(e,t){var i;e._setPositionDimensions({});let r=null!==(i=e.pathOffset)&&void 0!==i?i:{x:0,y:0};e.set({left:r.x,top:r.y}),(0,s.syncPolygonCircleFillPolarAlignment)(e,t)}(m,(0,d.calculateCircleFrameDimensions)(a,o)),m.dirty=!0,m.setCoords(),E(r),n.requestRenderAll()}({barHeights:a,soundWaveGroup:c,canvas:O,circleRadius:R,circleBarHeight:A,heightMultiplier:F,baselinePoints:null!=z?z:void 0,numBars:j});return}if(null!=_?_:(null===(t=c.clipPath)||void 0===t?void 0:t.type)==="circle"){!function(e){let t;let{barHeights:i,soundWaveGroup:r,canvas:n,circleRadius:a=0,circleBarHeight:o=100,heightMultiplier:l=1,roundedRectCorners:s}=e,d=r.getObjects().filter(e=>{var t,i;return null===(i=e.name)||void 0===i?void 0:null===(t=i.startsWith)||void 0===t?void 0:t.call(i,"sound-bar-")}),c=d.length;0!==c&&(t=i.length<=c/2?[...i,...i.slice().reverse()]:i,d.forEach((e,i)=>{let r;if(i>=t.length){let e=Math.floor(i/c*t.length);r=t[Math.min(e,t.length-1)]||0}else r=t[i];let n=Math.max(4,u(r,o,l)),d=e.angle||0,m=a+n/2;e.set({height:n,top:-Math.cos(Math.PI/180*d)*m,left:Math.sin(Math.PI/180*d)*m}),p(e,n,s),e.setCoords()}),E(r),n.requestRenderAll())}({barHeights:a,soundWaveGroup:c,canvas:O,circleRadius:R,circleBarHeight:A,heightMultiplier:F,roundedRectCorners:M});return}let L=y(c);if(L){let e=(0,o.getHorizontalPolygonMeta)(L);
1N({barHeights:a,polygon:L,referenceHeight:h,thickness:null!==(i=null==e?void 0:e.barThickness)&&void 0!==i?i:1,canvas:O,numBars:null!=j?j:null==e?void 0:e.numBars,heightMultiplier:F,baselinePoints:null!=z?z:void 0,mirrored:D,roundCorners:null==e?void 0:e.roundCorners,barLefts:null==e?void 0:e.barLefts}),E(c);return}let P=c.getObjects().filter(e=>{var t,i;return"seeker-line"!==e.name&&!(null===(i=e.name)||void 0===i?void 0:null===(t=i.startsWith)||void 0===t?void 0:t.call(i,"freq-label-"))}),{isDottedBars:U,dotDiameter:W=1}=e;if(U&&W>0){let e=function(e,t){let i=f.get(e);if(i)return i.columns;let r=new Map;t.forEach(e=>{let t=e.name,i=null==t?void 0:t.match(m);if(!i)return;let n=parseInt(i[1],10),a=r.get(n);a||(a=[],r.set(n,a)),a.push(e)});let n=[...r.keys()].sort((e,t)=>e-t).map(e=>{var t;return(null!==(t=r.get(e))&&void 0!==t?t:[]).sort((e,t)=>{var i,r;let n=e.name.match(/-(\d+)$/),a=t.name.match(/-(\d+)$/);return parseInt(null!==(i=null==n?void 0:n[1])&&void 0!==i?i:"0",10)-parseInt(null!==(r=null==a?void 0:a[1])&&void 0!==r?r:"0",10)})});return f.set(e,{columns:n}),n}(c,P),t=(0,l.getDottedBarsMaxHalfRows)(h,W);e.forEach((e,i)=>{var r;let n=(null!==(r=a[i])&&void 0!==r?r:0)*h*F,o=(0,l.getDottedBarsVisibleDotCount)(n,W);e.forEach(e=>{let i=e.name,r=null==i?void 0:i.match(m);if(!r)return;let n=parseInt(r[2],10),a=(0,l.isDottedBarRowVisible)(n,o,D,t)?1:0;e.opacity!==a&&e.set("opacity",a)})}),E(c),O.requestRenderAll();return}(function(e){let{barHeights:t,soundWaveGroup:i,referenceHeight:n,effectiveHeightMultiplier:a,mirrored:o,roundedRectCorners:l}=e,s=x(i.getObjects()),d=g(s);if(!d)return;let c=r.fabric.util.transformPoint(v(d,o),i.calcTransformMatrix());s.forEach((e,i)=>{if(i>=t.length)return;let r=Math.max(1,Math.floor(t[i]*n*a)),s=o?d.center-r/2:d.bottom-r;e.set({height:r,top:s}),p(e,r,l),e.setCoords()});let u=g(s);u?b(i,v(u,o),c):E(i)})({barHeights:a,soundWaveGroup:c,referenceHeight:h,effectiveHeightMultiplier:F,mirrored:D,roundedRectCorners:M}),O.requestRenderAll()};let r=i(21749),n=i(65685),a=i(60665),o=i(91026),l=i(9571),s=i(68889),d=i(3746),c=i(41879);function u(e,t,i){return Math.floor(e*t*i)}function p(e,t,i){var r;if(!i||"rect"!==e.type)return;let n=null!==(r=e.width)&&void 0!==r?r:0,o=(0,a.soundWaveBarCornerRadius)(n,t);e.set({rx:o,ry:o})}let m=/^sound-bar-(\d+)-(\d+)$/,f=new WeakMap;function x(e){return e.filter(e=>(function(e){var t;let i=e.name;return!(!(null==i?void 0:null===(t=i.startsWith)||void 0===t?void 0:t.call(i,"sound-bar-"))||"seeker-line"===i||i.startsWith("freq-label-"))&&!m.test(i)})(e))}function h(e){return"polygon-sound-wave"===e.name&&"polygon"===e.type}function g(e){if(!e.length)return null;let t=1/0,i=-1/0;return e.forEach(e=>{var r,n;let a=null!==(r=e.top)&&void 0!==r?r:0,o=null!==(n=e.height)&&void 0!==n?n:0;t=Math.min(t,a),i=Math.max(i,a+o)}),{top:t,bottom:i,center:(t+i)/2}}function v(e,t){return new r.fabric.Point(0,t?e.center:e.bottom)}function b(e,t,i){var n,a;E(e);let o=r.fabric.util.transformPoint(t,e.calcTransformMatrix());e.set({left:(null!==(n=e.left)&&void 0!==n?n:0)+(i.x-o.x),top:(null!==(a=e.top)&&void 0!==a?a:0)+(i.y-o.y)}),e.setCoords()}function E(e){e._calcBounds(!0),e.set("dirty",!0),e.setCoords()}function y(e){return e.getObjects().find(e=>h(e))}function w(e){return e.getObjects().find(e=>e.name===c.RADIAL_POLYGON_SOUND_WAVE_NAME&&"polygon"===e.type)}function S(e,t){let i=Math.PI/180*e;return{x:Math.sin(i)*t,y:-Math.cos(i)*t}}function j(e,t){return!!e&&!!t&&1e-4>Math.abs(e.x-t.x)&&1e-4>Math.abs(e.y-t.y)}function C(e,t){return t>1&&j(e[0],e[t-1])&&j(e[t],e[e.length-1])}function N(e){var t,i,r,n,a;let{barHeights:l,polygon:s,referenceHeight:d,canvas:c,numBars:u,heightMultiplier:p=1,baselinePoints:m,mirrored:f=!0,roundCorners:x,barLefts:h,thickness:g}=e;if(!l.length||!s)return;if(x&&(null==h?void 0:h.length)){let e=null!=u?u:h.length,n=d/2,a=[];for(let i=0;i<e;i+=1){let e,r;let o=h[i],s=Math.max(1,Math.floor((null!==(t=l[i])&&void 0!==t?t:0)*d*p));if(f){let t=Math.floor((d-s)/2);e=t,r=t+s}else e=Math.floor(n-s),r=n;a.push({left:o,upperY:e,lowerY:r,height:s})}let m=null!==(i=s.left)&&void 0!==i?i:0,x=null!==(r=s.top)&&void 0!==r?r:0;s.set("objectCaching",!1),s.set("points",(0,o.buildHorizontalPolygonSoundWavePoints)(a,g,!0)),s.set({left:m,top:x}),s.dirty=!0,s.setCoords(),c.requestRenderAll();return}let v=null!=m?m:s.points;if(!(null==v?void 0:v.length))return;s.set("objectCaching",!1);let b=null!==(n=s.left)&&void 0!==n?n:0,E=null!==(a=s.top)&&void 0!==a?a:0,y=d/2,w=v.length,S=w/2,j=null!=u?u:Math.floor(S/2);l.length!==j&&console.warn("Bar heights count (".concat(l.length,") does not match polygon structure (").concat(j," bars). ")+"Using polygon structure count.");let C=Math.max(1,Math.floor(S/j)),N=[];for(let e=0;e<w;e++){let t=v[e],i=t.y;if(e<S){let t=Math.floor(e/C);if(t<j&&t<l.length){let e=Math.max(1,Math.floor(l[t]*d*p));i=f?-e/2+y:y-e}}else{let t=Math.floor((w-1-e)/C);if(t<j&&t<l.length){let e=Math.max(1,Math.floor(l[t]*d*p));i=f?e/2+y:y}}N.push({x:t.x,y:i})}s.set("points",N),s.set({left:b,top:E}),s.dirty=!0,s.setCoords(),c.requestRenderAll()}},82497:function(e,t,i){"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.CIRCLE_CENTER_IMAGE_PULSE_BRIGHTNESS_FACTOR=t.REST_BACKGROUND_PULSE_POSE=t.BACKGROUND_PULSE_OFF=t.HIGH_BACKGROUND_PULSE_CONFIG=t.DEFAULT_BACKGROUND_PULSE_CONFIG=void 0,t.circleCenterImagePulsePose=function(e){return{extraScale:e.extraScale,brightness:e.brightness*t.CIRCLE_CENTER_IMAGE_PULSE_BRIGHTNESS_FACTOR}},t.isBackgroundPulseFeatureEnabled=a,t.designUsesAudioReactiveBackgroundPulse=function(e){let t=e.config.backgroundPulse;return!!((null==t?void 0:t.enabled)&&(null==t?void 0:t.audioReactive))},t.shouldApplyBackgroundPulse=function(e){return!!(a()&&(null==e?void 0:e.enabled))},t.backgroundPulseAmountFromBins=o,t.backgroundPulseAmount=l,t.computeBackgroundPulsePose=s,t.backgroundPulsePoseFromBins=function(e,t){return s(e,o(e,t))},t.backgroundPulsePoseAtFrame=function(e,t,i){return s(e,l(e,t,i))},t.lightenCssColor=function(e,t){if(!(t>0))return e;let i=function(e){let t=e.trim(),i=/^#([0-9a-fA-F]{3})$/.exec(t);if(i){let[e,t,r]=i[1].split("").map(e=>parseInt(e+e,16));return{r:e,g:t,b:r}}let r=/^#([0-9a-fA-F]{6})$/.exec(t);return r?{r:parseInt(r[1].slice(0,2),16),g:parseInt(r[1].slice(2,4),16),b:parseInt(r[1].slice(4,6),16)}:null}(e);if(!i)return e;let r=Math.min(1,Math.max(0,t)),n=Math.round(i.r+(255-i.r)*r),a=Math.round(i.g+(255-i.g)*r),o=Math.round(i.b+(255-i.b)*r);return"#".concat(d(n)).concat(d(a)).concat(d(o))};let r=i(3741),n=i(91883);function a(){return r.featureFlags.backgroundPulse}function o(e,t){return e.enabled&&e.audioReactive&&(null==t?void 0:t.length)?Math.min(2*(0,n.bassRms)(t),1):0}function l(e,t,i){return o(e,null==t?void 0:t[i])}function s(e,i){return e.enabled&&i>0?{extraScale:e.scale*i,brightness:e.brightness*i}:t.REST_BACKGROUND_PULSE_POSE}function d(e){return e.toString(16).padStart(2,"0")}t.DEFAULT_BACKGROUND_PULSE_CONFIG={enabled:!0,scale:.06,brightness:.12,audioReactive:!0},t.HIGH_BACKGROUND_PULSE_CONFIG={enabled:!0,scale:.14,brightness:.28,audioReactive:!0},t.BACKGROUND_PULSE_OFF={...t.DEFAULT_BACKGROUND_PULSE_CONFIG,enabled:!1},t.REST_BACKGROUND_PULSE_POSE={extraScale:0,brightness:0},t.CIRCLE_CENTER_IMAGE_PULSE_BRIGHTNESS_FACTOR=.35},91026:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.HORIZONTAL_POLYGON_META_KEY=void 0,t.buildHorizontalPolygonSoundWavePoints=function(e,t,i){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:4;if(!e.length)return[];let o=[],l=[];e.forEach((l,s)=>{let d=i?(0,r.soundWaveBarCornerRadius)(t,l.height):0;if(!i||d<=0){o.push({x:l.left,y:l.upperY}),t>=1&&o.push({x:l.left+t,y:l.upperY});return}let c=l.upperY+d;if(0===s)o.push({x:l.left,y:c});else{let i=e[s-1],n=(0,r.soundWaveBarCornerRadius)(t,i.height);Math.abs(i.upperY+n-c)>.001&&o.push({x:l.left,y:c})}let u=l.left+t/2,p=l.upperY+d;o.push(...n(u,p,d,Math.PI,2*Math.PI,a,!0))});for(let o=e.length-1;o>=0;o-=1){let s=e[o],d=i?(0,r.soundWaveBarCornerRadius)(t,s.height):0;if(!i||d<=0){t>=1&&l.push({x:s.left+t,y:s.lowerY}),l.push({x:s.left,y:s.lowerY});continue}let c=s.lowerY-d;if(o===e.length-1)l.push({x:s.left+t,y:c});else{let i=e[o+1],n=(0,r.soundWaveBarCornerRadius)(t,i.height);Math.abs(i.lowerY-n-c)>.001&&l.push({x:s.left+t,y:c})}let u=s.left+t/2,p=s.lowerY-d;l.push(...n(u,p,d,0,Math.PI,a,!0))}return[...o,...l]},t.setHorizontalPolygonMeta=function(e,i){e[t.HORIZONTAL_POLYGON_META_KEY]=i},t.getHorizontalPolygonMeta=function(e){if(e)return e[t.HORIZONTAL_POLYGON_META_KEY]};let r=i(60665);function n(e,t,i,r,n,a,o){let l=[],s=o?1:0;for(let o=s;o<=a;o+=1){let s=r+o/a*(n-r);l.push({x:e+i*Math.cos(s),y:t+i*Math.sin(s)})}return l}t.HORIZONTAL_POLYGON_META_KEY="wvHorizontalPolygonMeta"},91883:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_CAMERA_SHAKE_CONFIG=t.BASS_RMS_BIN_FRACTION=void 0,t.isCameraShakeFeatureEnabled=a,t.designUsesAudioReactiveCameraShake=function(e){let t=e.config.cameraShake;return!!((null==t?void 0:t.enabled)&&(null==t?void 0:t.audioReactive))},t.shouldApplyCameraShake=function(e){return!!(a()&&(null==e?void 0:e.enabled))},t.bassRms=o,t.computeShakeOffset=function(e,t,i,r){let n=e*i*.05;return{x:(Math.sin(1.7*n+r)+.5*Math.sin(3.1*n+1.3*r)+.25*Math.sin(5.3*n+.7*r))/1.75*t,y:(Math.cos(1.9*n+.5*r)+.5*Math.cos(2.7*n+1.7*r)+.25*Math.cos(4.1*n+1.1*r))/1.75*t}},t.computeOverscanScale=function(e,t,i){let r=Math.min(e,t);return r>0&&i>0?1+2*i*1.05/r:1},t.effectiveCameraShakeIntensityFromBins=l,t.effectiveCameraShakeIntensity=function(e,t,i){return e.audioReactive?l(e,(0,n.getPrecomputedSpectrumBars)(t,i)):e.intensity};let r=i(3741),n=i(95727);function a(){return r.featureFlags.cameraShake}function o(e){if(!e.length)return 0;let i=Math.max(1,Math.floor(e.length*t.BASS_RMS_BIN_FRACTION)),r=e.slice(0,i);return Math.sqrt(r.reduce((e,t)=>
1e+t*t,0)/r.length)}function l(e,t){let i=e.intensity;return e.audioReactive&&(null==t?void 0:t.length)&&(i*=Math.min(2*o(t),1)),i}t.BASS_RMS_BIN_FRACTION=.2,t.DEFAULT_CAMERA_SHAKE_CONFIG={enabled:!0,intensity:12,frequency:1.5,audioReactive:!0,seed:42}},81234:function(e,t,i){"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.generateCycleColorMap=t.generateColorMap=void 0,t.findGradientColor=a,t.getPositionT=function(e,t,i,r,n){let a;let o=i>0?e/i:0,l=r>0?t/r:0;switch(n){case"to-right":default:a=o;break;case"to-left":a=1-o;break;case"to-bottom":a=l;break;case"to-top":a=1-l;break;case"to-bottom-right":a=(o+l)/2;break;case"to-bottom-left":a=(1-o+l)/2;break;case"to-top-right":a=(o+(1-l))/2;break;case"to-top-left":a=(1-o+(1-l))/2;break;case"radial":a=Math.hypot(o-.5,l-.5)/Math.hypot(.5,.5)}return Math.max(0,Math.min(1,a))},t.getColorAtT=function(e,t){if(1===e.length)return e[0];let i=Math.max(0,Math.min(1,t))*(e.length-1);return a(e[Math.floor(i)],e[Math.ceil(i)],i%1)},t.getCyclicColorAtBarIndex=o;let n=(r=i(30733))&&r.__esModule?r:{default:r};function a(e,t,i){let r={r:parseInt(e.substring(1,3),16),g:parseInt(e.substring(3,5),16),b:parseInt(e.substring(5,7),16)},n={r:parseInt(t.substring(1,3),16),g:parseInt(t.substring(3,5),16),b:parseInt(t.substring(5,7),16)},a={r:Math.floor(r.r+(n.r-r.r)*i),g:Math.floor(r.g+(n.g-r.g)*i),b:Math.floor(r.b+(n.b-r.b)*i)};return"#".concat(a.r.toString(16).padStart(2,"0")).concat(a.g.toString(16).padStart(2,"0")).concat(a.b.toString(16).padStart(2,"0"))}function o(e,t,i){if(1===e.length)return e[0];let r=[...e,e[0]],n=i/t*(r.length-1);return a(r[Math.floor(n)],r[Math.ceil(n)],n%1)}t.generateColorMap=(0,n.default)((e,t)=>{let i=[];for(let r=0;r<t;r++){let n=r/t*(e.length-1),o=Math.floor(n),l=Math.ceil(n);i[r]=a(e[o],e[l],n%1)}return i},(e,t)=>"".concat(e.join()).concat(t)),t.generateCycleColorMap=(0,n.default)((e,t)=>{let i=[];for(let r=0;r<t;r++)i[r]=o(e,t,r);return[...i,...i.reverse()]},(e,t)=>"".concat(e.join()).concat(t))},9571:function(e,t){"use strict";function i(e,t){return Math.max(1,Math.ceil(e/2/t))}Object.defineProperty(t,"__esModule",{value:!0}),t.getDottedBarsMaxHalfRows=i,t.getDottedBarsMaxRowsPerColumn=function(e,t,r){let n=i(e,t);return r?2*n:Math.max(1,Math.ceil(e/t))},t.getDottedBarsVisibleDotCount=function(e,t){return Math.floor(e/t)},t.isDottedBarRowVisible=function(e,t,i,r){return!(t<=0)&&(i?e<r?e<Math.ceil(t/2):e-r<Math.floor(t/2):e<t)},t.getDottedBarCenterY=function(e,t,i,r,n){let a=t/2;return!r||e<n?a-(e+.5)*i:a+(e-n+.5)*i}},97373:function(e,t){"use strict";function i(e,t,i){let r=e[t];for(let n=t;n<t+i;n++)e[n]<r&&(r=e[n]);return r}Object.defineProperty(t,"__esModule",{value:!0}),t.findQuietest=i,t.eachWorkableWaveformData=function(e){let{waveformData:t,sampleDistance:r,width:n,iterator:a}=e;if(!t||0===t.length)throw Error("eachWorkableWaveformData: waveformData is required and cannot be empty");for(let e=0;e<n;e+=r){let o=Math.floor(e*t.length/n);a({data:Math.floor((i(t,o,r)+t[o])/2),index:e,lastData:t[o]})}}},68889:function(e,t,i){"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.generateCircleSoundWaveFill=function(e,t,i){return t.length?1===t.length?t[0]:null==i.waveGradientDirection?s(e,t,i.referenceWidth):(0,l.generateFillBackground)(e,t,i.waveGradientDirection):"#00000000"},t.getCircleFillPolarAlignmentOffsets=d,t.alignCircleFillToPolarOrigin=function(e,t){if("string"==typeof e)return e;let{offsetX:i,offsetY:r}=d(t);if(e instanceof n.fabric.Pattern)return new n.fabric.Pattern({source:e.source,repeat:e.repeat,offsetX:i,offsetY:r});if(e instanceof n.fabric.Gradient){var a;return new n.fabric.Gradient({type:e.type,gradientUnits:e.gradientUnits,coords:{...e.coords},colorStops:(null!==(a=e.colorStops)&&void 0!==a?a:[]).map(e=>({...e})),offsetX:i,offsetY:r})}return e},t.syncPolygonCircleFillPolarAlignment=function(e,t){var i,r,a;let o=e.fill;if(!o||"string"==typeof o||!(o instanceof n.fabric.Pattern)&&!(o instanceof n.fabric.Gradient))return;let l=null!==(i=e.pathOffset)&&void 0!==i?i:{x:0,y:0},{offsetX:s,offsetY:c}=d({frameDimensions:t,polygonWidth:null!==(r=e.width)&&void 0!==r?r:t.width,polygonHeight:null!==(a=e.he
1ight)&&void 0!==a?a:t.height,pathOffsetX:l.x,pathOffsetY:l.y});o.offsetX=s,o.offsetY=c};let n=i(21749),a=(r=i(30733))&&r.__esModule?r:{default:r},o=i(81234),l=i(46301);a.default.Cache=Map;let s=(0,a.default)((e,t,r)=>{let{width:a,height:l}=e,s=function(e,t){if("undefined"!=typeof document){let i=document.createElement("canvas");return i.width=e,i.height=t,i}let r=n.fabric.document;if(r){let i=r.createElement("canvas");return i.width=e,i.height=t,i}let{createCanvas:a}=i(18462);return a(e,t)}(a,l),d=s.getContext("2d");if(!d)return new n.fabric.Pattern({source:s,repeat:"no-repeat"});let c=a/2,u=l/2,p=d.createImageData(a,l),{data:m}=p;for(let e=0;e<l;e+=1)for(let i=0;i<a;i+=1){let n=180*Math.atan2(i-c,-(e-u))/Math.PI;n<0&&(n+=360);let l=(0,o.getCyclicColorAtBarIndex)(t,r,n/360*r),s=parseInt(l.substring(1,3),16),d=parseInt(l.substring(3,5),16),p=parseInt(l.substring(5,7),16),f=(e*a+i)*4;m[f]=s,m[f+1]=d,m[f+2]=p,m[f+3]=255}return d.putImageData(p,0,0),new n.fabric.Pattern({source:s,repeat:"no-repeat"})},(e,t,i)=>"".concat(e.width,"x").concat(e.height,":").concat(i,":").concat(t.join()));function d(e){let{frameDimensions:t,polygonWidth:i,polygonHeight:r,pathOffsetX:n,pathOffsetY:a}=e;return{offsetX:-n+i/2-t.width/2,offsetY:-a+r/2-t.height/2}}},11872:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.generateColorStops=void 0,t.generateColorStops=e=>{let t=[{color:e[0],offset:0}];for(let i=1;i<e.length;i++)t.push({offset:Number((i/(e.length-1)).toFixed(3)),color:e[i]});return t}},59571:function(e,t,i){"use strict";t.B=void 0;let r=i(21749),n=i(38986),a=i(81234),o=i(97373),l=i(46301),s=i(65685),d=i(44074),c=i(9571);t.B=function(e){let{waveformConfig:t,shownWaveformData:i}=e,u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,{space:p,thickness:m,reference:f,waveColors:x,waveGradientDirection:h,...g}=t;if(!x.length)return[];let v=null!=h?h:"to-right",b=[],E=n.SOUNDWAVE_REFERENCE_HEIGHT,y=Math.max(n.MIN_DOTTED_BAR_THICKNESS,m),w=y/2,S=(0,d.isMirroredSoundWaveStyle)(t.style),j=(0,c.getDottedBarsMaxHalfRows)(E,y),C=(0,c.getDottedBarsMaxRowsPerColumn)(E,y,S),N=(0,s.getEffectiveHeightMultiplier)(g),_=null!=g.height&&"number"==typeof g.height&&g.height>0;return(0,o.eachWorkableWaveformData)({waveformData:i,sampleDistance:p+y,width:f.width,iterator:e=>{let t,{data:i,index:o}=e;t=Math.max(t=_?(0,s.legacyDataToBarGeometry)(i,n.SOUNDWAVE_REFERENCE_HEIGHT,g.height).height:(0,s.dataToBarGeometry)(i,E,N).height,y);let d=(0,c.getDottedBarsVisibleDotCount)(t,y),p=o+w;for(let e=0;e<C;e+=1){let t=(0,c.getDottedBarCenterY)(e,E,y,S,j),i=(0,c.isDottedBarRowVisible)(e,d,S,j),n=(0,a.getPositionT)(p,t,f.width,E,v),s=x.length>1?(0,a.getColorAtT)(x,n):x[0],m=new r.fabric.Circle({left:p,top:t,radius:w,originX:"center",originY:"center",fill:(0,l.generateFillBackground)(y,[s]),name:"sound-bar-".concat(o,"-").concat(e),opacity:i?u:0});b.push(m)}}}),b}},46301:function(e,t,i){"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.generateFillBackground=void 0;let n=i(21749),a=(r=i(30733))&&r.__esModule?r:{default:r},o=i(11872),l=i(93795);function s(e){return"number"==typeof e?{width:e,height:e}:e}a.default.Cache=Map,t.generateFillBackground=(0,a.default)(function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:l.DEFAULT_GRADIENT_DIRECTION;if(!t.length)return"#00000000";if(1===t.length)return t[0];let r=s(e);return new n.fabric.Gradient((0,l.isRadialGradientDirection)(i)?{colorStops:(0,o.generateColorStops)(t),type:"radial",offsetX:0,offsetY:0,coords:(0,l.getRadialGradientCoords)(r.width,r.height)}:{colorStops:(0,o.generateColorStops)(t),type:"linear",offsetX:0,offsetY:0,coords:(0,l.getLinearGradientCoords)(r.width,r.height,i)})},(e,t,i)=>{let r=s(e);return[r.width,r.height,i,...t]})},41879:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.generateRadialPolygonSoundWave=t.RADIAL_POLYGON_SOUND_WAVE_NAME=void 0;let r=i(21749),n=i(38986),a=i(97373),o=i(68889),l=i(3746);function s(e,t){let i=Math.PI/180*e;return{x:Math.sin(i)*t,y:-Math.cos(i)*t}}t.RADIAL_POLYGON_SOUND_WAVE_NAME="radial-polygon-sound-wave",t.generateRadialPolygonSoundWave=function(e){let{waveformConfig:i,shownWaveformData:d}=e,c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,{waveColors:u,reference:p,space:m,thickness:f,circleRadius:x=0,circleBarHeight:h=0,waveGradientDirection:g}=i;if(!u.length)return[];let v=(0,l.calculateCircleFrameDimensions)(x,h),b=[],E=[];if((0,a.eachWorkableWaveformData)({waveformData:d,sampleDistance:m+f,width:p.width,iterator:e=>{let{data:t,index:i}=e,r=i/p.width*360,a=(x||0)+(n.SAMPLE_HEIGHT-t)/n.SAMPLE_HEIGHT*(h||1);b.push(s(r,a)),E.push(s(r,x||0))}}),!b.length)return[];let y=[...b.length>1?[...b,{...b[0]}]:b,...E.length>1?[{...E[0]},...E.slice().reverse()]:E],w=y.map(e=>e.x),S=y.map(e=>e.y),j=Math.min(...w),C=Math.max(...w),N=Math.min(...S),_=Math.max(...S),R=(j+C)/2,A=(N+_)/2,k=(0,o.generateCircleSoundWaveFill)(v,u,{waveGradientDirection:g,referenceWidth:p.width}),I=(0,o.alignCircleFillToPolarOrigin)(k,{frameDimensions:v,polygonWidth:C-j,polygonHeight:_-N,pathOffsetX:R,pathOffsetY:A});return[new r.fabric.Rect({...p,width:v.width,height:v.height,fill:"#ffffff00",name:n.CIRCLE_SOUNDWAVE_FRAME_RECT_NAME,originX:"center",originY:"center",top:0,left:0}),new r.fabric.Polygon(y,{fill:I,name:t.RADIAL_POLYGON_SOUND_WAVE_NAME,opacity:c,originX:"center",originY:"center",top:A,left:R})]}},3746:function(e,t,i){"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.generateRadialSoundWaveRects=t.calculateCircleFrameDimensions=void 0;let r=i(21749),n=i(38986),a=i(81234),o=i(97373),l=i(46301),s=i(60665);t.calculateCircleFrameDimensions=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=2*(e+t);return{width:i,height:i}},t.generateRadialSoundWaveRects=function(e){let{waveformConfig:i,shownWaveformData:d}=e,c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,{waveColors:u,reference:p,space:m,thickness:f,circleRadius:x=0,circleBarHeight:h=0,waveGradientDirection:g}=i;if(!u.length)return[];let v=null==g?(0,a.generateCycleColorMap)(u,p.width):null,b=(0,s.shouldRoundSoundWaveRectCorners)(i),E=(0,t.calculateCircleFrameDimensions)(x,h),y=[new r.fabric.Rect({...p,width:E.width,height:E.height,fill:"#ffffff00",name:n.CIRCLE_SOUNDWAVE_FRAME_RECT_NAME,originX:"center",originY:"center",top:0,left:0})];return(0,o.eachWorkableWaveformData)({waveformData:d,sampleDistance:m+f,width:p.width,iterator:e=>{let t,{data:i,index:o}=e,d=o/p.width*360,m=(n.SAMPLE_HEIGHT-i)/n.SAMPLE_HEIGHT*(h||1),E=-Math.cos(Math.PI/180*d)*((x||0)+m/2),w=Math.sin(Math.PI/180*d)*((x||0)+m/2),S=Math.max(m,4),j=b?(0,s.soundWaveBarCornerRadius)(f,S):void 0;if(null!=v)t=v[o];else{let e=Math.max(1,x+h),i=2*e,r=(0,a.getPositionT)(w+e,E+e,i,i,g);t=u.length>1?(0,a.getColorAtT)(u,r):u[0]}let C=new r.fabric.Rect({angle:d,top:E,left:w,width:f,height:S,fill:(0,l.generateFillBackground)(f,[t]),name:"sound-bar-".concat(o),opacity:c,originX:"center",originY:"center",...void 0!==j?{rx:j,ry:j}:{}});y.push(C)}}),y}},74194:function(e,t,i){"use strict";t.v=void 0;let r=i(21749),n=i(38986),a=i(81234),o=i(97373),l=i(46301),s=i(65685),d=i(44074),c=i(60665),u=i(91026);t.v=function(e){let{waveformConfig:t,shownWaveformData:i}=e,p=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,{space:m,thickness:f,reference:x,waveColors:h,waveGradientDirection:g,...v}=t;if(!h.length)return[];let b=null!=g?g:"to-right",E=[],y=[],w=[],S=(0,c.shouldRoundSoundWaveRectCorners)(t),j=0===m,C=(0,d.isMirroredSoundWaveStyle)(t.style),N=n.SOUNDWAVE_REFERENCE_HEIGHT/2,_=(0,s.getEffectiveHeightMultiplier)(v),R=null!=v.height&&"number"==typeof v.height&&v.height>0;if((0,o.eachWorkableWaveformData)({waveformData:i,sampleDistance:m+f,width:x.width,iterator:e=>{let t,i,o,{data:d,index:u}=e;if(R){let e=(0,s.legacyDataToBarGeometry)(d,n.SOUNDWAVE_REFERENCE_HEIGHT,v.height);i=e.height,t=C?e.top:Math.floor(N-i)}else{let e=(0,s.dataToBarGeometryWithShape)(d,n.SOUNDWAVE_REFERENCE_HEIGHT,_,C);t=e.top,i=e.height}if(i<=0&&(i=1,t=Math.floor((n.SOUNDWAVE_REFERENCE_HEIGHT-i)/2)),j){let e=C?t:Math.floor(N-i),r=C?t+i:N;y.push({left:u,upperY:e,lowerY:r,height:i}),w.push(u);return}S&&(o=(0,c.soundWaveBarCornerRadius)(f,i));let m=t+i/2,g=(0,a.getPositionT)(u,m,x.width,n.SOUNDWAVE_REFERENCE_HEIGHT,b),A=h.length>1?(0,a.getColorAtT)(h,g):h[0],k=new r.fabric.Rect({left:u,top:t,width:f,height:i,fill:(0,l.generateFillBackground)(f,[A]),name:"sound-bar-".concat(u),opacity:p,...null!=o?{rx:o,ry:o}:{}});E.push(k)}}),!j)return E;let A=new r.fabric.Polygon((0,u.buildHorizontalPolygonSoundWavePoints)(y,f,S),{fill:(0,l.generateFillBackground)({width:x.width,height:n.SOUNDWAVE_REFERENCE_HEIGHT},h,b),name:"polygon-sound-wave",opacity:p});return(0,u.setHorizontalPolygonMeta)(A,{numBars:y.length,barThickness:f,roundCorners:S,barLefts:w}),[A]}},54530:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}
1),t.getDefaultImageRectParams=void 0;let r=i(38986);t.getDefaultImageRectParams=function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return{top:i+t/2,left:n+e/2,width:e+10,height:t+t/e*10,scaleX:1,scaleY:1,originX:"center",originY:"center",selectable:!0,padding:0,lockUniScaling:!0,name:r.BG_IMAGE_OBJECT_NAME}}},93795:function(e,t){"use strict";function i(e,i){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.DEFAULT_GRADIENT_DIRECTION;switch(r){case"to-left":return{x1:e,y1:0,x2:0,y2:0};case"to-bottom":return{x1:0,y1:0,x2:0,y2:i};case"to-top":return{x1:0,y1:i,x2:0,y2:0};case"to-bottom-right":return{x1:0,y1:0,x2:e,y2:i};case"to-bottom-left":return{x1:e,y1:0,x2:0,y2:i};case"to-top-right":return{x1:0,y1:i,x2:e,y2:0};case"to-top-left":return{x1:e,y1:i,x2:0,y2:0};default:return{x1:0,y1:0,x2:e,y2:0}}}function r(e,t){let i=e/2,r=t/2;return{x1:i,y1:r,r1:0,x2:i,y2:r,r2:Math.hypot(i,r)}}Object.defineProperty(t,"__esModule",{value:!0}),t.getGradientDirectionCoords=t.GRADIENT_DIRECTIONS=t.DEFAULT_GRADIENT_DIRECTION=void 0,t.isRadialGradientDirection=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.DEFAULT_GRADIENT_DIRECTION;return"radial"===e},t.getLinearGradientCoords=i,t.getRadialGradientCoords=r,t.getRadialGradientRadius=function(e,t){return r(e,t).r2},t.DEFAULT_GRADIENT_DIRECTION="to-right",t.GRADIENT_DIRECTIONS=[{value:"to-top-left",label:"Top left",kind:"linear",rotation:225,gridColumn:1,gridRow:1},{value:"to-top",label:"Top",kind:"linear",rotation:270,gridColumn:2,gridRow:1},{value:"to-top-right",label:"Top right",kind:"linear",rotation:315,gridColumn:3,gridRow:1},{value:"to-left",label:"Left",kind:"linear",rotation:180,gridColumn:1,gridRow:2},{value:"radial",label:"Radial",kind:"radial",rotation:0,gridColumn:2,gridRow:2},{value:"to-right",label:"Right",kind:"linear",rotation:0,gridColumn:3,gridRow:2},{value:"to-bottom-left",label:"Bottom left",kind:"linear",rotation:135,gridColumn:1,gridRow:3},{value:"to-bottom",label:"Bottom",kind:"linear",rotation:90,gridColumn:2,gridRow:3},{value:"to-bottom-right",label:"Bottom right",kind:"linear",rotation:45,gridColumn:3,gridRow:3}],t.getGradientDirectionCoords=i},72871:function(e,t,i){"use strict";t.$7=void 0,t.Zk=function(e,i){let{allowFreeDownload:n,freeTierSizes:a=t.$7,size:o,fileType:l}=i;return!!(e.paidAt||n||(l===r.ExportFileType.PNG||l===r.ExportFileType.JPG)&&a.includes(o))};let r=i(19458);t.$7=[r.ExportSize.optimized]},60665:function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.canShowRoundedBarsToggle=function(e){var t;let i=null!==(t=e.style)&&void 0!==t?t:r.SoundWaveStyle.horizontal_simple;return i===r.SoundWaveStyle.circle_simple||(0,n.isHorizontalBarStyle)(i)},t.shouldRoundSoundWaveRectCorners=function(e){var t;if(!e.roundedBars)return!1;let i=null!==(t=e.style)&&void 0!==t?t:r.SoundWaveStyle.horizontal_simple;return i===r.SoundWaveStyle.circle_simple||(0,n.isHorizontalBarStyle)(i)},t.usesHorizontalPolygonSoundWave=function(e){var t;return!!(0,n.isHorizontalBarStyle)(e.style)&&(null!==(t=e.space)&&void 0!==t?t:0)===0},t.soundWaveBarCornerRadius=function(e,t){return Math.min(e/2,t/2)};let r=i(19458),n=i(44074)},95727:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SpectrumChunkBuffer=t.SPECTRUM_IPC_CHUNK_FRAMES=void 0,t.spectrumRowsForWorkerPool=function(e){return e.slice()},t.partitionFrameRanges=function(e,t){if(e<=0||t<=0)return[];let i=Math.min(t,e),r=Math.floor(e/i),n=e%i,a=0,o=[];for(let e=0;e<i;e+=1){let e=r+(n>0?1:0);n>0&&(n-=1),o.push({start:a,end:a+e}),a+=e}return o},t.getPrecomputedSpectrumBars=function(e,t){return e?e instanceof i?e.getFrame(t):e[t]:void 0},t.SPECTRUM_IPC_CHUNK_FRAMES=1500;class i{append(e,t){if(0===t.length)return;if(0===this.rows.length){this.offset=e,this.rows=t.slice();return}let i=this.offset+this.rows.length;if(e!==i)throw Error("Spectrum chunk out of order: expected frame ".concat(i,", got ").concat(e));for(let e=0;e<t.length;e+=1)this.rows.push(t[e])}getFrame(e){return this.rows[e-this.offset]}constructor(){this.offset=0,this.rows=[]}}t.SpectrumChunkBuffer=i},91162:function(e,t,i){"use strict";t.JF=function(e,t,i){let{barHeightByLeft:n,diameter:a}=u(i),o=(0,s.isMirroredSoundWaveStyle)(i.waveformConfig.style),l=(0,d.getDottedBarsMaxHalfRows)(r.SOUNDWAVE_REFERENCE_HEIGHT,a),p=new Map;
1e.getObjects().forEach(e=>{let t=e.name,i=null==t?void 0:t.match(c);if(!i)return;let r=parseInt(i[1],10),n=p.get(r);n||(n=[],p.set(r,n)),n.push(e)});let m=[...p.keys()].sort((e,t)=>e-t),f=Math.round((m.length||1)*t);m.forEach((e,t)=>{var i;let r=p.get(e);if(!r)return;let s=null!==(i=n.get(e))&&void 0!==i?i:0,u=(0,d.getDottedBarsVisibleDotCount)(s,a),m=t<f?1:.5;r.forEach(e=>{var t;let i=null===(t=e.name)||void 0===t?void 0:t.match(c);if(!i)return;let r=parseInt(i[2],10),n=(0,d.isDottedBarRowVisible)(r,u,o,l)?m:0;e.opacity!==n&&e.set("opacity",n)})})},t.Jd=function(e,t){let{thickness:i,reference:a,waveColors:l}=t;if(!l.length)return;let s=Math.max(r.MIN_DOTTED_BAR_THICKNESS,i),d=(0,n.generateColorMap)(l,a.width);e.getObjects().forEach(e=>{let t=e.name,i=null==t?void 0:t.match(c);if(!i)return;let r=d[parseInt(i[1],10)];void 0!==r&&e.set("fill",(0,o.generateFillBackground)(s,[r]))})},t.t=function(e,t){let{barHeightByLeft:i,diameter:n}=u(t),a=(0,s.isMirroredSoundWaveStyle)(t.waveformConfig.style),o=(0,d.getDottedBarsMaxHalfRows)(r.SOUNDWAVE_REFERENCE_HEIGHT,n);e.getObjects().forEach(e=>{var t;let r=e.name,l=null==r?void 0:r.match(c);if(!l)return;let s=parseInt(l[1],10),u=parseInt(l[2],10),p=null!==(t=i.get(s))&&void 0!==t?t:0,m=(0,d.getDottedBarsVisibleDotCount)(p,n),f=(0,d.isDottedBarRowVisible)(u,m,a,o);e.set("opacity",f?1:0)})};let r=i(38986),n=i(81234),a=i(97373),o=i(46301),l=i(65685),s=i(44074),d=i(9571),c=/^sound-bar-(\d+)-(\d+)$/;function u(e){let{waveformConfig:{space:t,thickness:i,reference:n,...o},shownWaveformData:s}=e,d=r.SOUNDWAVE_REFERENCE_HEIGHT,c=Math.max(r.MIN_DOTTED_BAR_THICKNESS,i),u=(0,l.getEffectiveHeightMultiplier)(o),p=null!=o.height&&"number"==typeof o.height&&o.height>0,m=new Map;return(0,a.eachWorkableWaveformData)({waveformData:s,sampleDistance:t+c,width:n.width,iterator:e=>{let t,{data:i,index:n}=e;t=Math.max(t=p?(0,l.legacyDataToBarGeometry)(i,r.SOUNDWAVE_REFERENCE_HEIGHT,o.height).height:(0,l.dataToBarGeometry)(i,d,u).height,c),m.set(n,t)}}),{barHeightByLeft:m,diameter:c}}},14890:function(e,t,i){"use strict";t.a=function(e){if(null==e)return;let{color:t,blur:i}=e;if("string"==typeof t&&"number"==typeof i)return{shadow:new r.fabric.Shadow({color:t,blur:i,offsetX:0,offsetY:0})}};let r=i(21749)},43328:function(e,t,i){"use strict";t.Zd=function(e){var t;return null!==(t=function(e){var t;if(!e)return e;let i=/^Job \S+ failed: ([\s\S]+)$/.exec(e),n=null!==(t=null==i?void 0:i[1])&&void 0!==t?t:e;return(0,r.sanitizeTranscriptionJobStoredResult)(n)}(e))&&void 0!==t?t:r.TRANSCRIPTION_FAILED_GENERIC_MESSAGE};let r=i(92333)},29362:function(e,t,i){"use strict";t.j=void 0;let r=i(4172),n=e=>{if(!e)return;let t=Date.parse("".concat(e,"T23:59:59.999Z"));if(!Number.isNaN(t))return t};t.j=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Date.now(),{state:i,cancellation_effective_date:a}=e,o=n(a);return void 0!==o&&t>o?r.WavevisualSubscriptionState.expired:void 0!==o&&t<=o&&(i===r.PaddleSubscriptionState.cancelled||i===r.PaddleSubscriptionState.active)?r.WavevisualSubscriptionState.grace_period:i===r.PaddleSubscriptionState.deleted||i===r.PaddleSubscriptionState.refunded?r.WavevisualSubscriptionState.expired:i===r.PaddleSubscriptionState.cancelled?void 0===o?r.WavevisualSubscriptionState.expired:r.WavevisualSubscriptionState.grace_period:i===r.PaddleSubscriptionState.active||"paused"===i||"past_due"===i||"trialing"===i?r.WavevisualSubscriptionState.active:r.WavevisualSubscriptionState.expired}},11242:function(e,t,i){"use strict";t.QL=void 0,t.FG=function(e){var i;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.QL;if(!(null==e?void 0:null===(i=e.tracks)||void 0===i?void 0:i.length))return{};let a=(0,r.normalizeCaptionsConfigLayouts)(e),o={};return a.tracks.forEach((e,t)=>{var i,r,l;let s=null===(i=a.layouts)||void 0===i?void 0:i.find(t=>t.id===e.layoutId),d=e.id||"caption-track-".concat(t+1);o[d]={id:d,groupId:null!==(r=e.groupId)&&void 0!==r?r:"default",defaultText:e.cues.map(e=>e.text).filter(Boolean).join(" "),textNodeName:null!==(l=null==s?void 0:s.textNodeName)&&void 0!==l?l:n,cues:e.cues.map((e,t)=>({id:"".concat(d,"-cue-").concat(t),startMs:e.startMs,endMs:e.endMs,text:e.text,fadeInMs:e.fadeInMs,fadeOutMs:e.fadeOutMs}))}}),o},t.Qo=function(e){return e?Object.values(e).reduce((e,t)=>
1e+t.cues.length,0):0};let r=i(40568);t.QL="caption-track-default"},95058:function(e){e.exports={deleteColor:"ColorPicker_deleteColor__uRXsG","color-picker-wrapper":"ColorPicker_color-picker-wrapper__L0xd1",isMobile:"ColorPicker_isMobile__8iAcv",colorCircleWrapper:"ColorPicker_colorCircleWrapper__iDzNs",colorCircle:"ColorPicker_colorCircle__A3dxw",readonly:"ColorPicker_readonly__Mv9x8"}},14846:function(e){e.exports={sidesheetItem:"SideSheet_sidesheetItem__lDm9Q",sidesheetItemIcon:"SideSheet_sidesheetItemIcon__jFXNH"}},49695:function(e){e.exports={tabMenu:"Menu_tabMenu__o4nch",tabMenuCollapsed:"Menu_tabMenuCollapsed__dSQDk",transparentBackground:"Menu_transparentBackground__H6Qqa"}},48943:function(e){e.exports={tabsContentWrapper:"Tabs_tabsContentWrapper__L8_1N"}},14806:function(e){e.exports={trigger:"CanvasSizeHeaderControl_trigger__6W_Mq"}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.