1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6867],{83327:function(e,t,n){"use strict";n.d(t,{z:function(){return c}});var i=n(52322),r=n(2784),o=n(61465),a=n(61335),l=n(64603),u=n(20324);let s=(0,a.j)("inline-flex items-center justify-center gap-2 whitespace-nowrap text-sm font-medium transition-all duration-150 btn-focus-ring btn-pressable disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{success:"btn-surface-success",default:"btn-surface-primary",destructive:"btn-surface-danger",outline:"btn-surface-neutral",secondary:"btn-surface-soft",ghost:"btn-surface-ghost",link:"btn-surface-link"},size:{default:"h-10 rounded-lg px-4",sm:"h-8 rounded-md px-3",lg:"h-12 rounded-[10px] px-6 text-base font-semibold",icon:"h-10 w-10 rounded-lg"}},defaultVariants:{variant:"default",size:"default"}}),c=r.forwardRef((e,t)=>{let{className:n,variant:r,size:a,asChild:c=!1,loading:d,disabled:f,children:m,..._}=e,v=c?o.g7:"button",E=f||d;return(0,i.jsxs)(v,{className:(0,u.m6)(s({variant:r,size:a,className:n})),ref:t,disabled:E,..._,children:[d&&(0,i.jsx)(l.frZ,{className:"animate-spin mr-2",fontSize:18}),m]})});c.displayName="Button"},43919:function(e,t,n){"use strict";n.d(t,{t:function(){return o}});var i=n(45137),r=n(17088);function o(){let{designId:e}=(0,i.h)(),t=(0,r.G)(e=>{var t;return null===(t=e.document)||void 0===t?void 0:t.id});return{parentId:null!=t?t:e,parentCollection:t?"video_projects":"designs",videoProjectId:t,designId:e}}},10289:function(e,t,n){"use strict";n.d(t,{M:function(){return a}});var i,r,o=n(2784);(i=r||(r={})).initial="initial",i.successful="successful",i.errored="errored",i.pending="pending",i.cancelled="cancelled",i.processing="processing";let a=e=>{let[t,n]=(0,o.useState)(e||r.initial);return(0,o.useMemo)(()=>({isSuccessful:t===r.successful,isErrored:t===r.errored,isPending:t===r.pending,isInitial:t===r.initial,isProcessing:t===r.processing,setSuccess(){n(r.successful)},setError(){n(r.errored)},setPending(){n(r.pending)},setInitial(){n(r.initial)},setProcessing(){n(r.processing)}}),[t])}},38420:function(e,t,n){"use strict";n.d(t,{b:function(){return a}});var i=n(19458),r=n(30118),o=n(80920);let a=()=>{var e,t;let n=(0,o.e1)(),{selectedSource:a}=(0,r._i)();return null!==(t=null!==(e=null==n?void 0:n.selectedSource)&&void 0!==e?e:a)&&void 0!==t?t:i.SourceType.SAMPLE}},62487:function(e,t,n){"use strict";n.d(t,{P:function(){return p},L:function(){return A}});var i=n(52322),r=n(2784),o=n(40381),a=n(18997),l=n(25139),u=n(23083),s=n(38986),c=n(30118),d=n(80920),f=n(118),m=n(2431),_=n(43919),v=n(86767);async function E(e){var t,n,i;let r=null!==(t=null==e?void 0:e.maxWaitMs)&&void 0!==t?t:3e4,o=null!==(n=null==e?void 0:e.pollMs)&&void 0!==n?n:500,a=null!==(i=null==e?void 0:e.isMounted)&&void 0!==i?i:()=>!0,l=0;for(;a()&&l<r;){let{saveState:e}=f.r.getState();if(e===f.S.SAVED)return{ok:!0,waitedMs:l};if(e===f.S.ERRORED)return{ok:!1,reason:"errored",waitedMs:l,saveState:e};await (0,v.wait)(o),l+=o}return a()?{ok:!1,reason:"timeout",waitedMs:l,saveState:f.r.getState().saveState}:{ok:!1,reason:"unmounted",waitedMs:l}}var I=n(61019);let h=(0,r.createContext)(null),p=e=>{let{children:t}=e,{applyWaveformEditorPatch:n}=(0,c._i)(),{setNotSaved:v}=(0,f.r)(),{parentId:p,parentCollection:A}=(0,_.t)(),{designJobs:g,isLoading:R,subscribeToDesignJobs:T,getDesignJobs:S}=(0,m.YZ)(),C=(0,r.useRef)(!1);(0,r.useEffect)(()=>(C.current=!0,()=>{C.current=!1}),[]),(0,r.useEffect)(()=>{if(!p||"string"!=typeof p)return;let e=T(p,A);return()=>{e()}},[p,A,T]);let O=(0,r.useCallback)(e=>{if(e.status!==o.E.completed){(0,a.H)(Error("Job status not completed: ".concat(e.status)));return}let t=d.$X.getState().waveforms;t.length>0?n({waveforms:t.map(e=>e.audioResourceId===s.AUDIO_ORIGINAL_FILE_ID||e.audioResourceId&&e.audioResourceId.startsWith("".concat(s.AUDIO_ORIGINAL_FILE_ID,"_"))?{...e,audioResourceId:s.AUDIO_CONVERTED_MP3_FILE_ID}:e)},"none"):n({audioResourceId:s.AUDIO_CONVERTED_MP3_FILE_ID},"none"),v()},[n,v]),N=(0,r.useCallback)(async(e,t)=>{if(!e||!C.current)return;let n=await E({isMounted:()=>C.current});if(!n.ok){"unmounted"!==n.reason&&(0,a.H)(Error("startConvertAudio: design save ".concat(n.reason," before convert")),{extra:{targetDesignId:e,fileName:t,saveState:n.saveState,waitedMs:n.waitedMs}});return}let i=t.toLowerCase();if(!i.endsWith(".mp3")&&!i.endsWith(".wav"))try{let t="".concat(l.es).concat(e);await (0,u.Ql)({type:l.du.CONVERT_AUDIO},e);
1let n=await m.YZ.getState().waitForDesignJobCompletion(t,e);return n&&C.current&&O(n),n}catch(n){(0,a.H)(n);let t=(0,I.wG)(n);if(t)return{result:t,status:o.E.errored,name:"".concat(l.es).concat(e),startedAt:new Date().toISOString(),schemaVersion:""}}},[O]),D=r.useMemo(()=>({startConvertAudio:N,getDesignJobs:S,designJobs:g,isLoading:R}),[N,S,g,R]);return(0,i.jsx)(h.Provider,{value:D,children:t})},A=()=>{let e=(0,r.useContext)(h);if(!e)throw Error("useAsyncJob must be used within AsyncJobProvider");return e}},45137:function(e,t,n){"use strict";n.d(t,{c:function(){return o},h:function(){return a}});var i=n(83553),r=n(2784);let o=(0,r.createContext)({setIsPaid:()=>null,saveEverything:()=>Promise.resolve(void 0),setCanvas:()=>null,setShouldReplaceDesign:()=>null,setEditMode:()=>null,canvas:null,editMode:i.uz.Locked}),a=()=>{let e=(0,r.useContext)(o);if(!e)throw Error("useEditorContext must be used within an EditorContextProvider");return e}},52522:function(e,t,n){"use strict";n.d(t,{Ki:function(){return et},hl:function(){return i.h}});var i=n(45137),r=n(52322),o=n(5632),a=n(2784),l=n(18149),u=n.n(l),s=n(17620),c=n.n(s),d=n(54073),f=n.n(d),m=n(42670),_=n(75652),v=n.n(_),E=n(19458),I=n(44041),h=n(7355),p=n(16572),A=n(18997),g=n(82066),R=n(6993),T=n(23083),S=n(30118),C=n(60417),O=n.n(C),N=n(33237),D=n(63775),P=n(36871),M=n(94457),L=n(15343),y=n(72818),w=n(96335),b=n(1023),F=n(52305),U=n(38986),x=n(64820),k=n(28687),H=n(1440),W=n(40568),X=n(80917),G=n(80920);function z(e){return(0,y.CE)((0,w.Gc)(e),"minScaleLimit","shouldSyncRect")}function V(e){return(0,y.CE)((0,w.y$)(e),"minScaleLimit","shouldSyncRect")}function Y(e,t,n,i){var r,o,a,l,u;let s=(0,b.Z)(e),c=s.filter(e=>{var t;return null===(t=e.name)||void 0===t?void 0:t.startsWith(U.WAVEFORM_NODE_PREFIX)}),d=s.find(e=>"qrcode"===e.name),{canvasAspectRatio:f,editorSize:m,waveformConfig:_,frameConfig:v}=t,E=null===(r=t.getWaveformsSnapshot)||void 0===r?void 0:r.call(t),I=E&&E.length>0?E:function(e){let t=null!=e?e:[],n=G.$X.getState().waveforms;if(0===n.length)return t;let i=new Map(n.map(e=>[e.id,e]));return t.map(e=>{let t=i.get(e.id);return t?{...e,...t,id:e.id}:e})}(t.waveforms),h=L.ReferenceDimensions[f],p=I.map((e,t)=>{var n,i,r;let{mockWaveformData:o,...a}=e,l=c.find(t=>t.name===e.id),u=(0,X.T)(a.centerImage),s={...(0,y.CE)(a,"centerImage"),...void 0!==u?{centerImage:u}:{}};if(l){let e=(0,F.convertActualToReferenceObject)(V(l),m.ratioToReference,v),{reference:i}=_;return{...s,rect:{...e,width:i.width,height:i.height,zIndex:null!==(n=e.zIndex)&&void 0!==n?n:x.LAYER_ZINDEX.full.waveform+.01*t}}}let d=null!==(i=s.rect)&&void 0!==i?i:{};return{...s,rect:{...d,zIndex:null!==(r=d.zIndex)&&void 0!==r?r:x.LAYER_ZINDEX.full.waveform+.01*t}}});if(0===c.length){let e=Error("No waveforms present on canvas");throw(0,A.H)(e),e}let g=s.filter(e=>{var t;return null===(t=e.name)||void 0===t?void 0:t.startsWith(U.IMAGE_LAYER_OBJECT_NAME_PREFIX)}),R=(t.images||[]).filter(e=>"asset"===e.kind).map(e=>{var t,n,i,r,o,a;let l=g.find(t=>t.name===e.id);if(l){let t=(0,F.convertActualToReferenceObject)(V(l),m.ratioToReference,v),o=null!==(r=null!==(i=null===(n=e.rect)||void 0===n?void 0:n.zIndex)&&void 0!==i?i:e.zIndex)&&void 0!==r?r:x.LAYER_ZINDEX.full.assetImage;return{...(0,y.CE)(e,"zIndex"),rect:{...t,zIndex:o}}}let u=null!==(a=null!==(o=null===(t=e.rect)||void 0===t?void 0:t.zIndex)&&void 0!==o?o:e.zIndex)&&void 0!==a?a:x.LAYER_ZINDEX.full.assetImage;return e.rect?{...(0,y.CE)(e,"zIndex"),rect:{...e.rect,zIndex:u}}:{...(0,y.CE)(e,"zIndex"),rect:{zIndex:u}}}),T=t.background,S=(null==T?void 0:T.imageURL)||(null==T?void 0:T.imageResourceId)?{id:U.CUSTOM_BG_IMAGE_FILE_ID,kind:"background",resourceId:(null==T?void 0:T.imageResourceId)||U.CUSTOM_BG_IMAGE_FILE_ID,url:null!==(l=null==T?void 0:T.imageURL)&&void 0!==l?l:null,rect:(null==T?void 0:T.imageRect)&&!(0,y.xb)(T.imageRect)?{...z(T.imageRect),zIndex:x.LAYER_ZINDEX.full.bgImage}:{zIndex:x.LAYER_ZINDEX.full.bgImage},backgroundSize:null!==(u=null==T?void 0:T.backgroundSize)&&void 0!==u?u:void 0,visible:!0}:null,C=S?[S,...R]:R,w=t.qr?(0,y.CE)(t.qr,"minScaleLimit"):{},Y=d?(0,F.convertActualToReferenceObject)(V(d),m.ratioToReference,v):{},{svg:j,publicURL:B,...Z}={svg:void 0,publicURL:void 0,imported:!1,zIndex:x.LAYER_ZINDEX.full.qr,...w,...Y},Q=null==p?void 0:null===(a=p[0])||void 0===a?void 0:null===(o=a.rect)||void 0===o?void 0:o.left;(null==Q||"number"!=typeof Q)&&(0,A.H)(Error("Waveform left is not defined: ".concat(String(Q))));let q={};n.fileName&&(q.fileName=n.fileName),n.playableURL&&(q.playableURL=n.playableURL),n.storedURL&&(q.storedURL=n.storedURL);let K={canvasAspectRatio:f,waveformConfig:_,editorSize:h,waveforms:p,textNodes:(0,H.av)(O()(t.textNodes.map(e=>{var n,i;let r=(0,W.shouldKeepEmptyCaptionTextNode)(e.name,t.captions);if(""===e.text&&!r)return null;let o=s.find(t=>t.name===e.name);if(!o)return r?{...(0,y.CE)(e,"minScaleLimit"),zIndex:null!==(n=null==e?void 0:e.zIndex)&&void 0!==n?n:x.LAYER_ZINDEX.full.textNodes}:((0,A.H)(Error("EditorContext and Fabric nodes are not synced somehow")),null);let a=(0,F.convertActualToReferenceObject)(V(o),m.ratioToReference,v),l=r&&(0,k.isUsableCaptionAuthoredSlot)(e)?{...a,width:e.width,height:e.height}:a;return{...(0,y.CE)(e,"minScaleLimit"),...l,zIndex:null!==(i=null==e?void 0:e.zIndex)&&void 0!==i?i:x.LAYER_ZINDEX.full.textNodes}})),t.captions,f),background:{...t.background,imageRect:t.background.imageRect&&!(0,y.xb)(t.background.imageRect)?z(t.background.imageRect):void 0},qr:Z,...Object.keys(q).length>0&&{audio:q},animation:t.animation?{...t.animation,style:(0,N.coerceAnimationStyle)(t.animation.style),...null!=t.animation.spectrumReactivity&&{spectrumReactivity:(0,D.normalizeSpectrumReactivity)(t.animation.spectrumReactivity)}}:t.animation,...null!=t.cameraShake&&{cameraShake:t.cameraShake},...null!=t.backgroundPulse&&{backgroundPulse:t.backgroundPulse},...null!=t.captions&&{captions:(0,W.normalizeCaptionsConfigLayouts)(t.captions)},...(0,P.ds)(t.stemAnalysis)&&{stemAnalysis:t.stemAnalysis},images:C,selectedSource:t.selectedSource,audioResourceId:t.audioResourceId,audioFileName:t.audioFileName};return{type:M.DesignType.SOUNDWAVE,config:K,resources:i}}var j=n(118),B=n(83096),Z=n(65089),Q=n(74978),q=n(14084),K=n(83553),$=n(38420),J=n(8959),ee=n(34729);let et=e=>{let{defaultValue:t,children:n}=e,[l,s]=(0,a.useState)(),[d,_]=(0,a.useState)(null==t?void 0:t.designId),[C,O]=(0,a.useState)((null==t?void 0:t.canvas)||null),[N,D]=(0,a.useState)(null),[P,M]=(0,a.useState)(null),y=(0,o.useRouter)(),w=(0,S._i)(),{updateEditorState:b,editorSize:F,loadFonts:U,audioFileName:x}=w,k=(0,$.b)(),{saveState:H,setSaveState:W,setNotSaved:X}=(0,j.r)(),G=(0,I.G)(),z=(0,B.FI)(),{userDetails:V}=(0,h.aC)(),{resources:et,getResources:en,seedPendingResources:ei}=(0,Z.o0)(),er=(0,p.mv)((null==V?void 0:V.subscriptions)||[]),eo=(0,a.useRef)(!1),ea=(0,a.useRef)(null),el=(0,a.useRef)(null),[eu,es]=(0,a.useState)(0),{isPaid:ec,editMode:ed,orderId:ef,subscribeToDesign:em,setIsPaid:e_,setEditMode:ev,isLoading:eE}
1=(0,q.s)(),{mutate:eI}=(0,g.useMutation)(["load-template-design",d],async e=>(b({status:E.EditorStatus.LOADING},!1),(0,T.Ny)(e)),{onSuccess:e=>{if(!eo.current)return;if(!e){b({status:E.EditorStatus.LOADED},!1),G.error((0,r.jsx)(m.Z,{id:"Error.DesignNotFound"}));return}e.config.canvasAspectRatio&&b({canvasAspectRatio:e.config.canvasAspectRatio},!1);let{textNodes:t}=e.config;(null==t?void 0:t.length)&&U(v()(t.map(e=>{let{fontFamily:t}=e;return t}))),M(e),y.push(y.pathname),X()},onError:e=>{(0,A.H)(e),b({status:E.EditorStatus.LOADED},!1),G.error((0,r.jsx)(m.Z,{id:"Error.DesignNotFound"}))}});(0,a.useEffect)(()=>(eo.current=!0,()=>{eo.current=!1}),[]),(0,a.useEffect)(()=>{if(!d||"string"!=typeof d)return;let e=em(d,er);return()=>{e()}},[d,em,er]),(0,a.useEffect)(()=>{"string"==typeof d&&"string"!=typeof y.query.id&&y.push("".concat(y.pathname,"?id=").concat(d))},[d,y]),(0,a.useEffect)(function(){P&&function(e){var t;let{width:n,height:i}=e.editorSize;if(n<=0||i<=0)return!1;let r=null!==(t=L.ReferenceDimensions[e.canvasAspectRatio])&&void 0!==t?t:L.ReferenceDimensions[E.AspectRatio["2/1"]];return 4>=Math.abs(i-Math.round(n*r.height/r.width))}(w)&&((0,Q.MI)({shouldReplaceDesign:P,editorContext:w,seedPendingResources:ei,updateEditorState:b,setLastUpdatedAt:es,playerContext:z}),M(null))},[x,w,F.width,F.height,z,ei,k,P,b]);let eh=(0,a.useCallback)(async e=>{let t;e!==d&&(D(null),j.r.getState().setSaveState(j.S.SAVED)),b({status:E.EditorStatus.LOADING},!1);try{t=await (0,T.rT)(e)}catch(t){(0,A.H)(t),b({status:E.EditorStatus.LOADED},!1),G.error((0,r.jsx)(m.Z,{id:"Error.DesignNotFound"}));let e={...y.query};delete e.id,y.replace({pathname:y.pathname,query:e},void 0,{shallow:!0});return}if(eo.current){if(!t){b({status:E.EditorStatus.LOADED},!1),G.error((0,r.jsx)(m.Z,{id:"Error.DesignNotFound"}));let e={...y.query};delete e.id,y.replace({pathname:y.pathname,query:e},void 0,{shallow:!0});return}_(e),s(t.orderType),b({canvasAspectRatio:t.config.canvasAspectRatio},!1),U(v()(t.config.textNodes.map(e=>{let{fontFamily:t}=e;return t}))),M(t)}},[d,b,U,G,y]),ep=(0,a.useRef)(null),eA=(0,a.useCallback)(()=>{if(C&&w.status===E.EditorStatus.LOADED)try{let e=Y(C.getObjects(),w,z,en());D(e),W(j.S.SAVED)}catch(e){(0,A.H)(e)}},[C,w,z,en,W]);(0,a.useEffect)(()=>{if(y.query.override&&y.query.override.includes(":")){let[e,t]=y.query.override.toString().split(":");(0,A.sO)().then(n=>n.featureFlags.override({[e]:t}))}},[y.query]),(0,a.useEffect)(function(){var e;if(w.status!==E.EditorStatus.INITIAL){ea.current=null;return}let t=new URLSearchParams(window.location.search),n=new URLSearchParams((null===(e=y.asPath)||void 0===e?void 0:e.split("?")[1])||""),i="string"==typeof y.query.id?y.query.id:t.get("id")||n.get("id"),r="string"==typeof y.query.job?y.query.job:t.get("job")||n.get("job"),o="string"==typeof y.query.ratio?y.query.ratio:t.get("ratio")||n.get("ratio"),a=(0,J.sT)(r,o),l="string"==typeof y.query.templateId?y.query.templateId:t.get("templateId")||n.get("templateId")||a;if("string"==typeof i&&i){el.current=null;let e="id:".concat(i);ea.current!==e&&(ea.current=e,eh(i));return}if("string"==typeof l&&l){let e="template:".concat(l);ea.current!==e&&(ea.current=e,el.current=l,eI(l));return}y.isReady&&F.width>0&&!P&&b({status:E.EditorStatus.LOADED},!1)},[w.status,eh,d,b,y.query,y.asPath,y.isReady,F.width,eI,P]);let eg=(0,a.useCallback)(async()=>{let e;if(!C){let e=Error("saveEverything: canvas was not initialized");throw(0,A.H)(e),e}if(ed===K.uz.Locked||eE)return eA(),d;try{e=Y(C.getObjects(),w,z,en())}catch(e){(0,A.H)(e);return}if((0,ee.Y)(d)&&(e={...e,config:c()(e.config,"captions")}),!d&&el.current&&(e={...e,sourceTemplateId:el.current}),u()(N,e))return W(j.S.SAVED),d;try{W(j.S.SAVING);let t=await (0,T.M9)(e,d);if(es(Date.now()),!t){(0,A.H)(Error("saveDesignQuery unexpected data: ".concat(t))),W(j.S.ERRORED);return}if(!eo.current)return;let n=!d;return t.id&&t.id!==d&&_(t.id),"string"!=typeof y.query.id&&y.push("".concat(y.pathname,"?id=").concat(t.id)),n&&(el.current=null),R.Od("design-preview:".concat(d)),D(e),W(j.S.SAVED),t.id}catch(t){(0,A.H)(t),W(j.S.ERRORED);let e=q.s.getState().designDocument;e&&ev(await (0,K.ed)(e,()=>Promise.resolve(er)))}},[C,d,ed,w,eE,N,z,en,y,W,ev,er,eA]),eR=(0,a.useMemo)(()=>f()(eg,800),[eg]),eT=(0,a.useRef)(d);(0,a.useEffect)(()=>{let e=eT.current;e!==d&&(eT.current=d,ep.current=null,(void 0!==e||"string"!=typeof d)&&(eR.cancel(),D(null),j.r.getState().setSaveState(j.S.SAVED)))},[d,eR]),(0,a.useEffect)(()=>
1{if(!d||!C||eE||w.status!==E.EditorStatus.LOADED)return;let e="".concat(d,":").concat(eu,":").concat(ed);ep.current!==e&&(ep.current=e,eA())},[d,C,ed,eE,w.status,eu,eA]),(0,a.useEffect)(()=>{ed===K.uz.Locked&&eR.cancel()},[ed,eR]);let eS=ed!==K.uz.Locked&&!eE&&w.status!==E.EditorStatus.LOADING;(0,a.useEffect)(()=>H===j.S.NOTSAVED&&C&&eS?(eR(),eR.cancel):()=>null,[C,eS,eR,H]),(0,a.useEffect)(()=>()=>{eR.cancel()},[eR]);let eC=(0,a.useMemo)(()=>({isPaid:ec,setIsPaid:e_,canvas:C,setCanvas:O,lastUpdatedAt:eu,saveEverything:eg,designId:d,setShouldReplaceDesign:M,orderType:l,orderId:ef,editMode:ed,setEditMode:ev}),[ec,C,eg,d,l,ef,ed,ev,e_,eu]);return(0,r.jsx)(i.c.Provider,{value:eC,children:n})}},74978:function(e,t,n){"use strict";n.d(t,{d1:function(){return F},MI:function(){return b}});var i=n(45455),r=n.n(i),o=n(17620),a=n.n(o),l=n(75652),u=n.n(l),s=n(19458),c=n(40805),d=n(51574),f=n(92428),m=n(33394),_=n(65685),v=n(44074);let E=e=>{let{selectedSource:t,waveforms:n,selectedWaveformId:i}=e;if(i&&(null==n?void 0:n.length)){let e=n.find(e=>e.id===i);if((null==e?void 0:e.selectedSource)!=null)return e.selectedSource}return null!=t?t:s.SourceType.SAMPLE};var I=n(80920),h=n(17488),p=n(80917),A=n(84444),g=n(64345),R=n(63775),T=n(54151),S=n(36871),C=n(29008);function O(e){if(Array.isArray(e)&&e.length>0)return e}function N(e,t){return e&&"object"==typeof e&&"startRatio"in e&&"endRatio"in e&&"number"==typeof e.startRatio&&"number"==typeof e.endRatio?{startRatio:e.startRatio,endRatio:e.endRatio}:t}function D(e,t){return"trim"in e&&e.trim?e.trim:t}function P(e){if("centerImage"in e)return e.centerImage}function M(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];for(let e of t)if(Array.isArray(e)&&e.length>0)return e}function L(e){return e?e.map(e=>e.url?{...e,url:(0,T.resolvePodcastTemplateAssetUrl)(e.url)}:e):e}function y(e,t,n){let i;let r=null!=n?n:{};if(null!=r.heightMultiplier)i=r.heightMultiplier;else if(null!=r.height)i=(0,_.legacyHeightToMultiplier)(r.height);else{var o,l,u;i=null!==(u=null!==(l=null!==(o=e.heightMultiplier)&&void 0!==o?o:null!=e.height?(0,_.legacyHeightToMultiplier)(e.height):void 0)&&void 0!==l?l:t.heightMultiplier)&&void 0!==u?u:1}let s=null!=n&&Object.prototype.hasOwnProperty.call(n,"glow");return(0,v.normalizeWaveformConfig)({...a()(e,"height"),heightMultiplier:i,...s?{}:{glow:null}})}function w(e,t){let n=null==t?void 0:t.find(e=>"background"===e.kind);if(!n)return e;let i=null==e.imageURL||""===e.imageURL,o=null==e.imageResourceId||""===e.imageResourceId,a=!e.imageRect||r()(e.imageRect),l=null==e.backgroundSize;return{...e,...i&&null!=n.url&&""!==n.url?{imageURL:n.url}:{},...o&&null!=n.resourceId&&""!==n.resourceId?{imageResourceId:n.resourceId}:{},...a&&n.rect&&!r()(n.rect)?{imageRect:{...n.rect}}:{},...l&&null!=n.backgroundSize?{backgroundSize:n.backgroundSize}:{}}}let b=e=>{var t,n,i,r,o,a,l,u,_,v,T,b,F,U,x;let{shouldReplaceDesign:k,editorContext:H,seedPendingResources:W,updateEditorState:X,setLastUpdatedAt:G,playerContext:z}=e,{reducedWaveformData:V,audio:Y,...j}=k.config,B=I.$X.getState().waveforms,Z=null===(t=j.waveforms)||void 0===t?void 0:t[0],Q=null!==(l=null==Z?void 0:Z.audioResourceId)&&void 0!==l?l:j.audioResourceId,q=y({...H.waveformConfig,...(0,m.Z)(k.config.waveformConfig)},H.waveformConfig,k.config.waveformConfig),K=B[0]||c.initialContextData.waveforms[0],$=(null===(n=k.config.waveforms)||void 0===n?void 0:n.map((e,t)=>{var n,i,r,o,a,l,u;let s=B[t]||K,d=function(e){if("mockWaveformData"in e&&void 0!==e.mockWaveformData)return O(e.mockWaveformData)}(e),m=null!==(r=M(function(e){if("waveformData"in e&&void 0!==e.waveformData)return O(e.waveformData)}(e),d,0===t?V:void 0,0===t?k.config.waveformData:void 0,s.waveformData,c.initialContextData.waveforms[0].waveformData))&&void 0!==r?r:c.initialContextData.waveforms[0].waveformData,_="audioFileName"in e?e.audioFileName:void 0,v=null!==(o="selectedSource"in e&&void 0!==e.selectedSource?e.selectedSource:void 0)&&void 0!==o?o:s.selectedSource,E=null!==(l=null!==(a="audioResourceId"in e&&void 0!==e.audioResourceId?e.audioResourceId:void 0)&&void 0!==a?a:0===t?Q:void 0)&&void 0!==l?l:s.audioResourceId,I=N(D(e,null==q?void 0:q.trim),void 0),h=I&&(0!==I.startRatio||1!==I.endRatio);return{...s,id:e.id,rect:e.rect,centerImage:function(e,t){let n=(0,p.T)(e);if(!(null==n?void 0:n.resourceId)||!t)return n;let i=function(e,t){if(e)return function(e){if(e&&"publicURL"in e&&"string"==typeof e.publicURL&&""!==e.publicURL)return e.publicURL}(e[t])}(t,n.resourceId),r=!n.url||""===n.url;return i&&r?{...n,url:i}:n}(P(e),k.resources),waveformData:m,audioFileName:null!=_?_:s.audioFileName,selectedSource:v,...void 0!==E&&{audioResourceId:E},...void 0!==I&&{trim:I},shownWaveformData:(0,f.computeShownWaveformData)({waveformData:m,waveformConfig:q,trim:h?{startRatio:0,endRatio:1}:I,width:(null===(i=k.config.waveformConfig)||void 0===i?void 0:null===(n=i.reference)||void 0===n?void 0:n.width)||H.waveformConfig.reference.width,audioFileName:_,source:v,fallback:null!==(u=s.shownWaveformData)&&void 0!==u?u:[]})}}))||B,J=null!==(_=null!==(u=k.config.animation)&&void 0!==u?u:c.initialContextData.animation)&&void 0!==_?_:{style:"spectrum"},ee={...J,style:(0,g.ck)(J.style),...null!=J.spectrumReactivity&&{spectrumReactivity:(0,R.normalizeSpectrumReactivity)(J.spectrumReactivity)}},et=function(e,t){if(0===e.length)return;let n=function(e){if(!e||"object"!=typeof e||!("selectedWaveformId"in e))return;let t=e.selectedWaveformId;return"string"==typeof t?t:void 0}(t);return n&&e.some(e=>e.id===n)?n:e[0].id}($,k.config),en=E({selectedSource:k.config.selectedSource,selectedWaveformId:et,waveforms:$.map(e=>({id:e.id,selectedSource:e.selectedSource}))}),ei={...j,editorSize:H.editorSize,audioResourceId:Q,waveformData:null!==(v=M(null===(i=$[0])||void 0===i?void 0:i.waveformData,Array.isArray(V)?V:void 0,k.config.waveformData,c.initialContextData.waveformData))&&void 0!==v?v:c.initialContextData.waveformData,shownWaveformData:null!==(T=M(null===(r=$[0])||void 0===r?void 0:r.shownWaveformData,(0,C.pk)(k.config),c.initialContextData.shownWaveformData))&&void 0!==T?T:c.initialContextData.shownWaveformData,waveformConfig:q,soundwaveRect:null!==(F=null!==(b=(0,A.derivePrimarySoundwaveRect)($))&&void 0!==b?b:k.config.soundwaveRect)&&void 0!==F?F:c.initialContextData.soundwaveRect,selectedSource:en,textNodes:(0,h.normalizeTextNodeZIndices)(k.config.textNodes||c.initialContextData.textNodes),canvasAspectRatio:k.config.canvasAspectRatio||c.initialContextData.canvasAspectRatio,background:w({...c.initialContextData.background,...k.config.background},k.config.images),images:null!==(U=L(k.config.images))&&void 0!==U?U:[],audioFileName:k.config.audioFileName||c.initialContextData.audioFileName,waveforms:$,selectedWaveformId:et,animation:ee,cameraShake:k.config.cameraShake,backgroundPulse:k.config.backgroundPulse,captions:k.config.captions,stemAnalysis:(0,S.ds)(k.config.stemAnalysis)?k.config.stemAnalysis:void 0};if("schemaVersion"in k||!k.resources||!(Object.keys(k.resources).length>0)||W(k.resources),X({...ei,status:s.EditorStatus.LOADED},"replace"),G(Date.now()),Q&&(en===s.SourceType.AUDIO||en===s.SourceType.SAMPLE||en===s.SourceType.STOCK||en===s.SourceType.SPOTIFY)){let e=Object.keys(k.resources||[]).length>0&&(null===(x=k.resources)||void 0===x?void 0:x[Q]);e&&e.type===d.CustomFileType.bucket?(e.publicURL&&z.setPlayableURL(e.publicURL),e.pathInBucket&&z.setStoredURL(null==e?void 0:e.pathInBucket)):e&&e.type===d.CustomFileType.public?(z.setPlayableURL(e.publicURL),z.setStoredURL(e.publicURL)):e&&e.type===d.CustomFileType.spotify&&(z.updatePlayerState({fileName:ei.audioFileName}),z.setExternalURL(e.publicURL))}else(null==Y?void 0:Y.fileName)&&(ei.audioFileName=null==Y?void 0:Y.fileName),Y&&z.updatePlayerState(Y),(null==Y?void 0:Y.playableURL)&&z.setPlayableURL(null==Y?void 0:Y.playableURL),(null==Y?void 0:Y.storedURL)&&z.setStoredURL(null==Y?void 0:Y.storedURL),(null==Y?void 0:Y.externalURL)&&z.setExternalURL(null==Y?void 0:Y.externalURL);!(null===(o=k.config.qr)||void 0===o?void 0:o.svg)&&(null===(a=k.config.qr)||void 0===a?void 0:a.publicURL)&&fetch(k.config.qr.publicURL).then(e=>e.text()).then(e=>{X({qr:{imported:!1,...k.config.qr,svg:e}},!1)})},F=(e,t,n,i)=>{var r,o,a,l,s,d,_,v,R,T,S,O,b,F;n&&i&&Object.keys(n).length>0&&i(n);let U=I.$X.getState().waveforms,x=null!==(s=U.find(e=>e.id===t.selectedWaveformId))&&void 0!==s?s:U[0],k=null!==(_=null!==(d=null==x?void 0:x.selectedSource)&&void 0!==d?d:t.selectedSource)&&void 0!==_?_:E({selectedSource:t.selectedSource,selectedWaveformId:t.selectedWaveformId,waveforms:U}),H=y({...t.waveformConfig,...(0,m.Z)(e.waveformConfig)},t.waveformConfig,e.waveformConfig),W=U[0]||c.initialContextData.waveforms[0],X=(null===(r=e.waveforms)||void 0===r?void 0:r.map((n,i)=>{var r,o,a,l,u,s;let d=U[i]||W,m=null!==(a=M(d.waveformData,W.waveformData,c.initialContextData.waveforms[0].waveformData))&&void 0!==a?a:c.initialContextData.waveforms[0].waveformData,_=N(D(n,null==H?void 0:H.trim),void 0),v=_&&(0!==_.startRatio||1!==_.endRatio);return{...d,id:n.id,rect:n.rect,centerImage:null!==(l=(0,p.T)(P(n)))&&void 0!==l?l:(0,p.T)(d.centerImage),...void 0!==_&&{trim:_},shownWaveformData:(0,f.computeShownWaveformData)({waveformData:m,waveformConfig:H,trim:v?{startRatio:0,endRatio:1}:_,width:(null===(o=e.waveformConfig)||void 0===o?void 0:null===(r=o.reference)||void 0===r?void 0:r.width)||t.waveformConfig.reference.width,audioFileName:t.audioFileName,source:"selectedSource"in n&&void 0!==n.selectedSource?n.selectedSource:null!==(s=d.selectedSource)&&void 0!==s?s:k,fallback:null!==(u=d.shownWaveformData)&&void 0!==u?u:[]})}}))||U,G=null!==(v=(0,A.derivePrimarySoundwaveRect)(X))&&void 0!==v?v:t.soundwaveRect,z={...e,waveformConfig:H,editorSize:t.editorSize,soundwaveRect:G,textNodes:(0,h.normalizeTextNodeZIndices)([...null!==(R=e.textNodes)&&void 0!==R?R:t.textNodes]),canvasAspectRatio:null!==(T=e.canvasAspectRatio)&&void 0!==T?T:t.canvasAspectRatio,qr:{...t.qr,fillColor:null!==(S=null===(o=e.qr)||void 0===o?void 0:o.fillColor)&&void 0!==S?S:null===(a=t.qr)||void 0===a?void 0:a.fillColor},waveforms:X};z.shownWaveformData=(0,f.computeShownWaveformData)({waveformData:null!==(O=M(t.waveformData,null===(l=X[0])||void 0===l?void 0:l.waveformData,(0,C.rZ)(e),c.initialContextData.waveformData))&&void 0!==O?O:c.initialContextData.waveformData,waveformConfig:z.waveformConfig,width:z.waveformConfig.reference.width,audioFileName:t.audioFileName,source:k,fallback:null!==(b=t.shownWaveformData)&&void 0!==b?b:[]}),t.loadFonts(u()(z.textNodes.map(e=>{let{fontFamily:t}=e;return t})));let V=null!==(F=L(void 0!==e.images?e.images:(t.images||[]).filter(e=>"asset"===e.kind)))&&void 0!==F?F:[];z.images=V,z.background=w({...c.initialContextData.background,...e.background},V),z.animation&&(z.animation={...z.animation,style:(0,g.ck)(z.animation.style)}),t.updateEditorState(z)}},90655:function(e,t,n){"use strict";n.d(t,{_:function(){return a}
1,r:function(){return o}});var i=n(2784),r=n(40805);let o=(0,i.createContext)(r.initialContextData),a=()=>{let e=(0,i.useContext)(o);if(!e)throw Error("useEditorContext must be used within an EditorContextProvider");return e}},30118:function(e,t,n){"use strict";n.d(t,{rU:function(){return i.r},BD:function(){return V},_i:function(){return i._}});var i=n(90655),r=n(52322),o=n(75652),a=n.n(o),l=n(2784),u=n(15343),s=n(53438),c=n(40568),d=n(92428),f=n(27061),m=n(70429),_=n(64820),v=n(40805),E=n(19458),I=n(18997),h=n(51574),p=n(27818),A=n(3438),g=n(43841),R=n(69378),T=n.n(R);let S=(0,g.U)((e,t)=>({history:[v.initialContextData],current:0,push:n=>{let{current:i,history:r}=t(),o=r[i];if(o&&T()(o,n))return i;let a=i>-2?r.slice(r.length<100?0:1,i+1):[],l=a.length;return a.push(n),e({history:a,current:l}),l},replace:n=>{let{current:i,history:r}=t();if(i<r.length&&T()(r[i],n))return i;let o=r.slice(0,i);return o.push(n),e({history:o}),i},getHistoryLength:()=>t().history.length,getHistoryStepAt:e=>t().history[e],back:()=>{let{current:n}=t();n>0&&e({current:n-1})},forward:()=>{let{current:n,history:i}=t();n<i.length-1&&e({current:n+1})}}));var C=n(80920),O=n(118),N=n(83096),D=n(93580);let P=()=>(0,r.jsx)("link",{href:"https://fonts.googleapis.com/css2?".concat(D.Qg.map(e=>"family=".concat(e)).join("&"),"&display=swap"),rel:"stylesheet"});var M=n(65089),L=n(38986),y=n(3741),w=n(64345),b=n(53093),F=n(32529),U=n(32945),x=n(43821),k=n(23746),H=n(74591),W=n(27099),X=n(84444);function G(e,t){return{...e,editorSize:t.editorSize,frameConfig:t.frameConfig,status:t.status}}let z=l.useLayoutEffect,V=e=>{var t,n,o,g;let{children:R,defaultValue:T}=e,{setNotSaved:D}=(0,O.r)(),[V,Y]=(0,l.useState)(["Open Sans"]),j=S(),{setStoredURL:B,setPlayableURL:Z,setExternalURL:Q,updatePlayerState:q,audioElement:K,setPlayerStatus:$}=(0,N.FI)(),J=(0,l.useRef)(!1),[ee,et]=(0,l.useState)(null!==(g=null==T?void 0:T.isAudioTrimming)&&void 0!==g&&g);(0,l.useEffect)(()=>(J.current=!0,()=>{J.current=!1}),[]);let[en,ei]=(0,l.useState)({...v.defaultEditorConfig,...T}),er=(0,C.$X)(e=>e.selectedWaveformId);z(()=>{var e,t,n;let i={...v.defaultEditorConfig,...T};C.$X.getState().setWaveforms(null!==(e=i.waveforms)&&void 0!==e?e:[]),C.$X.getState().setSelectedWaveformId(null!==(n=null!==(t=i.selectedWaveformId)&&void 0!==t?t:v.defaultEditorConfig.selectedWaveformId)&&void 0!==n?n:"waveform_0")},[]);let eo=(0,l.useCallback)(e=>{J.current&&Y(t=>a()([...t,...e]))},[]),ea=(0,l.useRef)(en);(0,l.useEffect)(()=>{ea.current=en},[en]);let el=(0,l.useCallback)((e,t)=>{if(!J.current)return;let n={...ea.current,...e};if("waveforms"in e){let e=(0,X.derivePrimarySoundwaveRect)(n.waveforms);e&&(n.soundwaveRect=e)}if("selectedWaveformId"in e&&C.$X.getState().setSelectedWaveformId(n.selectedWaveformId),"waveforms"in e){var i;C.$X.getState().setWaveforms(null!==(i=n.waveforms)&&void 0!==i?i:[])}ea.current=n,ei(n),"push"===t?j.push(n):"replace"===t&&j.replace(n)},[j]),eu=(0,l.useCallback)(function(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if(!J.current)return;let n="none";!0===t||"push"===t?n="push":"replace"===t&&(n="replace"),el(e,n)},[el]),es=(0,l.useCallback)(function(e,t){let n=!(arguments.length>2)||void 0===arguments[2]||arguments[2],{textNodes:i}=ea.current,r=i.findIndex(t=>e===t.name);r<0||(eu({textNodes:[...i.slice(0,r),{...i[r],...t},...i.slice(r+1)]},n),D())},[D,eu]),ec=l.useCallback(e=>{if((0,c.isCaptionSlotLayerName)(e,en.captions))return;let t=en.textNodes.findIndex(t=>e===t.name);t<0||(eu({textNodes:[...en.textNodes.slice(0,t),...en.textNodes.slice(t+1)]}),D())},[en.captions,en.textNodes,D,eu]),ed=(0,l.useCallback)(e=>{let t=e.name?en.textNodes.find(t=>t.name===e.name):void 0;if(t)return t.name;let n=(0,H.DI)(e,{canvasAspectRatio:en.canvasAspectRatio,existingTextNodes:en.textNodes,layerId:e.name});return eu({textNodes:en.textNodes.slice().concat([n])}),D(),n.name},[en.canvasAspectRatio,en.textNodes,D,eu]),ef=(0,l.useCallback)(e=>{let t=ea.current,n=(t.waveforms||[]).map(e=>{if(e.id.startsWith(L.WAVEFORM_NODE_PREFIX)){let t=parseInt(e.id.slice(L.WAVEFORM_NODE_PREFIX.length),10);return Number.isNaN(t)?-1:t}return -1}),i=n.length>0?Math.max(...n):-1,r="".concat(L.WAVEFORM_NODE_PREFIX).concat(i+1),o={...e,id:r,waveformData:F.MockWaveformData,shownWaveformData:(0,f.getShownWaveformData)({waveformData:F.MockWaveformData,...t.waveformConfig,width:t.waveformConfig.reference.width,source:E.SourceType.SAMPLE}),audioFileName:v.SAMPLE_FILE,selectedSource:E.SourceType.SAMPLE,audioResourceId:void 0,rect:{...v.defaultEditorConfig.soundwaveRect,left:u.ReferenceDimensions[t.canvasAspectRatio].width/2,top:u.ReferenceDimensions[t.canvasAspectRatio].height/2}},a={...t,waveforms:[...t.waveforms||[],o],selectedWaveformId:r};return ea.current=a,ei(a),C.$X.setState({waveforms:a.waveforms,selectedWaveformId:r}),j.push(a),D(),r},[j,D]),em=(0,l.useCallback)(()=>{var e;return null!==(e=ea.current.waveforms)&&void 0!==e?e:[]},[]),e_=(0,l.useCallback)(function(e,t){var n;let i=!(arguments.length>2)||void 0===arguments[2]||arguments[2],r=ea.current,o=(r.waveforms||[]).map(n=>n.id!==e?n:t.centerImage&&n.centerImage?{...n,...t,centerImage:{...n.centerImage,...t.centerImage}}:{...n,...t}),a=(0,X.derivePrimarySoundwaveRect)(o),l={...r,waveforms:o,...a?{soundwaveRect:a}:{},status:E.EditorStatus.LOADED};ea.current=l,ei(l),C.$X.getState().setWaveforms(null!==(n=l.waveforms)&&void 0!==n?n:[]),i&&j.push(l),D()},[j,D]),ev=(0,l.useCallback)(e=>{let t;let n=ea.current,i=n.waveforms||[];if(i.length<=1)return;let r=i.filter(t=>t.id!==e);if(n.selectedWaveformId===e){var o;t={...n,waveforms:r,selectedWaveformId:null===(o=r[0])||void 0===o?void 0:o.id}}else t={...n,waveforms:r};ea.current=t,ei(t),C.$X.setState({waveforms:r,selectedWaveformId:t.selectedWaveformId}),j.push(t),D()},[j,D]),eE=(0,l.useCallback)(e=>{var t,n,i,r,o;let a=ea.current,l=a.images||[];if(e.id){let r=l.find(t=>
1t.id===e.id);if(r){let o=null!==(n=null!==(t=e.zIndex)&&void 0!==t?t:r.zIndex)&&void 0!==n?n:_.DEFAULT_NEW_ASSET_IMAGE_ZINDEX,u={...r,...e,zIndex:o,rect:e.rect?{...e.rect,zIndex:null!==(i=e.rect.zIndex)&&void 0!==i?i:o}:r.rect},s=l.map(t=>t.id===e.id?u:t),c={...a,images:s};return ea.current=c,ei(c),j.push(c),D(),e.id}}let u=l.filter(e=>e.id.startsWith(L.IMAGE_LAYER_OBJECT_NAME_PREFIX)).map(e=>{let t=parseInt(e.id.slice(L.IMAGE_LAYER_OBJECT_NAME_PREFIX.length),10);return Number.isNaN(t)?-1:t}),s=u.length>0?Math.max(...u):-1,c="".concat(L.IMAGE_LAYER_OBJECT_NAME_PREFIX).concat(s+1),d={id:c,kind:"asset",visible:!0,locked:!1,zIndex:_.DEFAULT_NEW_ASSET_IMAGE_ZINDEX,...e},f=null!==(r=d.zIndex)&&void 0!==r?r:_.DEFAULT_NEW_ASSET_IMAGE_ZINDEX,m={...d,zIndex:f,rect:d.rect?{...d.rect,zIndex:null!==(o=d.rect.zIndex)&&void 0!==o?o:f}:d.rect},v={...a,images:[...l,m]};return ea.current=v,ei(v),j.push(v),D(),c},[j,D]),eI=(0,l.useCallback)(function(e,t){let n=!(arguments.length>2)||void 0===arguments[2]||arguments[2],i=ea.current,r=(i.images||[]).map(n=>n.id===e?{...n,...t}:n),o={...i,images:r};ea.current=o,ei(o),n&&j.push(o),D()},[j,D]),eh=(0,l.useCallback)(e=>{let t=ea.current,n=(t.images||[]).filter(t=>t.id!==e),i={...t,images:n};ea.current=i,ei(i),j.push(i),D()},[j,D]),ep=(0,l.useCallback)(e=>{eu({pendingSelectionObjectName:e},!1)},[eu]),eA=(0,l.useCallback)(()=>
1{eu({pendingSelectionObjectName:void 0},!1)},[eu]),eg=(0,l.useCallback)(e=>{var t,n,i,r,o,a,l;let u=ea.current,c={...u.waveformConfig,...e};A.UH();let f=null!==(i=u.waveformConfig.circleRadius)&&void 0!==i?i:0,_=null!==(r=c.circleRadius)&&void 0!==r?r:0,v=void 0!==e.circleRadius&&f>0&&_>0&&f!==_,E=(0,s.applyWaveformConfigToWaveformNodes)({waveforms:null!==(o=u.waveforms)&&void 0!==o?o:[],waveformConfig:c}),I=v?E.map(e=>{var t;let n=null===(t=u.waveforms)||void 0===t?void 0:t.find(t=>t.id===e.id);return(null==n?void 0:n.centerImage)&&(0,W.isCompleteCenterImageLayout)(n.centerImage)?{...e,centerImage:{...n.centerImage,...(0,W.remapCenterImageLayoutForCircleRadiusChange)({width:n.centerImage.width,height:n.centerImage.height,left:n.centerImage.left,top:n.centerImage.top,scaleX:n.centerImage.scaleX,scaleY:n.centerImage.scaleY},f,_)}}:e}):E,h=null!==(a=null===(t=u.waveforms)||void 0===t?void 0:t.find(e=>e.id===u.selectedWaveformId))&&void 0!==a?a:null===(n=u.waveforms)||void 0===n?void 0:n[0],p=h?(0,m.getWaveformDisplayTrim)(h,c):c.trim,g=(0,d.computeShownWaveformData)({waveformData:u.waveformData,waveformConfig:c,trim:p,width:c.reference.width,source:u.selectedSource,fallback:null!==(l=u.shownWaveformData)&&void 0!==l?l:[]});eu({waveformConfig:c,shownWaveformData:g,...I&&{waveforms:I}}),D()},[D,eu]),eR=(0,l.useCallback)(function(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];eu({background:{...en.background,...e}},t),t&&D()},[en.background,D,eu]),eT=(0,l.useMemo)(()=>j.current>0?()=>{var e;let t=S.getState(),{current:n,history:i}=t;if(n<=0)return;let r=i[n-1];if(!r){(0,I.H)("Undo failed: no step found");return}let o=G(r,ea.current);t.back(),ei(o),ea.current=o,C.$X.setState({waveforms:null!==(e=o.waveforms)&&void 0!==e?e:[],selectedWaveformId:o.selectedWaveformId}),D(),A.Yw()}:null,[j,D]),eS=(0,l.useMemo)(()=>j.current<j.getHistoryLength()-1?()=>{var e;let t=S.getState(),{current:n,history:i}=t;if(n>=i.length-1)return;let r=i[n+1];if(!r){(0,I.H)("Redo failed: no step found");return}let o=G(r,ea.current);t.forward(),ei(o),ea.current=o,C.$X.setState({waveforms:null!==(e=o.waveforms)&&void 0!==e?e:[],selectedWaveformId:o.selectedWaveformId}),D(),A.KX()}:null,[j,D]),eC=(0,M.Wf)(en.audioResourceId);(0,l.useEffect)(()=>{eC&&eC.type===h.CustomFileType.bucket&&(en.selectedSource===E.SourceType.AUDIO||en.selectedSource===E.SourceType.SAMPLE)?((null==eC?void 0:eC.name)&&eC.name!==en.audioFileName&&eu({audioFileName:eC.name},!1),B(eC.pathInBucket),Q(void 0),eC.publicURL&&Z(eC.publicURL)):eC&&eC.type===h.CustomFileType.public&&en.selectedSource===E.SourceType.STOCK&&(eC.name&&eC.name!==en.audioFileName&&eu({audioFileName:eC.name},!1),B(eC.publicURL),Z(eC.publicURL),Q(void 0))},[en.audioResourceId,eu,B,Q,Z,en.audioFileName,q,eC,en.selectedSource]),(0,l.useEffect)(()=>{let e=!0,t=null,n=0;return K&&(K.onpause=()=>{e&&K&&($(p.c.paused),t&&(clearTimeout(t),t=null))},K.onplay=()=>{var i,r,o,a,l,u,s,c;if(!e||!K)return;t&&(clearTimeout(t),t=null);let d=n+=1,f=null!==(a=null===(i=en.waveforms)||void 0===i?void 0:i.find(e=>e.id===en.selectedWaveformId))&&void 0!==a?a:null===(r=en.waveforms)||void 0===r?void 0:r[0],m=null!==(l=null==f?void 0:f.trim)&&void 0!==l?l:null===(o=en.waveformConfig)||void 0===o?void 0:o.trim,{duration:_}=K,v=Number.isFinite(_)&&_>0,{startRatio:E,endRatio:I}=null!=m?m:{},h=null!=E&&null!=I&&Number.isFinite(E)&&Number.isFinite(I)&&I>E,A=(i,r,o)=>{if(e&&K&&o===n){if(t=null,(0,k.W_)()){K.currentTime=i,U.EM.setTime(0);let e=K.duration;if(Number.isFinite(e)&&r<e-.05){let e=r-i;e>0&&(t=setTimeout(()=>A(i,r,o),1e3*e))}return}$(p.c.paused),K.pause(),K.currentTime=i}},g=(i,r)=>{if(!e||!K||d!==n)return;let o=K.duration;if(!Number.isFinite(o)||o<=0)return;let a=o*i,l=o*r,u=l-a;if(!Number.isFinite(a)||!Number.isFinite(u)||u<=0)return;let s=K.currentTime;(s<a||s>=l)&&(s=a,K.currentTime=a),U.EM.setDuration(u),t=setTimeout(()=>A(a,l,d),1e3*(l-s))};if(K&&h)v?g(E,I):K.addEventListener("loadedmetadata",()=>g(E,I),{once:!0});else if(v){let e=(0,x.sF)(_,m),n=null!==(u=null==e?void 0:e.windowStart)&&void 0!==u?u:0,i=null!==(s=null==e?void 0:e.windowEnd)&&void 0!==s?s:_,r=null!==(c=null==e?void 0:e.windowDuration)&&void 0!==c?c:_;(K.currentTime<n||K.currentTime>=i)&&(K.currentTime=n),U.EM.setDuration(r);let o=i-K.currentTime;o>0&&o<r&&(t=setTimeout(()=>A(n,i,d),1e3*o))}$(p.c.playing)},K.onerror=n=>{var i;e&&K&&((0,I.H)(Error("Cannot play audio"),{extra:{error:n,errorCode:null==K?void 0:null===(i=K.error)||void 0===i?void 0:i.code,src:K.src}}),$(p.c.error),t&&(clearTimeout(t),t=null))},K.onended=()=>{var n,i,r,o,a,l,u;if(!e||!K)return;t&&(clearTimeout(t),t=null);let s=null!==(o=null===(n=en.waveforms)||void 0===n?void 0:n.find(e=>e.id===en.selectedWaveformId))&&void 0!==o?o:null===(i=en.waveforms)||void 0===i?void 0:i[0],c=null!==(a=null==s?void 0:s.trim)&&void 0!==a?a:null===(r=en.waveformConfig)||void 0===r?void 0:r.trim,d=(0,x.sF)(K.duration,c),f=null!==(l=null==d?void 0:d.windowStart)&&void 0!==l?l:0;if((0,k.W_)()){K.currentTime=f;let e=null==d?void 0:d.windowDuration;e&&e>0&&U.EM.setDuration(e),U.EM.getState().isPlaying||U.EM.play(),U.EM.setTime(0),null===(u=K.play())||void 0===u||u.catch(()=>void 0);return}$(p.c.paused),K.currentTime=f}),()=>{e=!1}},[K,null===(t=en.waveformConfig)||void 0===t?void 0:t.trim,en.waveforms,en.selectedWaveformId,$]);let eO=(0,l.useMemo)(()=>({...en,selectedWaveformId:er,updateEditorState:eu,applyWaveformEditorPatch:el,getWaveformsSnapshot:em,updateWaveformConfig:eg,updateTextNode:es,removeTextNode:ec,addTextNode:ed,addWaveform:ef,updateWaveform:e_,removeWaveform:ev,addImageLayer:eE,updateImageLayer:eI,removeImageLayer:eh,requestObjectSelection:ep,clearPendingOb
1jectSelection:eA,updateBackground:eR,undo:eT,redo:eS,loadFonts:eo,setAudioTrimming:et,isAudioTrimming:ee}),[ed,ef,e_,ev,eE,eI,eh,ep,eA,en,er,eo,eS,ec,eT,eR,eu,el,em,es,eg,et,ee]);return(0,l.useEffect)(()=>{var e,t;(null===(e=en.animation)||void 0===e?void 0:e.style)&&U.EM.setAnimationStyle((0,w.ck)(en.animation.style)),U.EM.setSpectrumReactivity(null===(t=en.animation)||void 0===t?void 0:t.spectrumReactivity)},[null===(n=en.animation)||void 0===n?void 0:n.style,null===(o=en.animation)||void 0===o?void 0:o.spectrumReactivity]),(0,l.useEffect)(()=>{y.featureFlags.debugSDK&&(0,b.ki)(eO)},[eO]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.r.Provider,{value:eO,children:R}),(0,r.jsx)(P,{}),V.map(e=>(0,r.jsx)("span",{className:"absolute -left-full",style:{fontFamily:e,visibility:"hidden"},children:e},e))]})}},83096:function(e,t,n){"use strict";n.d(t,{FI:function(){return f},I0:function(){return d}});var i=n(52322),r=n(2784),o=n(27818),a=n(3741),l=n(86337);let u=null;"undefined"==typeof document||u||(u=document.createElement("audio"));let s={},c=(0,r.createContext)({...s,playerStatus:o.c.initial,updatePlayerState:()=>null,setPlayableURL:()=>null,setStoredURL:()=>null,setPlayerStatus:()=>null,setExternalURL:()=>null,audioElement:u});a.featureFlags.playAudioSilently&&u&&(u.volume=0);let d=e=>{let{defaultValue:t,children:n}=e,[a,d]=(0,r.useState)((null==t?void 0:t.playerState)||s),[f,m]=(0,r.useState)(null==t?void 0:t.storedURL),[_,v]=(0,r.useState)(null==t?void 0:t.externalURL),[E,I]=(0,r.useState)(null==t?void 0:t.playableURL),[h,p]=(0,r.useState)((null==t?void 0:t.playerStatus)||o.c.initial),A=(0,r.useCallback)(e=>{d({...a,...e})},[a]);(0,r.useEffect)(()=>{u&&(E?(p(o.c.paused),u.currentTime=E.includes(".webm")?1e8:0,u.src=E):u.removeAttribute("src"),u.load())},[E]),(0,r.useEffect)(()=>{let e=!0;return u&&(u.onpause=()=>{e&&u&&p(o.c.paused)},u.onplay=()=>{e&&u&&((0,l.CS)(u.currentSrc||u.src),p(o.c.playing))},u.onerror=t=>{e&&u&&(console.error("Audio error:",t),p(o.c.error))},u.onended=()=>{e&&u&&p(o.c.paused)}),()=>{e=!1}},[]),(0,r.useEffect)(()=>()=>{u&&(null==u||u.pause(),u.removeAttribute("src"))},[]);let g=(0,r.useMemo)(()=>({...a,updatePlayerState:A,audioElement:u,storedURL:f,playableURL:E,setPlayableURL:I,setStoredURL:m,setPlayerStatus:p,playerStatus:h,externalURL:_,setExternalURL:v}),[a,A,f,E,h,_]);return(0,i.jsx)(c.Provider,{value:g,children:n})},f=()=>{let e=(0,r.useContext)(c);if(!e)throw Error("usePlayerState must be used within an PlayerProvider");return e}},65089:function(e,t,n){"use strict";n.d(t,{bQ:function(){return O},Wf:function(){return D},o0:function(){return N},dy:function(){return P}});var i=n(52322),r=n(44041),o=n(19458),a=n(51574),l=n(72818),u=n(15906),s=n(38986),c=n(53093),d=n(2784),f=n(42670),m=n(23083),_=n(67516),v=n(80920),E=n(14084);let I=e=>{if(!e)return!1;if(e.type===a.CustomFileType.bucket){var t;return!(null===(t=e.pathInBucket)||void 0===t?void 0:t.trim())}return!1},h=e=>"publicURL"in e?e.publicURL:void 0,p=(e,t)=>{var n,i,r,o;if(!t)return!1;if(e.type===a.CustomFileType.bucket&&t.type===a.CustomFileType.bucket){let r=null===(n=e.pathInBucket)||void 0===n?void 0:n.trim(),o=null===(i=t.pathInBucket)||void 0===i?void 0:i.trim();return!!(r&&o&&r===o)}if(e.type===a.CustomFileType.dimg&&t.type===a.CustomFileType.dimg){let n=null===(r=e.urlPath)||void 0===r?void 0:r.trim(),i=null===(o=t.urlPath)||void 0===o?void 0:o.trim();if(n&&i&&n===i)return!0}if(e.type!==a.CustomFileType.bucket&&t.type===e.type){let n=h(e),i=h(t);return!!(n&&i&&n===i)}return!1},A=(e,t,n,i)=>{var r;return!(!I(e)||(null==i?void 0:i.has(n)))&&(null==t?void 0:t.type)===a.CustomFileType.bucket&&!!(null===(r=t.pathInBucket)||void 0===r?void 0:r.trim())},g=(e,t,n)=>{if(0===Object.keys(e).length)return e;let i=!1,r={};return Object.entries(e).forEach(e=>{let[o,a]=e;if(A(a,null==t?void 0:t[o],o,n)||p(a,null==t?void 0:t[o])){i=!0;return}r[o]=a}),i?r:e},R=(e,t)=>Object.entries(e).filter(e=>{let[n,i]=e;return I(i)&&t.has(n)}).length;async function T(e,t){let{designId:n,exportSize:i,exportFileType:r,method:a=o.ExportMethod.v11,onSuccess:l,onError:u}=e,s=new AbortController;t.current.push({id:n,exportSize:i,exportFileType:r,method:a,abortController:s,onSuccess:l,onError:u});let c=()=>{t.current=t.current.filter(e=>e.abortController!==s)};try{let e=await (0,m.po)(n,i,r,a);if(s.signal.aborted)return null;if(!e||!(null==e?void 0:e.url))throw Error("Failed to get download URL");if(c(),null===e)return null;return null==l||l(e),e}catch(e){throw c(),!s.signal.aborted&&u&&u(e),e}}let S=(0,d.createContext)({resources:{},getResources:()=>({}),upsertResource:()=>null,unsetResource:()=>null,seedPendingResources:()=>null,mergePendingResources:()=>
1null,setResources:()=>null,uploadAudioFile:()=>null,pendingResourceCount:0,fetchDesignDownload:()=>Promise.resolve(null),audioBlobCache:{},setAudioBlob:()=>null,getAudioBlob:()=>void 0}),C={},O=e=>{let{defaultValue:t,initialPendingResources:n,initialInFlightResourceIds:o,children:m}=e,v=(0,E.s)(e=>{var t;return null===(t=e.designDocument)||void 0===t?void 0:t.resources}),I=(0,E.s)(e=>e.subscribedDesignId),h=(0,d.useMemo)(()=>v||t||C,[v,t]),p=(0,d.useRef)(new Set(null!=o?o:[])),[A,O]=(0,d.useState)(()=>null!=n?n:{}),[N,D]=(0,d.useState)({}),P=(0,d.useRef)([]),M=(0,r.G)(),L=(0,d.useRef)(h),y=(0,d.useRef)(A),w=(0,d.useRef)();L.current=h,y.current=A;let b=(0,d.useCallback)((e,t)=>{D(n=>{if(void 0===t){let t={...n};return delete t[e],t}return{...n,[e]:t}})},[]),F=(0,d.useCallback)(e=>N[e],[N]),U=(0,d.useMemo)(()=>({...h,...A}),[h,A]),x=(0,d.useCallback)(()=>({...L.current,...y.current}),[]);(0,d.useEffect)(()=>{w.current!==I&&(w.current=I,I&&(p.current.clear(),y.current={},O({})))},[I]),(0,d.useEffect)(()=>{v&&O(e=>{let t=g(e,v,p.current);return t!==e&&(y.current=t),t})},[v]),(0,d.useEffect)(()=>()=>{P.current.forEach(e=>{e.abortController.abort()}),P.current=[]},[]);let k=(0,d.useCallback)((e,t)=>{let n={...L.current,...y.current}[e],i=g({...y.current,[e]:{...n,...t}},L.current,p.current);y.current=i,O(i)},[]),H=(0,d.useCallback)(e=>{let t=(0,l.CE)(y.current,e);y.current=t,O(t)},[]),W=(0,d.useCallback)(e=>{let t=g(e,L.current,p.current);y.current=t,O(t)},[]),X=(0,d.useCallback)(e=>{if(!e||0===Object.keys(e).length)return;let t=g({...y.current,...e},L.current,p.current);y.current=t,O(t)},[]),G=(0,d.useCallback)(e=>{let{designId:t,file:n,resourceId:r,onDone:o,onError:l,onProgress:c}=e,d=r||s.AUDIO_ORIGINAL_FILE_ID;p.current.add(d);let m=g({...y.current,[d]:{name:n.name,type:a.CustomFileType.bucket,pathInBucket:""}},L.current,p.current);y.current=m,O(m),(0,u.$p)({designId:t,type:"audio",onProgress:c,onDone:async(e,t,i)=>{p.current.delete(d);let r={type:a.CustomFileType.bucket,pathInBucket:e,name:n.name};k(d,r),o(),t&&i&&k(d,{...r,publicURL:await i()})},onError:(e,t)=>{p.current.delete(d),y.current={},O({}),M.error((0,i.jsx)(f.Z,{id:(0,_.p)(e),values:{maxSize:"100MB"}})),l(e,t)}})(n)},[M,k]),z=(0,d.useCallback)(e=>T(e,P),[]),V=(0,d.useCallback)(()=>{},[]),Y=R(A,p.current),j=(0,d.useMemo)(()=>({unsetResource:H,upsertResource:k,resources:U,getResources:x,seedPendingResources:W,mergePendingResources:X,setResources:V,uploadAudioFile:G,pendingResourceCount:Y,fetchDesignDownload:z,audioBlobCache:N,setAudioBlob:b,getAudioBlob:F}),[H,k,U,x,W,X,V,G,Y,z,N,b,F]);return(0,d.useEffect)(()=>{(0,c.o2)(j)},[j]),(0,i.jsx)(S.Provider,{value:j,children:m})},N=()=>{let e=(0,d.useContext)(S);if(!e)throw Error("useResourceStore must be used within an ResourceProvider");return e},D=e=>{let t=(0,d.useContext)(S);if(!t)throw Error("useResource must be used within an ResourceProvider");return(0,d.useMemo)(()=>e?t.resources[e]:void 0,[t.resources,e])},P=()=>{let e=(0,v.kH)().find(e=>!!e.audioResourceId);return D((null==e?void 0:e.audioResourceId)||s.AUDIO_ORIGINAL_FILE_ID)}},14084:function(e,t,n){"use strict";let i,r;n.d(t,{s:function(){return s}});var o=n(43841),a=n(83553),l=n(14067),u=n(18997);let s=(0,o.U)(e=>({designDocument:null,subscribedDesignId:void 0,isPaid:!1,editMode:a.uz.Editable,orderId:void 0,isLoading:!1,subscribeToDesign:(t,n)=>(i&&r!==t&&(i(),i=void 0),r===t&&i)?i:(r=t,e({isLoading:!0,subscribedDesignId:t}),(0,l.subscribeToFirestoreDocument)("designs",t,async t=>{if(!t){e({designDocument:null,isLoading:!1,isPaid:!1,editMode:a.uz.Editable,orderId:void 0});return}e({designDocument:t,isLoading:!1,isPaid:!!t.paidAt||t.isPaid||!1,orderId:t.orderId});try{let i=await (0,a.ed)(t,n?()=>Promise.resolve(n):void 0);e({editMode:i})}catch(t){(0,u.H)(t),e({editMode:a.uz.Editable})}}).then(e=>{i=e}).catch(t=>{(0,u.H)(t),e({isLoading:!1})}),()=>{i&&(i(),i=void 0),r===t&&(r=void 0),e({designDocument:null,subscribedDesignId:void 0,isPaid:!1,editMode:a.uz.Editable,orderId:void 0,isLoading:!1})}),unsubscribeFromDesign:()=>{i&&(i(),i=void 0),r=void 0,e({designDocument:null,subscribedDesignId:void 0,isPaid:!1,editMode:a.uz.Editable,orderId:void 0,isLoading:!1})},setIsPaid:t=>e({isPaid:t}),setEditMode:t=>e({editMode:t})}))},118:function(e,t,n){"use strict";n.d(t,{S:function(){return r},r:function(){return a}});var i,r,o=n(43841);(i=r||(r={})).NOTSAVED="NOTSAVED",i.SAVING="SAVING",i.SAVED="SAVED",i.ERRORED="ERRORED";let a=(0,o.U)((e,t)=>({saveState:"SAVED",setSaveState:t=>e({saveState:t}),setNotSaved:()=>e({saveState:"NOTSAVED"}),isNotSaved:()=>"NOTSAVED"===t().saveState,resetSaveState:()=>e({saveState:"SAVED"})}))},43821:function(e,t,n){"use strict";function i(e,t){if(!e||!Number.isFinite(e)||e<=0)return null;let n=function(e){if(!e)return!1;let{startRatio:t,endRatio:n}=e;return!!("number"==typeof t&&"number"==typeof n&&Number.isFinite(t)&&Number.isFinite(n))&&!(t>=n)&&!(1e-6>Math.abs(t)&&1e-6>Math.abs(n-1))}(t),i=n?t.startRatio:0,r=n?t.endRatio:1,o=i*e,a=r*e,l=a-o;return!Number.isFinite(l)||l<=0?null:{windowStart:o,windowDuration:l,windowEnd:a,hasTrim:n}}function r(e,t){return Math.max(0,Math.min(e-t.windowStart,t.windowDuration))}function o(e,t){let n=Math.max(0,Math.min(e,t.windowDuration));return t.windowStart+n}n.d(t,{ZR:function(){return o},sF:function(){return i},x$:function(){return r}})},34729:function(e,t,n){"use strict";n.d(t,{Y:function(){return a}});var i=n(40381),r=n(25139),o=n(2431);function a(e){if(!e)return!1;
1let t=o.YZ.getState().designJobs["".concat(r.A9).concat(e)];return(null==t?void 0:t.status)===i.E.queued||(null==t?void 0:t.status)===i.E.inprogress}},23746:function(e,t,n){"use strict";n.d(t,{NQ:function(){return o},W_:function(){return r}});let i=!1;function r(){return i}function o(e){i=e}},86337:function(e,t,n){"use strict";n.d(t,{CS:function(){return r},Mq:function(){return o}});let i=new Set;function r(e){e&&i.add(e)}function o(e){return!!e&&i.has(e)}},67516:function(e,t,n){"use strict";n.d(t,{p:function(){return o}});var i=n(68901);let r=new Set(["Alert.Upload.MAX_SIZE_EXCEEDED","Alert.Upload.UNSUPPORTED_FILE_FORMAT","Alert.Upload.UNSUPPORTED_FILE_FORMAT_WITH_VIDEO","Alert.Upload.CORRUPTED_FILE","Alert.Upload.Failed"]);function o(e){let t=e instanceof Error?e.message:String(null!=e?e:"");return t===i.FileError.MAX_SIZE_EXCEEDED?"Alert.Upload.MAX_SIZE_EXCEEDED":t===i.FileError.INCORRECT_FILE_TYPE||"UNSUPPORTED_FILE_FORMAT"===t?"Alert.Upload.UNSUPPORTED_FILE_FORMAT":"CORRUPTED_FILE"===t?"Alert.Upload.CORRUPTED_FILE":r.has(t)?t:"Alert.Upload.Failed"}},33545:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getSignedUploadUrl=t.getDownloadUrl=void 0;let i=n(21977),r=n(74304);t.getDownloadUrl=(0,i.buildGetFetch)({apiPathConcatenator:e=>"".concat(r.feconfig.apiURL,"/storage/signed-download-url?path=").concat(encodeURIComponent(e)),errorMessage:"Failed to get download URL"}),t.getSignedUploadUrl=(0,i.buildGetFetch)({apiPathConcatenator:(e,t,n,i)=>"".concat(r.feconfig.apiURL,"/storage/signed-upload-url?type=").concat(e,"&designId=").concat(t,"&fileName=").concat(encodeURIComponent(n)).concat(i?"&contentType=".concat(encodeURIComponent(i)):""),errorMessage:"Failed to get signed upload URL"})},78369:function(e,t,n){"use strict";n.d(t,{I:function(){return s}});var i=n(52322),r=n(2784),o=n(12524),a=n.n(o),l=n(11949),u=n.n(l);class s extends r.Component{componentDidMount(){this.textInput.current&&this.props.autoFocus&&this.textInput.current.focus()}componentDidUpdate(){this.textInput.current&&this.props.autoFocus&&this.textInput.current.focus()}render(){let{className:e,suffix:t,label:n,errorText:r,...o}=this.props;return(0,i.jsxs)("span",{className:a()("px-0 relative inline-flex flex-col text-gray-900",{"mt-3 md:mt-2":!!n},e),children:[n&&(0,i.jsx)("label",{className:"absolute px-2 text-sm bg-white left-1 md:text-xs -top-3 md:-top-2 rounded-sm",htmlFor:o.id,children:n}),(0,i.jsx)("input",{id:o.id,className:a()(u().input,{[e||""]:!t,"shadow-sm":!t,"w-full":!!t,"py-2.5":!!n,"py-1.5":!n,"border-red-500":r,[u().error]:r,"focus:border-blue-400 focus:shadow-blue-300":!r}),ref:this.textInput,...o}),r&&(0,i.jsx)("span",{className:"flex w-full mt-2 text-red-500",children:r}),t&&(0,i.jsx)("span",{className:"-ml-10",children:t})]})}constructor(e){super(e),this.textInput=r.createRef()}}},17847:function(e,t){"use strict";var n,i;Object.defineProperty(t,"__esModule",{value:!0}),t.ImageRectAttributes=t.RectAttributes=void 0,(i=n||(t.RectAttributes=n={})).top="top",i.left="left",i.width="width",i.height="height",i.scaleX="scaleX",i.scaleY="scaleY",i.skewX="skewX",i.skewY="skewY",i.originX="originX",i.originY="originY",i.angle="angle",i.selectable="selectable",i.lockUniScaling="lockUniScaling",i.lockMovementX="lockMovementX",i.lockMovementY="lockMovementY",i.name="name",i.clip="clip",i.minScaleLimit="minScaleLimit",i.shouldSyncRect="shouldSyncRect",i.zIndex="zIndex",t.ImageRectAttributes=Object.values(n).filter(e=>"width"!==e&&"height"!==e)},27818:function(e,t){"use strict";var n,i;t.c=void 0,(i=n||(t.c=n={})).initial="init",i.loading="loading",i.paused="paused",i.playing="playing",i.error="error"},33237:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.coerceAnimationStyle=i,t.isRecorderAnimationStyle=r,t.animationStylePickerValue=function(e){let t=i(e);return r(t)?"recorder-style":t},t.animationStyleFromPickerSelection=function(e,t){return"recorder-style"===e&&r(t)?t:e};let n=["timeline","spectrum","recorder-style","recorder-sine"];function i(e){return"oscillator"===e?"recorder-style":e&&n.includes(e)?e:"spectrum"}function r(e){return"recorder-style"===e||"recorder-sine"===e}},68901:function(e,t){"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.FileError=void 0,t.FileError={MAX_SIZE_EXCEEDED:"MAX_SIZE_EXCEEDED",INCORRECT_FILE_TYPE:"INCORRECT_FILE_TYPE",MAX_DURATION_EXCEEDED:"MAX_DURATION_EXCEEDED"}},53665:function(e,t,n){"use strict";var i;n(34406),Object.defineProperty(t,"__esModule",{value:!0}),t.isDevEnvironment=void 0,t.isDevEnvironment=null===(i=n(74304).feconfig)||void 0===i?void 0:i.isDEV},80368:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sanitizeFileName=function(e){let t=e.replace(/ä/g,"ae").replace(/ö/g,"oe").replace(/ü/g,"ue").replace(/Ä/g,"Ae").replace(/Ö/g,"Oe").replace(/Ü/g,"Ue").replace(/ß/g,"ss");return(t=t.normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^.a-z0-9]/gi,"_")).toLocaleLowerCase()}},15906:function(e,t,n){"use strict";var i=n(34406);t.$p=t.ws=t.jk=t.Iv=t.n0=void 0;let r=n(68901),o=n(80368),a=n(33545),l=n(14067),u=n(62995),s=n(86767);t.n0=41943040,t.Iv="".concat(t.n0/1048576,"MB"),t.jk=104857600;let c={apiUrl:i.env.NEXT_PUBLIC_API_URL||"/api",getAuthToken:async()=>(0,l.getIdToken)()},d=async e=>{let{file:n,type:i,designId:o}=e;switch(i){case"image":if(n.size>t.n0)throw Error(r.FileError.MAX_SIZE_EXCEEDED);break;case"audio":if(n.size>t.jk)throw Error(r.FileError.MAX_SIZE_EXCEEDED);break;default:return{promise:Promise.reject(Error("Invalid file type")),onProgress:()=>null}}if(!await c.getAuthToken())throw Error("No authentication token available");let l=[];return{promise:new Promise((e,t)=>{(0,a.getSignedUploadUrl)(i,o,n.name,n.type).then(i=>{let{url:r,headers:o,fullPath:a}=i,u=new XMLHttpRequest;u.upload.addEventListener("progress",e=>{if(e.lengthComputable){let t=e.loaded/e.total*100;l.forEach(e=>e(t))}}),u.addEventListener("load",()=>{u.status>=200&&u.status<300?e({fullPath:a,name:n.name}):t(Error("Upload failed with status ".concat(u.status,": ").concat(u.responseText)))}),u.addEventListener("error",()=>{t(Error("Network error during upload"))}),u.addEventListener("abort",()=>{t(Error("Upload aborted"))}),u.open("PUT",r),u.setRequestHeader("Content-Type",n.type||"application/octet-stream"),o&&Object.entries(o).forEach(e=>{let[t,n]=e;"Content-Type"!==t&&u.setRequestHeader(t,n)}),u.send(n)}).catch(e=>{t(e)})}),onProgress:function(e){l.push(e)}}};async function f(e){async function t(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(n>10)return"";try{return(await (0,a.getDownloadUrl)(e)).url}catch(r){let e=r instanceof Error?r.message:String(r),i=/\bstatus:\s*429\b/.test(e);if(i&&n>=5)return"";return await (0,s.wait)(i?2e3*2**Math.min(n,3):1e3),t(n+1)}}return t(0)}t.ws=d,t.$p=e=>{let{type:n,onProgress:i,onDone:r,onError:a,designId:l,onDownloadURL:s}=e;return async e=>{try{let a=(0,o.sanitizeFileName)(e.name);if(a!==e.name){let t=e.slice(0,e.size,e.type);e=new File([t],a.toLowerCase(),{type:e.type})}let c=await (0,t.ws)({file:e,type:n,designId:l});c.onProgress(i);let d=await c.promise,m=await f(d.fullPath);if("string"==typeof d){r&&r(d);return}let _=async()=>{if(m)return m;try{return await f(d.fullPath)}catch(e){return(0,u.logError)(e,{extra:{fileRef:d}}),""}};if(r&&r(d.fullPath,d,_),s){let e=await _();s(e)}}catch(t){a(t,{extra:{fileSize:e.size,fileName:e.name}})}}}},93580:function(e,t){"use strict";t.Qg=t.B8=void 0,t.B8=[{value:"Open Sans",fontName:"Open Sans"},{value:"Roboto",fontName:"Roboto"},{value:"Montserrat",fontName:"Montserrat"},{value:"Oswald",fontName:"Oswald"},{value:"Lato",fontName:"Lato"},{value:"Arial",fontName:"Arial"},{value:"sans-serif",fontName:"Sans Serif"},{value:"Dancing Script",fontName:"Dancing Script"},{value:"Indie Flower",fontName:"Indie Flower"},{value:"Shadows Into Light",fontName:"Shadows Into Light"},{value:"Big Shoulders Display",fontName:"Big Shoulders Display"},{value:"Krona One",fontName:"Krona One"},{value:"Yellowtail",fontName:"Yellowtail"},{value:"Barlow",fontName:"Barlow"},{value:"Barrio",fontName:"Barrio"},{value:"Lobster",fontName:"Lobster"},{value:"Silkscreen",fontName:"Silkscreen"},{value:"Pacifico",fontName:"Pacifico"},{value:"Permanent Marker",fontName:"Permanent Marker"},{value:"Bangers",fontName:"Bangers"},{value:"Cookie",fontName:"Cookie"},{value:"Caveat",fontName:"Caveat"},{value:"Inter",fontName:"Inter"},{value:"Merriweather",fontName:"Merriweather"},{value:"Nunito Sans",fontName:"Nunito Sans"},{value:"Playfair Display",fontName:"Playfair Display"},{value:"Poppins",fontName:"Poppins"}].sort((e,t)=>
1e.fontName.localeCompare(t.fontName)),t.Qg=["Open Sans","Roboto","Montserrat","Oswald","Lato","Dancing Script","Indie Flower","Shadows Into Light","Big Shoulders Display","Krona One","Yellowtail","Barlow","Barrio","Lobster","Silkscreen","Pacifico","Permanent Marker","Caveat","Bangers","Cookie","Inter","Merriweather","Nunito Sans","Playfair Display","Poppins"]},94457:function(e,t){"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.DesignType=void 0,(n||(t.DesignType=n={})).SOUNDWAVE="soundwave"},52438:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CONVERT_AUDIO_INVALID_VIDEO_CONTAINER_MESSAGE=t.CONVERT_AUDIO_SERVICE_UNAVAILABLE_MESSAGE=t.CONVERT_AUDIO_VIDEO_EXTRACTION_FAILED_MESSAGE=t.CONVERT_AUDIO_NO_AUDIO_IN_VIDEO_MESSAGE=void 0,t.isWaveConvertEdgeHttpStatus=function(e){return null!=e&&n.has(e)},t.classifyConvertAudioFailureReason=r,t.isConvertAudioUserFailure=function(e){let t=r(e);return!i.has(t)},t.isConvertAudioSystemFailureReason=function(e){return i.has(e)},t.isConvertAudioUserFacingFailureMessage=function(e){return!!(e&&o.has(e))},t.classifyClientConvertAudioFailure=function(e){return"VIDEO_HAS_NO_AUDIO_TRACK"===e?"no_audio_in_video":"VIDEO_INVALID_CONTAINER"===e?"invalid_video_container":"CORRUPTED_FILE"===e?"client_corrupted_file":"POSTER_CAPTURE_FAILED"===e?"client_poster_failed":"MAX_SIZE_EXCEEDED"===e||"UNSUPPORTED_FILE_FORMAT"===e||"InvalidAudioFile"===e?"client_validation":"Could not save design"===e||"AUDIO_CONVERSION_FAILED"===e?"client_save_failed":"client_upload_failed"},t.CONVERT_AUDIO_NO_AUDIO_IN_VIDEO_MESSAGE="This video has no audio we can extract. Upload an audio file or a video that includes sound.",t.CONVERT_AUDIO_VIDEO_EXTRACTION_FAILED_MESSAGE="We couldn't extract audio from this video. Try a shorter clip, MP4 with AAC audio, or upload an audio file directly.",t.CONVERT_AUDIO_SERVICE_UNAVAILABLE_MESSAGE="Audio conversion service timed out. Please try again.";let n=new Set([502,503,520,522,524,525]);t.CONVERT_AUDIO_INVALID_VIDEO_CONTAINER_MESSAGE="This video file looks incomplete or corrupted. Please try uploading again or use a different file.";let i=new Set(["source_missing","system_error"]);function r(e){return e===t.CONVERT_AUDIO_NO_AUDIO_IN_VIDEO_MESSAGE?"no_audio_in_video":e===t.CONVERT_AUDIO_VIDEO_EXTRACTION_FAILED_MESSAGE?"waveconvert_failed":e===t.CONVERT_AUDIO_INVALID_VIDEO_CONTAINER_MESSAGE?"invalid_video_container":e.includes("Recorded or uploaded audio is empty or too short")?"empty_recording":e.startsWith("convertAudioFile:invalid-resource:")?"invalid_resource":e.startsWith("convertAudioFile:unsupported-format:")?"unsupported_format":e.startsWith("convertAudioFile:source-too-small:")?"source_too_small":e.startsWith("convertAudioFile:no-audio-in-video:")?"no_audio_in_video":e.startsWith("convertAudioFile:source-missing:")?"source_missing":e.includes("Convert job failed")||e.includes("Failed to create conversion job")||e.includes("Request failed with status code 400")?"waveconvert_failed":e===t.CONVERT_AUDIO_SERVICE_UNAVAILABLE_MESSAGE||/Request failed with status code (502|503|520|522|524|525)/.test(e)?"conversion_timeout":"system_error"}let o=new Set([t.CONVERT_AUDIO_NO_AUDIO_IN_VIDEO_MESSAGE,t.CONVERT_AUDIO_VIDEO_EXTRACTION_FAILED_MESSAGE,t.CONVERT_AUDIO_INVALID_VIDEO_CONTAINER_MESSAGE,"Recorded or uploaded audio is empty or too short. Please record again or upload a longer clip.",t.CONVERT_AUDIO_SERVICE_UNAVAILABLE_MESSAGE])},53438:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.applyWaveformConfigToWaveformNodes=function(e){let{waveforms:t,waveformConfig:n,rect:o}=e;return t.map(e=>{var t;let a=(0,r.getWaveformDisplayTrim)(e,n),l=(0,i.computeShownWaveformData)({waveformData:e.waveformData,waveformConfig:n,trim:a,width:n.reference.width,audioFileName:e.audioFileName,source:e.selectedSource,fallback:null!==(t=e.shownWaveformData)&&void 0!==t?t:[]});return{...e,...o?{rect:{...e.rect,...o,scaleX:1,scaleY:1}}:{},shownWaveformData:l}})};let i=n(92428),r=n(70429)},95669:function(e,t){"use strict";function n(e){if(!e)return!0;let t=e.trim().toLowerCase();return"#fff"===t||"#ffffff"===t||"white"===t}
1Object.defineProperty(t,"__esModule",{value:!0}),t.CAPTION_DEFAULT_FILL_COLOR=t.CAPTION_PAUSE_GAP_S=t.CAPTION_MIN_WORDS_FOR_SOFT_BREAK=t.CAPTION_SHORT_CUE_MAX_WORDS=t.CAPTION_CHAR_WIDTH_RATIO=t.CAPTION_LINE_HEIGHT=t.CAPTION_HORIZONTAL_INSET_RATIO=t.CAPTION_MAX_BLOCK_HEIGHT_RATIO=t.CAPTION_FLOOR_FONT_RATIO=t.CAPTION_MAX_FONT_RATIO=t.CAPTION_MIN_FONT_RATIO=t.CAPTION_MAX_CUE_DURATION_S=t.CAPTION_MAX_CUE_CHARS=t.CAPTION_MAX_CUE_WORDS=t.CAPTION_MAX_LINES=void 0,t.isUnsetOrLegacyWhiteCaptionFill=n,t.captionFillOrDefault=function(e){return n(e)?t.CAPTION_DEFAULT_FILL_COLOR:e},t.CAPTION_MAX_LINES=2,t.CAPTION_MAX_CUE_WORDS=8,t.CAPTION_MAX_CUE_CHARS=42,t.CAPTION_MAX_CUE_DURATION_S=4,t.CAPTION_MIN_FONT_RATIO=.05,t.CAPTION_MAX_FONT_RATIO=.08,t.CAPTION_FLOOR_FONT_RATIO=.035,t.CAPTION_MAX_BLOCK_HEIGHT_RATIO=.22,t.CAPTION_HORIZONTAL_INSET_RATIO=.05,t.CAPTION_LINE_HEIGHT=1.16,t.CAPTION_CHAR_WIDTH_RATIO=.55,t.CAPTION_SHORT_CUE_MAX_WORDS=3,t.CAPTION_MIN_WORDS_FOR_SOFT_BREAK=3,t.CAPTION_PAUSE_GAP_S=.35,t.CAPTION_DEFAULT_FILL_COLOR="#000000"},28687:function(e,t,n){"use strict";var i;Object.defineProperty(t,"__esModule",{value:!0}),t.CAPTION_KARAOKE_HIGHLIGHT_FILL=t.MIN_CAPTION_AUTHORED_SLOT_WIDTH=t.CAPTION_ANCHOR_FONT_SIZE=t.CAPTION_AUTHORED_SLOT_HEIGHT=t.CAPTION_AUTHORED_SLOT_WIDTH=void 0,t.isUsableCaptionAuthoredSlot=d,t.stampCaptionAuthoredSlotSize=_,t.readCaptionAuthoredSlotSize=function(e){var n,i;let r=Number(m(e,t.CAPTION_AUTHORED_SLOT_WIDTH)),o=Number(m(e,t.CAPTION_AUTHORED_SLOT_HEIGHT));return d({width:r,height:o})?{width:r*(null!==(n=e.scaleX)&&void 0!==n?n:1),height:o*(null!==(i=e.scaleY)&&void 0!==i?i:1)}:null},t.stampCaptionAnchorFontSize=v,t.readCaptionAnchorFontSize=function(e){var n;let i=Number(m(e,t.CAPTION_ANCHOR_FONT_SIZE));if(i>0)return i*(null!==(n=e.scaleY)&&void 0!==n?n:1)},t.fabricGroupChildren=E,t.diffCaptionLineGroupPatch=function(e,t){if(!t)return{...e};let n={};return I.forEach(i=>{void 0!==e[i]&&((0,o.default)(t[i],e[i])||(n[i]=e[i]))}),n},t.isCaptionSlotTextNode=function(e,t){return e.name===u.CAPTION_TEXT_NODE_NAME||!!(null==t?void 0:t.has(e.name))},t.captionLinesFromDisplayText=h,t.captionLineLocalRects=p,t.isEditorTextSelection=function(e){return!!e&&(e instanceof r.fabric.IText||e.name===u.CAPTION_TEXT_NODE_NAME||A(e))},t.isCaptionLineGroup=A,t.captionLineTexts=g,t.captionSlotDisplayText=function(e){if(!e)return"";let[t,n]=g(e);return[null==t?void 0:t.text,null==n?void 0:n.text].filter(e=>(null!=e?e:"").trim().length>0).join(" ")},t.captionLineCueCharRange=R,t.invalidateFabricObjectCache=S,t.applyCaptionLineLocalLayout=C,t.buildCaptionLineGroup=function(e){var t,n,i,o,a,u;let[d,f]=h(e.text),m=T(f),E=O(d,e,s,!0),I=O(f,e,c,m),p=new r.fabric.Group([E,I],{left:e.left,top:e.top,originX:null!==(t=e.originX)&&void 0!==t?t:"center",originY:null!==(n=e.originY)&&void 0!==n?n:"center",angle:e.angle,scaleX:e.scaleX,scaleY:e.scaleY,name:e.name,selectable:null===(i=e.selectable)||void 0===i||i,evented:null===(o=e.evented)||void 0===o||o,subTargetCheck:!1,objectCaching:!1,lockScalingX:!0,lockScalingY:!0,lockScalingFlip:!0});return p.set({name:e.name}),C(p,e.fontSize,m),p.set({left:e.left,top:e.top,originX:null!==(a=e.originX)&&void 0!==a?a:"center",originY:null!==(u=e.originY)&&void 0!==u?u:"center"}),p.set("shadow",(0,l.textNodeShadowToFabric)(e.shadow)),_(p,e.width,e.height),v(p,e.captionAnchorFontSize),p.setCoords(),p},t.applyCaptionLineGroupPatch=function(e,t){var n,i,r;let[o,a]=g(e);if(!o||!a)return;let u={};if(null!=t.fontSize&&(u.fontSize=t.fontSize),null!=t.fontFamily&&(u.fontFamily=t.fontFamily),null!=t.fillColor&&(u.fill=t.fillColor,o.set("styles",{}),a.set("styles",{})),null!=t.lineHeight&&(u.lineHeight=t.lineHeight),Object.keys(u).length>0&&(o.set(u),a.set(u)),null!=t.text){let[e,n]=h(t.text);o.set({text:e}),a.set({text:n}),e||n||(o.set("styles",{}),a.set("styles",{}))}let s=T(null!==(n=a.text)&&void 0!==n?n:""),c=null!==(r=null!==(i=t.fontSize)&&void 0!==i?i:o.fontSize)&&void 0!==r?r:36;null!=t.text||null!=t.fontSize||null!=t.fontFamily||null!=t.lineHeight?C(e,c,s):a.set({visible:s});let d={};null!=t.left&&(d.left=t.left),null!=t.top&&(d.top=t.top),null!=t.originX&&(d.originX=t.originX),null!=t.originY&&(d.originY=t.originY),null!=t.angle&&(d.angle=t.angle),null!=t.scaleX&&(d.scaleX=t.scaleX),null!=t.scaleY&&(d.scaleY=t.
1scaleY),null!=t.opacity&&(d.opacity=t.opacity),null!=t.visible&&(d.visible=t.visible),Object.keys(d).length>0&&e.set(d),void 0!==t.shadow&&e.set("shadow",(0,l.textNodeShadowToFabric)(t.shadow)),e.set("objectCaching",!1),e.dirty=!0,e.setCoords(),S(e)},t.applyCaptionLineGroupWordHighlight=function(e,t,n,i,r,o){let[a,l]=g(e);if(!a||!l)return;let u=null==n?void 0:n.find(e=>i>=e.startMs&&i<e.endMs),s=0;[a,l].forEach(e=>{var n;let i=null!==(n=e.text)&&void 0!==n?n:"",a=R(t,i,s);s=a.nextFrom;let l={};for(let e=0;e<i.length;e+=1){let t=a.start>=0?a.start+e:-1,n=null!=u&&t>=u.charStart&&t<u.charEnd;l[e]={fill:n?r:o}}e.set("styles",{0:l}),e.dirty=!0}),e.dirty=!0,S(e)};let r=n(21749),o=(i=n(18149))&&i.__esModule?i:{default:i},a=n(95669),l=n(6196),u=n(11080),s="-line-0",c="-line-1";function d(e){return null!=e&&null!=e.width&&null!=e.height&&e.width>=t.MIN_CAPTION_AUTHORED_SLOT_WIDTH&&e.height>0}t.CAPTION_AUTHORED_SLOT_WIDTH="captionAuthoredSlotWidth",t.CAPTION_AUTHORED_SLOT_HEIGHT="captionAuthoredSlotHeight",t.CAPTION_ANCHOR_FONT_SIZE="captionAnchorFontSize",t.MIN_CAPTION_AUTHORED_SLOT_WIDTH=32;let f=(e,t,n)=>{e.set(t,n)},m=(e,t)=>e.get(t);function _(e,n,i){null!=n&&n>0&&f(e,t.CAPTION_AUTHORED_SLOT_WIDTH,n),null!=i&&i>0&&f(e,t.CAPTION_AUTHORED_SLOT_HEIGHT,i)}function v(e,n){null!=n&&n>0&&f(e,t.CAPTION_ANCHOR_FONT_SIZE,n)}function E(e){return e&&"function"==typeof e.getObjects?e.getObjects():[]}t.CAPTION_KARAOKE_HIGHLIGHT_FILL="#f5b700";let I=["text","fontSize","fontFamily","fillColor","left","top","originX","originY","angle","scaleX","scaleY","opacity","lineHeight","shadow","visible"];function h(e){var t;let n=(null!=e?e:"").replace(/\r/g,"").split("\n");return[null!==(t=n[0])&&void 0!==t?t:"",n.slice(1).join(" ")]}function p(e,t){if(!t)return[{left:0,top:0},{left:0,top:0}];let n=e*a.CAPTION_LINE_HEIGHT/2;return[{left:0,top:-n},{left:0,top:n}]}function A(e){let t=E(e).map(e=>{var t;return null!==(t=e.name)&&void 0!==t?t:""});return t.some(e=>e.endsWith(s))&&t.some(e=>e.endsWith(c))}function g(e){let t=E(e),n=t.find(e=>{var t;return(null!==(t=e.name)&&void 0!==t?t:"").endsWith(s)}),i=t.find(e=>{var t;return(null!==(t=e.name)&&void 0!==t?t:"").endsWith(c)});return n&&i&&"string"==typeof n.text&&"string"==typeof i.text?[n,i]:[null,null]}function R(e,t,n){if(!t)return{start:n,end:n,nextFrom:n};let i=e.indexOf(t,n);return -1===i?{start:-1,end:-1,nextFrom:n}:{start:i,end:i+t.length,nextFrom:i+t.length}}function T(e){return e.trim().length>0}function S(e){let t=e;for(;t;)t.set("objectCaching",!1),t.dirty=!0,t=t.group}function C(e,t,n){var i;let[r,o]=g(e);if(!r||!o)return;let a=p(t,n);r.set({left:a[0].left,top:a[0].top,originX:"center",originY:"center",textAlign:"center"}),o.set({left:a[1].left,top:a[1].top,originX:"center",originY:"center",textAlign:"center",visible:n}),r.setCoords(),o.setCoords(),null===(i=e._calcBounds)||void 0===i||i.call(e,!0),e.setCoords()}function O(e,t,n,i){var o;return new r.fabric.Text(e,{fontFamily:t.fontFamily,fontSize:t.fontSize,fill:t.fillColor,originX:"center",originY:"center",textAlign:"center",selectable:!1,evented:!1,objectCaching:!1,visible:i,lineHeight:null!==(o=t.lineHeight)&&void 0!==o?o:a.CAPTION_LINE_HEIGHT,name:"".concat(t.name).concat(n)})}},1440:function(e,t,n){"use strict";t.av=function(e,t,n){return!t||0===(0,l.captionsConfigCueCount)(t)||e.some(e=>(0,l.shouldKeepEmptyCaptionTextNode)(e.name,t))?e:[...e,function(e,t){var n,s,c,d;let f=i.ReferenceDimensions[t],m=null===(s=e.layouts)||void 0===s?void 0:null===(n=s[0])||void 0===n?void 0:n.textNodeName,_=m&&m!==l.LEGACY_ASR_CAPTION_SLOT_NAME?m:o.CAPTION_TEXT_NODE_NAME,v=(0,u.captionSlotLayoutPatch)({text:"",canvasWidth:f.width,canvasHeight:f.height,fontSizeMode:(0,l.captionsFontSizeMode)(e)});return{name:_,text:"",fontFamily:"Open Sans",fillColor:a.CAPTION_DEFAULT_FILL_COLOR,fontSize:v.fontSize,width:v.width,height:v.height,left:null!==(c=v.left)&&void 0!==c?c:f.width/2,top:null!==(d=v.top)&&void 0!==d?d:f.height/2,originX:v.originX,originY:v.originY,textAlign:v.textAlign,zIndex:r.LAYER_ZINDEX.full.textNodes}}(t,n)]};let i=n(15343),r=n(64820),o=n(11080),a=n(95669),l=n(40568),u=n(3809)},92428:function(e,t,n){"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.computeShownWaveformData=function(e){let{waveformData:t,waveformConfig:n,width:o,trim:a,audioFileName:l,source:u,fallback:s=[]}=e;return(0,r.hasWorkableWaveformData)(t)?(0,i.getShownWaveformData)({space:n.space,thickness:n.thickness,style:n.style,trim:a,width:o,audioFileName:l,source:u,waveformData:t}):s};let i=n(27061),r=n(10424)},52305:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.convertActualToReferenceObject=function(e,t,n){let i={...e};return(null==i?void 0:i.top)&&(i.top=(i.top-((null==n?void 0:n.offsetTop)||0))/t),(null==i?void 0:i.left)&&(i.left=(i.left-((null==n?void 0:n.offsetLeft)||0))/t),(null==i?void 0:i.scaleX)&&(i.scaleX/=t),(null==i?void 0:i.scaleY)&&(i.scaleY/=t),i}},3809:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fitCaptionToSlot=f,t.fitCaptionIntoAuthoredSlot=m,t.captionSlotLayoutPatch=function(e){if(null!=e.slotWidth&&null!=e.slotHeight&&e.slotWidth>0&&e.slotHeight>0){let t=m({text:e.text,slotWidth:e.slotWidth,slotHeight:e.slotHeight,canvasWidth:e.canvasWidth,canvasHeight:e.canvasHeight,anchorFontSize:e.anchorFontSize,fontSizeMode:e.fontSizeMode,heldFontSize:e.heldFontSize});return{text:t.displayText,fontSize:t.fontSize,width:e.slotWidth,height:e.slotHeight,originX:"center",originY:"center",textAlign:"center"}}let t=f(e);return{text:t.displayText,fontSize:t.fontSize,width:t.width,height:t.height,left:t.left,top:t.top,originX:"center",originY:"center",textAlign:"center"}};let i=n(95669);function r(e,t,n){let r=e.trim().split(/\s+/).filter(Boolean);if(!r.length)return[];let o=n*i.CAPTION_CHAR_WIDTH_RATIO,a=[],l="";return r.forEach(e=>{let n=l?"".concat(l," ").concat(e):e;if(!l||n.length*o<=t){l=n;return}a.push(l),l=e}),l&&a.push(l),a}function o(e,t,n){let o=r(e,t,n);return o.length?o.length<=i.CAPTION_MAX_LINES?o.join("\n"):[...o.slice(0,i.CAPTION_MAX_LINES-1),o.slice(i.CAPTION_MAX_LINES-1).join(" ")].join("\n"):""}function a(e){return e?e.split("\n").length:1}function l(e,t,n,o){let a=Math.max(1,r(e,n,t).length),l=t*i.CAPTION_LINE_HEIGHT*a;return a<=i.CAPTION_MAX_LINES&&l<=o+.01}function u(e,t,n,i,r){let o=i,a=i,u=r;for(let i=0;i<24;i+=1){let i=(a+u)/2;l(e,i,t,n)?(o=i,a=i):u=i}return o}function s(e){return null==e||!Number.isFinite(e)||e<=0?null:e}function c(e,t,n){var r,o;return null!==(o=null!==(r=s(e))&&void 0!==r?r:s(t))&&void 0!==o?o:n*i.CAPTION_MIN_FONT_RATIO}function d(e,t,n,i,r){return l(e,t,n,i)?t:u(e,n,i,Math.min(t,r),t)}function f(e){let t,{text:n,canvasWidth:r,canvasHeight:l,anchorFontSize:f,fontSizeMode:m,heldFontSize:_}=e,v=n.trim(),E=r*i.CAPTION_HORIZONTAL_INSET_RATIO,I=l*i.CAPTION_HORIZONTAL_INSET_RATIO,h=Math.max(1,r-2*E),p=l*i.CAPTION_MAX_BLOCK_HEIGHT_RATIO,A=l*i.CAPTION_MAX_FONT_RATIO,g=l*i.CAPTION_MIN_FONT_RATIO,R=l*i.CAPTION_FLOOR_FONT_RATIO,T=s(f),S="stable"===m,C=v.trim().split(/\s+/).filter(Boolean).length<=i.CAPTION_SHORT_CUE_MAX_WORDS,O=C?g:R;S?t=c(f,_,l):null!=T?t=d(v,T,h,p,R):(t=u(v,h,p,O,A),t=C?Math.min(t=Math.max(t,g),A):Math.min(t=Math.max(t,R),A-.01));let N=o(v,h,t)||v,D=a(N),P=Math.max(t*i.CAPTION_LINE_HEIGHT,t*i.CAPTION_LINE_HEIGHT*D),M=S?P:Math.min(p,P),L=l-I-M/2;return{text:v,displayText:N,fontSize:t,width:h,height:M,left:r/2,top:L,lineCount:D}}function m(e){let{text:t,slotWidth:n,slotHeight:r,canvasWidth:l,canvasHeight:f,anchorFontSize:m,fontSizeMode:_,heldFontSize:v}=e,E=t.trim(),I=Math.max(1,n),h=Math.max(1,r);if("stable"===_){let e=c(m,v,f),t=o(E,I,e)||E,n=a(t),r=Math.max(e*i.CAPTION_LINE_HEIGHT,e*i.CAPTION_LINE_HEIGHT*n);return{text:E,displayText:t,fontSize:e,width:I,height:r,left:l/2,top:f/2,lineCount:n}}let p=s(m),A=Math.min(null!=p?p:f*i.CAPTION_MAX_FONT_RATIO,h/i.CAPTION_LINE_HEIGHT,I),g=null!=p?d(E,A,I,h,Math.min(8,A)):Math.min(A,u(E,I,h,Math.min(8,A),A)),R=o(E,I,g)||E,T=a(R),S=Math.min(h,Math.max(g*i.CAPTION_LINE_HEIGHT,g*i.CAPTION_LINE_HEIGHT*T));return{text:E,displayText:R,fontSize:g,width:I,height:S,left:l/2,top:f/2,lineCount:T}}},1023:function(e,t){"use strict";t.Z=function(e){let t=[],n=e=>{t.push(e),"function"==typeof e.forEachObject&&e.forEachObject(e=>n(e))};return e.forEach(n),t}},70429:function(e,t,n){"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.getWaveformDisplayTrim=function(e,t){var n;let r=null!==(n=e.trim)&&void 0!==n?n:t.trim;return r&&(0!==r.startRatio||1!==r.endRatio)&&e.selectedSource===i.SourceType.AUDIO?{startRatio:0,endRatio:1}:r};let i=n(19458)},10424:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.hasWorkableWaveformData=function(e){return Array.isArray(e)&&e.length>0}},80917:function(e,t,n){"use strict";t.T=function(e){if(!e)return;let t=(0,r.isServerFetchableImageUrl)(e.url)?e.url:void 0;if(!(e.resourceId||t))return;let n={resourceId:e.resourceId,...t?{url:t}:{}};return(0,i.isCompleteCenterImageLayout)(e)?{...n,width:e.width,height:e.height,left:e.left,top:e.top,scaleX:e.scaleX,scaleY:e.scaleY}:n};let i=n(27099),r=n(11753)},33394:function(e,t){"use strict";t.Z=function(e){if(!e||"object"!=typeof e)return{};let t={...e};for(let e of n)delete t[e];return t};let n=["waveformData","shownWaveformData","reducedWaveformData"]},36871:function(e,t,n){"use strict";function i(e){return"number"==typeof e&&Number.isFinite(e)}t.lP=t.IW=t.vY=t.hy=void 0,t.ds=function(e){var n,r;return!!("object"==typeof(r=e)&&null!==r&&!Array.isArray(r))&&!("stems"in(n=e))&&!("rms"in n)&&e.version===t.lP&&"string"==typeof e.resourceId&&e.resourceId.length>0&&e.engine===t.IW&&i(e.fps)&&i(e.durationMs)},n(38986),t.hy="stem-analysis",t.vY=["drums","bass","vocals","other"],t.IW="htdemucs",t.lP=1},17488:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_NODE_ZINDEX_BASE=t.TEXT_NODE_ZINDEX_STEP=void 0,t.nextTextNodeZIndex=function(e){return 0===e.length?t.TEXT_NODE_ZINDEX_BASE:o(Math.max(...e.map(r)))},t.normalizeTextNodeZIndices=function(e){if(e.length<=1||!function(e){let t=new Set;for(let n of e){let e=r(n);if(t.has(e))return!0;t.add(e)}return!1}(e))return e;let t=e.map((e,t)=>({i:t,z:r(e)})),n=t.map((e,t)=>t).sort((e,n)=>{let i=t[e].z,r=t[n].z;return i!==r?i-r:e-n}),i=new Map,a=-1/0;for(let e of n){let{z:n}=t[e],r=n;r<=a&&(r=o(a)),a=r,i.set(e,r)}return e.map((e,t)=>{var n;let o=null!==(n=i.get(t))&&void 0!==n?n:r(e);return e.zIndex===o?e:{...e,zIndex:o}})};let i=n(64820);function r(e){let n=e.zIndex;return"number"==typeof n&&Number.isFinite(n)?n:t.TEXT_NODE_ZINDEX_BASE}function o(e){return Math.round((e+t.TEXT_NODE_ZINDEX_STEP)*100)/100}t.TEXT_NODE_ZINDEX_STEP=.01,t.TEXT_NODE_ZINDEX_BASE=i.LAYER_ZINDEX.full.textNodes},32945:function(e,t,n){"use strict";t.EM=void 0;let i=n(63775),r={currentFrame:0,fps:30,durationInFrames:300,currentTime:0,duration:10,isPlaying:!1,isVideoRendering:!1,seekerPosition:0,animationStyle:"spectrum",spectrumReactivity:i.DEFAULT_SPECTRUM_REACTIVITY},o=null,a=new Set,l=null,u=0,s=()=>{if(null!==o)return;let e=t=>{if(r.isVideoRendering)r.seekerPosition=r.durationInFrames>0?r.currentFrame/r.durationInFrames:0;else if(r.isPlaying&&r.duration>0&&null!==l){let e=Math.max(0,Math.min(u+(t-l)/1e3,r.duration));r.currentTime=e,r.seekerPosition=r.duration>0?e/r.duration:0,r.currentFrame=Math.floor(e*r.fps)}else r.seekerPosition=r.duration>0?r.currentTime/r.duration:0;(r.isPlaying||r.isVideoRendering)&&a.forEach(e=>{try{r.currentTime>=e.start&&r.currentTime<=e.end&&e.animate(r.currentFrame,{...r})}catch(e){console.error("Error in component animation:",e)}}),o=requestAnimationFrame(e)};o=requestAnimationFrame(e)},c=()=>{null!==o&&(cancelAnimationFrame(o),o=null),l=null,u=0};t.EM={getState:()=>({...r}),setFrame:e=>{let t=Math.max(0,Math.min(e,r.durationInFrames||1/0));r.currentFrame=t,r.seekerPosition=r.durationInFrames>0?t/r.durationInFrames:0,r.isVideoRendering&&r.fps>0&&(r.currentTime=t/r.fps),r.isVideoRendering&&a.forEach(e=>{try{r.currentTime>=e.start&&r.currentTime<=e.end&&e.animate(r.currentFrame,{...r})}catch(e){console.error("Error in component animation:",e)}})},setFps:e=>{r.fps=e},setDurationInFrames:e=>{r.durationInFrames=e},setTime:e=>{let t=Math.max(0,Math.min(e,r.duration));r.currentTime=t,r.seekerPosition=r.duration>0?t/r.duration:0,r.currentFrame=Math.floor(t*r.fps),r.isPlaying&&null!==l&&(u=t,l=performance.now())},setDuration:e=>{r.duration=e},play:()=>
1{if(r.duration<=0){console.warn("AnimationService.play() called but duration is not set. Call setDuration() first.");return}r.currentTime=0,r.currentFrame=0,r.seekerPosition=0,r.isPlaying=!0,l=performance.now(),u=0,null===o&&s()},stop:()=>{r.isPlaying=!1,r.currentFrame=0,r.currentTime=0,r.seekerPosition=0,l=null,u=0,c()},seek:e=>{let t=Math.max(0,Math.min(1,e)),n=t*r.duration;r.currentTime=n,r.seekerPosition=t,r.currentFrame=Math.floor(n*r.fps),r.isPlaying&&null!==l&&(u=n,l=performance.now())},setAnimationStyle:e=>{r.animationStyle=e},setSpectrumReactivity:e=>{r.spectrumReactivity=(0,i.normalizeSpectrumReactivity)(e)},setIsVideoRendering:e=>{r.isVideoRendering=e},setAudioData:e=>{r.audioData=e},setPrecomputedSpectrum:e=>{r.precomputedSpectrum=e},addComponent:e=>{a.add(e),r.isPlaying&&a.size>0&&null===o&&(null===l&&(u=r.currentTime,l=performance.now()),s())},removeComponent:e=>{a.delete(e),0!==a.size||r.isPlaying||r.isVideoRendering||c()}},t.EM},66833:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_NEW_TEXT_LAYER_TEXT=void 0,t.buildNewTextNodeConfig=function(e,n){var a,l,u,s,c,d,f,m,_,v;let E=null!==(a=n.layerId)&&void 0!==a?a:"".concat(r.TEXT_NODE_OBJECT_NAME_PREFIX).concat(Date.now()),I=i.ReferenceDimensions[n.canvasAspectRatio];return{name:E,text:null!==(l=e.text)&&void 0!==l?l:t.DEFAULT_NEW_TEXT_LAYER_TEXT,fontFamily:e.fontFamily||"Open Sans",fillColor:e.fillColor||"#000000",fontSize:e.fontSize||48,originX:null!==(u=e.originX)&&void 0!==u?u:"center",originY:null!==(s=e.originY)&&void 0!==s?s:"center",scaleX:null!==(c=e.scaleX)&&void 0!==c?c:1,scaleY:null!==(d=e.scaleY)&&void 0!==d?d:1,left:null!==(f=e.left)&&void 0!==f?f:I.width/2,top:null!==(m=e.top)&&void 0!==m?m:I.height-100,width:e.width,height:e.height,zIndex:null!==(_=e.zIndex)&&void 0!==_?_:(0,o.nextTextNodeZIndex)(n.existingTextNodes),shadow:null!==(v=e.shadow)&&void 0!==v?v:null,lockFillColor:e.lockFillColor,...void 0!==e.textAlign?{textAlign:e.textAlign}:{}}};let i=n(15343),r=n(38986),o=n(17488);t.DEFAULT_NEW_TEXT_LAYER_TEXT="text"},97096:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.canvasSceneFromDesignConfig=l,t.canvasSceneFromEditorState=function(e){return l({canvasAspectRatio:e.canvasAspectRatio,background:e.background,textNodes:e.textNodes,images:e.images,waveforms:e.waveforms,waveformConfig:e.waveformConfig,shownWaveformData:e.shownWaveformData,soundwaveRect:e.soundwaveRect,qr:e.qr,animation:e.animation,captions:e.captions,cameraShake:e.cameraShake,backgroundPulse:e.backgroundPulse,layout:{editorSize:e.editorSize,frameConfig:e.frameConfig}})};let i=n(19458),r=n(15343),o=n(40805),a=n(84444);function l(e){var t,n,l,u,s,c,d,f,m,_;let v=null!==(l=e.canvasAspectRatio)&&void 0!==l?l:i.AspectRatio["3/2"],E=function(e){var t;let n=null!==(t=r.ReferenceDimensions[e])&&void 0!==t?t:r.ReferenceDimensions[i.AspectRatio["3/2"]];return{editorSize:{width:n.width,height:n.height,ratioToReference:1},frameConfig:{wrapperWidth:n.width,wrapperHeight:n.height,offsetTop:0,offsetLeft:0,ratioToReference:1}}}(v),I={...E.editorSize,...e.editorSize,...null!==(u=null===(t=e.layout)||void 0===t?void 0:t.editorSize)&&void 0!==u?u:{}},h={...E.frameConfig,...null!==(s=null===(n=e.layout)||void 0===n?void 0:n.frameConfig)&&void 0!==s?s:{}},p=null!==(c=e.waveforms)&&void 0!==c?c:[],A=null!==(f=null!==(d=e.soundwaveRect)&&void 0!==d?d:(0,a.derivePrimarySoundwaveRect)(p))&&void 0!==f?f:
1o.defaultEditorConfig.soundwaveRect;return{canvasAspectRatio:v,editorSize:I,frameConfig:h,background:e.background,textNodes:null!==(m=e.textNodes)&&void 0!==m?m:[],images:e.images,waveforms:p,waveformConfig:e.waveformConfig,shownWaveformData:null!==(_=e.shownWaveformData)&&void 0!==_?_:[],soundwaveRect:A,qr:e.qr,animation:e.animation,captions:e.captions,cameraShake:e.cameraShake,backgroundPulse:e.backgroundPulse}}},46921:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.canvasSceneFromVideoDocument=function(e){var t,n,l,u,h,p,A,g,R,T,S,C,O,N,D,P,M,L,y,w;let{document:b,resources:F={}}=e,U=null!==(n=b.width)&&void 0!==n?n:o.ReferenceDimensions[i.AspectRatio["3/2"]].width,x=null!==(l=b.height)&&void 0!==l?l:o.ReferenceDimensions[i.AspectRatio["3/2"]].height,k=(0,c.aspectRatioFromSize)(U,x),{assets:H}=b.assets,W=b.tracks.flatMap(e=>e.clips.flatMap(e=>e.layers)),X=W.filter(e=>"text"===e.type&&e.id!==s.CAPTION_TEXT_NODE_NAME).map(v),G=(0,c.captionNodeFromVideoDocument)(b,X),z=G?[...X,G]:X,V=[];for(let e of W){if("image"===e.type){let t=function(e,t,n){let i=E(e.assetId,t,n),{bounds:r}=e,o=(0,_.imageRectFromBounds)(r);return void 0!==e.zIndex&&(o.zIndex=e.zIndex),{id:e.id,kind:"asset",resourceId:e.assetId,url:null!=i?i:null,rect:o,zIndex:e.zIndex,visible:!0!==e.hidden}}(e,H,F);t&&V.push(t)}"video"===e.type&&V.push(function(e,t,n){let i=E(e.assetId,t,n),{bounds:r}=e;return{id:a.SOURCE_VIDEO_LAYER_OBJECT_NAME,kind:"asset",resourceId:e.assetId,url:null!=i?i:null,mediaKind:"video",rect:{left:r.left,top:r.top,width:r.width,height:r.height,scaleX:1,scaleY:1,angle:0},zIndex:e.zIndex,visible:!0!==e.hidden}}(e,H,F))}let Y=W.find(e=>"waveform"===e.type),j={...r.initialWaveformConfig},B=Y?{...j,style:null!==(O=null!==(C=Y.style)&&void 0!==C?C:j.style)&&void 0!==O?O:i.SoundWaveStyle.horizontal_simple,waveColors:(null===(S=Y.colors)||void 0===S?void 0:S.length)?Y.colors:j.waveColors,thickness:null!==(N=Y.thickness)&&void 0!==N?N:j.thickness,space:null!==(D=Y.space)&&void 0!==D?D:j.space,heightMultiplier:null!==(P=Y.heightMultiplier)&&void 0!==P?P:j.heightMultiplier,circleRadius:null!==(M=Y.circleRadius)&&void 0!==M?M:j.circleRadius,circleBarHeight:null!==(L=Y.circleBarHeight)&&void 0!==L?L:j.circleBarHeight,roundedBars:null!==(y=Y.roundedBars)&&void 0!==y?y:j.roundedBars,glow:void 0!==Y.glow?Y.glow:j.glow,waveGradientDirection:null!==(w=Y.waveGradientDirection)&&void 0!==w?w:j.waveGradientDirection}:j,Z=null!==(u=(0,d.derivePrimarySoundwaveRect)([]))&&void 0!==u?u:{left:0,top:0,width:a.SOUNDWAVE_REFERENCE_WIDTH,height:a.SOUNDWAVE_REFERENCE_HEIGHT,scaleX:1,scaleY:1,angle:0},Q=Y?[function(e,t,n){let i=(0,m.waveformRectFromBounds)(e.bounds);return void 0!==e.zIndex&&(i.zIndex=e.zIndex),{id:e.id,...I(t,i,n[e.assetId]),rect:i,...e.trim?{trim:e.trim}:{},...e.centerImage?{centerImage:e.centerImage}:{}}}(Y,B,H)]:[{id:"".concat(a.WAVEFORM_NODE_PREFIX,"0"),...I(B,Z),rect:Z}],q=null!=b.background?{colors:null!==(h=b.background.colors)&&void 0!==h?h:["#ffffff"],gradientDirection:b.background.gradientDirection,imageURL:null!==(p=b.background.imageURL)&&void 0!==p?p:null,imageResourceId:b.background.imageResourceId,backgroundSize:null!==(A=b.background.backgroundSize)&&void 0!==A?A:null}:null!==(g=e.fallbackBackground)&&void 0!==g?g:{colors:["#ffffff"]};return(0,f.canvasSceneFromDesignConfig)({canvasAspectRatio:k,background:q,textNodes:z,images:V,waveforms:Q,waveformConfig:B,shownWaveformData:null!==(R=null===(t=Q[0])||void 0===t?void 0:t.shownWaveformData)&&void 0!==R?R:[],animation:null!==(T=b.animation)&&void 0!==T?T:r.defaultEditorConfig.animation,editorSize:{width:U,height:x},layout:{editorSize:{width:U,height:x,ratioToReference:1},frameConfig:{wrapperWidth:U,wrapperHeight:x,offsetTop:0,offsetLeft:0,ratioToReference:1}}})};let i=n(19458),r=n(40805),o=n(15343),a=n(38986),l=n(32529),u=n(27061),s=n(11080),c=n(18780),d=n(84444),f=n(97096),m=n(77868),_=n(99120);function v(e){var t,n,i,r;let{bounds:o}=e;return{name:e.id,text:e.text,fontFamily:null!==(t=e.fontFamily)&&void 0!==t?t:"Open Sans",fontSize:null!==(n=e.fontSize)&&void 0!==n?n:48,fillColor:null!==(i=e.fillColor)&&void 0!==i?i:"#000000",...e.textAlign?{textAlign:e.textAlign}:{},...e.lineHeight?{lineHeight:e.lineHeight}:{},left:o.left,top:o.top,width:o.width,height:o.height,originX:"center",originY:"center",scaleX:1,scaleY:1,zIndex:null!==(r=e.zIndex)&&void 0!==r?r:0}}function E(e,t,n){var i,r,o,a,l;if(e)return null!==(l=null!==(a=null===(i=n[e])||void 0===i?void 0:i.publicURL)&&void 0!==a?a:null===(r=n[e])||void 0===r?void 0:r.url)&&void 0!==l?l:null===(o=t[e])||void 0===o?void 0:o.url}function I(e,t,n){var o,s,c,d;let f=null!==(o=t.width)&&void 0!==o?o:a.SOUNDWAVE_REFERENCE_WIDTH,m=null==n?void 0:n.waveformData,_=!!(m&&m.length>0),v=_&&m?m:l.MockWaveformData,E=_&&(null==n?void 0:n.name)||r.SAMPLE_FILE,I=_?i.SourceType.AUDIO:i.SourceType.SAMPLE;return{waveformData:v,shownWaveformData:(0,u.getShownWaveformData)({waveformData:v,space:null!==(s=e.space)&&void 0!==s?s:r.initialWaveformConfig.space,thickness:null!==(c=e.thickness)&&void 0!==c?c:r.initialWaveformConfig.thickness,style:null!==(d=e.style)&&void 0!==d?d:r.initialWaveformConfig.style,width:f,audioFileName:E,source:I}),audioFileName:E,selectedSource:I}}},18780:function(e,t,n){"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.aspectRatioFromSize=s,t.findCaptionLayer=f,t.captionNodeFromVideoDocument=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=f(e);if(n){var i,o,a,s,m;let{bounds:e}=n;return{name:u.CAPTION_TEXT_NODE_NAME,text:"",fontFamily:null!==(i=n.fontFamily)&&void 0!==i?i:"Open Sans",fontSize:null!==(o=n.fontSize)&&void 0!==o?o:36,fillColor:null!==(a=n.fillColor)&&void 0!==a?a:"#ffffff",textAlign:null!==(s=n.textAlign)&&void 0!==s?s:"center",left:e.left,top:e.top,width:e.width,height:e.height,originX:"center",originY:"center",scaleX:1,scaleY:1,zIndex:null!==(m=n.zIndex)&&void 0!==m?m:(0,l.nextTextNodeZIndex)(t)}}if(!d(e))return;let _=r.ReferenceDimensions[c(e)];return{name:u.CAPTION_TEXT_NODE_NAME,text:"",fontFamily:"Open Sans",fillColor:"#ffffff",fontSize:36,originX:"center",originY:"center",scaleX:1,scaleY:1,left:_.width/2,top:_.height-160,zIndex:(0,l.nextTextNodeZIndex)(t)}},t.fitCueIntoCaptionSlot=function(e,t){let n;if(!t)return{text:t};let i=r.ReferenceDimensions[c(e)],l=f(e);if(l){var u;if(l.bounds.width<=0||l.bounds.height<=0)return{text:t};n={width:l.bounds.width,height:l.bounds.height,fontSize:null!==(u=l.fontSize)&&void 0!==u?u:36}}else{if(!d(e))return{text:t};n={width:i.width*(1-2*o.CAPTION_HORIZONTAL_INSET_RATIO),height:36*o.CAPTION_LINE_HEIGHT*o.CAPTION_MAX_LINES,fontSize:36}}let s=(0,a.fitCaptionIntoAuthoredSlot)({text:t,slotWidth:n.width,slotHeight:n.height,canvasWidth:i.width,canvasHeight:i.height,anchorFontSize:n.fontSize});return{text:s.displayText,fontSize:s.fontSize}};let i=n(19458),r=n(15343),o=n(95669),a=n(3809),l=n(17488),u=n(11080);function s(e,t){let n=e/t,o=Object.entries(r.ReferenceDimensions),a=i.AspectRatio["3/2"],l=1/0;for(let[e,t]of o){let i=Math.abs(n-t.width/t.height);i<l&&(l=i,a=e)}return a}function c(e){var t,n;let o=r.ReferenceDimensions[i.AspectRatio["3/2"]];return s(null!==(t=e.width)&&void 0!==t?t:o.width,null!==(n=e.height)&&void 0!==n?n:o.height)}function d(e){var t;return Object.values(null!==(t=e.captionTracks)&&void 0!==t?t:{}).some(e=>e.cues.length>0)}function f(e){return e.tracks.flatMap(e=>e.clips.flatMap(e=>e.layers)).find(e=>"caption"===e.type)}},50907:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.designDocumentFromCanvasScene=function(e,t){var n,o,a,l,u,s,c;let d=new Date().toISOString();return{type:i.DesignType.SOUNDWAVE,schemaVersion:"v2.5.6",userId:null!==(a=null==t?void 0:t.userId)&&void 0!==a?a:"video-render",id:null!==(l=null==t?void 0:t.designId)&&void 0!==l?l:"video-render",createdAt:d,updatedAt:d,resources:{},config:{...r.defaultEditorConfig,canvasAspectRatio:e.canvasAspectRatio,background:e.background,textNodes:e.textNodes,images:e.images,waveforms:e.waveforms,waveformConfig:e.waveformConfig,shownWaveformData:null!==(u=e.shownWaveformData)&&void 0!==u?u:[],selectedSource:null!==(s=null===(n=e.waveforms[0])||void 0===n?void 0:n.selectedSource)&&void 0!==s?s:r.defaultEditorConfig.selectedSource,audioFileName:null!==(c=null===(o=e.waveforms[0])||void 0===o?void 0:o.audioFileName)&&void 0!==c?c:r.defaultEditorConfig.audioFileName,qr:e.qr,animation:e.animation,cameraShake:e.cameraShake,backgroundPulse:e.backgroundPulse,editorSize:{width:e.editorSize.width,height:e.editorSize.height},soundwaveRect:e.soundwaveRect}}};let i=n(94457),r=n(40805)},99120:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.visualBoundsFromImageRect=function(e){var t,n,i,r,o,a;let l=null!==(t=e.width)&&void 0!==t?t:100,u=null!==(n=e.height)&&void 0!==n?n:100;return{left:null!==(i=e.left)&&void 0!==i?i:0,top:null!==(r=e.top)&&void 0!==r?r:0,width:l*(null!==(o=e.scaleX)&&void 0!==o?o:1),height:u*(null!==(a=e.scaleY)&&void 0!==a?a:1)}},t.imageRectFromBounds=function(e){let t=e.width||100,n=e.height||100;return{left:e.left,top:e.top,width:t,height:n,scaleX:1,scaleY:1,angle:0}}},74591:function(e,t,n){"use strict";t.bj=t.LQ=t.DI=t.PB=t.GX=void 0;var i=n(97096);Object.defineProperty(t,"GX",{enumerable:!0,get:function(){return i.canvasSceneFromEditorState}});var r=n(46921);Object.defineProperty(t,"PB",{enumerable:!0,get:function(){return r.canvasSceneFromVideoDocument}}),n(77868),n(99120);var o=n(66833);Object.defineProperty(t,"DI",{enumerable:!0,get:function(){return o.buildNewTextNodeConfig}}),n(50907);var a=n(18780);Object.defineProperty(t,"LQ",{enumerable:!0,get:function(){return a.captionNodeFromVideoDocument}}),Object.defineProperty(t,"bj",{enumerable:!0,get:function(){return a.fitCueIntoCaptionSlot}})},27099:function(e,t,n){"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.isCompleteCenterImageLayout=a,t.defaultCircleCenterImageLayout=l,t.resolveCenterImageLayoutForFabric=function(e,t,n,i){if(!a(e))return l(t,n,i);let r=e.width,o=e.height;if(r<=0||o<=0||t<=0||n<=0)return l(t,n,i);if(r===t&&o===n)return{width:t,height:n,left:e.left,top:e.top,scaleX:e.scaleX,scaleY:e.scaleY};let c=u(r,o,i,e);return s(t,n,i,c.offsetX,c.offsetY,c.zoom)},t.remapCenterImageLayoutForCircleRadiusChange=function(e,t,n){if(t<=0||n<=0||t===n)return e;let i=n/t;return{...e,left:e.left*i,top:e.top*i,scaleX:e.scaleX*i,scaleY:e.scaleY*i}},t.normalizedPanZoomFromCircleCenterLayout=u,t.circleCenterLayoutFromPanZoom=s;let i=n(38986),r=n(59909);function o(e,t,n){return Math.min(n,Math.max(t,e))}function a(e){return!!e&&"number"==typeof e.width&&"number"==typeof e.height&&"number"==typeof e.left&&"number"==typeof e.top&&"number"==typeof e.scaleX&&"number"==typeof e.scaleY}function l(e,t,n){let{left:o,top:a,scaleX:l,scaleY:u}=(0,r.scaleForCircleCenterImage)(e,t,n,0,0,i.CIRCLE_CENTER_IMAGE_ZOOM_DEFAULT);return{width:e,height:t,left:o,top:a,scaleX:l,scaleY:u}}function u(e,t,n,a){let l=2*n;if(l<=0)return{offsetX:0,offsetY:0,zoom:i.CIRCLE_CENTER_IMAGE_ZOOM_DEFAULT};let u=Math.min(e,t);if(u<=0)return{offsetX:0,offsetY:0,zoom:i.CIRCLE_CENTER_IMAGE_ZOOM_DEFAULT};let s=a.scaleX*u/l;s=o(s,i.CIRCLE_CENTER_IMAGE_ZOOM_MIN,i.CIRCLE_CENTER_IMAGE_ZOOM_MAX);let{excessX:c,excessY:d}=(0,r.scaleForCircleCenterImage)(e,t,n,0,0,s);return{offsetX:c>1e-6?o(-a.left/c,-1,1):0,offsetY:d>1e-6?o(-a.top/d,-1,1):0,zoom:s}}function s(e,t,n,i,o,a){let{left:l,top:u,scaleX:s,scaleY:c}=(0,r.scaleForCircleCenterImage)(e,t,n,i,o,a);return{width:e,height:t,left:l,top:u,scaleX:s,scaleY:c}}},84444:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.derivePrimarySoundwaveRect=function(e){var t;return null==e?void 0:null===(t=e[0])||void 0===t?void 0:t.rect}},65685:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.legacyHeightToMultiplier=r,t.getEffectiveHeightMultiplier=function(e){var t;let n=null!==(t=e.heightMultiplier)&&void 0!==t?t:null!=e.height?r(e.height):1;return Math.max(i.MIN_HEIGHT_MULTIPLIER,Math.min(i.MAX_HEIGHT_MULTIPLIER,n))},t.dataToScaledAmplitude=o,t.dataToBarGeometry=a,t.dataToBarGeometryWithShape=function(e,t,n,i){let r=Math.max(1,Math.floor(t*o(e,n)));return i?{top:Math.floor((t-r)/2),height:r}:{top:Math.floor(t/2-r),height:r}},t.legacyDataToBarGeometry=function(e,t,n){if("number"!=typeof n||n<=0)return a(e,t,1);let i=Math.floor(t*e/n/2),r=t-2*i;return r<0?(i+=r,r=Math.abs(r)):0===r&&(i-=1,r=1),{top:i,height:r}};let i=n(38986);function r(e){if("number"!=typeof e||Number.isNaN(e)||e<=0)return 1;let t=e>=i.MIN_HORIZONTAL_BAR_HEIGHT?e/i.SAMPLE_HEIGHT:1/e;return Math.max(i.MIN_HEIGHT_MULTIPLIER,Math.min(i.MAX_HEIGHT_MULTIPLIER,t))}function o(e,t){return Math.min(1,Math.max(0,1-e/i.SAMPLE_HEIGHT)*t)}function a(e,t,n){let i=Math.max(1,Math.floor(t*o(e,n)));return{top:Math.floor((t-i)/2),height:i}}},83553:function(e,t,n){"use strict";var i,r;t.uz=void 0,t.ed=a;let o=n(3741);async function a(e,t){if(!e.isPaid||o.featureFlags.freeDownloadsForReviews)return i.Editable;if(e.isPaid&&!e.paidAt)return i.Locked;if(t&&e.isPaid&&e.paidAt&&await t())return i.Editable;let n=new Date(new Date().getTime()-2592e5).toISOString();return e.isPaid&&e.paidAt&&e.paidAt<n?i.Locked:i.Editable}(r=i||(t.uz=i={})).Editable="editable",r.Locked="locked",r.Without_Audio="without_audio"},11753:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isServerFetchableImageUrl=function(e){if(!e||"string"!=typeof e)return!1;try{let t=new URL(e);return"http:"===t.protocol||"https:"===t.protocol}catch(e){return!1}}},24948:function(e,t,n){"use strict";var i;Object.defineProperty(t,"__esModule",{value:!0}),t.pickCanvasAbsoluteFabricRect=function(e){let t=(0,o.default)(e,...Object.keys(a.RectAttributes)),n="right"===e.originX||"center"===e.originX?e.originX:"left",i="bottom"===e.originY||"center"===e.originY?e.originY:"top",l=e.calcTransformMatrix(!1),u=r.fabric.util.qrDecompose(l),s=r.fabric.util.transformPoint(new r.fabric.Point(0,0),l),c=e.translateToOriginPoint(s,n,i);return{...t,left:c.x,top:c.y,scaleX:u.scaleX,scaleY:u.scaleY,angle:u.angle,skewX:u.skewX,skewY:u.skewY,originX:n,originY:i}};let r=n(21749),o=(i=n(13888))&&i.__esModule?i:{default:i},a=n(17847)},96335:function(e,t,n){"use strict";
1var i=function(e){return e&&e.__esModule?e:{default:e}};t.Gc=void 0,t.y$=function(e){return e.group?(0,l.pickCanvasAbsoluteFabricRect)(e):(0,t.Gc)(e)},t.rE=function(e){return{...(0,r.default)((0,o.default)(e,Object.keys(a.RectAttributes)),["width","height"]),originX:"center",originY:"center"}},t.$A=function(){return[...u,"zIndex"]};let r=i(n(17620)),o=i(n(13888)),a=n(17847),l=n(24948);t.Gc=e=>(0,o.default)(e,...Object.keys(a.RectAttributes));let u=Object.keys(a.RectAttributes).filter(e=>"width"!==e&&"height"!==e)},29008:function(e,t){"use strict";t.rZ=function(e){var t;return null!==(t=function(e){var t,n;let i=null===(n=e.waveforms)||void 0===n?void 0:null===(t=n[0])||void 0===t?void 0:t.waveformData;return null!=i?i:void 0!==e.reducedWaveformData&&null!==e.reducedWaveformData?e.reducedWaveformData:void 0!==e.waveformData&&null!==e.waveformData?e.waveformData:void 0}(e))&&void 0!==t?t:[]},t.pk=function(e){var t;return null!==(t=function(e){var t,n;let i=null===(n=e.waveforms)||void 0===n?void 0:null===(t=n[0])||void 0===t?void 0:t.shownWaveformData;return null!=i?i:void 0!==e.shownWaveformData&&null!==e.shownWaveformData?e.shownWaveformData:void 0}(e))&&void 0!==t?t:[]}},64345:function(e,t,n){"use strict";t.MY=o,t.ck=function(e){let t=(0,i.coerceAnimationStyle)(e);return o()||"recorder-sine"!==t?t:"recorder-style"};let i=n(33237),r=n(3741);function o(){return!!r.featureFlags.recorderSine}},59909:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.rescaleCenterImageOffsetsForZoomChange=function(e,t,n,i,a,l,u){let s=o(n,i,a,0,0,l),c=o(n,i,a,0,0,u),d=(e,t,n)=>n<=0?r(e):t<=0?0:r(-(-e*t)/n);return{offsetX:d(e,s.excessX,c.excessX),offsetY:d(t,s.excessY,c.excessY)}},t.scaleForCircleCenterImage=o;let i=n(38986);function r(e){return Math.max(-1,Math.min(1,e))}function o(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:i.CIRCLE_CENTER_IMAGE_ZOOM_DEFAULT,l=2*(n||0),u=e||l,s=t||l,c=l/Math.min(u,s)*Math.min(i.CIRCLE_CENTER_IMAGE_ZOOM_MAX,Math.max(i.CIRCLE_CENTER_IMAGE_ZOOM_MIN,a||i.CIRCLE_CENTER_IMAGE_ZOOM_DEFAULT)),d=Math.max((u*c-l)/2,0),f=Math.max((s*c-l)/2,0);return{scaleX:c,scaleY:c,left:-r*d+0,top:-o*f+0,excessX:d,excessY:f}}},2554:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}
1),t.clearSpectrumFftCache=function(){Object.keys(i).forEach(e=>{delete i[e]}),Object.keys(n).forEach(e=>{delete n[e]})},t.visualizeSpectrumAudio=function(e){let{smoothing:t=!0,optimizeFor:n="speed",dataOffsetInSeconds:i=0,...r}=e;if(!t)return a({...r,optimizeFor:n,dataOffsetInSeconds:i});let o=[r.frame-1,r.frame,r.frame+1],l=o.map(e=>a({...r,frame:e,optimizeFor:n,dataOffsetInSeconds:i}));return Array(r.numberOfSamples).fill(0).map((e,t)=>l.reduce((e,n)=>e+n[t],0)/o.length)};let n={},i={};function r(e){let t=Math.max(-1,Math.min(1,e));return t>0?32767*t:32768*t}let o={};function a(e){let{audioData:t,frame:a,fps:l,numberOfSamples:u,optimizeFor:s,dataOffsetInSeconds:c}=e,d="".concat(t.resultId,"-").concat(a,"-").concat(l,"-").concat(u,"-").concat(s,"-").concat(c);if(i[d])return i[d];let f=function(e){if(n[e.resultId])return n[e.resultId];let t=0,i=e.channelWaveforms[0];for(let e=0;e<i.length;e++){let n=i[e];n>t&&(t=n)}let o=r(t);return n[e.resultId]=o,o}(t),m=function(e){let{sampleSize:t,data:n,sampleRate:i,frame:a,fps:l,maxInt:u,optimizeFor:s,dataOffsetInSeconds:c}=e;if(!(t>0&&(t&t-1)==0))throw TypeError('The argument "bars" must be a power of two. For example: 64, 128. Got instead: '.concat(t));if(!l)throw TypeError('The argument "fps" was not provided');if(n.length<t)throw TypeError("Audio data is not big enough to provide ".concat(t," bars."));let d=Math.max(0,Math.floor((a/l-c)*i)-t/2),f=new Int16Array(t);return f.set(n.subarray(d,d+t).map(e=>r(e))),(function(e){let t=e,n=[];for(let e=0;e<3;e++){let e=Math.floor(1.5),i=1/(2*e+1);for(let i=0;i<e;i++)n[i]=t[i],n[t.length-i-1]=t[t.length-i-1];for(let r=e;r<t.length-e;r++){let o=0;for(let n=-e;n<=e;n++)o+=i*t[r+n]+n;n[r]=o}t=n}return n})(function(e){let t=e.map(e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]));return t.slice(0,t.length/2)}("accuracy"===s?function e(t){let n=t.length;if(1===n)return[[t[0],0]];let i=[],r=[];for(let e=0;e<n;e++)e%2==0?i.push(t[e]):r.push(t[e]);let a=e(i),l=e(r),u=[];for(let e=0;e<n/2;e++){var s,c;let t=a[e],i=(s=function(e,t){if(o[t]=o[t]||{},!o[t][e]){let n=-2*Math.PI*e/t;o[t][e]=[Math.cos(n),Math.sin(n)]}return o[t][e]}(e,n),c=l[e],[s[0]*c[0]-s[1]*c[1],s[0]*c[1]+s[1]*c[0]]);u[e]=[t[0]+i[0],t[1]+i[1]],u[e+n/2]=[t[0]-i[0],t[1]-i[1]]}return u}(f):function(e){let t=e.length,n=Array(t);if(t<=1){for(let t=0;t<e.length;t++)n[t]=[2*e[t],0];return n}let i=function(e){let t=Array(e);for(let n=0;n<e;n++)t[n]=.8-.46*Math.cos(2*Math.PI*n/(e-1));return t}(t);for(let r=0;r<t;r++)n[r]=[e[r]*i[r],0];let r=function(e){let t=Array(e);for(let n=0;n<e;n++)t[n]=function(e,t){let n=0;for(let i=0;i<t;i++)n=n<<1|e>>i&1;return n}(n,Math.log2(e));return t}(t);for(let i=0;i<t;i++)n[i]=[e[r[i]],0];for(let e=1;e<=Math.log2(t);e++){let i=1<<e,r=i/2,o=2*Math.PI/i;for(let e=0;e<t;e+=i){let t=1,i=0;for(let a=0;a<r;a++){let l=t*n[e+a+r][0]-i*n[e+a+r][1],u=t*n[e+a+r][1]+i*n[e+a+r][0],s=n[e+a][0],c=n[e+a][1];n[e+a]=[s+l,c+u],n[e+a+r]=[s-l,c-u];let d=t*Math.cos(o)-i*Math.sin(o);i=t*Math.sin(o)+i*Math.cos(o),t=d}}}return n}(f))).map(e=>e/(t/2)/u)}({sampleSize:2*u,data:t.channelWaveforms[0],frame:a,fps:l,sampleRate:t.sampleRate,maxInt:f,optimizeFor:s,dataOffsetInSeconds:c});return i[d]=m,m}},63775:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.spectrumState=t.SpectrumState=t.PERCEPTUAL_GAIN_TOP_END=t.PERCEPTUAL_GAIN_TOP_START=t.PERCEPTUAL_FREQ_TOP_RANGE=t.PERCEPTUAL_GAIN_HIGH=t.PERCEPTUAL_FREQ_HIGH_END=t.PERCEPTUAL_GAIN_MID=t.PERCEPTUAL_FREQ_MID_END=t.PERCEPTUAL_FREQ_MID_PLATEAU_START=t.PERCEPTUAL_GAIN_LOW_MUD_SHELF_MIN=t.PERCEPTUAL_FREQ_LOW_MUD_SHELF_END=t.PERCEPTUAL_GAIN_MID_LOW_MAX=t.PERCEPTUAL_GAIN_MID_LOW_MIN=t.PERCEPTUAL_FREQ_MID_LOW_END=t.PERCEPTUAL_GAIN_LOW_MAX=t.PERCEPTUAL_GAIN_LOW_MIN=t.PERCEPTUAL_FREQ_LOW_END=t.PERCEPTUAL_GAIN_SUB_BASS=t.PERCEPTUAL_FREQ_SUB_BASS=t.SOFT_KNEE_RATIO=t.SOFT_KNEE_THRESHOLD=t.RADIAL_TILT_MIN_FREQ=t.RADIAL_FREQUENCY_TILT_DB_PER_OCTAVE=t.MAX_SPECTRUM_REACTIVITY=t.MIN_SPECTRUM_REACTIVITY=t.DEFAULT_SPECTRUM_REACTIVITY=t.SMOOTH_RELEASE=t.SMOOTH_ATTACK=t.HEADROOM_FACTOR=t.ROLLING_MAX_ATTACK=t.ROLLING_MAX_DECAY=t.VISUAL_CEILING=t.VISUAL_FLOOR=t.LOG_COMPRESSION_K=t.LOW_FREQ_COMPRESSION=t.SPECTRUM_MAX_FREQ=t.HIGH_FREQ_TAPER_START=t.HIGH_PASS_CUTOFF=t.SPECTRUM_MIN_FREQ=void 0,t.clampSpectrumReactivity=r,t.normalizeSpectrumReactivity=o,t.spectrumReactivityToSmoothing=a,t.roundToPowerOfTwo=s,t.getPerceptualGain=d,t.frequencyForRadialGain=f,t.mapBarToFrequency=m,t.applyLogCompression=_,t.applySoftKneeLimiter=v,t.applyVisualBounds=E,t.applyNeighborBlending=I,t.getFrequencyDataFromAudio=h,t.processSpectrumData=p,t.precomputeAllFrames=A;let i=n(2554);function r(e){return Number.isFinite(e)?Math.min(t.MAX_SPECTRUM_REACTIVITY,Math.max(t.MIN_SPECTRUM_REACTIVITY,Math.round(e))):t.DEFAULT_SPECTRUM_REACTIVITY}function o(e){return null!=e&&Number.isFinite(e)?r(e):t.DEFAULT_SPECTRUM_REACTIVITY}function a(e){var n,i;let r=o(e);if(r<=t.DEFAULT_SPECTRUM_REACTIVITY){let e=r/t.DEFAULT_SPECTRUM_REACTIVITY;return{attack:.45+(t.SMOOTH_ATTACK-.45)*e,release:.07+(t.SMOOTH_RELEASE-.
107)*e}}let a=(r-t.DEFAULT_SPECTRUM_REACTIVITY)/(t.MAX_SPECTRUM_REACTIVITY-t.DEFAULT_SPECTRUM_REACTIVITY);return{attack:(n=t.SMOOTH_ATTACK)+(.84-n)*a,release:(i=t.SMOOTH_RELEASE)+(.19-i)*a}}function l(e,n){return null!=n?n:e?t.RADIAL_TILT_MIN_FREQ:t.SPECTRUM_MIN_FREQ}t.SPECTRUM_MIN_FREQ=20,t.HIGH_PASS_CUTOFF=30,t.HIGH_FREQ_TAPER_START=13500,t.SPECTRUM_MAX_FREQ=16e3,t.LOW_FREQ_COMPRESSION=.4,t.LOG_COMPRESSION_K=18,t.VISUAL_FLOOR=.02,t.VISUAL_CEILING=.95,t.ROLLING_MAX_DECAY=.995,t.ROLLING_MAX_ATTACK=.4,t.HEADROOM_FACTOR=1.3,t.SMOOTH_ATTACK=.65,t.SMOOTH_RELEASE=.12,t.DEFAULT_SPECTRUM_REACTIVITY=50,t.MIN_SPECTRUM_REACTIVITY=0,t.MAX_SPECTRUM_REACTIVITY=100,t.RADIAL_FREQUENCY_TILT_DB_PER_OCTAVE=4.5,t.RADIAL_TILT_MIN_FREQ=80,t.SOFT_KNEE_THRESHOLD=.65,t.SOFT_KNEE_RATIO=3,t.PERCEPTUAL_FREQ_SUB_BASS=60,t.PERCEPTUAL_GAIN_SUB_BASS=.6,t.PERCEPTUAL_FREQ_LOW_END=200,t.PERCEPTUAL_GAIN_LOW_MIN=.62,t.PERCEPTUAL_GAIN_LOW_MAX=.74,t.PERCEPTUAL_FREQ_MID_LOW_END=500,t.PERCEPTUAL_GAIN_MID_LOW_MIN=.74,t.PERCEPTUAL_GAIN_MID_LOW_MAX=.8,t.PERCEPTUAL_FREQ_LOW_MUD_SHELF_END=1500,t.PERCEPTUAL_GAIN_LOW_MUD_SHELF_MIN=.72,t.PERCEPTUAL_FREQ_MID_PLATEAU_START=2600,t.PERCEPTUAL_FREQ_MID_END=4e3,t.PERCEPTUAL_GAIN_MID=1,t.PERCEPTUAL_FREQ_HIGH_END=8e3,t.PERCEPTUAL_GAIN_HIGH=1.1,t.PERCEPTUAL_FREQ_TOP_RANGE=8e3,t.PERCEPTUAL_GAIN_TOP_START=1.1,t.PERCEPTUAL_GAIN_TOP_END=.8;class u{initialize(e){this.initialized&&this.previousValues.length===e||(this.globalRollingMax=.001,this.previousValues=Array(e).fill(0),this.initialized=!0)}reset(){this.globalRollingMax=.001,this.previousValues=[],this.initialized=!1}updateGlobalMax(e){this.globalRollingMax*=t.ROLLING_MAX_DECAY,e>this.globalRollingMax&&(this.globalRollingMax+=(e-this.globalRollingMax)*t.ROLLING_MAX_ATTACK)}normalizeWithGlobalMax(e){return Math.min(e/Math.max(this.globalRollingMax*t.HEADROOM_FACTOR,.001),1)}applySmoothing(e,n){let i,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.SMOOTH_ATTACK,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t.SMOOTH_RELEASE,a=this.previousValues[e];return i=n>a?a+(n-a)*r:a+(n-a)*o,this.previousValues[e]=i,i}resetSmoothing(){this.previousValues.fill(0)}constructor(){this.globalRollingMax=.001,this.previousValues=[],this.initialized=!1}}function s(e){return e<=0?64:2**Math.ceil(Math.log2(e))}function c(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4.5;return 10**(t*Math.log2(e/1e3)/20)}function d(e){let n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(n){let n=c(Math.max(e,t.RADIAL_TILT_MIN_FREQ),t.RADIAL_FREQUENCY_TILT_DB_PER_OCTAVE);if(e<t.PERCEPTUAL_FREQ_MID_END)n*=t.PERCEPTUAL_GAIN_MID;else if(e<t.PERCEPTUAL_FREQ_HIGH_END)n*=t.PERCEPTUAL_GAIN_HIGH;else{let i=Math.min((e-t.PERCEPTUAL_FREQ_HIGH_END)/t.PERCEPTUAL_FREQ_TOP_RANGE,1);n*=t.PERCEPTUAL_GAIN_TOP_START+i*(t.PERCEPTUAL_GAIN_TOP_END-t.PERCEPTUAL_GAIN_TOP_START)}return n}let i=c(e);if(e<t.HIGH_PASS_CUTOFF)return(1-Math.cos(e/t.HIGH_PASS_CUTOFF*Math.PI/2))/2*i*.5;if(e<t.PERCEPTUAL_FREQ_SUB_BASS)i*=t.PERCEPTUAL_GAIN_SUB_BASS;else if(e<t.PERCEPTUAL_FREQ_LOW_END){let n=(e-t.PERCEPTUAL_FREQ_SUB_BASS)/(t.PERCEPTUAL_FREQ_LOW_END-t.PERCEPTUAL_FREQ_SUB_BASS);i*=t.PERCEPTUAL_GAIN_LOW_MIN+n*(t.PERCEPTUAL_GAIN_LOW_MAX-t.PERCEPTUAL_GAIN_LOW_MIN)}else if(e<t.PERCEPTUAL_FREQ_MID_LOW_END){let n=(e-t.PERCEPTUAL_FREQ_LOW_END)/(t.PERCEPTUAL_FREQ_MID_LOW_END-t.PERCEPTUAL_FREQ_LOW_END);i*=t.PERCEPTUAL_GAIN_MID_LOW_MIN+n*(t.PERCEPTUAL_GAIN_MID_LOW_MAX-t.PERCEPTUAL_GAIN_MID_LOW_MIN)}else if(e<t.PERCEPTUAL_FREQ_LOW_MUD_SHELF_END){let n=(e-t.PERCEPTUAL_FREQ_MID_LOW_END)/(t.PERCEPTUAL_FREQ_LOW_MUD_SHELF_END-t.PERCEPTUAL_FREQ_MID_LOW_END);i*=t.PERCEPTUAL_GAIN_MID_LOW_MAX+n*(t.PERCEPTUAL_GAIN_LOW_MUD_SHELF_MIN-t.PERCEPTUAL_GAIN_MID_LOW_MAX)}else if(e<t.PERCEPTUAL_FREQ_MID_PLATEAU_START){let n=(e-t.PERCEPTUAL_FREQ_LOW_MUD_SHELF_END)/(t.PERCEPTUAL_FREQ_MID_PLATEAU_START-t.PERCEPTUAL_FREQ_LOW_MUD_SHELF_END);i*=t.PERCEPTUAL_GAIN_LOW_MUD_SHELF_MIN+n*(t.PERCEPTUAL_GAIN_MID-t.PERCEPTUAL_GAIN_LOW_MUD_SHELF_MIN)}else if(e<t.PERCEPTUAL_FREQ_MID_END)i*=t.PERCEPTUAL_GAIN_MID;else if(e<t.PERCEPTUAL_FREQ_HIGH_END)i*=t.PERCEPTUAL_GAIN_HIGH;else{let n=Math.min((e-t.PERCEPTUAL_FREQ_HIGH_END)/t.PERCEPTUAL_FREQ_TOP_RANGE,1);
1i*=t.PERCEPTUAL_GAIN_TOP_START+n*(t.PERCEPTUAL_GAIN_TOP_END-t.PERCEPTUAL_GAIN_TOP_START)}if(e>=t.HIGH_FREQ_TAPER_START){let n=t.SPECTRUM_MAX_FREQ-t.HIGH_FREQ_TAPER_START;i*=.5*(1+Math.cos(Math.PI*(1-Math.min(1,Math.max(0,(t.SPECTRUM_MAX_FREQ-e)/n)))))}return i}function f(e,t){return t>0&&e<t?t:e}function m(e){let{barIndex:n,numBars:i,frequencyData:r,maxFrequency:o,frequencyPerBin:a,minFreq:l=t.SPECTRUM_MIN_FREQ}=e,u=n/i;u**=t.LOW_FREQ_COMPRESSION;let s=Math.log10(l),c=10**(s+u*(Math.log10(t.SPECTRUM_MAX_FREQ)-s)),d=c/a,f=Math.floor(d),m=d-f;return{targetFrequency:c,interpolatedAmplitude:(r[Math.min(Math.max(f,1),o-1)]||0)*(1-m)+(r[Math.min(Math.max(Math.min(Math.ceil(d),o-1),1),o-1)]||0)*m}}function _(e){return Math.log10(1+t.LOG_COMPRESSION_K*e)/Math.log10(1+t.LOG_COMPRESSION_K)}function v(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.SOFT_KNEE_THRESHOLD,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.SOFT_KNEE_RATIO;return e<=n?e:Math.min(n+(e-n)/i,1)}function E(e){return t.VISUAL_FLOOR+e*(t.VISUAL_CEILING-t.VISUAL_FLOOR)}function I(e){let t=Array(e.length);for(let n=0;n<e.length;n++){let i=n>0?e[n-1]:e[n],r=e[n],o=n<e.length-1?e[n+1]:e[n];t[n]=.7*r+.15*i+.15*o}return t}function h(e){let{audioData:t,currentFrame:n,fps:r,numBars:o,optimizeFor:a,dataOffsetInSeconds:l}=e;if(void 0===n||!t)return[];let u=s(o),c=(0,i.visualizeSpectrumAudio)({fps:r,frame:n,audioData:t,numberOfSamples:u,optimizeFor:null!=a?a:"speed",dataOffsetInSeconds:null!=l?l:0});return c.length>o?c.slice(0,o):c}function p(e){let{frequencyData:n,numBars:i,state:r=t.spectrumState,radialSpectrum:o=!1,disableSmoothing:u=!1,minFreq:s,spectrumReactivity:c,smoothAttack:h,smoothRelease:p}=e,A=l(o,s),{attack:g,release:R}=null!=h&&null!=p?{attack:h,release:p}:a(c);if(!n.length||0===i)return[];r.initialize(i);let T=n.length,S=22050/T,C=[];for(let e=0;e<i;e++){let{targetFrequency:t,interpolatedAmplitude:r}=m({barIndex:e,numBars:i,frequencyData:n,maxFrequency:T,frequencyPerBin:S,minFreq:A}),a=r*d(o?f(t,S):t,o);C.push(a)}r.updateGlobalMax(Math.max(...C,.001));let O=[];
1return C.forEach((e,t)=>{let n=r.normalizeWithGlobalMax(e),i=E(v(_(u?n:r.applySmoothing(t,n,g,R))));O.push(i)}),I(O)}async function A(e){let{audioData:t,fps:n,totalFrames:i,numBars:r,numBarsForFFT:o=r,radialSpectrum:a=!1,disableSmoothing:s=!1,minFreq:c,spectrumReactivity:d,optimizeFor:f="speed",trimOffsetInFrames:m=0,onProgress:_}=e,v=l(a,c);if(!t||0===i||0===r)return[];let E=new u;E.initialize(r);let I=[],A=()=>new Promise(e=>{"undefined"!=typeof requestAnimationFrame?requestAnimationFrame(()=>{setTimeout(e,0)}):setTimeout(e,0)}),g=0,R=0;for(let e=m;e<m+i;e++){let l=e-m,u=p({frequencyData:h({audioData:t,currentFrame:e,fps:n,numBars:o,optimizeFor:f}),numBars:r,state:E,radialSpectrum:a,disableSmoothing:s,minFreq:v,spectrumReactivity:d});I.push(u);let c=l+1,T=c/i;_&&c>=R+100&&(Promise.resolve(_(T)).catch(e=>{console.error("[precomputeAllFrames] Error in progress callback:",e)}),R=c),c>=g+500&&(g=c),(c%25==0||c===i)&&await A()}return _&&i>0&&Promise.resolve(_(1)).catch(e=>{console.error("[precomputeAllFrames] Error in final progress callback:",e)}),I}t.SpectrumState=u,t.spectrumState=new u},6196:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.textNodeShadowToFabric=function(e){if(null==e)return;let{color:t,blur:n,offsetX:r,offsetY:o}=e;if("string"==typeof t&&"number"==typeof n&&"number"==typeof r&&"number"==typeof o)return new i.fabric.Shadow({color:t,blur:n,offsetX:r,offsetY:o})};let i=n(21749)},61019:function(e,t,n){"use strict";t.wG=function(e){if(!e||"object"!=typeof e)return;let{serverError:t}=e;if("string"==typeof t&&t.trim())return t},t.fK=function(e){let t=function(e){var t;if(!e)return e;let n=/^Job \S+ failed: ([\s\S]+)$/.exec(e);return null!==(t=null==n?void 0:n[1])&&void 0!==t?t:e}(e);return t===i.CONVERT_AUDIO_NO_AUDIO_IN_VIDEO_MESSAGE?"Error.VideoHasNoAudioTrack":t===i.CONVERT_AUDIO_VIDEO_EXTRACTION_FAILED_MESSAGE?"Error.VideoAudioExtractionFailed":t===i.CONVERT_AUDIO_INVALID_VIDEO_CONTAINER_MESSAGE?"Error.VideoInvalidContainer":((0,i.isConvertAudioUserFacingFailureMessage)(t),"Error.InvalidAudioFile")},t.xF=function(e){return"Error.VideoHasNoAudioTrack"===e?i.CONVERT_AUDIO_NO_AUDIO_IN_VIDEO_MESSAGE:"Error.VideoAudioExtractionFailed"===e?i.CONVERT_AUDIO_VIDEO_EXTRACTION_FAILED_MESSAGE:"Error.VideoInvalidContainer"===e?i.CONVERT_AUDIO_INVALID_VIDEO_CONTAINER_MESSAGE:"Couldn't process the audio file. Please try another file."};let i=n(52438)},11949:function(e){e.exports={p:"primitives_p__mvyI0",text:"primitives_text__Y9xwa",uploadItem:"primitives_uploadItem__O3956",input:"primitives_input__gHm6X",error:"primitives_error__1pW8F"}}}]);
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.