"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[39357],{3053:(e,t,r)=>{r.d(t,{BO:()=>rw,Bk:()=>eU,E9:()=>rb,FZ:()=>eX,Fx:()=>tq,GW:()=>t$,H1:()=>C,OK:()=>I,UC:()=>eB,Xp:()=>rU,dB:()=>eM,fP:()=>rr,gd:()=>ez,kY:()=>rG,xN:()=>rt,yT:()=>S,zo:()=>ex});var o=r(52114),n=r(19002),i=r(11055),a=r(37811),l=Object.defineProperty,u=(e,t)=>{for(var r in t)l(e,r,{get:t[r],enumerable:!0,configurable:!0,set:e=>t[r]=()=>e})};if("function"!=typeof o.createContext)throw Error('Remotion requires React.createContext, but it is "undefined".\nIf you are in a React Server Component, turn it into a client component by adding "use client" at the top of the file.\n\nBefore:\n import {useCurrentFrame} from "remotion";\n\nAfter:\n "use client";\n import {useCurrentFrame} from "remotion";');function s(){return"NODE_ENV"}var d=()=>"env",c=()=>{let e="undefined"!=typeof window&&window.remotion_isPlayer,t="undefined"!=typeof window&&void 0!==window.process&&void 0!==window.process.env&&("test"===window.process[d()][s()]||"production"===window.process[d()][s()]&&"undefined"!=typeof window&&void 0!==window.remotion_puppeteerTimeout);return{isStudio:"undefined"!=typeof window&&window.remotion_isStudio,isRendering:t,isPlayer:e,isReadOnlyStudio:"undefined"!=typeof window&&window.remotion_isReadOnlyStudio,isClientSideRendering:!1}},m=o.createElement,f=n.jsx,p=[],v=e=>new Proxy(e,{apply(e,t,r){if(p.includes(r[0])){let[o,n,...i]=r;return Reflect.apply(e,t,[o,{...null!=n?n:{},stack:Error().stack},...i])}return Reflect.apply(e,t,r)}}),h=()=>{c().isStudio&&(o.createElement=v(m),n.jsx=v(f))},y=e=>{p.push(e),h()},g=(0,o.createContext)(!1),w=()=>(0,o.useContext)(g);function b(e){return!!e}var x="4.0.398",E=e=>{let{className:t,classPrefix:r,type:o}=e;if(!t)return!1;if("exact"===o){let e=t.split(" ");return r.some(t=>e.some(e=>e.trim()===t||e.trim().endsWith(":".concat(t))||e.trim().endsWith("!".concat(t))))}return r.some(e=>t.startsWith(e)||t.includes(" ".concat(e))||t.includes("!".concat(e))||t.includes(":".concat(e)))},C=(0,o.forwardRef)((e,t)=>{let{style:r,...i}=e,a=(0,o.useMemo)(()=>({position:"absolute",top:E({className:i.className,classPrefix:["top-","inset-"],type:"prefix"})?void 0:0,left:E({className:i.className,classPrefix:["left-","inset-"],type:"prefix"})?void 0:0,right:E({className:i.className,classPrefix:["right-","inset-"],type:"prefix"})?void 0:0,bottom:E({className:i.className,classPrefix:["bottom-","inset-"],type:"prefix"})?void 0:0,width:E({className:i.className,classPrefix:["w-"],type:"prefix"})?void 0:"100%",height:E({className:i.className,classPrefix:["h-"],type:"prefix"})?void 0:"100%",display:E({className:i.className,classPrefix:["block","inline-block","inline","flex","inline-flex","flow-root","grid","inline-grid","contents","list-item","hidden"],type:"exact"})?void 0:"flex",flexDirection:E({className:i.className,classPrefix:["flex-row","flex-col","flex-row-reverse","flex-col-reverse"],type:"exact"})?void 0:"column",...r}),[i.className,r]);return(0,n.jsx)("div",{ref:t,style:a,...i})}),R=(0,o.createContext)(null),F=o.createContext({registerSequence:()=>{throw Error("SequenceManagerContext not initialized")},unregisterSequence:()=>{throw Error("SequenceManagerContext not initialized")},sequences:[]}),P=o.createContext({hidden:{},setHidden:()=>{throw Error("SequenceVisibilityToggle not initialized")}}),T=e=>{let{children:t}=e,[r,i]=(0,o.useState)([]),[a,l]=(0,o.useState)({}),u=(0,o.useCallback)(e=>{i(t=>[...t,e])},[]),s=(0,o.useCallback)(e=>{i(t=>t.filter(t=>t.id!==e))},[]),d=(0,o.useMemo)(()=>({registerSequence:u,sequences:r,unregisterSequence:s}),[u,r,s]),c=(0,o.useMemo)(()=>({hidden:a,setHidden:l}),[a]);return(0,n.jsx)(F.Provider,{value:d,children:(0,n.jsx)(P.Provider,{value:c,children:t})})};function V(e){let t=e+0x6d2b79f5;return t=Math.imul(t^t>>>15,1|t),(((t^=t+Math.imul(t^t>>>7,61|t))^t>>>14)>>>0)/0x100000000}var S=(e,t)=>{if(void 0!==t)throw TypeError("random() takes only one argument");if(null===e)return Math.random();if("string"==typeof e)return V(function(e){let t=0,r=0;for(t=0;tey,useTimelinePosition:()=>eh,usePlayingState:()=>eg,persistCurrentFrame:()=>ef,getInitialFrameState:()=>ep,getFrameForComposition:()=>ev});var N=o.createContext(null),I=()=>{let e=(0,o.useContext)(N),[t]=(0,o.useState)(()=>c());return null!=e?e:t},M=(0,o.createContext)({compositions:[],folders:[],currentCompositionMetadata:null,canvasContent:null}),A=(0,o.createContext)({registerComposition:()=>{},unregisterComposition:()=>{},registerFolder:()=>{},unregisterFolder:()=>{},setCanvasContent:()=>{},updateCompositionDefaultProps:()=>{},onlyRenderComposition:null}),j=(0,o.createContext)({props:{},updateProps:()=>{throw Error("Not implemented")},resetUnsaved:()=>{throw Error("Not implemented")}}),_=o.createRef(),L=o.createRef(),D=e=>{let{children:t}=e,[r,i]=o.useState({}),a=(0,o.useCallback)(e=>{let{defaultProps:t,id:r,newProps:o}=e;i(e=>{var n;return{...e,[r]:"function"==typeof o?o(null!==(n=e[r])&&void 0!==n?n:t):o}})},[]),l=(0,o.useCallback)(e=>{i(t=>{if(t[e]){let r={...t};return delete r[e],r}return t})},[]);(0,o.useImperativeHandle)(_,()=>({getProps:()=>r,setProps:i}),[r]);let u=(0,o.useMemo)(()=>({props:r,updateProps:a,resetUnsaved:l}),[r,l,a]);return(0,n.jsx)(j.Provider,{value:u,children:t})},O=()=>"remotion_inputPropsOverride"+window.location.origin,U=()=>{if("undefined"==typeof localStorage)return null;let e=localStorage.getItem(O());return e?JSON.parse(e):null},B="remotion-date:",H="remotion-file:",q=e=>{let{data:t,indent:r,staticBase:o}=e,n=!1,i=!1,a=!1,l=!1;try{return{serializedString:JSON.stringify(t,function(e,t){let r=this[e];return r instanceof Date?(n=!0,"".concat(B).concat(r.toISOString())):r instanceof Map?(a=!0,t):r instanceof Set?(l=!0,t):"string"==typeof r&&null!==o&&r.startsWith(o)?(i=!0,"".concat(H).concat(r.replace(o+"/",""))):t},r),customDateUsed:n,customFileUsed:i,mapUsed:a,setUsed:l}}catch(e){throw Error("Could not serialize the passed input props to JSON: "+e.message)}},W=e=>JSON.parse(e,(e,t)=>"string"==typeof t&&t.startsWith(B)?new Date(t.replace(B,"")):"string"==typeof t&&t.startsWith(H)?"".concat(window.remotion_staticBase,"/").concat(t.replace(H,"")):t),z=e=>W(q({data:e,indent:2,staticBase:window.remotion_staticBase}).serializedString),Y=e=>c().isStudio?z(e):e,J=!1,G=()=>{J||(J=!0,console.warn("Called `getInputProps()` on the server. This function is not available server-side and has returned an empty object."),console.warn("To hide this warning, don't call this function on the server:"),console.warn(" typeof window === 'undefined' ? {} : getInputProps()"))},Z=()=>{if("undefined"==typeof window)return G(),{};if(c().isPlayer)throw Error("You cannot call `getInputProps()` from a . Instead, the props are available as React props from component that you passed as `component` prop.");let e=U();if(e)return e;if("undefined"==typeof window||void 0===window.remotion_inputProps)throw Error("Cannot call `getInputProps()` - window.remotion_inputProps is not set. This API is only available if you are in the Studio, or while you are rendering server-side.");let t=window.remotion_inputProps;return t?W(t):{}},Q=(0,o.createContext)({getNonce:()=>0,fastRefreshes:0,manualRefreshes:0}),$=(0,o.createContext)({increaseManualRefreshes:()=>{}}),K=()=>{let e=(0,o.useContext)(Q),[t,r]=(0,o.useState)(()=>e.getNonce()),n=(0,o.useRef)(e);return(0,o.useEffect)(()=>{n.current!==e&&(n.current=e,r(e.getNonce))},[e]),t},X=["h264","h265","vp8","vp9","mp3","aac","wav","prores","h264-mkv","h264-ts","gif"];function ee(e,t,r){if("number"!=typeof e)throw Error('The "'.concat(t,'" prop ').concat(r," must be a number, but you passed a value of type ").concat(typeof e));if(isNaN(e))throw TypeError('The "'.concat(t,'" prop ').concat(r," must not be NaN, but is NaN."));if(!Number.isFinite(e))throw TypeError('The "'.concat(t,'" prop ').concat(r," must be finite, but is ").concat(e,"."));if(e%1!=0)throw TypeError('The "'.concat(t,'" prop ').concat(r," must be an integer, but is ").concat(e,"."));if(e<=0)throw TypeError('The "'.concat(t,'" prop ').concat(r," must be positive, but got ").concat(e,"."))}function et(e,t){let{allowFloats:r,component:o}=t;if(void 0===e)throw Error('The "durationInFrames" prop '.concat(o," is missing."));if("number"!=typeof e)throw Error('The "durationInFrames" prop '.concat(o," must be a number, but you passed a value of type ").concat(typeof e));if(e<=0)throw TypeError('The "durationInFrames" prop '.concat(o," must be positive, but got ").concat(e,"."));if(!r&&e%1!=0)throw TypeError('The "durationInFrames" prop '.concat(o," must be an integer, but got ").concat(e,"."));if(!Number.isFinite(e))throw TypeError('The "durationInFrames" prop '.concat(o," must be finite, but got ").concat(e,"."))}function er(e,t,r){if("number"!=typeof e)throw Error('"fps" must be a number, but you passed a value of type '.concat(typeof e," ").concat(t));if(!Number.isFinite(e))throw Error('"fps" must be a finite, but you passed '.concat(e," ").concat(t));if(isNaN(e))throw Error('"fps" must not be NaN, but got '.concat(e," ").concat(t));if(e<=0)throw TypeError('"fps" must be positive, but got '.concat(e," ").concat(t));if(r&&e>50)throw TypeError("The FPS for a GIF cannot be higher than 50. Use the --every-nth-frame option to lower the FPS: https://remotion.dev/docs/render-as-gif")}var eo=e=>{var t,r,o,n,i,a,l,u;let{calculated:s,compositionId:d,compositionFps:c,compositionHeight:m,compositionWidth:f,compositionDurationInFrames:p}=e,v='calculated by calculateMetadata() for the composition "'.concat(d,'"'),h='of the "" component with the id "'.concat(d,'"'),y=null!==(r=null!==(t=null==s?void 0:s.width)&&void 0!==t?t:f)&&void 0!==r?r:void 0;ee(y,"width",(null==s?void 0:s.width)?v:h);let g=null!==(n=null!==(o=null==s?void 0:s.height)&&void 0!==o?o:m)&&void 0!==n?n:void 0;ee(g,"height",(null==s?void 0:s.height)?v:h);let w=null!==(a=null!==(i=null==s?void 0:s.fps)&&void 0!==i?i:c)&&void 0!==a?a:null;er(w,(null==s?void 0:s.fps)?v:h,!1);let b=null!==(u=null!==(l=null==s?void 0:s.durationInFrames)&&void 0!==l?l:p)&&void 0!==u?u:null;et(b,{allowFloats:!1,component:'of the "" component with the id "'.concat(d,'"')});let x=null==s?void 0:s.defaultCodec;!function(e,t,r){if(void 0!==e){if("string"!=typeof e)throw TypeError('The "'.concat(r,'" prop ').concat(t," must be a string, but you passed a value of type ").concat(typeof e,"."));if(!X.includes(e))throw Error('The "'.concat(r,'" prop ').concat(t," must be one of ").concat(X.join(", "),", but you passed ").concat(e,"."))}}(x,v,"defaultCodec");let E=null==s?void 0:s.defaultOutName;return{width:y,height:g,fps:w,durationInFrames:b,defaultCodec:x,defaultOutName:E,defaultVideoImageFormat:null==s?void 0:s.defaultVideoImageFormat,defaultPixelFormat:null==s?void 0:s.defaultPixelFormat,defaultProResProfile:null==s?void 0:s.defaultProResProfile}},en=e=>{var t,r,o,n,i,a;let{calculateMetadata:l,signal:u,defaultProps:s,inputProps:d,compositionId:m,compositionDurationInFrames:f,compositionFps:p,compositionHeight:v,compositionWidth:h}=e,y=l?l({defaultProps:s,props:d,abortSignal:u,compositionId:m,isRendering:c().isRendering}):null;if(null!==y&&"object"==typeof y&&"then"in y)return y.then(e=>{var t;let{height:r,width:o,durationInFrames:n,fps:i,defaultCodec:a,defaultOutName:l,defaultVideoImageFormat:u,defaultPixelFormat:c,defaultProResProfile:y}=eo({calculated:e,compositionDurationInFrames:f,compositionFps:p,compositionHeight:v,compositionWidth:h,compositionId:m});return{width:o,height:r,fps:i,durationInFrames:n,id:m,defaultProps:Y(s),props:Y(null!==(t=e.props)&&void 0!==t?t:d),defaultCodec:null!=a?a:null,defaultOutName:null!=l?l:null,defaultVideoImageFormat:null!=u?u:null,defaultPixelFormat:null!=c?c:null,defaultProResProfile:null!=y?y:null}});let g=eo({calculated:y,compositionDurationInFrames:f,compositionFps:p,compositionHeight:v,compositionWidth:h,compositionId:m});return null===y?{...g,id:m,defaultProps:Y(null!=s?s:{}),props:Y(d),defaultCodec:null,defaultOutName:null,defaultVideoImageFormat:null,defaultPixelFormat:null,defaultProResProfile:null}:{...g,id:m,defaultProps:Y(null!=s?s:{}),props:Y(null!==(t=y.props)&&void 0!==t?t:d),defaultCodec:null!==(r=y.defaultCodec)&&void 0!==r?r:null,defaultOutName:null!==(o=y.defaultOutName)&&void 0!==o?o:null,defaultVideoImageFormat:null!==(n=y.defaultVideoImageFormat)&&void 0!==n?n:null,defaultPixelFormat:null!==(i=y.defaultPixelFormat)&&void 0!==i?i:null,defaultProResProfile:null!==(a=y.defaultProResProfile)&&void 0!==a?a:null}},ei=e=>{try{let t=en(e);return{type:"success",result:t}}catch(e){return{type:"error",error:e}}},ea=(0,o.createContext)(null),el=(0,o.createRef)(),eu=e=>!!e.calculateMetadata,es="remotion.propsUpdatedExternally",ed=e=>{let t=(0,o.useContext)(ea),{props:r}=(0,o.useContext)(j),{compositions:n,canvasContent:i,currentCompositionMetadata:a}=(0,o.useContext)(M),l=(null==i?void 0:i.type)==="composition"?i.compositionId:null,u=null!=e?e:l,s=n.find(e=>e.id===u),d=(0,o.useMemo)(()=>{var e;return s&&null!==(e=r[s.id])&&void 0!==e?e:{}},[r,s]),c=I();return(0,o.useMemo)(()=>{var e,r,o,n;return s?a?{type:"success",result:{...a,id:s.id,defaultProps:null!==(e=s.defaultProps)&&void 0!==e?e:{}}}:eu(s)?t&&t[s.id]?t[s.id]:null:(et(s.durationInFrames,{allowFloats:!1,component:'in ')}),er(s.fps,'in '),!1),ee(s.width,"width",'in ')),ee(s.height,"height",'in ')),{type:"success",result:{width:s.width,height:s.height,fps:s.fps,id:s.id,durationInFrames:s.durationInFrames,defaultProps:null!==(r=s.defaultProps)&&void 0!==r?r:{},props:{...null!==(o=s.defaultProps)&&void 0!==o?o:{},...null!=d?d:{},..."undefined"==typeof window||c.isPlayer||!window.remotion_inputProps?{}:null!==(n=Z())&&void 0!==n?n:{}},defaultCodec:null,defaultOutName:null,defaultVideoImageFormat:null,defaultPixelFormat:null,defaultProResProfile:null}}):null},[s,t,a,d,c.isPlayer])},ec=()=>{var e;let{canvasContent:t,compositions:r,currentCompositionMetadata:n}=(0,o.useContext)(M),i=r.find(e=>(null==t?void 0:t.type)==="composition"&&e.id===t.compositionId),a=ed(null!==(e=null==i?void 0:i.id)&&void 0!==e?e:null);return(0,o.useMemo)(()=>{var e;return a&&"error"!==a.type&&"loading"!==a.type&&i?{...a.result,defaultProps:null!==(e=i.defaultProps)&&void 0!==e?e:{},id:i.id,...null!=n?n:{},component:i.component}:null},[n,a,i])},em=()=>"remotion.time-all",ef=e=>{localStorage.setItem(em(),JSON.stringify(e))},ep=()=>{var e;return JSON.parse(null!==(e=localStorage.getItem(em()))&&void 0!==e?e:"{}")},ev=e=>{var t,r;let o=JSON.parse(null!==(t=localStorage.getItem(em()))&&void 0!==t?t:"{}");return void 0!==o[e]?Number(o[e]):"undefined"==typeof window?0:null!==(r=window.remotion_initialFrame)&&void 0!==r?r:0},eh=()=>{var e,t;let r=ec(),n=(0,o.useContext)(ej),i=I();if(!r)return"undefined"==typeof window?0:null!==(e=window.remotion_initialFrame)&&void 0!==e?e:0;let a=null!==(t=n.frame[r.id])&&void 0!==t?t:i.isPlayer?0:ev(r.id);return Math.min(r.durationInFrames-1,a)},ey=()=>{let{setFrame:e}=(0,o.useContext)(eA);return e},eg=()=>{let{playing:e,imperativePlaying:t}=(0,o.useContext)(ej),{setPlaying:r}=(0,o.useContext)(eA);return(0,o.useMemo)(()=>[e,r,t],[t,e,r])},ew=e=>e instanceof Error||null!==e&&"object"==typeof e&&"stack"in e&&"string"==typeof e.stack&&"message"in e&&"string"==typeof e.message;function eb(e,t){let r;throw ew(t)?(r=t).stack||(r.stack=Error(r.message).stack):r="string"==typeof t?Error(t):Error("Rendering was cancelled"),e&&(e.remotion_cancelledError=r.stack),r}function ex(e){return eb("undefined"!=typeof window?window:void 0,e)}var eE=["trace","verbose","info","warn","error"],eC=e=>eE.indexOf(e),eR=(e,t)=>eC(e)<=eC(t),eF=e=>{let{args:t,logLevel:r,tag:o}=e,n=[...t];return c().isRendering&&!c().isClientSideRendering&&n.unshift(Symbol.for("__remotion_level_".concat(r))),o&&c().isRendering&&!c().isClientSideRendering&&n.unshift(Symbol.for("__remotion_tag_".concat(o))),n},eP={trace:function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),o=1;o1?t-1:0),o=1;o1?t-1:0),o=1;o1?t-1:0),o=1;o1?t-1:0),o=1;o{var t,r,o,n,i;let{scope:a,environment:l,label:u,options:s}=e;if("string"!=typeof u&&null!==u)throw Error("The label parameter of delayRender() must be a string or undefined, got: "+JSON.stringify(u));let d=Math.random();a.remotion_delayRenderHandles.push(d);let c=null!==(r=null===(t=Error().stack)||void 0===t?void 0:t.replace(/^Error/g,""))&&void 0!==r?r:"";if(l.isRendering){let e=(null!==(n=null!==(o=null==s?void 0:s.timeoutInMilliseconds)&&void 0!==o?o:a.remotion_puppeteerTimeout)&&void 0!==n?n:3e4)-2e3,t=(null!==(i=null==s?void 0:s.retries)&&void 0!==i?i:0)-(a.remotion_attempt-1);a.remotion_delayRenderTimeouts[d]={label:null!=u?u:null,startTime:Date.now(),timeout:setTimeout(()=>{eb(a,Error(["A delayRender()",u?'"'.concat(u,'"'):null,"was called but not cleared after ".concat(e,"ms. See https://remotion.dev/docs/timeout for help."),t>0?"Retries left: "+t:null,t>0?"- Rendering the frame will be retried.":null,"The delayRender was called:",c].filter(b).join(" ")))},e)}}return a.remotion_renderReady=!1,d},eV=e=>{let{scope:t,handle:r,environment:o,logLevel:n}=e;if(void 0===r)throw TypeError("The continueRender() method must be called with a parameter that is the return value of delayRender(). No value was passed.");if("number"!=typeof r)throw TypeError("The parameter passed into continueRender() must be the return value of delayRender() which is a number. Got: "+JSON.stringify(r));t.remotion_delayRenderHandles=t.remotion_delayRenderHandles.filter(e=>{if(e===r){if(o.isRendering&&void 0!==t){if(!t.remotion_delayRenderTimeouts[r])return!1;let{label:e,startTime:o,timeout:i}=t.remotion_delayRenderTimeouts[r];clearTimeout(i);let a=[e?'"'.concat(e,'"'):"A handle","handle was cleared after","".concat(Date.now()-o,"ms")].filter(b).join(" ");eP.verbose({logLevel:n,tag:"delayRender()"},a),delete t.remotion_delayRenderTimeouts[r]}return!1}return!0}),0===t.remotion_delayRenderHandles.length&&(t.remotion_renderReady=!0)},eS=(0,o.createContext)({logLevel:"info",mountTime:0}),ek=()=>{let{logLevel:e}=o.useContext(eS);if(null===e)throw Error("useLogLevel must be used within a LogLevelProvider");return e},eN=()=>{let{mountTime:e}=o.useContext(eS);if(null===e)throw Error("useMountTime must be used within a LogLevelProvider");return e},eI=(0,o.createContext)(null),eM=()=>{var e;let t=I(),r=null!==(e=(0,o.useContext)(eI))&&void 0!==e?e:"undefined"!=typeof window?window:void 0,n=ek();return{delayRender:(0,o.useCallback)((e,o)=>r?eT({scope:r,environment:t,label:null!=e?e:null,options:null!=o?o:{}}):Math.random(),[t,r]),continueRender:(0,o.useCallback)(e=>{r&&eV({scope:r,handle:e,environment:t,logLevel:n})},[t,n,r]),cancelRender:(0,o.useCallback)(e=>eb(null!=r?r:"undefined"!=typeof window?window:void 0,e),[r])}},eA=(0,o.createContext)({setFrame:()=>{throw Error("default")},setPlaying:()=>{throw Error("default")}}),ej=(0,o.createContext)({frame:{},playing:!1,playbackRate:1,rootId:"",imperativePlaying:{current:!1},setPlaybackRate:()=>{throw Error("default")},audioAndVideoTags:{current:[]}}),e_=e=>{let{children:t,frameState:r}=e,[i,a]=(0,o.useState)(!1),l=(0,o.useRef)(!1),[u,s]=(0,o.useState)(1),d=(0,o.useRef)([]),[c]=(0,o.useState)(()=>String(S(null))),[m,f]=(0,o.useState)(()=>ep()),p=null!=r?r:m,{delayRender:v,continueRender:h}=eM();"undefined"!=typeof window&&(0,o.useLayoutEffect)(()=>{window.remotion_setFrame=(e,t,r)=>{window.remotion_attempt=r;let o=v("Setting the current frame to ".concat(e)),n=!0;f(r=>{var o;return(null!==(o=r[t])&&void 0!==o?o:window.remotion_initialFrame)===e?(n=!1,r):{...r,[t]:e}}),n?requestAnimationFrame(()=>h(o)):h(o)},window.remotion_isPlayer=!1},[h,v]);let y=(0,o.useMemo)(()=>({frame:p,playing:i,imperativePlaying:l,rootId:c,playbackRate:u,setPlaybackRate:s,audioAndVideoTags:d}),[p,u,i,c]),g=(0,o.useMemo)(()=>({setFrame:f,setPlaying:a}),[]);return(0,n.jsx)(ej.Provider,{value:y,children:(0,n.jsx)(eA.Provider,{value:g,children:t})})},eL=(0,o.createContext)(!1),eD=e=>{let{children:t}=e;return(0,n.jsx)(eL.Provider,{value:!0,children:t})},eO=()=>{var e,t,r;let n=(0,o.useContext)(R),i=null!==(e=null==n?void 0:n.width)&&void 0!==e?e:null,a=null!==(t=null==n?void 0:n.height)&&void 0!==t?t:null,l=null!==(r=null==n?void 0:n.durationInFrames)&&void 0!==r?r:null,u=ec();return(0,o.useMemo)(()=>{if(!u)return null;let{id:e,durationInFrames:t,fps:r,height:o,width:n,defaultProps:s,props:d,defaultCodec:c,defaultOutName:m,defaultVideoImageFormat:f,defaultPixelFormat:p,defaultProResProfile:v}=u;return{id:e,width:null!=i?i:n,height:null!=a?a:o,fps:r,durationInFrames:null!=l?l:t,defaultProps:s,props:d,defaultCodec:c,defaultOutName:m,defaultVideoImageFormat:f,defaultPixelFormat:p,defaultProResProfile:v}},[l,a,i,u])},eU=()=>{let e=eO(),t=(0,o.useContext)(eL),r=w();if(!e){if("undefined"!=typeof window&&window.remotion_isPlayer||r)throw Error("No video config found. Likely reasons:-- You are probably calling useVideoConfig() from outside the component passed to . See https://www.remotion.dev/docs/player/examples for how to set up the Player correctly.-- You have multiple versions of Remotion installed which causes the React context to get lost.");throw Error("No video config found. You are probably calling useVideoConfig() from a component which has not been registered as a . See https://www.remotion.dev/docs/the-fundamentals#defining-compositions for more information.")}if(!t)throw Error("Called useVideoConfig() outside a Remotion composition.");return e},eB=()=>{let e=(0,o.useContext)(eL),t=I();if(!e){if(t.isPlayer)throw Error("useCurrentFrame can only be called inside a component that was passed to . See: https://www.remotion.dev/docs/player/examples");throw Error("useCurrentFrame() can only be called inside a component that was registered as a composition. See https://www.remotion.dev/docs/the-fundamentals#defining-compositions")}let r=eh(),n=(0,o.useContext)(R);return r-(n?n.cumulatedFrom+n.relativeFrom:0)},eH=e=>{var t;let{frame:r,children:i,active:a=!0}=e,l=eB(),u=eU();if(void 0===r)throw Error("The component requires a 'frame' prop, but none was passed.");if("number"!=typeof r)throw Error("The 'frame' prop of must be a number, but is of type ".concat(typeof r));if(Number.isNaN(r))throw Error("The 'frame' prop of must be a real number, but it is NaN.");if(!Number.isFinite(r))throw Error("The 'frame' prop of must be a finite number, but it is ".concat(r,"."));let s=(0,o.useMemo)(()=>"boolean"==typeof a?a:"function"==typeof a?a(l):void 0,[a,l]),d=(0,o.useContext)(ej),c=(0,o.useContext)(R),m=null!==(t=null==c?void 0:c.relativeFrom)&&void 0!==t?t:0,f=(0,o.useMemo)(()=>s?{...d,playing:!1,imperativePlaying:{current:!1},frame:{[u.id]:r+m}}:d,[s,d,u.id,r,m]),p=(0,o.useMemo)(()=>c?s?{...c,cumulatedFrom:0}:c:null,[c,s]);return(0,n.jsx)(ej.Provider,{value:f,children:(0,n.jsx)(R.Provider,{value:p,children:i})})},eq=(0,o.forwardRef)((e,t)=>{var r;let{from:i=0,durationInFrames:a=1/0,children:l,name:u,height:s,width:d,showInTimeline:c=!0,_remotionInternalLoopDisplay:m,_remotionInternalStack:f,_remotionInternalPremountDisplay:p,_remotionInternalPostmountDisplay:v,...h}=e,{layout:y="absolute-fill"}=h,[g]=(0,o.useState)(()=>String(Math.random())),w=(0,o.useContext)(R),{rootId:b}=(0,o.useContext)(ej),x=w?w.cumulatedFrom+w.relativeFrom:0,E=K();if("absolute-fill"!==y&&"none"!==y)throw TypeError('The layout prop of expects either "absolute-fill" or "none", but you passed: '.concat(y));if("none"===y&&void 0!==h.style)throw TypeError('If layout="none", you may not pass a style.');if("number"!=typeof a)throw TypeError("You passed to durationInFrames an argument of type ".concat(typeof a,", but it must be a number."));if(a<=0)throw TypeError("durationInFrames must be positive, but got ".concat(a));if("number"!=typeof i)throw TypeError('You passed to the "from" props of your an argument of type '.concat(typeof i,", but it must be a number."));if(!Number.isFinite(i))throw TypeError('The "from" prop of a sequence must be finite, but got '.concat(i,"."));let T=eh(),V=eU(),S=w?Math.min(w.durationInFrames-i,a):a,k=Math.max(0,Math.min(V.durationInFrames-i,S)),{registerSequence:N,unregisterSequence:M}=(0,o.useContext)(F),{hidden:A}=(0,o.useContext)(P),j=(0,o.useMemo)(()=>(null==w?void 0:w.premounting)||!!h._remotionInternalIsPremounting,[h._remotionInternalIsPremounting,null==w?void 0:w.premounting]),_=(0,o.useMemo)(()=>(null==w?void 0:w.postmounting)||!!h._remotionInternalIsPostmounting,[h._remotionInternalIsPostmounting,null==w?void 0:w.postmounting]),L=(0,o.useMemo)(()=>{var e,t,r;return{cumulatedFrom:x,relativeFrom:i,durationInFrames:k,parentFrom:null!==(e=null==w?void 0:w.relativeFrom)&&void 0!==e?e:0,id:g,height:null!==(t=null!=s?s:null==w?void 0:w.height)&&void 0!==t?t:null,width:null!==(r=null!=d?d:null==w?void 0:w.width)&&void 0!==r?r:null,premounting:j,postmounting:_,premountDisplay:null!=p?p:null,postmountDisplay:null!=v?v:null}},[x,i,k,w,g,s,d,j,_,p,v]),D=(0,o.useMemo)(()=>null!=u?u:"",[u]),O=I();(0,o.useEffect)(()=>{var e;if(O.isStudio)return N({from:i,duration:k,id:g,displayName:D,parent:null!==(e=null==w?void 0:w.id)&&void 0!==e?e:null,type:"sequence",rootId:b,showInTimeline:c,nonce:E,loopDisplay:m,stack:null!=f?f:null,premountDisplay:null!=p?p:null,postmountDisplay:null!=v?v:null}),()=>{M(g)}},[a,g,u,N,D,M,null==w?void 0:w.id,k,b,i,c,E,m,f,p,v,O.isStudio]);let U=Math.ceil(x+i+a-1),B=TU?null:l,H="none"===h.layout?void 0:h.style,q=(0,o.useMemo)(()=>({flexDirection:void 0,...d?{width:d}:{},...s?{height:s}:{},...null!=H?H:{}}),[s,H,d]);if(null!==t&&"none"===y)throw TypeError('It is not supported to pass both a `ref` and `layout="none"` to .');return null!==(r=A[g])&&void 0!==r&&r?null:(0,n.jsx)(R.Provider,{value:L,children:null===B?null:"none"===h.layout?B:(0,n.jsx)(C,{ref:t,style:q,className:h.className,children:B})})}),eW=(0,o.forwardRef)((e,t)=>{let r=eB();if("none"===e.layout)throw Error('`` with `premountFor` and `postmountFor` props does not support layout="none"');let{style:i,from:a=0,durationInFrames:l=1/0,premountFor:u=0,postmountFor:s=0,styleWhilePremounted:d,styleWhilePostmounted:c,...m}=e,f=Math.ceil(a+l-1),p=r=a-u,v=r>f&&r<=f+s,h=p?a:v?a+l-1:0,y=p||v,g=(0,o.useMemo)(()=>{var e;return{...i,opacity:p||v?0:1,pointerEvents:p||v?"none":null!==(e=null==i?void 0:i.pointerEvents)&&void 0!==e?e:void 0,...p?d:{},...v?c:{}}},[i,p,v,d,c]);return(0,n.jsx)(eH,{frame:h,active:y,children:(0,n.jsx)(ez,{ref:t,from:a,durationInFrames:l,style:g,_remotionInternalPremountDisplay:u,_remotionInternalPostmountDisplay:s,_remotionInternalIsPremounting:p,_remotionInternalIsPostmounting:v,...m})})}),ez=(0,o.forwardRef)((e,t)=>{let r=I();return"none"!==e.layout&&!r.isRendering&&(e.premountFor||e.postmountFor)?(0,n.jsx)(eW,{...e,ref:t}):(0,n.jsx)(eq,{...e,ref:t})}),eY=e=>{if("string"!=typeof e)throw TypeError('The "filename" must be a string, but you passed a value of type '.concat(typeof e));if(""===e.trim())throw Error("The `filename` must not be empty");if(!e.match(/^([0-9a-zA-Z-!_.*'()/:&$@=;+,?]+)/g))throw Error('The `filename` must match "/^([0-9a-zA-Z-!_.*\'()/:&$@=;+,?]+)/g". Use forward slashes only, even on Windows.')},eJ=e=>{if("string"!=typeof e&&!(e instanceof Uint8Array))throw TypeError('The "content" must be a string or Uint8Array, but you passed a value of type '.concat(typeof e));if("string"==typeof e&&""===e.trim())throw Error("The `content` must not be empty")},eG=e=>{"artifact"===e.type&&(eY(e.filename),"thumbnail"!==e.contentType&&eJ(e.content))},eZ=(0,o.createContext)({registerRenderAsset:()=>{},unregisterRenderAsset:()=>{},renderAssets:[]});Symbol("Thumbnail");var eQ=e=>"undefined"==typeof window||e.startsWith("http://")||e.startsWith("https://")||e.startsWith("file://")||e.startsWith("blob:")||e.startsWith("data:")?e:new URL(e,window.origin).href,e$=e=>{let{trimAfter:t,mediaDurationInFrames:r,playbackRate:o,trimBefore:n}=e,i=r;return void 0!==t&&(i=t),void 0!==n&&(i-=n),Math.floor(i/o)},eK=(0,o.createContext)(null),eX=e=>{let{durationInFrames:t,times:r=1/0,children:i,name:a,...l}=e,u=eB(),{durationInFrames:s}=eU();if(et(t,{component:"of the component",allowFloats:!0}),"number"!=typeof r)throw TypeError('You passed to "times" an argument of type '.concat(typeof r,", but it must be a number."));if(r!==1/0&&r%1!=0)throw TypeError('The "times" prop of a loop must be an integer, but got '.concat(r,"."));if(r<0)throw TypeError('The "times" prop of a loop must be at least 0, but got '.concat(r));let d=Math.min(Math.ceil(s/t),r),c="none"===l.layout?void 0:l.style,m=t*(d-1),f=Math.min(Math.floor(u/t)*t,m),p=(0,o.useMemo)(()=>({numberOfTimes:d,startOffset:-f,durationInFrames:t}),[d,t,f]),v=(0,o.useMemo)(()=>({iteration:Math.floor(u/t),durationInFrames:t}),[u,t]);return(0,n.jsx)(eK.Provider,{value:v,children:(0,n.jsx)(ez,{durationInFrames:t,from:f,name:null!=a?a:"",_remotionInternalLoopDisplay:p,layout:l.layout,style:c,children:i})})};eX.useLoop=()=>o.useContext(eK);var e0=e=>{let{logLevel:t,tag:r,message:o,mountTime:n}=e,i=[n?Date.now()-n+"ms ":null,r].filter(Boolean).join(" ");eP.trace({logLevel:t,tag:null},"[".concat(i,"]"),o)},e1=(0,o.createContext)({}),e5={},e2=[],e9=e=>{let{children:t}=e,[r,i]=(0,o.useState)(()=>e5);return(0,o.useEffect)(()=>{let e=()=>{i(e5)};return e2.push(e),()=>{e2=e2.filter(t=>t!==e)}},[]),(0,n.jsx)(e1.Provider,{value:r,children:t})},e4=e=>{let t=e.indexOf("#");return -1===t?null:t},e3=e=>{let t=e4(e);return null===t?e:e.slice(0,t)},e6=e=>{let t=(0,o.useContext)(e1),r=e4(e),n=e3(e);return t[n]?null!==r?t[n]+e.slice(r):t[n]:e},e8=(e,t)=>{if("number"!=typeof e.volume&&"function"!=typeof e.volume&&void 0!==e.volume)throw TypeError("You have passed a volume of type ".concat(typeof e.volume," to your <").concat(t," /> component. Volume must be a number or a function with the signature '(frame: number) => number' undefined."));if("number"==typeof e.volume&&e.volume<0)throw TypeError("You have passed a volume below 0 to your <".concat(t," /> component. Volume must be between 0 and 1"));if("number"!=typeof e.playbackRate&&void 0!==e.playbackRate)throw TypeError("You have passed a playbackRate of type ".concat(typeof e.playbackRate," to your <").concat(t," /> component. Playback rate must a real number or undefined."));if("number"==typeof e.playbackRate&&(isNaN(e.playbackRate)||!Number.isFinite(e.playbackRate)||e.playbackRate<=0))throw TypeError("You have passed a playbackRate of ".concat(e.playbackRate," to your <").concat(t," /> component. Playback rate must be a real number above 0."))},e7=(e,t)=>{if(void 0!==e){if("number"!=typeof e)throw TypeError("type of startFrom prop must be a number, instead got type ".concat(typeof e,"."));if(isNaN(e)||e===1/0)throw TypeError("startFrom prop can not be NaN or Infinity.");if(e<0)throw TypeError("startFrom must be greater than equal to 0 instead got ".concat(e,"."))}if(void 0!==t){if("number"!=typeof t)throw TypeError("type of endAt prop must be a number, instead got type ".concat(typeof t,"."));if(isNaN(t))throw TypeError("endAt prop can not be NaN.");if(t<=0)throw TypeError("endAt must be a positive number, instead got ".concat(t,"."))}if(t{if(void 0!==e){if("number"!=typeof e)throw TypeError("type of trimBefore prop must be a number, instead got type ".concat(typeof e,"."));if(isNaN(e)||e===1/0)throw TypeError("trimBefore prop can not be NaN or Infinity.");if(e<0)throw TypeError("trimBefore must be greater than equal to 0 instead got ".concat(e,"."))}if(void 0!==t){if("number"!=typeof t)throw TypeError("type of trimAfter prop must be a number, instead got type ".concat(typeof t,"."));if(isNaN(t))throw TypeError("trimAfter prop can not be NaN.");if(t<=0)throw TypeError("trimAfter must be a positive number, instead got ".concat(t,"."))}if(t<=e)throw TypeError("trimAfter prop must be greater than trimBefore prop.")},tt=e=>{let{startFrom:t,endAt:r,trimBefore:o,trimAfter:n}=e;if(void 0!==t&&void 0!==o)throw TypeError("Cannot use both startFrom and trimBefore props. Use trimBefore instead as startFrom is deprecated.");if(void 0!==r&&void 0!==n)throw TypeError("Cannot use both endAt and trimAfter props. Use trimAfter instead as endAt is deprecated.");let i=void 0!==t||void 0!==r;void 0!==o||void 0!==n?te(o,n):i&&e7(t,r)},tr=e=>{var t,r;let{startFrom:o,endAt:n,trimBefore:i,trimAfter:a}=e;return{trimBeforeValue:null!==(t=null!=i?i:o)&&void 0!==t?t:void 0,trimAfterValue:null!==(r=null!=a?a:n)&&void 0!==r?r:void 0}},to=(e,t)=>{if("got-duration"===t.type){let r=eQ(t.src);return e[r]===t.durationInSeconds?e:{...e,[r]:t.durationInSeconds}}return e},tn=(0,o.createContext)({durations:{},setDurations:()=>{throw Error("context missing")}}),ti=e=>{let{children:t}=e,[r,i]=(0,o.useReducer)(to,{}),a=(0,o.useMemo)(()=>({durations:r,setDurations:i}),[r]);return(0,n.jsx)(tn.Provider,{value:a,children:t})},ta=e=>{let{crossOrigin:t,requestsVideoFrame:r,isClientSideRendering:o}=e;return null!=t?t:o||r?"anonymous":void 0},tl=e=>{let{mediaRef:t,mediaType:r,onAutoPlayError:o,logLevel:n,mountTime:i,reason:a,isPlayer:l}=e,{current:u}=t;if(!u)return;e0({logLevel:n,tag:"play",message:"Attempting to play ".concat(u.src,". Reason: ").concat(a),mountTime:i});let s=u.play();s.catch&&s.catch(e=>{if(!(!u||e.message.includes("request was interrupted by a call to pause")||e.message.includes("The operation was aborted.")||e.message.includes("The fetching process for the media resource was aborted by the user agent")||e.message.includes("request was interrupted by a new load request")||e.message.includes("because the media was removed from the document")||e.message.includes("user didn't interact with the document")&&u.muted)&&(console.log("Could not play ".concat(r," due to following error: "),e),!u.muted)){if(o){o();return}"video"===r&&l&&(eP.info({logLevel:n,tag:"<"+r+">"},"The video will be muted and we'll retry playing it."),eP.info({logLevel:n,tag:"<"+r+">"},"Use onAutoPlayError() to handle this error yourself."),u.muted=!0,u.play())}})},tu=e=>{let{audioContext:t,ref:r}=e,o=null;return{attemptToConnect:()=>{!o&&r.current&&(o=t.createMediaElementSource(r.current))},get:()=>{if(!o)throw Error("Audio element not connected");return o}}},ts=!1,td=e=>{ts||(ts=!0,"undefined"!=typeof window&&eP.warn({logLevel:e,tag:null},"AudioContext is not supported in this browser"))},tc=(e,t)=>{let r=I();return(0,o.useMemo)(()=>r.isRendering?null:"undefined"==typeof AudioContext?(td(e),null):new AudioContext({latencyHint:t,sampleRate:48e3}),[e,t,r.isRendering])},tm="data:audio/mp3;base64,/+MYxAAJcAV8AAgAABn//////+/gQ5BAMA+D4Pg+BAQBAEAwD4Pg+D4EBAEAQDAPg++hYBH///hUFQVBUFREDQNHmf///////+MYxBUGkAGIMAAAAP/29Xt6lUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV/+MYxDUAAANIAAAAAFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV",tf=(e,t)=>{let r=Object.keys(e).sort(),o=Object.keys(t).sort();if(r.length!==o.length)return!1;for(let n=0;n"src"!==e||r.startsWith("data:")||t.startsWith("data:")?r!==t:new URL(r,window.origin).toString()!==new URL(t,window.origin).toString(),tv=(0,o.createContext)(null),th=e=>{let{children:t,numberOfAudioTags:r,audioLatencyHint:i}=e,a=(0,o.useRef)([]),[l]=(0,o.useState)(r);if(r!==l)throw Error("The number of shared audio tags has changed dynamically. Once you have set this property, you cannot change it afterwards.");let u=ek(),s=tc(u,i),d=(0,o.useMemo)(()=>Array(r).fill(!0).map(()=>{let e=(0,o.createRef)();return{id:Math.random(),ref:e,mediaElementSourceNode:s?tu({audioContext:s,ref:e}):null}}),[s,r]),c=(0,o.useRef)(Array(r).fill(!1)),m=(0,o.useCallback)(()=>{d.forEach(e=>{var t;let{ref:r,id:o}=e,n=null===(t=a.current)||void 0===t?void 0:t.find(e=>e.id===o),{current:i}=r;if(i){if(void 0===n){i.src=tm;return}if(!n)throw TypeError("Expected audio data to be there");Object.keys(n.props).forEach(e=>{tp(e,n.props[e],i[e])&&(i[e]=n.props[e])})}})},[d]),f=(0,o.useCallback)(e=>{var t,o;let{aud:n,audioId:i,premounting:l,postmounting:u}=e,s=null===(t=a.current)||void 0===t?void 0:t.find(e=>e.audioId===i);if(s)return s;let f=c.current.findIndex(e=>!1===e);if(-1===f)throw Error("Tried to simultaneously mount ".concat(r+1," tags at the same time. With the current settings, the maximum amount of tags is limited to ").concat(r," at the same time. Remotion pre-mounts silent audio tags to help avoid browser autoplay restrictions. See https://remotion.dev/docs/player/autoplay#using-the-numberofsharedaudiotags-prop for more information on how to increase this limit."));let{id:p,ref:v,mediaElementSourceNode:h}=d[f],y=[...c.current];y[f]=p,c.current=y;let g={props:n,id:p,el:v,audioId:i,mediaElementSourceNode:h,premounting:l,audioMounted:!!v.current,postmounting:u};return null===(o=a.current)||void 0===o||o.push(g),m(),g},[r,d,m]),p=(0,o.useCallback)(e=>{var t;let r=[...c.current],o=d.findIndex(t=>t.id===e);if(-1===o)throw TypeError("Error occured in ");r[o]=!1,c.current=r,a.current=null===(t=a.current)||void 0===t?void 0:t.filter(t=>t.id!==e),m()},[d,m]),v=(0,o.useCallback)(e=>{var t;let{aud:r,audioId:o,id:n,premounting:i,postmounting:l}=e,u=!1;a.current=null===(t=a.current)||void 0===t?void 0:t.map(e=>{let t=!!e.el.current;return(e.audioMounted!==t&&(u=!0),e.id===n)?tf(r,e.props)&&e.premounting===i&&e.postmounting===l?e:(u=!0,{...e,props:r,premounting:i,postmounting:l,audioId:o,audioMounted:t}):e}),u&&m()},[m]),h=eN(),y=I(),g=(0,o.useCallback)(()=>{d.forEach(e=>{let t=a.current.find(t=>t.el===e.ref);null!=t&&t.premounting||tl({mediaRef:e.ref,mediaType:"audio",onAutoPlayError:null,logLevel:u,mountTime:h,reason:"playing all audios",isPlayer:y.isPlayer})}),null==s||s.resume()},[s,u,h,d,y.isPlayer]),w=(0,o.useMemo)(()=>({registerAudio:f,unregisterAudio:p,updateAudio:v,playAllAudios:g,numberOfAudioTags:r,audioContext:s}),[r,g,f,p,v,s]);return(0,n.jsxs)(tv.Provider,{value:w,children:[d.map(e=>{let{id:t,ref:r}=e;return(0,n.jsx)("audio",{ref:r,preload:"metadata",src:tm},t)}),t]})},ty=e=>{var t;let{aud:r,audioId:n,premounting:i,postmounting:a}=e,l=(0,o.useContext)(tv),[u]=(0,o.useState)(()=>{if(l&&l.numberOfAudioTags>0)return l.registerAudio({aud:r,audioId:n,premounting:i,postmounting:a});let e=o.createRef(),t=(null==l?void 0:l.audioContext)?tu({audioContext:l.audioContext,ref:e}):null;return{el:e,id:Math.random(),props:r,audioId:n,mediaElementSourceNode:t,premounting:i,audioMounted:!!e.current,postmounting:a}}),s=null!==(t=o.useInsertionEffect)&&void 0!==t?t:o.useLayoutEffect;return"undefined"!=typeof document&&(s(()=>{l&&l.numberOfAudioTags>0&&l.updateAudio({id:u.id,aud:r,audioId:n,premounting:i,postmounting:a})},[r,l,u.id,n,i,a]),s(()=>()=>{l&&l.numberOfAudioTags>0&&l.unregisterAudio(u.id)},[l,u.id])),u},tg=(e,t)=>1e-5>Math.abs(e-t),tw=(e,t)=>Math.round(e/t*100)/100,tb=()=>!!("undefined"!=typeof window&&/AppleWebKit/.test(window.navigator.userAgent))&&!window.navigator.userAgent.includes("Chrome/"),tx=()=>"undefined"!=typeof window&&/iP(ad|od|hone)/i.test(window.navigator.userAgent)&&tb(),tE=e=>tx()&&e.startsWith("blob:"),tC=e=>{let{actualFrom:t,fps:r}=e;return tw(Math.max(0,-t),r)},tR=e=>{let{duration:t,fps:r}=e;return tw(t,r)},tF=e=>{var t;let{actualSrc:r,actualFrom:o,duration:n,fps:i}=e;if(tE(r)||r.startsWith("data:")||new URL(r,null!==(t="undefined"==typeof window?null:window.location.href)&&void 0!==t?t:"http://localhost:3000").hash||!Number.isFinite(o))return r;let a="".concat(r,"#t=").concat(tC({actualFrom:o,fps:i}));return Number.isFinite(n)?"".concat(a,",").concat(tR({duration:n,fps:i})):a},tP=e=>{let{prevStartFrom:t,newStartFrom:r,prevDuration:o,newDuration:n,fps:i}=e,a=tC({actualFrom:t,fps:i}),l=tC({actualFrom:r,fps:i}),u=tR({duration:o,fps:i}),s=tR({duration:n,fps:i});return!(lu)},tT=e=>{let{actualSrc:t,actualFrom:r,duration:n,fps:i}=e,a=(0,o.useRef)(r),l=(0,o.useRef)(n),u=(0,o.useRef)(t);return tP({prevStartFrom:a.current,newStartFrom:r,prevDuration:l.current,newDuration:n,fps:i})&&t===u.current||(a.current=r,l.current=n,u.current=t),tF({actualSrc:u.current,actualFrom:a.current,duration:l.current,fps:i})},tV=!1,tS=e=>{tV||(tV=!0,eP.warn({logLevel:e,tag:null},"In Safari, setting a volume and a playback rate at the same time is buggy."),eP.warn({logLevel:e,tag:null},"In Desktop Safari, only volumes <= 1 will be applied."),eP.warn({logLevel:e,tag:null},e,"In Mobile Safari, the volume will be ignored and set to 1 if a playbackRate is set."))},tk=e=>{var t,r,n;let{mediaRef:i,volume:a,logLevel:l,source:u,shouldUseWebAudioApi:s}=e,d=(0,o.useRef)(null),c=(0,o.useRef)(a);c.current=a;let m=(0,o.useContext)(tv);if(!m)throw Error("useAmplification must be used within a SharedAudioContext");let{audioContext:f}=m;return"undefined"!=typeof window&&(0,o.useLayoutEffect)(()=>{var e,t;if(!f||!i.current||!s)return;if(1!==i.current.playbackRate&&tb()){tS(l);return}if(!u)return;let r=new GainNode(f,{gain:c.current});return u.attemptToConnect(),u.get().connect(r),r.connect(f.destination),d.current={gainNode:r},eP.trace({logLevel:l,tag:null},"Starting to amplify ".concat(null===(e=i.current)||void 0===e?void 0:e.src,". Gain = ").concat(c.current,", playbackRate = ").concat(null===(t=i.current)||void 0===t?void 0:t.playbackRate)),()=>{d.current=null,r.disconnect(),u.get().disconnect()}},[l,i,f,u,s]),d.current&&!tg(d.current.gainNode.gain.value,a)&&(d.current.gainNode.gain.value=a,eP.trace({logLevel:l,tag:null},"Setting gain to ".concat(a," for ").concat(null===(n=i.current)||void 0===n?void 0:n.src))),(tb()&&i.current&&(null===(t=i.current)||void 0===t?void 0:t.playbackRate)!==1||!s)&&i.current&&!tg(a,null===(r=i.current)||void 0===r?void 0:r.volume)&&(i.current.volume=Math.min(a,1)),d},tN=()=>{var e;let t=(0,o.useContext)(R);return Math.min(0,null!==(e=null==t?void 0:t.relativeFrom)&&void 0!==e?e:0)},tI=e=>{let t=eX.useLoop(),r=eB(),o=tN();return"repeat"===e||null===t?r+o:r+o+t.durationInFrames*t.iteration},tM=e=>{if(/data:|blob:/.test(e.substring(0,5)))return"Data URL";let t=e.split("/").map(e=>e.split("\\")).flat(1);return t[t.length-1]},tA=e=>{let{frame:t,volume:r,mediaVolume:o=1}=e;if("number"==typeof r)return r*o;if(void 0===r)return Number(o);let n=r(t)*o;if("number"!=typeof n)throw TypeError("You passed in a a function to the volume prop but it did not return a number but a value of type ".concat(typeof n," for frame ").concat(t));if(Number.isNaN(n))throw TypeError("You passed in a function to the volume prop but it returned NaN for frame ".concat(t,"."));if(!Number.isFinite(n))throw TypeError("You passed in a function to the volume prop but it returned a non-finite number for frame ".concat(t,"."));return Math.max(0,n)},tj={},t_=e=>{tj[e]||(console.warn(e),tj[e]=!0)},tL=e=>{let{volume:t,mediaVolume:r,mediaType:n,src:i,displayName:a,trimBefore:l,trimAfter:u,playbackRate:s}=e;if(!i)throw Error("No src passed");let d=tN(),c=(0,o.useContext)(R),m=eU(),[f]=(0,o.useState)(()=>t),p=e$({mediaDurationInFrames:m.durationInFrames,playbackRate:s,trimBefore:l,trimAfter:u}),v=c?Math.min(c.durationInFrames,p):p,h=(0,o.useMemo)(()=>"number"==typeof t?t:Array(Math.floor(Math.max(0,v+d))).fill(!0).map((e,o)=>tA({frame:o+d,volume:t,mediaVolume:r})).join(","),[v,d,t,r]);(0,o.useEffect)(()=>{"number"==typeof t&&t!==f&&t_("Remotion: The ".concat(n," with src ").concat(i," has changed it's volume. Prefer the callback syntax for setting volume to get better timeline display: https://www.remotion.dev/docs/audio/volume"))},[f,n,i,t]);let y="function"==typeof t,g=K(),{rootId:w}=(0,o.useContext)(ej);return{volumes:h,duration:v,doesVolumeChange:y,nonce:g,rootId:w,isStudio:I().isStudio,finalDisplayName:null!=a?a:tM(i)}},tD=e=>{let{volume:t,mediaVolume:r,src:n,mediaType:i,playbackRate:a,displayName:l,id:u,stack:s,showInTimeline:d,premountDisplay:c,postmountDisplay:m,loopDisplay:f}=e,p=(0,o.useContext)(R),v=tN(),{registerSequence:h,unregisterSequence:y}=(0,o.useContext)(F),{volumes:g,duration:w,doesVolumeChange:b,nonce:x,rootId:E,isStudio:C,finalDisplayName:P}=tL({volume:t,mediaVolume:r,mediaType:i,src:n,displayName:l,trimAfter:void 0,trimBefore:void 0,playbackRate:a});(0,o.useEffect)(()=>{var e,t,r;if(!n)throw Error("No src passed");if((C||(null===(t=window.process)||void 0===t?void 0:null===(e=t.env)||void 0===e?void 0:e.NODE_ENV)==="test")&&d)return h({type:i,src:n,id:u,duration:w,from:0,parent:null!==(r=null==p?void 0:p.id)&&void 0!==r?r:null,displayName:P,rootId:E,volume:g,showInTimeline:!0,nonce:x,startMediaFrom:0-v,doesVolumeChange:b,loopDisplay:f,playbackRate:a,stack:s,premountDisplay:c,postmountDisplay:m}),()=>{y(u)}},[w,u,p,n,h,y,g,b,x,i,v,a,s,d,c,m,C,f,E,P])},tO=(e,t)=>{let[r,n]=(0,o.useState)([]),[i,a]=(0,o.useState)([]),[l,u]=(0,o.useState)([]),s=I().isRendering,d=(0,o.useRef)(!1),c=(0,o.useCallback)(e=>s?{unblock:()=>{}}:(n(t=>[...t,e]),{unblock:()=>{n(t=>{let r=t.filter(t=>t!==e);return r.length===t.length?t:r})}}),[s]),m=(0,o.useCallback)(e=>(a(t=>[...t,e]),{remove:()=>{a(t=>t.filter(t=>t!==e))}}),[]),f=(0,o.useCallback)(e=>(u(t=>[...t,e]),{remove:()=>{u(t=>t.filter(t=>t!==e))}}),[]);return(0,o.useEffect)(()=>{!s&&r.length>0&&(i.forEach(e=>e()),e0({logLevel:e,message:"Player is entering buffer state",mountTime:t,tag:"player"}))},[r]),"undefined"!=typeof window&&(0,o.useLayoutEffect)(()=>{s||0!==r.length||(l.forEach(e=>e()),e0({logLevel:e,message:"Player is exiting buffer state",mountTime:t,tag:"player"}))},[r]),(0,o.useMemo)(()=>({addBlock:c,listenForBuffering:m,listenForResume:f,buffering:d}),[c,d,m,f])},tU=o.createContext(null),tB=e=>{let{children:t}=e,{logLevel:r,mountTime:i}=(0,o.useContext)(eS),a=tO(null!=r?r:"info",i);return(0,n.jsx)(tU.Provider,{value:a,children:t})},tH=e=>{let[t,r]=(0,o.useState)(e.buffering.current);return(0,o.useEffect)(()=>(e.listenForBuffering(()=>{r(!0)}),e.listenForResume(()=>{r(!1)}),()=>{e.listenForBuffering(()=>{}),e.listenForResume(()=>{})}),[e]),t},tq=()=>{let e=(0,o.useContext)(tU),t=e?e.addBlock:null;return(0,o.useMemo)(()=>({delayPlayback:()=>{if(!t)throw Error("Tried to enable the buffering state, but a Remotion context was not found. This API can only be called in a component that was passed to the Remotion Player or a . Or you might have experienced a version mismatch - run `npx remotion versions` and ensure all packages have the same version. This error is thrown by the buffer state https://remotion.dev/docs/player/buffer-state");let{unblock:e}=t({id:String(Math.random())});return{unblock:e}}}),[t])},tW=()=>/^((?!chrome|android).)*safari/i.test(window.navigator.userAgent),tz=e=>{let{mediaRef:t,mediaType:r,onVariableFpsVideoDetected:n,pauseWhenBuffering:i,logLevel:a,mountTime:l}=e,u=(0,o.useRef)(!1),{delayPlayback:s}=tq(),d=(0,o.useCallback)(e=>{var o;if("video"!==r||!i)return;let d=t.current;if(!d)return;if(d.readyState>=d.HAVE_FUTURE_DATA&&!tW()){e0({logLevel:a,message:"Not using buffer until first frame, because readyState is ".concat(d.readyState," and is not Safari or Desktop Chrome"),mountTime:l,tag:"buffer"});return}if(!d.requestVideoFrameCallback){e0({logLevel:a,message:"Not using buffer until first frame, because requestVideoFrameCallback is not supported",mountTime:l,tag:"buffer"});return}u.current=!0,e0({logLevel:a,message:"Buffering ".concat(null===(o=t.current)||void 0===o?void 0:o.src," until the first frame is received"),mountTime:l,tag:"buffer"});let c=s(),m=()=>{c.unblock(),d.removeEventListener("ended",m,{once:!0}),d.removeEventListener("pause",m,{once:!0}),u.current=!1},f=()=>{m()};d.requestVideoFrameCallback((t,r)=>{Math.abs(r.mediaTime-e)>.5&&n(),m()}),d.addEventListener("ended",f,{once:!0}),d.addEventListener("pause",f,{once:!0}),d.addEventListener("canplay",f,{once:!0})},[s,a,t,r,l,n,i]);return(0,o.useMemo)(()=>({isBuffering:()=>u.current,bufferUntilFirstFrame:d}),[d])},tY=e=>{var t,r,n,i;let a=o.useRef({time:null!==(n=null===(t=e.current)||void 0===t?void 0:t.currentTime)&&void 0!==n?n:0,lastUpdate:performance.now()}),l=null!==(i=null===(r=e.current)||void 0===r?void 0:r.currentTime)&&void 0!==i?i:null;return null!==l&&a.current.time!==l&&(a.current.time=l,a.current.lastUpdate=performance.now()),a},tJ=e=>{let{mediaRef:t,time:r,logLevel:o,why:n,mountTime:i}=e,a=tx()?Number(r.toFixed(1)):r;return e0({logLevel:o,tag:"seek",message:"Seeking from ".concat(t.currentTime," to ").concat(a,". src= ").concat(t.src," Reason: ").concat(n),mountTime:i}),t.currentTime=a,a},tG=e=>{let{element:t,shouldBuffer:r,isPremounting:n,isPostmounting:i,logLevel:a,mountTime:l,src:u}=e,s=tq(),[d,c]=(0,o.useState)(!1);return(0,o.useEffect)(()=>{let e=[],{current:o}=t;if(!o||!r)return;if(n||i){if((n||i)&&o.readyState{let r=!1;e.forEach(e=>{e(t),r=!0}),e=[],c(e=>(e&&(r=!0),!1)),r&&e0({logLevel:a,message:"Unmarking as buffering: ".concat(o.src,". Reason: ").concat(t),tag:"buffer",mountTime:l})},m=t=>{c(!0),e0({logLevel:a,message:"Marking as buffering: ".concat(o.src,". Reason: ").concat(t),tag:"buffer",mountTime:l});let{unblock:r}=s.delayPlayback(),n=()=>{d('"canplay" was fired'),f()},i=()=>{d('"error" event was occurred'),f()};o.addEventListener("canplay",n,{once:!0}),e.push(()=>{o.removeEventListener("canplay",n)}),o.addEventListener("error",i,{once:!0}),e.push(()=>{o.removeEventListener("error",i)}),e.push(e=>{e0({logLevel:a,message:"Unblocking ".concat(o.src," from buffer. Reason: ").concat(e),tag:"buffer",mountTime:l}),r()})},f=()=>{if(o.readyState{m('"waiting" event was fired')};o.addEventListener("waiting",t),e.push(()=>{o.removeEventListener("waiting",t)})}};return f(),()=>{d("element was unmounted or prop changed")}},[s,u,t,n,i,a,r,l]),d},tZ=e=>{let{mediaRef:t,mediaType:r,lastSeek:n,onVariableFpsVideoDetected:i}=e,a=(0,o.useRef)(null);return(0,o.useEffect)(()=>{let{current:e}=t;if(e)a.current={time:e.currentTime,lastUpdate:performance.now()};else{a.current=null;return}if("video"!==r){a.current=null;return}if(!e.requestVideoFrameCallback)return;let o=()=>{},l=()=>{if(!e)return;let t=e.requestVideoFrameCallback((e,t)=>{if(null!==a.current){let e=Math.abs(a.current.time-t.mediaTime),r=Math.abs(null===n.current?1/0:t.mediaTime-n.current);e>.5&&r>.5&&t.mediaTime>a.current.time&&i()}a.current={time:t.mediaTime,lastUpdate:performance.now()},l()});o=()=>{e.cancelVideoFrameCallback(t),o=()=>{}}};return l(),()=>{o()}},[n,t,r,i]),a};function tQ(e,t){if(t.length<2)throw Error(e+" must have at least 2 elements");for(let r of t){if("number"!=typeof r)throw Error("".concat(e," must contain only numbers"));if(!Number.isFinite(r))throw Error("".concat(e," must contain only finite numbers, but got [").concat(t.join(","),"]"))}}function t$(e,t,r,o){var n;if(void 0===e)throw Error("input can not be undefined");if(void 0===t)throw Error("inputRange can not be undefined");if(void 0===r)throw Error("outputRange can not be undefined");if(t.length!==r.length)throw Error("inputRange ("+t.length+") and outputRange ("+r.length+") must have the same length");tQ("inputRange",t),tQ("outputRange",r),function(e){for(let t=1;te[t-1]))throw Error("inputRange must be strictly monotonically increasing but got [".concat(e.join(","),"]"))}(t);let i=null!==(n=null==o?void 0:o.easing)&&void 0!==n?n:e=>e,a="extend";(null==o?void 0:o.extrapolateLeft)!==void 0&&(a=o.extrapolateLeft);let l="extend";if((null==o?void 0:o.extrapolateRight)!==void 0&&(l=o.extrapolateRight),"number"!=typeof e)throw TypeError("Cannot interpolate an input which is not a number");let u=function(e,t){let r;for(r=1;r=e);++r);return r-1}(e,t);return function(e,t,r,o){let{extrapolateLeft:n,extrapolateRight:i,easing:a}=o,l=e,[u,s]=t,[d,c]=r;if(ls){if("identity"===i)return l;if("clamp"===i)l=s;else if("wrap"===i){let e=s-u;l=((l-u)%e+e)%e+u}}return d===c?d:l=(l=a(l=(l-u)/(s-u)))*(c-d)+d}(e,[t[u],t[u+1]],[r[u],r[u+1]],{easing:i,extrapolateLeft:a,extrapolateRight:l})}var tK=e=>{let{frame:t,playbackRate:r,startFrom:o}=e;return t$(t,[-1,o,o+1],[-1,o,o+r])},tX=e=>{let{fps:t,frame:r,playbackRate:o,startFrom:n}=e;return 1e3/t*tK({frame:r,playbackRate:o,startFrom:n})/1e3},t0={},t1=(e,t)=>{if(null===e||0===e.seekable.length||e.seekable.length>1||t0[e.src])return;let r={start:e.seekable.start(0),end:e.seekable.end(0)};if(0===r.start&&0===r.end){let r=["The media ".concat(e.src," cannot be seeked. This could be one of few reasons:"),"1) The media resource was replaced while the video is playing but it was not loaded yet.","2) The media does not support seeking.","3) The media was loaded with security headers prventing it from being included.","Please see https://remotion.dev/docs/non-seekable-media for assistance."].join("\n");if("console-error"===t)console.error(r);else if("console-warning"===t)console.warn("The media ".concat(e.src," does not support seeking. The video will render fine, but may not play correctly in the Remotion Studio and in the . See https://remotion.dev/docs/non-seekable-media for an explanation."));else throw Error(r);t0[e.src]=!0}},t5=e=>{let{mediaRef:t,src:r,mediaType:n,playbackRate:i,onlyWarnForMediaSeekingError:a,acceptableTimeshift:l,pauseWhenBuffering:u,isPremounting:s,isPostmounting:d,onAutoPlayError:c}=e,{playbackRate:m}=(0,o.useContext)(ej),f=eB(),p=eh(),[v]=eg(),h=(0,o.useContext)(tU),{fps:y}=eU(),g=tN(),w=(0,o.useRef)(null),b=(0,o.useRef)(null),x=ek(),E=eN();if(!h)throw Error("useMediaPlayback must be used inside a ");let C=(0,o.useRef)({}),R=(0,o.useCallback)(()=>{r&&!C.current[r]&&(eP.verbose({logLevel:x,tag:null},"Detected ".concat(r," as a variable FPS video. Disabling buffering while seeking.")),C.current[r]=!0)},[x,r]),F=tZ({mediaRef:t,mediaType:n,lastSeek:b,onVariableFpsVideoDetected:R}),P=tY(t),T=tX({frame:f,playbackRate:i,startFrom:-g,fps:y}),V=tG({element:t,shouldBuffer:u,isPremounting:s,isPostmounting:d,logLevel:x,mountTime:E,src:null!=r?r:null}),{bufferUntilFirstFrame:S,isBuffering:k}=tz({mediaRef:t,mediaType:n,onVariableFpsVideoDetected:R,pauseWhenBuffering:u,logLevel:x,mountTime:E}),N=i*m,M=(()=>{var e;return(null===(e=t.current)||void 0===e?void 0:e.duration)?Math.min(t.current.duration,null!=l?l:.65):null!=l?l:.65})(),A=tH(h);(0,o.useEffect)(()=>{var e,r,o,n,i;if(null===(e=t.current)||void 0===e?void 0:e.paused)return;if(!v){e0({logLevel:x,tag:"pause",message:"Pausing ".concat(null===(r=t.current)||void 0===r?void 0:r.src," because ").concat(s?"media is premounting":d?"media is postmounting":"Player is not playing"),mountTime:E}),null===(o=t.current)||void 0===o||o.pause();return}let a=V||k();h.buffering.current&&!a&&(e0({logLevel:x,tag:"pause",message:"Pausing ".concat(null===(n=t.current)||void 0===n?void 0:n.src," because player is buffering but media tag is not"),mountTime:E}),null===(i=t.current)||void 0===i||i.pause())},[k,V,h,A,s,x,t,n,E,v,d]);let j=I();(0,o.useLayoutEffect)(()=>{let e=Math.max(0,N);t.current&&t.current.playbackRate!==e&&(t.current.playbackRate=e)},[t,N]),(0,o.useEffect)(()=>{var e,o,i;let l="audio"===n?"":"";if(!t.current)throw Error("No ".concat(n," ref found"));if(!r)throw Error("No 'src' attribute was passed to the ".concat(l," element."));let{duration:m}=t.current,f=!Number.isNaN(m)&&Number.isFinite(m)?Math.min(m,T):T,y=P.current.time,g=null!==(i=null===(e=F.current)||void 0===e?void 0:e.time)&&void 0!==i?i:null,R=C.current[r],I=Math.abs(f-y),A=g?Math.abs(f-g):null,_=(null===(o=F.current)||void 0===o?void 0:o.lastUpdate)&&F.current.time>P.current.lastUpdate?A:I,L=A&&!R?_:I;if(L>M&&w.current!==f){b.current=tJ({mediaRef:t.current,time:f,logLevel:x,why:"because time shift is too big. shouldBeTime = ".concat(f,", isTime = ").concat(y,", requestVideoCallbackTime = ").concat(g,", timeShift = ").concat(L).concat(R?", isVariableFpsVideo = true":"",", isPremounting = ").concat(s,", isPostmounting = ").concat(d,", pauseWhenBuffering = ").concat(u),mountTime:E}),w.current=b.current,v&&(N>0&&S(f),t.current.paused&&tl({mediaRef:t,mediaType:n,onAutoPlayError:c,logLevel:x,mountTime:E,reason:"player is playing but media tag is paused, and just seeked",isPlayer:j.isPlayer})),a||t1(t.current,a?"console-warning":"console-error");return}let D=v?.15:.01,O=Math.abs(t.current.currentTime-f)>D,U=V||k(),B=h.buffering.current&&!U;if(!v||B){O&&(b.current=tJ({mediaRef:t.current,time:f,logLevel:x,why:"not playing or something else is buffering. time offset is over seek threshold (".concat(D,")"),mountTime:E}));return}if(!v||h.buffering.current)return;let H=t.current.paused&&!t.current.ended,q=0===p;if(H||q){let e=H?"media tag is paused":"absolute frame is 0";O&&(b.current=tJ({mediaRef:t.current,time:f,logLevel:x,why:"is over timeshift threshold (threshold = ".concat(D,") and ").concat(e),mountTime:E})),tl({mediaRef:t,mediaType:n,onAutoPlayError:c,logLevel:x,mountTime:E,reason:"player is playing and ".concat(e),isPlayer:j.isPlayer}),!R&&N>0&&S(f)}},[p,M,S,h.buffering,F,x,T,k,V,t,n,a,N,v,r,c,s,d,u,E,P,j.isPlayer])},t2=e=>{let{mediaRef:t,id:r,mediaType:n,onAutoPlayError:i,isPremounting:a,isPostmounting:l}=e,{audioAndVideoTags:u,imperativePlaying:s}=(0,o.useContext)(ej),d=ek(),c=eN(),m=I();(0,o.useEffect)(()=>(u.current.push({id:r,play:e=>{if(s.current&&!a&&!l)return tl({mediaRef:t,mediaType:n,onAutoPlayError:i,logLevel:d,mountTime:c,reason:e,isPlayer:m.isPlayer})}}),()=>{u.current=u.current.filter(e=>e.id!==r)}),[u,r,t,n,i,s,a,l,d,c,m.isPlayer])},t9=(0,o.createContext)({mediaMuted:!1,mediaVolume:1}),t4=(0,o.createContext)({setMediaMuted:()=>{throw Error("default")},setMediaVolume:()=>{throw Error("default")}}),t3=()=>{let{mediaVolume:e}=(0,o.useContext)(t9),{setMediaVolume:t}=(0,o.useContext)(t4);return(0,o.useMemo)(()=>[e,t],[e,t])},t6=()=>{let{mediaMuted:e}=(0,o.useContext)(t9),{setMediaMuted:t}=(0,o.useContext)(t4);return(0,o.useMemo)(()=>[e,t],[e,t])},t8=e=>{if(e>=100)throw Error("Volume was set to ".concat(e,", but regular volume is 1, not 100. Did you forget to divide by 100? Set a volume of less than 100 to dismiss this error."))},t7=(0,o.forwardRef)((e,t)=>{var r,i,a;let[l]=(0,o.useState)(e.shouldPreMountAudioTags);if(e.shouldPreMountAudioTags!==l)throw Error("Cannot change the behavior for pre-mounting audio tags dynamically.");let u=ek(),{volume:s,muted:d,playbackRate:c,shouldPreMountAudioTags:m,src:f,onDuration:p,acceptableTimeShiftInSeconds:v,_remotionInternalNeedsDurationCalculation:h,_remotionInternalNativeLoopPassed:y,_remotionInternalStack:g,allowAmplificationDuringRender:w,name:b,pauseWhenBuffering:x,showInTimeline:E,loopVolumeCurveBehavior:C,stack:F,crossOrigin:T,delayRenderRetries:V,delayRenderTimeoutInMilliseconds:k,toneFrequency:N,useWebAudioApi:I,onError:M,onNativeError:A,audioStreamIndex:j,..._}=e,[L]=t3(),[D]=t6(),O=tI(null!=C?C:"repeat"),{hidden:U}=(0,o.useContext)(P);if(!f)throw TypeError("No 'src' was passed to .");let B=e6(f),H=(0,o.useContext)(R),[q]=(0,o.useState)(()=>String(Math.random())),W=null!==(r=U[q])&&void 0!==r&&r,z=tA({frame:O,volume:s,mediaVolume:L});t8(z);let Y=ta({crossOrigin:T,requestsVideoFrame:!1,isClientSideRendering:!1}),J=(0,o.useMemo)(()=>({muted:d||D||W||z<=0,src:B,loop:y,crossOrigin:Y,..._}),[y,W,D,d,_,B,z,Y]),G=(0,o.useMemo)(()=>"audio-".concat(S(null!=f?f:""),"-").concat(null==H?void 0:H.relativeFrom,"-").concat(null==H?void 0:H.cumulatedFrom,"-").concat(null==H?void 0:H.durationInFrames,"-muted:").concat(e.muted,"-loop:").concat(e.loop),[f,null==H?void 0:H.relativeFrom,null==H?void 0:H.cumulatedFrom,null==H?void 0:H.durationInFrames,e.muted,e.loop]);if(!(0,o.useContext)(tv))throw Error("SharedAudioContext not found");let{el:Z,mediaElementSourceNode:Q}=ty({aud:J,audioId:G,premounting:!!(null==H?void 0:H.premounting),postmounting:!!(null==H?void 0:H.postmounting)});tD({volume:s,mediaVolume:L,src:f,mediaType:"audio",playbackRate:null!=c?c:1,displayName:null!=b?b:null,id:q,stack:g,showInTimeline:E,premountDisplay:null!==(i=null==H?void 0:H.premountDisplay)&&void 0!==i?i:null,postmountDisplay:null!==(a=null==H?void 0:H.postmountDisplay)&&void 0!==a?a:null,loopDisplay:void 0}),t5({mediaRef:Z,src:f,mediaType:"audio",playbackRate:null!=c?c:1,onlyWarnForMediaSeekingError:!1,acceptableTimeshift:null!=v?v:null,isPremounting:!!(null==H?void 0:H.premounting),isPostmounting:!!(null==H?void 0:H.postmounting),pauseWhenBuffering:x,onAutoPlayError:null}),t2({id:q,isPostmounting:!!(null==H?void 0:H.postmounting),isPremounting:!!(null==H?void 0:H.premounting),mediaRef:Z,mediaType:"audio",onAutoPlayError:null}),tk({logLevel:u,mediaRef:Z,source:Q,volume:z,shouldUseWebAudioApi:null!=I&&I}),(0,o.useImperativeHandle)(t,()=>Z.current,[Z]);let $=(0,o.useRef)(p);return($.current=p,(0,o.useEffect)(()=>{let{current:e}=Z;if(!e)return;if(e.duration){var t;null===(t=$.current)||void 0===t||t.call($,e.src,e.duration);return}let r=()=>{var t;null===(t=$.current)||void 0===t||t.call($,e.src,e.duration)};return e.addEventListener("loadedmetadata",r),()=>{e.removeEventListener("loadedmetadata",r)}},[Z,f]),l)?null:(0,n.jsx)("audio",{ref:Z,preload:"metadata",crossOrigin:Y,...J})}),re=(0,o.forwardRef)((e,t)=>{let r=(0,o.useRef)(null),{volume:i,playbackRate:a,allowAmplificationDuringRender:l,onDuration:u,toneFrequency:s,_remotionInternalNeedsDurationCalculation:d,_remotionInternalNativeLoopPassed:c,acceptableTimeShiftInSeconds:m,name:f,onNativeError:p,delayRenderRetries:v,delayRenderTimeoutInMilliseconds:h,loopVolumeCurveBehavior:y,pauseWhenBuffering:g,audioStreamIndex:w,...b}=e,x=eh(),E=tI(null!=y?y:"repeat"),C=eB(),F=(0,o.useContext)(R),{registerRenderAsset:P,unregisterRenderAsset:T}=(0,o.useContext)(eZ),{delayRender:V,continueRender:k}=eM(),N=(0,o.useMemo)(()=>{var t;return"audio-".concat(S(null!==(t=e.src)&&void 0!==t?t:""),"-").concat(null==F?void 0:F.relativeFrom,"-").concat(null==F?void 0:F.cumulatedFrom,"-").concat(null==F?void 0:F.durationInFrames)},[e.src,null==F?void 0:F.relativeFrom,null==F?void 0:F.cumulatedFrom,null==F?void 0:F.durationInFrames]),I=tA({volume:i,frame:E,mediaVolume:1});t8(I),(0,o.useImperativeHandle)(t,()=>r.current,[]),(0,o.useEffect)(()=>{var t,r;if(!e.src)throw Error("No src passed");if(window.remotion_audioEnabled&&!e.muted&&!(I<=0))return P({type:"audio",src:eQ(e.src),id:N,frame:x,volume:I,mediaFrame:C,playbackRate:null!==(t=e.playbackRate)&&void 0!==t?t:1,toneFrequency:null!=s?s:1,audioStartFrame:Math.max(0,-(null!==(r=null==F?void 0:F.relativeFrom)&&void 0!==r?r:0)),audioStreamIndex:null!=w?w:0}),()=>T(N)},[e.muted,e.src,P,x,N,T,I,E,C,a,e.playbackRate,s,null==F?void 0:F.relativeFrom,w]);let{src:M}=e,A=t||d;return((0,o.useLayoutEffect)(()=>{var e,t;if((null===(t=window.process)||void 0===t?void 0:null===(e=t.env)||void 0===e?void 0:e.NODE_ENV)==="test"||!A)return;let o=V("Loading duration with src="+M,{retries:null!=v?v:void 0,timeoutInMilliseconds:null!=h?h:void 0}),{current:n}=r,i=()=>{(null==n?void 0:n.duration)&&u(n.src,n.duration),k(o)};return(null==n?void 0:n.duration)?(u(n.src,n.duration),k(o)):null==n||n.addEventListener("loadedmetadata",i,{once:!0}),()=>{null==n||n.removeEventListener("loadedmetadata",i),k(o)}},[M,u,A,v,h,k,V]),A)?(0,n.jsx)("audio",{ref:r,...b,onError:p}):null}),rt=(0,o.forwardRef)((e,t)=>{var r,i,a;let l=(0,o.useContext)(tv),{startFrom:u,endAt:s,trimBefore:d,trimAfter:c,name:m,stack:f,pauseWhenBuffering:p,showInTimeline:v,onError:h,...y}=e,{loop:g,...w}=e,{fps:b}=eU(),x=I();if(x.isClientSideRendering)throw Error(" is not supported in @remotion/web-renderer. Use