ossclip 0.1.30 → 0.1.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- var Yb=Object.defineProperty;var Gb=(e,t,n)=>t in e?Yb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ae=(e,t,n)=>Gb(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerPolicy&&(i.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?i.credentials="include":o.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(o){if(o.ep)return;o.ep=!0;const i=n(o);fetch(o.href,i)}})();function Xb(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var cv={exports:{}},ou={},dv={exports:{}},Te={};/**
1
+ var Qb=Object.defineProperty;var eS=(e,t,n)=>t in e?Qb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ae=(e,t,n)=>eS(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerPolicy&&(i.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?i.credentials="include":o.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(o){if(o.ep)return;o.ep=!0;const i=n(o);fetch(o.href,i)}})();function tS(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var mv={exports:{}},iu={},gv={exports:{}},Te={};/**
2
2
  * @license React
3
3
  * react.production.min.js
4
4
  *
@@ -6,7 +6,7 @@ var Yb=Object.defineProperty;var Gb=(e,t,n)=>t in e?Yb(e,t,{enumerable:!0,config
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var Xs=Symbol.for("react.element"),qb=Symbol.for("react.portal"),Jb=Symbol.for("react.fragment"),Qb=Symbol.for("react.strict_mode"),eS=Symbol.for("react.profiler"),tS=Symbol.for("react.provider"),nS=Symbol.for("react.context"),rS=Symbol.for("react.forward_ref"),oS=Symbol.for("react.suspense"),iS=Symbol.for("react.memo"),sS=Symbol.for("react.lazy"),bh=Symbol.iterator;function aS(e){return e===null||typeof e!="object"?null:(e=bh&&e[bh]||e["@@iterator"],typeof e=="function"?e:null)}var fv={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},pv=Object.assign,hv={};function Pi(e,t,n){this.props=e,this.context=t,this.refs=hv,this.updater=n||fv}Pi.prototype.isReactComponent={};Pi.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Pi.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function mv(){}mv.prototype=Pi.prototype;function Pf(e,t,n){this.props=e,this.context=t,this.refs=hv,this.updater=n||fv}var Ff=Pf.prototype=new mv;Ff.constructor=Pf;pv(Ff,Pi.prototype);Ff.isPureReactComponent=!0;var Sh=Array.isArray,gv=Object.prototype.hasOwnProperty,_f={current:null},yv={key:!0,ref:!0,__self:!0,__source:!0};function vv(e,t,n){var r,o={},i=null,s=null;if(t!=null)for(r in t.ref!==void 0&&(s=t.ref),t.key!==void 0&&(i=""+t.key),t)gv.call(t,r)&&!yv.hasOwnProperty(r)&&(o[r]=t[r]);var a=arguments.length-2;if(a===1)o.children=n;else if(1<a){for(var l=Array(a),c=0;c<a;c++)l[c]=arguments[c+2];o.children=l}if(e&&e.defaultProps)for(r in a=e.defaultProps,a)o[r]===void 0&&(o[r]=a[r]);return{$$typeof:Xs,type:e,key:i,ref:s,props:o,_owner:_f.current}}function lS(e,t){return{$$typeof:Xs,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Mf(e){return typeof e=="object"&&e!==null&&e.$$typeof===Xs}function uS(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var kh=/\/+/g;function ic(e,t){return typeof e=="object"&&e!==null&&e.key!=null?uS(""+e.key):t.toString(36)}function rl(e,t,n,r,o){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var s=!1;if(e===null)s=!0;else switch(i){case"string":case"number":s=!0;break;case"object":switch(e.$$typeof){case Xs:case qb:s=!0}}if(s)return s=e,o=o(s),e=r===""?"."+ic(s,0):r,Sh(o)?(n="",e!=null&&(n=e.replace(kh,"$&/")+"/"),rl(o,t,n,"",function(c){return c})):o!=null&&(Mf(o)&&(o=lS(o,n+(!o.key||s&&s.key===o.key?"":(""+o.key).replace(kh,"$&/")+"/")+e)),t.push(o)),1;if(s=0,r=r===""?".":r+":",Sh(e))for(var a=0;a<e.length;a++){i=e[a];var l=r+ic(i,a);s+=rl(i,t,n,l,o)}else if(l=aS(e),typeof l=="function")for(e=l.call(e),a=0;!(i=e.next()).done;)i=i.value,l=r+ic(i,a++),s+=rl(i,t,n,l,o);else if(i==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return s}function ga(e,t,n){if(e==null)return e;var r=[],o=0;return rl(e,r,"","",function(i){return t.call(n,i,o++)}),r}function cS(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Ht={current:null},ol={transition:null},dS={ReactCurrentDispatcher:Ht,ReactCurrentBatchConfig:ol,ReactCurrentOwner:_f};function wv(){throw Error("act(...) is not supported in production builds of React.")}Te.Children={map:ga,forEach:function(e,t,n){ga(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return ga(e,function(){t++}),t},toArray:function(e){return ga(e,function(t){return t})||[]},only:function(e){if(!Mf(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Te.Component=Pi;Te.Fragment=Jb;Te.Profiler=eS;Te.PureComponent=Pf;Te.StrictMode=Qb;Te.Suspense=oS;Te.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=dS;Te.act=wv;Te.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=pv({},e.props),o=e.key,i=e.ref,s=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,s=_f.current),t.key!==void 0&&(o=""+t.key),e.type&&e.type.defaultProps)var a=e.type.defaultProps;for(l in t)gv.call(t,l)&&!yv.hasOwnProperty(l)&&(r[l]=t[l]===void 0&&a!==void 0?a[l]:t[l])}var l=arguments.length-2;if(l===1)r.children=n;else if(1<l){a=Array(l);for(var c=0;c<l;c++)a[c]=arguments[c+2];r.children=a}return{$$typeof:Xs,type:e.type,key:o,ref:i,props:r,_owner:s}};Te.createContext=function(e){return e={$$typeof:nS,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:tS,_context:e},e.Consumer=e};Te.createElement=vv;Te.createFactory=function(e){var t=vv.bind(null,e);return t.type=e,t};Te.createRef=function(){return{current:null}};Te.forwardRef=function(e){return{$$typeof:rS,render:e}};Te.isValidElement=Mf;Te.lazy=function(e){return{$$typeof:sS,_payload:{_status:-1,_result:e},_init:cS}};Te.memo=function(e,t){return{$$typeof:iS,type:e,compare:t===void 0?null:t}};Te.startTransition=function(e){var t=ol.transition;ol.transition={};try{e()}finally{ol.transition=t}};Te.unstable_act=wv;Te.useCallback=function(e,t){return Ht.current.useCallback(e,t)};Te.useContext=function(e){return Ht.current.useContext(e)};Te.useDebugValue=function(){};Te.useDeferredValue=function(e){return Ht.current.useDeferredValue(e)};Te.useEffect=function(e,t){return Ht.current.useEffect(e,t)};Te.useId=function(){return Ht.current.useId()};Te.useImperativeHandle=function(e,t,n){return Ht.current.useImperativeHandle(e,t,n)};Te.useInsertionEffect=function(e,t){return Ht.current.useInsertionEffect(e,t)};Te.useLayoutEffect=function(e,t){return Ht.current.useLayoutEffect(e,t)};Te.useMemo=function(e,t){return Ht.current.useMemo(e,t)};Te.useReducer=function(e,t,n){return Ht.current.useReducer(e,t,n)};Te.useRef=function(e){return Ht.current.useRef(e)};Te.useState=function(e){return Ht.current.useState(e)};Te.useSyncExternalStore=function(e,t,n){return Ht.current.useSyncExternalStore(e,t,n)};Te.useTransition=function(){return Ht.current.useTransition()};Te.version="18.3.1";dv.exports=Te;var d=dv.exports;const le=Xb(d);/**
9
+ */var Xs=Symbol.for("react.element"),nS=Symbol.for("react.portal"),rS=Symbol.for("react.fragment"),oS=Symbol.for("react.strict_mode"),iS=Symbol.for("react.profiler"),sS=Symbol.for("react.provider"),aS=Symbol.for("react.context"),lS=Symbol.for("react.forward_ref"),uS=Symbol.for("react.suspense"),cS=Symbol.for("react.memo"),dS=Symbol.for("react.lazy"),Eh=Symbol.iterator;function fS(e){return e===null||typeof e!="object"?null:(e=Eh&&e[Eh]||e["@@iterator"],typeof e=="function"?e:null)}var yv={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},vv=Object.assign,wv={};function Pi(e,t,n){this.props=e,this.context=t,this.refs=wv,this.updater=n||yv}Pi.prototype.isReactComponent={};Pi.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Pi.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function xv(){}xv.prototype=Pi.prototype;function _f(e,t,n){this.props=e,this.context=t,this.refs=wv,this.updater=n||yv}var Mf=_f.prototype=new xv;Mf.constructor=_f;vv(Mf,Pi.prototype);Mf.isPureReactComponent=!0;var Ch=Array.isArray,bv=Object.prototype.hasOwnProperty,$f={current:null},Sv={key:!0,ref:!0,__self:!0,__source:!0};function kv(e,t,n){var r,o={},i=null,s=null;if(t!=null)for(r in t.ref!==void 0&&(s=t.ref),t.key!==void 0&&(i=""+t.key),t)bv.call(t,r)&&!Sv.hasOwnProperty(r)&&(o[r]=t[r]);var a=arguments.length-2;if(a===1)o.children=n;else if(1<a){for(var l=Array(a),c=0;c<a;c++)l[c]=arguments[c+2];o.children=l}if(e&&e.defaultProps)for(r in a=e.defaultProps,a)o[r]===void 0&&(o[r]=a[r]);return{$$typeof:Xs,type:e,key:i,ref:s,props:o,_owner:$f.current}}function pS(e,t){return{$$typeof:Xs,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Af(e){return typeof e=="object"&&e!==null&&e.$$typeof===Xs}function hS(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Ih=/\/+/g;function lc(e,t){return typeof e=="object"&&e!==null&&e.key!=null?hS(""+e.key):t.toString(36)}function ol(e,t,n,r,o){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var s=!1;if(e===null)s=!0;else switch(i){case"string":case"number":s=!0;break;case"object":switch(e.$$typeof){case Xs:case nS:s=!0}}if(s)return s=e,o=o(s),e=r===""?"."+lc(s,0):r,Ch(o)?(n="",e!=null&&(n=e.replace(Ih,"$&/")+"/"),ol(o,t,n,"",function(c){return c})):o!=null&&(Af(o)&&(o=pS(o,n+(!o.key||s&&s.key===o.key?"":(""+o.key).replace(Ih,"$&/")+"/")+e)),t.push(o)),1;if(s=0,r=r===""?".":r+":",Ch(e))for(var a=0;a<e.length;a++){i=e[a];var l=r+lc(i,a);s+=ol(i,t,n,l,o)}else if(l=fS(e),typeof l=="function")for(e=l.call(e),a=0;!(i=e.next()).done;)i=i.value,l=r+lc(i,a++),s+=ol(i,t,n,l,o);else if(i==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return s}function ga(e,t,n){if(e==null)return e;var r=[],o=0;return ol(e,r,"","",function(i){return t.call(n,i,o++)}),r}function mS(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var Ht={current:null},il={transition:null},gS={ReactCurrentDispatcher:Ht,ReactCurrentBatchConfig:il,ReactCurrentOwner:$f};function Ev(){throw Error("act(...) is not supported in production builds of React.")}Te.Children={map:ga,forEach:function(e,t,n){ga(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return ga(e,function(){t++}),t},toArray:function(e){return ga(e,function(t){return t})||[]},only:function(e){if(!Af(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Te.Component=Pi;Te.Fragment=rS;Te.Profiler=iS;Te.PureComponent=_f;Te.StrictMode=oS;Te.Suspense=uS;Te.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=gS;Te.act=Ev;Te.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=vv({},e.props),o=e.key,i=e.ref,s=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,s=$f.current),t.key!==void 0&&(o=""+t.key),e.type&&e.type.defaultProps)var a=e.type.defaultProps;for(l in t)bv.call(t,l)&&!Sv.hasOwnProperty(l)&&(r[l]=t[l]===void 0&&a!==void 0?a[l]:t[l])}var l=arguments.length-2;if(l===1)r.children=n;else if(1<l){a=Array(l);for(var c=0;c<l;c++)a[c]=arguments[c+2];r.children=a}return{$$typeof:Xs,type:e.type,key:o,ref:i,props:r,_owner:s}};Te.createContext=function(e){return e={$$typeof:aS,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:sS,_context:e},e.Consumer=e};Te.createElement=kv;Te.createFactory=function(e){var t=kv.bind(null,e);return t.type=e,t};Te.createRef=function(){return{current:null}};Te.forwardRef=function(e){return{$$typeof:lS,render:e}};Te.isValidElement=Af;Te.lazy=function(e){return{$$typeof:dS,_payload:{_status:-1,_result:e},_init:mS}};Te.memo=function(e,t){return{$$typeof:cS,type:e,compare:t===void 0?null:t}};Te.startTransition=function(e){var t=il.transition;il.transition={};try{e()}finally{il.transition=t}};Te.unstable_act=Ev;Te.useCallback=function(e,t){return Ht.current.useCallback(e,t)};Te.useContext=function(e){return Ht.current.useContext(e)};Te.useDebugValue=function(){};Te.useDeferredValue=function(e){return Ht.current.useDeferredValue(e)};Te.useEffect=function(e,t){return Ht.current.useEffect(e,t)};Te.useId=function(){return Ht.current.useId()};Te.useImperativeHandle=function(e,t,n){return Ht.current.useImperativeHandle(e,t,n)};Te.useInsertionEffect=function(e,t){return Ht.current.useInsertionEffect(e,t)};Te.useLayoutEffect=function(e,t){return Ht.current.useLayoutEffect(e,t)};Te.useMemo=function(e,t){return Ht.current.useMemo(e,t)};Te.useReducer=function(e,t,n){return Ht.current.useReducer(e,t,n)};Te.useRef=function(e){return Ht.current.useRef(e)};Te.useState=function(e){return Ht.current.useState(e)};Te.useSyncExternalStore=function(e,t,n){return Ht.current.useSyncExternalStore(e,t,n)};Te.useTransition=function(){return Ht.current.useTransition()};Te.version="18.3.1";gv.exports=Te;var d=gv.exports;const le=tS(d);/**
10
10
  * @license React
11
11
  * react-jsx-runtime.production.min.js
12
12
  *
@@ -14,7 +14,7 @@ var Yb=Object.defineProperty;var Gb=(e,t,n)=>t in e?Yb(e,t,{enumerable:!0,config
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var fS=d,pS=Symbol.for("react.element"),hS=Symbol.for("react.fragment"),mS=Object.prototype.hasOwnProperty,gS=fS.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,yS={key:!0,ref:!0,__self:!0,__source:!0};function xv(e,t,n){var r,o={},i=null,s=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(s=t.ref);for(r in t)mS.call(t,r)&&!yS.hasOwnProperty(r)&&(o[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)o[r]===void 0&&(o[r]=t[r]);return{$$typeof:pS,type:e,key:i,ref:s,props:o,_owner:gS.current}}ou.Fragment=hS;ou.jsx=xv;ou.jsxs=xv;cv.exports=ou;var u=cv.exports,dd={},bv={exports:{}},hn={},Sv={exports:{}},kv={};/**
17
+ */var yS=d,vS=Symbol.for("react.element"),wS=Symbol.for("react.fragment"),xS=Object.prototype.hasOwnProperty,bS=yS.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,SS={key:!0,ref:!0,__self:!0,__source:!0};function Cv(e,t,n){var r,o={},i=null,s=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(s=t.ref);for(r in t)xS.call(t,r)&&!SS.hasOwnProperty(r)&&(o[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)o[r]===void 0&&(o[r]=t[r]);return{$$typeof:vS,type:e,key:i,ref:s,props:o,_owner:bS.current}}iu.Fragment=wS;iu.jsx=Cv;iu.jsxs=Cv;mv.exports=iu;var u=mv.exports,pd={},Iv={exports:{}},hn={},Tv={exports:{}},Rv={};/**
18
18
  * @license React
19
19
  * scheduler.production.min.js
20
20
  *
@@ -22,7 +22,7 @@ var Yb=Object.defineProperty;var Gb=(e,t,n)=>t in e?Yb(e,t,{enumerable:!0,config
22
22
  *
23
23
  * This source code is licensed under the MIT license found in the
24
24
  * LICENSE file in the root directory of this source tree.
25
- */(function(e){function t(j,C){var P=j.length;j.push(C);e:for(;0<P;){var N=P-1>>>1,O=j[N];if(0<o(O,C))j[N]=C,j[P]=O,P=N;else break e}}function n(j){return j.length===0?null:j[0]}function r(j){if(j.length===0)return null;var C=j[0],P=j.pop();if(P!==C){j[0]=P;e:for(var N=0,O=j.length,z=O>>>1;N<z;){var Z=2*(N+1)-1,H=j[Z],G=Z+1,B=j[G];if(0>o(H,P))G<O&&0>o(B,H)?(j[N]=B,j[G]=P,N=G):(j[N]=H,j[Z]=P,N=Z);else if(G<O&&0>o(B,P))j[N]=B,j[G]=P,N=G;else break e}}return C}function o(j,C){var P=j.sortIndex-C.sortIndex;return P!==0?P:j.id-C.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var s=Date,a=s.now();e.unstable_now=function(){return s.now()-a}}var l=[],c=[],f=1,p=null,m=3,g=!1,w=!1,x=!1,k=typeof setTimeout=="function"?setTimeout:null,h=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function v(j){for(var C=n(c);C!==null;){if(C.callback===null)r(c);else if(C.startTime<=j)r(c),C.sortIndex=C.expirationTime,t(l,C);else break;C=n(c)}}function S(j){if(x=!1,v(j),!w)if(n(l)!==null)w=!0,D(b);else{var C=n(c);C!==null&&L(S,C.startTime-j)}}function b(j,C){w=!1,x&&(x=!1,h(T),T=-1),g=!0;var P=m;try{for(v(C),p=n(l);p!==null&&(!(p.expirationTime>C)||j&&!A());){var N=p.callback;if(typeof N=="function"){p.callback=null,m=p.priorityLevel;var O=N(p.expirationTime<=C);C=e.unstable_now(),typeof O=="function"?p.callback=O:p===n(l)&&r(l),v(C)}else r(l);p=n(l)}if(p!==null)var z=!0;else{var Z=n(c);Z!==null&&L(S,Z.startTime-C),z=!1}return z}finally{p=null,m=P,g=!1}}var E=!1,I=null,T=-1,R=5,F=-1;function A(){return!(e.unstable_now()-F<R)}function W(){if(I!==null){var j=e.unstable_now();F=j;var C=!0;try{C=I(!0,j)}finally{C?M():(E=!1,I=null)}}else E=!1}var M;if(typeof y=="function")M=function(){y(W)};else if(typeof MessageChannel<"u"){var $=new MessageChannel,V=$.port2;$.port1.onmessage=W,M=function(){V.postMessage(null)}}else M=function(){k(W,0)};function D(j){I=j,E||(E=!0,M())}function L(j,C){T=k(function(){j(e.unstable_now())},C)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(j){j.callback=null},e.unstable_continueExecution=function(){w||g||(w=!0,D(b))},e.unstable_forceFrameRate=function(j){0>j||125<j?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):R=0<j?Math.floor(1e3/j):5},e.unstable_getCurrentPriorityLevel=function(){return m},e.unstable_getFirstCallbackNode=function(){return n(l)},e.unstable_next=function(j){switch(m){case 1:case 2:case 3:var C=3;break;default:C=m}var P=m;m=C;try{return j()}finally{m=P}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(j,C){switch(j){case 1:case 2:case 3:case 4:case 5:break;default:j=3}var P=m;m=j;try{return C()}finally{m=P}},e.unstable_scheduleCallback=function(j,C,P){var N=e.unstable_now();switch(typeof P=="object"&&P!==null?(P=P.delay,P=typeof P=="number"&&0<P?N+P:N):P=N,j){case 1:var O=-1;break;case 2:O=250;break;case 5:O=1073741823;break;case 4:O=1e4;break;default:O=5e3}return O=P+O,j={id:f++,callback:C,priorityLevel:j,startTime:P,expirationTime:O,sortIndex:-1},P>N?(j.sortIndex=P,t(c,j),n(l)===null&&j===n(c)&&(x?(h(T),T=-1):x=!0,L(S,P-N))):(j.sortIndex=O,t(l,j),w||g||(w=!0,D(b))),j},e.unstable_shouldYield=A,e.unstable_wrapCallback=function(j){var C=m;return function(){var P=m;m=C;try{return j.apply(this,arguments)}finally{m=P}}}})(kv);Sv.exports=kv;var vS=Sv.exports;/**
25
+ */(function(e){function t(R,C){var P=R.length;R.push(C);e:for(;0<P;){var z=P-1>>>1,O=R[z];if(0<o(O,C))R[z]=C,R[P]=O,P=z;else break e}}function n(R){return R.length===0?null:R[0]}function r(R){if(R.length===0)return null;var C=R[0],P=R.pop();if(P!==C){R[0]=P;e:for(var z=0,O=R.length,D=O>>>1;z<D;){var Z=2*(z+1)-1,H=R[Z],G=Z+1,B=R[G];if(0>o(H,P))G<O&&0>o(B,H)?(R[z]=B,R[G]=P,z=G):(R[z]=H,R[Z]=P,z=Z);else if(G<O&&0>o(B,P))R[z]=B,R[G]=P,z=G;else break e}}return C}function o(R,C){var P=R.sortIndex-C.sortIndex;return P!==0?P:R.id-C.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var s=Date,a=s.now();e.unstable_now=function(){return s.now()-a}}var l=[],c=[],f=1,p=null,m=3,g=!1,w=!1,x=!1,k=typeof setTimeout=="function"?setTimeout:null,h=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function v(R){for(var C=n(c);C!==null;){if(C.callback===null)r(c);else if(C.startTime<=R)r(c),C.sortIndex=C.expirationTime,t(l,C);else break;C=n(c)}}function S(R){if(x=!1,v(R),!w)if(n(l)!==null)w=!0,L(b);else{var C=n(c);C!==null&&A(S,C.startTime-R)}}function b(R,C){w=!1,x&&(x=!1,h(T),T=-1),g=!0;var P=m;try{for(v(C),p=n(l);p!==null&&(!(p.expirationTime>C)||R&&!N());){var z=p.callback;if(typeof z=="function"){p.callback=null,m=p.priorityLevel;var O=z(p.expirationTime<=C);C=e.unstable_now(),typeof O=="function"?p.callback=O:p===n(l)&&r(l),v(C)}else r(l);p=n(l)}if(p!==null)var D=!0;else{var Z=n(c);Z!==null&&A(S,Z.startTime-C),D=!1}return D}finally{p=null,m=P,g=!1}}var E=!1,I=null,T=-1,j=5,_=-1;function N(){return!(e.unstable_now()-_<j)}function W(){if(I!==null){var R=e.unstable_now();_=R;var C=!0;try{C=I(!0,R)}finally{C?M():(E=!1,I=null)}}else E=!1}var M;if(typeof y=="function")M=function(){y(W)};else if(typeof MessageChannel<"u"){var $=new MessageChannel,V=$.port2;$.port1.onmessage=W,M=function(){V.postMessage(null)}}else M=function(){k(W,0)};function L(R){I=R,E||(E=!0,M())}function A(R,C){T=k(function(){R(e.unstable_now())},C)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(R){R.callback=null},e.unstable_continueExecution=function(){w||g||(w=!0,L(b))},e.unstable_forceFrameRate=function(R){0>R||125<R?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):j=0<R?Math.floor(1e3/R):5},e.unstable_getCurrentPriorityLevel=function(){return m},e.unstable_getFirstCallbackNode=function(){return n(l)},e.unstable_next=function(R){switch(m){case 1:case 2:case 3:var C=3;break;default:C=m}var P=m;m=C;try{return R()}finally{m=P}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(R,C){switch(R){case 1:case 2:case 3:case 4:case 5:break;default:R=3}var P=m;m=R;try{return C()}finally{m=P}},e.unstable_scheduleCallback=function(R,C,P){var z=e.unstable_now();switch(typeof P=="object"&&P!==null?(P=P.delay,P=typeof P=="number"&&0<P?z+P:z):P=z,R){case 1:var O=-1;break;case 2:O=250;break;case 5:O=1073741823;break;case 4:O=1e4;break;default:O=5e3}return O=P+O,R={id:f++,callback:C,priorityLevel:R,startTime:P,expirationTime:O,sortIndex:-1},P>z?(R.sortIndex=P,t(c,R),n(l)===null&&R===n(c)&&(x?(h(T),T=-1):x=!0,A(S,P-z))):(R.sortIndex=O,t(l,R),w||g||(w=!0,L(b))),R},e.unstable_shouldYield=N,e.unstable_wrapCallback=function(R){var C=m;return function(){var P=m;m=C;try{return R.apply(this,arguments)}finally{m=P}}}})(Rv);Tv.exports=Rv;var kS=Tv.exports;/**
26
26
  * @license React
27
27
  * react-dom.production.min.js
28
28
  *
@@ -30,15 +30,15 @@ var Yb=Object.defineProperty;var Gb=(e,t,n)=>t in e?Yb(e,t,{enumerable:!0,config
30
30
  *
31
31
  * This source code is licensed under the MIT license found in the
32
32
  * LICENSE file in the root directory of this source tree.
33
- */var wS=d,pn=vS;function ne(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var Ev=new Set,Is={};function Ro(e,t){bi(e,t),bi(e+"Capture",t)}function bi(e,t){for(Is[e]=t,e=0;e<t.length;e++)Ev.add(t[e])}var xr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),fd=Object.prototype.hasOwnProperty,xS=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Eh={},Ch={};function bS(e){return fd.call(Ch,e)?!0:fd.call(Eh,e)?!1:xS.test(e)?Ch[e]=!0:(Eh[e]=!0,!1)}function SS(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function kS(e,t,n,r){if(t===null||typeof t>"u"||SS(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Ut(e,t,n,r,o,i,s){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=s}var Pt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Pt[e]=new Ut(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Pt[t]=new Ut(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Pt[e]=new Ut(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Pt[e]=new Ut(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Pt[e]=new Ut(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Pt[e]=new Ut(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Pt[e]=new Ut(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Pt[e]=new Ut(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Pt[e]=new Ut(e,5,!1,e.toLowerCase(),null,!1,!1)});var $f=/[\-:]([a-z])/g;function Af(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace($f,Af);Pt[t]=new Ut(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace($f,Af);Pt[t]=new Ut(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace($f,Af);Pt[t]=new Ut(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Pt[e]=new Ut(e,1,!1,e.toLowerCase(),null,!1,!1)});Pt.xlinkHref=new Ut("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Pt[e]=new Ut(e,1,!1,e.toLowerCase(),null,!0,!0)});function Nf(e,t,n,r){var o=Pt.hasOwnProperty(t)?Pt[t]:null;(o!==null?o.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(kS(t,n,o,r)&&(n=null),r||o===null?bS(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):o.mustUseProperty?e[o.propertyName]=n===null?o.type===3?!1:"":n:(t=o.attributeName,r=o.attributeNamespace,n===null?e.removeAttribute(t):(o=o.type,n=o===3||o===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var Er=wS.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,ya=Symbol.for("react.element"),Xo=Symbol.for("react.portal"),qo=Symbol.for("react.fragment"),Lf=Symbol.for("react.strict_mode"),pd=Symbol.for("react.profiler"),Cv=Symbol.for("react.provider"),Iv=Symbol.for("react.context"),zf=Symbol.for("react.forward_ref"),hd=Symbol.for("react.suspense"),md=Symbol.for("react.suspense_list"),Df=Symbol.for("react.memo"),Ar=Symbol.for("react.lazy"),Tv=Symbol.for("react.offscreen"),Ih=Symbol.iterator;function Ui(e){return e===null||typeof e!="object"?null:(e=Ih&&e[Ih]||e["@@iterator"],typeof e=="function"?e:null)}var nt=Object.assign,sc;function ls(e){if(sc===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);sc=t&&t[1]||""}return`
34
- `+sc+e}var ac=!1;function lc(e,t){if(!e||ac)return"";ac=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(c){var r=c}Reflect.construct(e,[],t)}else{try{t.call()}catch(c){r=c}e.call(t.prototype)}else{try{throw Error()}catch(c){r=c}e()}}catch(c){if(c&&r&&typeof c.stack=="string"){for(var o=c.stack.split(`
33
+ */var ES=d,pn=kS;function ne(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var jv=new Set,Is={};function jo(e,t){bi(e,t),bi(e+"Capture",t)}function bi(e,t){for(Is[e]=t,e=0;e<t.length;e++)jv.add(t[e])}var xr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),hd=Object.prototype.hasOwnProperty,CS=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Th={},Rh={};function IS(e){return hd.call(Rh,e)?!0:hd.call(Th,e)?!1:CS.test(e)?Rh[e]=!0:(Th[e]=!0,!1)}function TS(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function RS(e,t,n,r){if(t===null||typeof t>"u"||TS(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Ut(e,t,n,r,o,i,s){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=s}var Pt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Pt[e]=new Ut(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Pt[t]=new Ut(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Pt[e]=new Ut(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Pt[e]=new Ut(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){Pt[e]=new Ut(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Pt[e]=new Ut(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Pt[e]=new Ut(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Pt[e]=new Ut(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Pt[e]=new Ut(e,5,!1,e.toLowerCase(),null,!1,!1)});var Nf=/[\-:]([a-z])/g;function Lf(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Nf,Lf);Pt[t]=new Ut(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Nf,Lf);Pt[t]=new Ut(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Nf,Lf);Pt[t]=new Ut(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Pt[e]=new Ut(e,1,!1,e.toLowerCase(),null,!1,!1)});Pt.xlinkHref=new Ut("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Pt[e]=new Ut(e,1,!1,e.toLowerCase(),null,!0,!0)});function zf(e,t,n,r){var o=Pt.hasOwnProperty(t)?Pt[t]:null;(o!==null?o.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(RS(t,n,o,r)&&(n=null),r||o===null?IS(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):o.mustUseProperty?e[o.propertyName]=n===null?o.type===3?!1:"":n:(t=o.attributeName,r=o.attributeNamespace,n===null?e.removeAttribute(t):(o=o.type,n=o===3||o===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var Er=ES.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,ya=Symbol.for("react.element"),Xo=Symbol.for("react.portal"),qo=Symbol.for("react.fragment"),Df=Symbol.for("react.strict_mode"),md=Symbol.for("react.profiler"),Pv=Symbol.for("react.provider"),Fv=Symbol.for("react.context"),Of=Symbol.for("react.forward_ref"),gd=Symbol.for("react.suspense"),yd=Symbol.for("react.suspense_list"),Bf=Symbol.for("react.memo"),Ar=Symbol.for("react.lazy"),_v=Symbol.for("react.offscreen"),jh=Symbol.iterator;function Ui(e){return e===null||typeof e!="object"?null:(e=jh&&e[jh]||e["@@iterator"],typeof e=="function"?e:null)}var nt=Object.assign,uc;function ls(e){if(uc===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);uc=t&&t[1]||""}return`
34
+ `+uc+e}var cc=!1;function dc(e,t){if(!e||cc)return"";cc=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(c){var r=c}Reflect.construct(e,[],t)}else{try{t.call()}catch(c){r=c}e.call(t.prototype)}else{try{throw Error()}catch(c){r=c}e()}}catch(c){if(c&&r&&typeof c.stack=="string"){for(var o=c.stack.split(`
35
35
  `),i=r.stack.split(`
36
36
  `),s=o.length-1,a=i.length-1;1<=s&&0<=a&&o[s]!==i[a];)a--;for(;1<=s&&0<=a;s--,a--)if(o[s]!==i[a]){if(s!==1||a!==1)do if(s--,a--,0>a||o[s]!==i[a]){var l=`
37
- `+o[s].replace(" at new "," at ");return e.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",e.displayName)),l}while(1<=s&&0<=a);break}}}finally{ac=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?ls(e):""}function ES(e){switch(e.tag){case 5:return ls(e.type);case 16:return ls("Lazy");case 13:return ls("Suspense");case 19:return ls("SuspenseList");case 0:case 2:case 15:return e=lc(e.type,!1),e;case 11:return e=lc(e.type.render,!1),e;case 1:return e=lc(e.type,!0),e;default:return""}}function gd(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case qo:return"Fragment";case Xo:return"Portal";case pd:return"Profiler";case Lf:return"StrictMode";case hd:return"Suspense";case md:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Iv:return(e.displayName||"Context")+".Consumer";case Cv:return(e._context.displayName||"Context")+".Provider";case zf:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Df:return t=e.displayName||null,t!==null?t:gd(e.type)||"Memo";case Ar:t=e._payload,e=e._init;try{return gd(e(t))}catch{}}return null}function CS(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return gd(t);case 8:return t===Lf?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function qr(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Rv(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function IS(e){var t=Rv(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var o=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(s){r=""+s,i.call(this,s)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function va(e){e._valueTracker||(e._valueTracker=IS(e))}function jv(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Rv(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function xl(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function yd(e,t){var n=t.checked;return nt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Th(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=qr(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Pv(e,t){t=t.checked,t!=null&&Nf(e,"checked",t,!1)}function vd(e,t){Pv(e,t);var n=qr(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?wd(e,t.type,n):t.hasOwnProperty("defaultValue")&&wd(e,t.type,qr(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Rh(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function wd(e,t,n){(t!=="number"||xl(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var us=Array.isArray;function fi(e,t,n,r){if(e=e.options,t){t={};for(var o=0;o<n.length;o++)t["$"+n[o]]=!0;for(n=0;n<e.length;n++)o=t.hasOwnProperty("$"+e[n].value),e[n].selected!==o&&(e[n].selected=o),o&&r&&(e[n].defaultSelected=!0)}else{for(n=""+qr(n),t=null,o=0;o<e.length;o++){if(e[o].value===n){e[o].selected=!0,r&&(e[o].defaultSelected=!0);return}t!==null||e[o].disabled||(t=e[o])}t!==null&&(t.selected=!0)}}function xd(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(ne(91));return nt({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function jh(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(ne(92));if(us(n)){if(1<n.length)throw Error(ne(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:qr(n)}}function Fv(e,t){var n=qr(t.value),r=qr(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function Ph(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function _v(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function bd(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?_v(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var wa,Mv=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,o){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,o)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(wa=wa||document.createElement("div"),wa.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=wa.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Ts(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var ms={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},TS=["Webkit","ms","Moz","O"];Object.keys(ms).forEach(function(e){TS.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ms[t]=ms[e]})});function $v(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||ms.hasOwnProperty(e)&&ms[e]?(""+t).trim():t+"px"}function Av(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=$v(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}var RS=nt({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Sd(e,t){if(t){if(RS[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(ne(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(ne(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(ne(61))}if(t.style!=null&&typeof t.style!="object")throw Error(ne(62))}}function kd(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Ed=null;function Of(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Cd=null,pi=null,hi=null;function Fh(e){if(e=Qs(e)){if(typeof Cd!="function")throw Error(ne(280));var t=e.stateNode;t&&(t=uu(t),Cd(e.stateNode,e.type,t))}}function Nv(e){pi?hi?hi.push(e):hi=[e]:pi=e}function Lv(){if(pi){var e=pi,t=hi;if(hi=pi=null,Fh(e),t)for(e=0;e<t.length;e++)Fh(t[e])}}function zv(e,t){return e(t)}function Dv(){}var uc=!1;function Ov(e,t,n){if(uc)return e(t,n);uc=!0;try{return zv(e,t,n)}finally{uc=!1,(pi!==null||hi!==null)&&(Dv(),Lv())}}function Rs(e,t){var n=e.stateNode;if(n===null)return null;var r=uu(n);if(r===null)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(ne(231,t,typeof n));return n}var Id=!1;if(xr)try{var Zi={};Object.defineProperty(Zi,"passive",{get:function(){Id=!0}}),window.addEventListener("test",Zi,Zi),window.removeEventListener("test",Zi,Zi)}catch{Id=!1}function jS(e,t,n,r,o,i,s,a,l){var c=Array.prototype.slice.call(arguments,3);try{t.apply(n,c)}catch(f){this.onError(f)}}var gs=!1,bl=null,Sl=!1,Td=null,PS={onError:function(e){gs=!0,bl=e}};function FS(e,t,n,r,o,i,s,a,l){gs=!1,bl=null,jS.apply(PS,arguments)}function _S(e,t,n,r,o,i,s,a,l){if(FS.apply(this,arguments),gs){if(gs){var c=bl;gs=!1,bl=null}else throw Error(ne(198));Sl||(Sl=!0,Td=c)}}function jo(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function Bv(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function _h(e){if(jo(e)!==e)throw Error(ne(188))}function MS(e){var t=e.alternate;if(!t){if(t=jo(e),t===null)throw Error(ne(188));return t!==e?null:e}for(var n=e,r=t;;){var o=n.return;if(o===null)break;var i=o.alternate;if(i===null){if(r=o.return,r!==null){n=r;continue}break}if(o.child===i.child){for(i=o.child;i;){if(i===n)return _h(o),e;if(i===r)return _h(o),t;i=i.sibling}throw Error(ne(188))}if(n.return!==r.return)n=o,r=i;else{for(var s=!1,a=o.child;a;){if(a===n){s=!0,n=o,r=i;break}if(a===r){s=!0,r=o,n=i;break}a=a.sibling}if(!s){for(a=i.child;a;){if(a===n){s=!0,n=i,r=o;break}if(a===r){s=!0,r=i,n=o;break}a=a.sibling}if(!s)throw Error(ne(189))}}if(n.alternate!==r)throw Error(ne(190))}if(n.tag!==3)throw Error(ne(188));return n.stateNode.current===n?e:t}function Wv(e){return e=MS(e),e!==null?Vv(e):null}function Vv(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Vv(e);if(t!==null)return t;e=e.sibling}return null}var Hv=pn.unstable_scheduleCallback,Mh=pn.unstable_cancelCallback,$S=pn.unstable_shouldYield,AS=pn.unstable_requestPaint,ut=pn.unstable_now,NS=pn.unstable_getCurrentPriorityLevel,Bf=pn.unstable_ImmediatePriority,Uv=pn.unstable_UserBlockingPriority,kl=pn.unstable_NormalPriority,LS=pn.unstable_LowPriority,Zv=pn.unstable_IdlePriority,iu=null,rr=null;function zS(e){if(rr&&typeof rr.onCommitFiberRoot=="function")try{rr.onCommitFiberRoot(iu,e,void 0,(e.current.flags&128)===128)}catch{}}var Bn=Math.clz32?Math.clz32:BS,DS=Math.log,OS=Math.LN2;function BS(e){return e>>>=0,e===0?32:31-(DS(e)/OS|0)|0}var xa=64,ba=4194304;function cs(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function El(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,o=e.suspendedLanes,i=e.pingedLanes,s=n&268435455;if(s!==0){var a=s&~o;a!==0?r=cs(a):(i&=s,i!==0&&(r=cs(i)))}else s=n&~o,s!==0?r=cs(s):i!==0&&(r=cs(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&o)&&(o=r&-r,i=t&-t,o>=i||o===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-Bn(t),o=1<<n,r|=e[n],t&=~o;return r}function WS(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function VS(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,o=e.expirationTimes,i=e.pendingLanes;0<i;){var s=31-Bn(i),a=1<<s,l=o[s];l===-1?(!(a&n)||a&r)&&(o[s]=WS(a,t)):l<=t&&(e.expiredLanes|=a),i&=~a}}function Rd(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Kv(){var e=xa;return xa<<=1,!(xa&4194240)&&(xa=64),e}function cc(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function qs(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Bn(t),e[t]=n}function HS(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var o=31-Bn(n),i=1<<o;t[o]=0,r[o]=-1,e[o]=-1,n&=~i}}function Wf(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Bn(n),o=1<<r;o&t|e[r]&t&&(e[r]|=t),n&=~o}}var Ne=0;function Yv(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Gv,Vf,Xv,qv,Jv,jd=!1,Sa=[],Wr=null,Vr=null,Hr=null,js=new Map,Ps=new Map,Lr=[],US="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function $h(e,t){switch(e){case"focusin":case"focusout":Wr=null;break;case"dragenter":case"dragleave":Vr=null;break;case"mouseover":case"mouseout":Hr=null;break;case"pointerover":case"pointerout":js.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ps.delete(t.pointerId)}}function Ki(e,t,n,r,o,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[o]},t!==null&&(t=Qs(t),t!==null&&Vf(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function ZS(e,t,n,r,o){switch(t){case"focusin":return Wr=Ki(Wr,e,t,n,r,o),!0;case"dragenter":return Vr=Ki(Vr,e,t,n,r,o),!0;case"mouseover":return Hr=Ki(Hr,e,t,n,r,o),!0;case"pointerover":var i=o.pointerId;return js.set(i,Ki(js.get(i)||null,e,t,n,r,o)),!0;case"gotpointercapture":return i=o.pointerId,Ps.set(i,Ki(Ps.get(i)||null,e,t,n,r,o)),!0}return!1}function Qv(e){var t=po(e.target);if(t!==null){var n=jo(t);if(n!==null){if(t=n.tag,t===13){if(t=Bv(n),t!==null){e.blockedOn=t,Jv(e.priority,function(){Xv(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function il(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Pd(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Ed=r,n.target.dispatchEvent(r),Ed=null}else return t=Qs(n),t!==null&&Vf(t),e.blockedOn=n,!1;t.shift()}return!0}function Ah(e,t,n){il(e)&&n.delete(t)}function KS(){jd=!1,Wr!==null&&il(Wr)&&(Wr=null),Vr!==null&&il(Vr)&&(Vr=null),Hr!==null&&il(Hr)&&(Hr=null),js.forEach(Ah),Ps.forEach(Ah)}function Yi(e,t){e.blockedOn===t&&(e.blockedOn=null,jd||(jd=!0,pn.unstable_scheduleCallback(pn.unstable_NormalPriority,KS)))}function Fs(e){function t(o){return Yi(o,e)}if(0<Sa.length){Yi(Sa[0],e);for(var n=1;n<Sa.length;n++){var r=Sa[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Wr!==null&&Yi(Wr,e),Vr!==null&&Yi(Vr,e),Hr!==null&&Yi(Hr,e),js.forEach(t),Ps.forEach(t),n=0;n<Lr.length;n++)r=Lr[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Lr.length&&(n=Lr[0],n.blockedOn===null);)Qv(n),n.blockedOn===null&&Lr.shift()}var mi=Er.ReactCurrentBatchConfig,Cl=!0;function YS(e,t,n,r){var o=Ne,i=mi.transition;mi.transition=null;try{Ne=1,Hf(e,t,n,r)}finally{Ne=o,mi.transition=i}}function GS(e,t,n,r){var o=Ne,i=mi.transition;mi.transition=null;try{Ne=4,Hf(e,t,n,r)}finally{Ne=o,mi.transition=i}}function Hf(e,t,n,r){if(Cl){var o=Pd(e,t,n,r);if(o===null)xc(e,t,r,Il,n),$h(e,r);else if(ZS(o,e,t,n,r))r.stopPropagation();else if($h(e,r),t&4&&-1<US.indexOf(e)){for(;o!==null;){var i=Qs(o);if(i!==null&&Gv(i),i=Pd(e,t,n,r),i===null&&xc(e,t,r,Il,n),i===o)break;o=i}o!==null&&r.stopPropagation()}else xc(e,t,r,null,n)}}var Il=null;function Pd(e,t,n,r){if(Il=null,e=Of(r),e=po(e),e!==null)if(t=jo(e),t===null)e=null;else if(n=t.tag,n===13){if(e=Bv(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Il=e,null}function e0(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(NS()){case Bf:return 1;case Uv:return 4;case kl:case LS:return 16;case Zv:return 536870912;default:return 16}default:return 16}}var Or=null,Uf=null,sl=null;function t0(){if(sl)return sl;var e,t=Uf,n=t.length,r,o="value"in Or?Or.value:Or.textContent,i=o.length;for(e=0;e<n&&t[e]===o[e];e++);var s=n-e;for(r=1;r<=s&&t[n-r]===o[i-r];r++);return sl=o.slice(e,1<r?1-r:void 0)}function al(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function ka(){return!0}function Nh(){return!1}function mn(e){function t(n,r,o,i,s){this._reactName=n,this._targetInst=o,this.type=r,this.nativeEvent=i,this.target=s,this.currentTarget=null;for(var a in e)e.hasOwnProperty(a)&&(n=e[a],this[a]=n?n(i):i[a]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?ka:Nh,this.isPropagationStopped=Nh,this}return nt(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=ka)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=ka)},persist:function(){},isPersistent:ka}),t}var Fi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Zf=mn(Fi),Js=nt({},Fi,{view:0,detail:0}),XS=mn(Js),dc,fc,Gi,su=nt({},Js,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Kf,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Gi&&(Gi&&e.type==="mousemove"?(dc=e.screenX-Gi.screenX,fc=e.screenY-Gi.screenY):fc=dc=0,Gi=e),dc)},movementY:function(e){return"movementY"in e?e.movementY:fc}}),Lh=mn(su),qS=nt({},su,{dataTransfer:0}),JS=mn(qS),QS=nt({},Js,{relatedTarget:0}),pc=mn(QS),ek=nt({},Fi,{animationName:0,elapsedTime:0,pseudoElement:0}),tk=mn(ek),nk=nt({},Fi,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),rk=mn(nk),ok=nt({},Fi,{data:0}),zh=mn(ok),ik={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},sk={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},ak={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function lk(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=ak[e])?!!t[e]:!1}function Kf(){return lk}var uk=nt({},Js,{key:function(e){if(e.key){var t=ik[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=al(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?sk[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Kf,charCode:function(e){return e.type==="keypress"?al(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?al(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),ck=mn(uk),dk=nt({},su,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Dh=mn(dk),fk=nt({},Js,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Kf}),pk=mn(fk),hk=nt({},Fi,{propertyName:0,elapsedTime:0,pseudoElement:0}),mk=mn(hk),gk=nt({},su,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),yk=mn(gk),vk=[9,13,27,32],Yf=xr&&"CompositionEvent"in window,ys=null;xr&&"documentMode"in document&&(ys=document.documentMode);var wk=xr&&"TextEvent"in window&&!ys,n0=xr&&(!Yf||ys&&8<ys&&11>=ys),Oh=" ",Bh=!1;function r0(e,t){switch(e){case"keyup":return vk.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function o0(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Jo=!1;function xk(e,t){switch(e){case"compositionend":return o0(t);case"keypress":return t.which!==32?null:(Bh=!0,Oh);case"textInput":return e=t.data,e===Oh&&Bh?null:e;default:return null}}function bk(e,t){if(Jo)return e==="compositionend"||!Yf&&r0(e,t)?(e=t0(),sl=Uf=Or=null,Jo=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return n0&&t.locale!=="ko"?null:t.data;default:return null}}var Sk={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Wh(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Sk[e.type]:t==="textarea"}function i0(e,t,n,r){Nv(r),t=Tl(t,"onChange"),0<t.length&&(n=new Zf("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var vs=null,_s=null;function kk(e){g0(e,0)}function au(e){var t=ti(e);if(jv(t))return e}function Ek(e,t){if(e==="change")return t}var s0=!1;if(xr){var hc;if(xr){var mc="oninput"in document;if(!mc){var Vh=document.createElement("div");Vh.setAttribute("oninput","return;"),mc=typeof Vh.oninput=="function"}hc=mc}else hc=!1;s0=hc&&(!document.documentMode||9<document.documentMode)}function Hh(){vs&&(vs.detachEvent("onpropertychange",a0),_s=vs=null)}function a0(e){if(e.propertyName==="value"&&au(_s)){var t=[];i0(t,_s,e,Of(e)),Ov(kk,t)}}function Ck(e,t,n){e==="focusin"?(Hh(),vs=t,_s=n,vs.attachEvent("onpropertychange",a0)):e==="focusout"&&Hh()}function Ik(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return au(_s)}function Tk(e,t){if(e==="click")return au(t)}function Rk(e,t){if(e==="input"||e==="change")return au(t)}function jk(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Vn=typeof Object.is=="function"?Object.is:jk;function Ms(e,t){if(Vn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var o=n[r];if(!fd.call(t,o)||!Vn(e[o],t[o]))return!1}return!0}function Uh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Zh(e,t){var n=Uh(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Uh(n)}}function l0(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?l0(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function u0(){for(var e=window,t=xl();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=xl(e.document)}return t}function Gf(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Pk(e){var t=u0(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&l0(n.ownerDocument.documentElement,n)){if(r!==null&&Gf(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var o=n.textContent.length,i=Math.min(r.start,o);r=r.end===void 0?i:Math.min(r.end,o),!e.extend&&i>r&&(o=r,r=i,i=o),o=Zh(n,i);var s=Zh(n,r);o&&s&&(e.rangeCount!==1||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&(t=t.createRange(),t.setStart(o.node,o.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var Fk=xr&&"documentMode"in document&&11>=document.documentMode,Qo=null,Fd=null,ws=null,_d=!1;function Kh(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;_d||Qo==null||Qo!==xl(r)||(r=Qo,"selectionStart"in r&&Gf(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),ws&&Ms(ws,r)||(ws=r,r=Tl(Fd,"onSelect"),0<r.length&&(t=new Zf("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Qo)))}function Ea(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var ei={animationend:Ea("Animation","AnimationEnd"),animationiteration:Ea("Animation","AnimationIteration"),animationstart:Ea("Animation","AnimationStart"),transitionend:Ea("Transition","TransitionEnd")},gc={},c0={};xr&&(c0=document.createElement("div").style,"AnimationEvent"in window||(delete ei.animationend.animation,delete ei.animationiteration.animation,delete ei.animationstart.animation),"TransitionEvent"in window||delete ei.transitionend.transition);function lu(e){if(gc[e])return gc[e];if(!ei[e])return e;var t=ei[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in c0)return gc[e]=t[n];return e}var d0=lu("animationend"),f0=lu("animationiteration"),p0=lu("animationstart"),h0=lu("transitionend"),m0=new Map,Yh="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function to(e,t){m0.set(e,t),Ro(t,[e])}for(var yc=0;yc<Yh.length;yc++){var vc=Yh[yc],_k=vc.toLowerCase(),Mk=vc[0].toUpperCase()+vc.slice(1);to(_k,"on"+Mk)}to(d0,"onAnimationEnd");to(f0,"onAnimationIteration");to(p0,"onAnimationStart");to("dblclick","onDoubleClick");to("focusin","onFocus");to("focusout","onBlur");to(h0,"onTransitionEnd");bi("onMouseEnter",["mouseout","mouseover"]);bi("onMouseLeave",["mouseout","mouseover"]);bi("onPointerEnter",["pointerout","pointerover"]);bi("onPointerLeave",["pointerout","pointerover"]);Ro("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Ro("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Ro("onBeforeInput",["compositionend","keypress","textInput","paste"]);Ro("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Ro("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Ro("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ds="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),$k=new Set("cancel close invalid load scroll toggle".split(" ").concat(ds));function Gh(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,_S(r,t,void 0,e),e.currentTarget=null}function g0(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],o=r.event;r=r.listeners;e:{var i=void 0;if(t)for(var s=r.length-1;0<=s;s--){var a=r[s],l=a.instance,c=a.currentTarget;if(a=a.listener,l!==i&&o.isPropagationStopped())break e;Gh(o,a,c),i=l}else for(s=0;s<r.length;s++){if(a=r[s],l=a.instance,c=a.currentTarget,a=a.listener,l!==i&&o.isPropagationStopped())break e;Gh(o,a,c),i=l}}}if(Sl)throw e=Td,Sl=!1,Td=null,e}function Ue(e,t){var n=t[Ld];n===void 0&&(n=t[Ld]=new Set);var r=e+"__bubble";n.has(r)||(y0(t,e,2,!1),n.add(r))}function wc(e,t,n){var r=0;t&&(r|=4),y0(n,e,r,t)}var Ca="_reactListening"+Math.random().toString(36).slice(2);function $s(e){if(!e[Ca]){e[Ca]=!0,Ev.forEach(function(n){n!=="selectionchange"&&($k.has(n)||wc(n,!1,e),wc(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Ca]||(t[Ca]=!0,wc("selectionchange",!1,t))}}function y0(e,t,n,r){switch(e0(t)){case 1:var o=YS;break;case 4:o=GS;break;default:o=Hf}n=o.bind(null,t,n,e),o=void 0,!Id||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(o=!0),r?o!==void 0?e.addEventListener(t,n,{capture:!0,passive:o}):e.addEventListener(t,n,!0):o!==void 0?e.addEventListener(t,n,{passive:o}):e.addEventListener(t,n,!1)}function xc(e,t,n,r,o){var i=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var a=r.stateNode.containerInfo;if(a===o||a.nodeType===8&&a.parentNode===o)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&(l=s.stateNode.containerInfo,l===o||l.nodeType===8&&l.parentNode===o))return;s=s.return}for(;a!==null;){if(s=po(a),s===null)return;if(l=s.tag,l===5||l===6){r=i=s;continue e}a=a.parentNode}}r=r.return}Ov(function(){var c=i,f=Of(n),p=[];e:{var m=m0.get(e);if(m!==void 0){var g=Zf,w=e;switch(e){case"keypress":if(al(n)===0)break e;case"keydown":case"keyup":g=ck;break;case"focusin":w="focus",g=pc;break;case"focusout":w="blur",g=pc;break;case"beforeblur":case"afterblur":g=pc;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":g=Lh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":g=JS;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":g=pk;break;case d0:case f0:case p0:g=tk;break;case h0:g=mk;break;case"scroll":g=XS;break;case"wheel":g=yk;break;case"copy":case"cut":case"paste":g=rk;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":g=Dh}var x=(t&4)!==0,k=!x&&e==="scroll",h=x?m!==null?m+"Capture":null:m;x=[];for(var y=c,v;y!==null;){v=y;var S=v.stateNode;if(v.tag===5&&S!==null&&(v=S,h!==null&&(S=Rs(y,h),S!=null&&x.push(As(y,S,v)))),k)break;y=y.return}0<x.length&&(m=new g(m,w,null,n,f),p.push({event:m,listeners:x}))}}if(!(t&7)){e:{if(m=e==="mouseover"||e==="pointerover",g=e==="mouseout"||e==="pointerout",m&&n!==Ed&&(w=n.relatedTarget||n.fromElement)&&(po(w)||w[br]))break e;if((g||m)&&(m=f.window===f?f:(m=f.ownerDocument)?m.defaultView||m.parentWindow:window,g?(w=n.relatedTarget||n.toElement,g=c,w=w?po(w):null,w!==null&&(k=jo(w),w!==k||w.tag!==5&&w.tag!==6)&&(w=null)):(g=null,w=c),g!==w)){if(x=Lh,S="onMouseLeave",h="onMouseEnter",y="mouse",(e==="pointerout"||e==="pointerover")&&(x=Dh,S="onPointerLeave",h="onPointerEnter",y="pointer"),k=g==null?m:ti(g),v=w==null?m:ti(w),m=new x(S,y+"leave",g,n,f),m.target=k,m.relatedTarget=v,S=null,po(f)===c&&(x=new x(h,y+"enter",w,n,f),x.target=v,x.relatedTarget=k,S=x),k=S,g&&w)t:{for(x=g,h=w,y=0,v=x;v;v=zo(v))y++;for(v=0,S=h;S;S=zo(S))v++;for(;0<y-v;)x=zo(x),y--;for(;0<v-y;)h=zo(h),v--;for(;y--;){if(x===h||h!==null&&x===h.alternate)break t;x=zo(x),h=zo(h)}x=null}else x=null;g!==null&&Xh(p,m,g,x,!1),w!==null&&k!==null&&Xh(p,k,w,x,!0)}}e:{if(m=c?ti(c):window,g=m.nodeName&&m.nodeName.toLowerCase(),g==="select"||g==="input"&&m.type==="file")var b=Ek;else if(Wh(m))if(s0)b=Rk;else{b=Ik;var E=Ck}else(g=m.nodeName)&&g.toLowerCase()==="input"&&(m.type==="checkbox"||m.type==="radio")&&(b=Tk);if(b&&(b=b(e,c))){i0(p,b,n,f);break e}E&&E(e,m,c),e==="focusout"&&(E=m._wrapperState)&&E.controlled&&m.type==="number"&&wd(m,"number",m.value)}switch(E=c?ti(c):window,e){case"focusin":(Wh(E)||E.contentEditable==="true")&&(Qo=E,Fd=c,ws=null);break;case"focusout":ws=Fd=Qo=null;break;case"mousedown":_d=!0;break;case"contextmenu":case"mouseup":case"dragend":_d=!1,Kh(p,n,f);break;case"selectionchange":if(Fk)break;case"keydown":case"keyup":Kh(p,n,f)}var I;if(Yf)e:{switch(e){case"compositionstart":var T="onCompositionStart";break e;case"compositionend":T="onCompositionEnd";break e;case"compositionupdate":T="onCompositionUpdate";break e}T=void 0}else Jo?r0(e,n)&&(T="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(T="onCompositionStart");T&&(n0&&n.locale!=="ko"&&(Jo||T!=="onCompositionStart"?T==="onCompositionEnd"&&Jo&&(I=t0()):(Or=f,Uf="value"in Or?Or.value:Or.textContent,Jo=!0)),E=Tl(c,T),0<E.length&&(T=new zh(T,e,null,n,f),p.push({event:T,listeners:E}),I?T.data=I:(I=o0(n),I!==null&&(T.data=I)))),(I=wk?xk(e,n):bk(e,n))&&(c=Tl(c,"onBeforeInput"),0<c.length&&(f=new zh("onBeforeInput","beforeinput",null,n,f),p.push({event:f,listeners:c}),f.data=I))}g0(p,t)})}function As(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Tl(e,t){for(var n=t+"Capture",r=[];e!==null;){var o=e,i=o.stateNode;o.tag===5&&i!==null&&(o=i,i=Rs(e,n),i!=null&&r.unshift(As(e,i,o)),i=Rs(e,t),i!=null&&r.push(As(e,i,o))),e=e.return}return r}function zo(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Xh(e,t,n,r,o){for(var i=t._reactName,s=[];n!==null&&n!==r;){var a=n,l=a.alternate,c=a.stateNode;if(l!==null&&l===r)break;a.tag===5&&c!==null&&(a=c,o?(l=Rs(n,i),l!=null&&s.unshift(As(n,l,a))):o||(l=Rs(n,i),l!=null&&s.push(As(n,l,a)))),n=n.return}s.length!==0&&e.push({event:t,listeners:s})}var Ak=/\r\n?/g,Nk=/\u0000|\uFFFD/g;function qh(e){return(typeof e=="string"?e:""+e).replace(Ak,`
38
- `).replace(Nk,"")}function Ia(e,t,n){if(t=qh(t),qh(e)!==t&&n)throw Error(ne(425))}function Rl(){}var Md=null,$d=null;function Ad(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Nd=typeof setTimeout=="function"?setTimeout:void 0,Lk=typeof clearTimeout=="function"?clearTimeout:void 0,Jh=typeof Promise=="function"?Promise:void 0,zk=typeof queueMicrotask=="function"?queueMicrotask:typeof Jh<"u"?function(e){return Jh.resolve(null).then(e).catch(Dk)}:Nd;function Dk(e){setTimeout(function(){throw e})}function bc(e,t){var n=t,r=0;do{var o=n.nextSibling;if(e.removeChild(n),o&&o.nodeType===8)if(n=o.data,n==="/$"){if(r===0){e.removeChild(o),Fs(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=o}while(n);Fs(t)}function Ur(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function Qh(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var _i=Math.random().toString(36).slice(2),er="__reactFiber$"+_i,Ns="__reactProps$"+_i,br="__reactContainer$"+_i,Ld="__reactEvents$"+_i,Ok="__reactListeners$"+_i,Bk="__reactHandles$"+_i;function po(e){var t=e[er];if(t)return t;for(var n=e.parentNode;n;){if(t=n[br]||n[er]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Qh(e);e!==null;){if(n=e[er])return n;e=Qh(e)}return t}e=n,n=e.parentNode}return null}function Qs(e){return e=e[er]||e[br],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function ti(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(ne(33))}function uu(e){return e[Ns]||null}var zd=[],ni=-1;function no(e){return{current:e}}function Ke(e){0>ni||(e.current=zd[ni],zd[ni]=null,ni--)}function Ve(e,t){ni++,zd[ni]=e.current,e.current=t}var Jr={},Dt=no(Jr),Qt=no(!1),xo=Jr;function Si(e,t){var n=e.type.contextTypes;if(!n)return Jr;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var o={},i;for(i in n)o[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function en(e){return e=e.childContextTypes,e!=null}function jl(){Ke(Qt),Ke(Dt)}function em(e,t,n){if(Dt.current!==Jr)throw Error(ne(168));Ve(Dt,t),Ve(Qt,n)}function v0(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var o in r)if(!(o in t))throw Error(ne(108,CS(e)||"Unknown",o));return nt({},n,r)}function Pl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Jr,xo=Dt.current,Ve(Dt,e),Ve(Qt,Qt.current),!0}function tm(e,t,n){var r=e.stateNode;if(!r)throw Error(ne(169));n?(e=v0(e,t,xo),r.__reactInternalMemoizedMergedChildContext=e,Ke(Qt),Ke(Dt),Ve(Dt,e)):Ke(Qt),Ve(Qt,n)}var hr=null,cu=!1,Sc=!1;function w0(e){hr===null?hr=[e]:hr.push(e)}function Wk(e){cu=!0,w0(e)}function ro(){if(!Sc&&hr!==null){Sc=!0;var e=0,t=Ne;try{var n=hr;for(Ne=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}hr=null,cu=!1}catch(o){throw hr!==null&&(hr=hr.slice(e+1)),Hv(Bf,ro),o}finally{Ne=t,Sc=!1}}return null}var ri=[],oi=0,Fl=null,_l=0,En=[],Cn=0,bo=null,gr=1,yr="";function co(e,t){ri[oi++]=_l,ri[oi++]=Fl,Fl=e,_l=t}function x0(e,t,n){En[Cn++]=gr,En[Cn++]=yr,En[Cn++]=bo,bo=e;var r=gr;e=yr;var o=32-Bn(r)-1;r&=~(1<<o),n+=1;var i=32-Bn(t)+o;if(30<i){var s=o-o%5;i=(r&(1<<s)-1).toString(32),r>>=s,o-=s,gr=1<<32-Bn(t)+o|n<<o|r,yr=i+e}else gr=1<<i|n<<o|r,yr=e}function Xf(e){e.return!==null&&(co(e,1),x0(e,1,0))}function qf(e){for(;e===Fl;)Fl=ri[--oi],ri[oi]=null,_l=ri[--oi],ri[oi]=null;for(;e===bo;)bo=En[--Cn],En[Cn]=null,yr=En[--Cn],En[Cn]=null,gr=En[--Cn],En[Cn]=null}var fn=null,dn=null,Ge=!1,On=null;function b0(e,t){var n=Tn(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function nm(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,fn=e,dn=Ur(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,fn=e,dn=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=bo!==null?{id:gr,overflow:yr}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Tn(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,fn=e,dn=null,!0):!1;default:return!1}}function Dd(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Od(e){if(Ge){var t=dn;if(t){var n=t;if(!nm(e,t)){if(Dd(e))throw Error(ne(418));t=Ur(n.nextSibling);var r=fn;t&&nm(e,t)?b0(r,n):(e.flags=e.flags&-4097|2,Ge=!1,fn=e)}}else{if(Dd(e))throw Error(ne(418));e.flags=e.flags&-4097|2,Ge=!1,fn=e}}}function rm(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;fn=e}function Ta(e){if(e!==fn)return!1;if(!Ge)return rm(e),Ge=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Ad(e.type,e.memoizedProps)),t&&(t=dn)){if(Dd(e))throw S0(),Error(ne(418));for(;t;)b0(e,t),t=Ur(t.nextSibling)}if(rm(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(ne(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){dn=Ur(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}dn=null}}else dn=fn?Ur(e.stateNode.nextSibling):null;return!0}function S0(){for(var e=dn;e;)e=Ur(e.nextSibling)}function ki(){dn=fn=null,Ge=!1}function Jf(e){On===null?On=[e]:On.push(e)}var Vk=Er.ReactCurrentBatchConfig;function Xi(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(ne(309));var r=n.stateNode}if(!r)throw Error(ne(147,e));var o=r,i=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===i?t.ref:(t=function(s){var a=o.refs;s===null?delete a[i]:a[i]=s},t._stringRef=i,t)}if(typeof e!="string")throw Error(ne(284));if(!n._owner)throw Error(ne(290,e))}return e}function Ra(e,t){throw e=Object.prototype.toString.call(t),Error(ne(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function om(e){var t=e._init;return t(e._payload)}function k0(e){function t(h,y){if(e){var v=h.deletions;v===null?(h.deletions=[y],h.flags|=16):v.push(y)}}function n(h,y){if(!e)return null;for(;y!==null;)t(h,y),y=y.sibling;return null}function r(h,y){for(h=new Map;y!==null;)y.key!==null?h.set(y.key,y):h.set(y.index,y),y=y.sibling;return h}function o(h,y){return h=Gr(h,y),h.index=0,h.sibling=null,h}function i(h,y,v){return h.index=v,e?(v=h.alternate,v!==null?(v=v.index,v<y?(h.flags|=2,y):v):(h.flags|=2,y)):(h.flags|=1048576,y)}function s(h){return e&&h.alternate===null&&(h.flags|=2),h}function a(h,y,v,S){return y===null||y.tag!==6?(y=jc(v,h.mode,S),y.return=h,y):(y=o(y,v),y.return=h,y)}function l(h,y,v,S){var b=v.type;return b===qo?f(h,y,v.props.children,S,v.key):y!==null&&(y.elementType===b||typeof b=="object"&&b!==null&&b.$$typeof===Ar&&om(b)===y.type)?(S=o(y,v.props),S.ref=Xi(h,y,v),S.return=h,S):(S=hl(v.type,v.key,v.props,null,h.mode,S),S.ref=Xi(h,y,v),S.return=h,S)}function c(h,y,v,S){return y===null||y.tag!==4||y.stateNode.containerInfo!==v.containerInfo||y.stateNode.implementation!==v.implementation?(y=Pc(v,h.mode,S),y.return=h,y):(y=o(y,v.children||[]),y.return=h,y)}function f(h,y,v,S,b){return y===null||y.tag!==7?(y=wo(v,h.mode,S,b),y.return=h,y):(y=o(y,v),y.return=h,y)}function p(h,y,v){if(typeof y=="string"&&y!==""||typeof y=="number")return y=jc(""+y,h.mode,v),y.return=h,y;if(typeof y=="object"&&y!==null){switch(y.$$typeof){case ya:return v=hl(y.type,y.key,y.props,null,h.mode,v),v.ref=Xi(h,null,y),v.return=h,v;case Xo:return y=Pc(y,h.mode,v),y.return=h,y;case Ar:var S=y._init;return p(h,S(y._payload),v)}if(us(y)||Ui(y))return y=wo(y,h.mode,v,null),y.return=h,y;Ra(h,y)}return null}function m(h,y,v,S){var b=y!==null?y.key:null;if(typeof v=="string"&&v!==""||typeof v=="number")return b!==null?null:a(h,y,""+v,S);if(typeof v=="object"&&v!==null){switch(v.$$typeof){case ya:return v.key===b?l(h,y,v,S):null;case Xo:return v.key===b?c(h,y,v,S):null;case Ar:return b=v._init,m(h,y,b(v._payload),S)}if(us(v)||Ui(v))return b!==null?null:f(h,y,v,S,null);Ra(h,v)}return null}function g(h,y,v,S,b){if(typeof S=="string"&&S!==""||typeof S=="number")return h=h.get(v)||null,a(y,h,""+S,b);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case ya:return h=h.get(S.key===null?v:S.key)||null,l(y,h,S,b);case Xo:return h=h.get(S.key===null?v:S.key)||null,c(y,h,S,b);case Ar:var E=S._init;return g(h,y,v,E(S._payload),b)}if(us(S)||Ui(S))return h=h.get(v)||null,f(y,h,S,b,null);Ra(y,S)}return null}function w(h,y,v,S){for(var b=null,E=null,I=y,T=y=0,R=null;I!==null&&T<v.length;T++){I.index>T?(R=I,I=null):R=I.sibling;var F=m(h,I,v[T],S);if(F===null){I===null&&(I=R);break}e&&I&&F.alternate===null&&t(h,I),y=i(F,y,T),E===null?b=F:E.sibling=F,E=F,I=R}if(T===v.length)return n(h,I),Ge&&co(h,T),b;if(I===null){for(;T<v.length;T++)I=p(h,v[T],S),I!==null&&(y=i(I,y,T),E===null?b=I:E.sibling=I,E=I);return Ge&&co(h,T),b}for(I=r(h,I);T<v.length;T++)R=g(I,h,T,v[T],S),R!==null&&(e&&R.alternate!==null&&I.delete(R.key===null?T:R.key),y=i(R,y,T),E===null?b=R:E.sibling=R,E=R);return e&&I.forEach(function(A){return t(h,A)}),Ge&&co(h,T),b}function x(h,y,v,S){var b=Ui(v);if(typeof b!="function")throw Error(ne(150));if(v=b.call(v),v==null)throw Error(ne(151));for(var E=b=null,I=y,T=y=0,R=null,F=v.next();I!==null&&!F.done;T++,F=v.next()){I.index>T?(R=I,I=null):R=I.sibling;var A=m(h,I,F.value,S);if(A===null){I===null&&(I=R);break}e&&I&&A.alternate===null&&t(h,I),y=i(A,y,T),E===null?b=A:E.sibling=A,E=A,I=R}if(F.done)return n(h,I),Ge&&co(h,T),b;if(I===null){for(;!F.done;T++,F=v.next())F=p(h,F.value,S),F!==null&&(y=i(F,y,T),E===null?b=F:E.sibling=F,E=F);return Ge&&co(h,T),b}for(I=r(h,I);!F.done;T++,F=v.next())F=g(I,h,T,F.value,S),F!==null&&(e&&F.alternate!==null&&I.delete(F.key===null?T:F.key),y=i(F,y,T),E===null?b=F:E.sibling=F,E=F);return e&&I.forEach(function(W){return t(h,W)}),Ge&&co(h,T),b}function k(h,y,v,S){if(typeof v=="object"&&v!==null&&v.type===qo&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case ya:e:{for(var b=v.key,E=y;E!==null;){if(E.key===b){if(b=v.type,b===qo){if(E.tag===7){n(h,E.sibling),y=o(E,v.props.children),y.return=h,h=y;break e}}else if(E.elementType===b||typeof b=="object"&&b!==null&&b.$$typeof===Ar&&om(b)===E.type){n(h,E.sibling),y=o(E,v.props),y.ref=Xi(h,E,v),y.return=h,h=y;break e}n(h,E);break}else t(h,E);E=E.sibling}v.type===qo?(y=wo(v.props.children,h.mode,S,v.key),y.return=h,h=y):(S=hl(v.type,v.key,v.props,null,h.mode,S),S.ref=Xi(h,y,v),S.return=h,h=S)}return s(h);case Xo:e:{for(E=v.key;y!==null;){if(y.key===E)if(y.tag===4&&y.stateNode.containerInfo===v.containerInfo&&y.stateNode.implementation===v.implementation){n(h,y.sibling),y=o(y,v.children||[]),y.return=h,h=y;break e}else{n(h,y);break}else t(h,y);y=y.sibling}y=Pc(v,h.mode,S),y.return=h,h=y}return s(h);case Ar:return E=v._init,k(h,y,E(v._payload),S)}if(us(v))return w(h,y,v,S);if(Ui(v))return x(h,y,v,S);Ra(h,v)}return typeof v=="string"&&v!==""||typeof v=="number"?(v=""+v,y!==null&&y.tag===6?(n(h,y.sibling),y=o(y,v),y.return=h,h=y):(n(h,y),y=jc(v,h.mode,S),y.return=h,h=y),s(h)):n(h,y)}return k}var Ei=k0(!0),E0=k0(!1),Ml=no(null),$l=null,ii=null,Qf=null;function ep(){Qf=ii=$l=null}function tp(e){var t=Ml.current;Ke(Ml),e._currentValue=t}function Bd(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function gi(e,t){$l=e,Qf=ii=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Jt=!0),e.firstContext=null)}function Pn(e){var t=e._currentValue;if(Qf!==e)if(e={context:e,memoizedValue:t,next:null},ii===null){if($l===null)throw Error(ne(308));ii=e,$l.dependencies={lanes:0,firstContext:e}}else ii=ii.next=e;return t}var ho=null;function np(e){ho===null?ho=[e]:ho.push(e)}function C0(e,t,n,r){var o=t.interleaved;return o===null?(n.next=n,np(t)):(n.next=o.next,o.next=n),t.interleaved=n,Sr(e,r)}function Sr(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Nr=!1;function rp(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function I0(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function wr(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Zr(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Fe&2){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,Sr(e,n)}return o=r.interleaved,o===null?(t.next=t,np(r)):(t.next=o.next,o.next=t),r.interleaved=t,Sr(e,n)}function ll(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Wf(e,n)}}function im(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var o=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?o=i=s:i=i.next=s,n=n.next}while(n!==null);i===null?o=i=t:i=i.next=t}else o=i=t;n={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Al(e,t,n,r){var o=e.updateQueue;Nr=!1;var i=o.firstBaseUpdate,s=o.lastBaseUpdate,a=o.shared.pending;if(a!==null){o.shared.pending=null;var l=a,c=l.next;l.next=null,s===null?i=c:s.next=c,s=l;var f=e.alternate;f!==null&&(f=f.updateQueue,a=f.lastBaseUpdate,a!==s&&(a===null?f.firstBaseUpdate=c:a.next=c,f.lastBaseUpdate=l))}if(i!==null){var p=o.baseState;s=0,f=c=l=null,a=i;do{var m=a.lane,g=a.eventTime;if((r&m)===m){f!==null&&(f=f.next={eventTime:g,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var w=e,x=a;switch(m=t,g=n,x.tag){case 1:if(w=x.payload,typeof w=="function"){p=w.call(g,p,m);break e}p=w;break e;case 3:w.flags=w.flags&-65537|128;case 0:if(w=x.payload,m=typeof w=="function"?w.call(g,p,m):w,m==null)break e;p=nt({},p,m);break e;case 2:Nr=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,m=o.effects,m===null?o.effects=[a]:m.push(a))}else g={eventTime:g,lane:m,tag:a.tag,payload:a.payload,callback:a.callback,next:null},f===null?(c=f=g,l=p):f=f.next=g,s|=m;if(a=a.next,a===null){if(a=o.shared.pending,a===null)break;m=a,a=m.next,m.next=null,o.lastBaseUpdate=m,o.shared.pending=null}}while(!0);if(f===null&&(l=p),o.baseState=l,o.firstBaseUpdate=c,o.lastBaseUpdate=f,t=o.shared.interleaved,t!==null){o=t;do s|=o.lane,o=o.next;while(o!==t)}else i===null&&(o.shared.lanes=0);ko|=s,e.lanes=s,e.memoizedState=p}}function sm(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],o=r.callback;if(o!==null){if(r.callback=null,r=n,typeof o!="function")throw Error(ne(191,o));o.call(r)}}}var ea={},or=no(ea),Ls=no(ea),zs=no(ea);function mo(e){if(e===ea)throw Error(ne(174));return e}function op(e,t){switch(Ve(zs,t),Ve(Ls,e),Ve(or,ea),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:bd(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=bd(t,e)}Ke(or),Ve(or,t)}function Ci(){Ke(or),Ke(Ls),Ke(zs)}function T0(e){mo(zs.current);var t=mo(or.current),n=bd(t,e.type);t!==n&&(Ve(Ls,e),Ve(or,n))}function ip(e){Ls.current===e&&(Ke(or),Ke(Ls))}var et=no(0);function Nl(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var kc=[];function sp(){for(var e=0;e<kc.length;e++)kc[e]._workInProgressVersionPrimary=null;kc.length=0}var ul=Er.ReactCurrentDispatcher,Ec=Er.ReactCurrentBatchConfig,So=0,tt=null,yt=null,bt=null,Ll=!1,xs=!1,Ds=0,Hk=0;function $t(){throw Error(ne(321))}function ap(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Vn(e[n],t[n]))return!1;return!0}function lp(e,t,n,r,o,i){if(So=i,tt=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,ul.current=e===null||e.memoizedState===null?Yk:Gk,e=n(r,o),xs){i=0;do{if(xs=!1,Ds=0,25<=i)throw Error(ne(301));i+=1,bt=yt=null,t.updateQueue=null,ul.current=Xk,e=n(r,o)}while(xs)}if(ul.current=zl,t=yt!==null&&yt.next!==null,So=0,bt=yt=tt=null,Ll=!1,t)throw Error(ne(300));return e}function up(){var e=Ds!==0;return Ds=0,e}function Jn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return bt===null?tt.memoizedState=bt=e:bt=bt.next=e,bt}function Fn(){if(yt===null){var e=tt.alternate;e=e!==null?e.memoizedState:null}else e=yt.next;var t=bt===null?tt.memoizedState:bt.next;if(t!==null)bt=t,yt=e;else{if(e===null)throw Error(ne(310));yt=e,e={memoizedState:yt.memoizedState,baseState:yt.baseState,baseQueue:yt.baseQueue,queue:yt.queue,next:null},bt===null?tt.memoizedState=bt=e:bt=bt.next=e}return bt}function Os(e,t){return typeof t=="function"?t(e):t}function Cc(e){var t=Fn(),n=t.queue;if(n===null)throw Error(ne(311));n.lastRenderedReducer=e;var r=yt,o=r.baseQueue,i=n.pending;if(i!==null){if(o!==null){var s=o.next;o.next=i.next,i.next=s}r.baseQueue=o=i,n.pending=null}if(o!==null){i=o.next,r=r.baseState;var a=s=null,l=null,c=i;do{var f=c.lane;if((So&f)===f)l!==null&&(l=l.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),r=c.hasEagerState?c.eagerState:e(r,c.action);else{var p={lane:f,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};l===null?(a=l=p,s=r):l=l.next=p,tt.lanes|=f,ko|=f}c=c.next}while(c!==null&&c!==i);l===null?s=r:l.next=a,Vn(r,t.memoizedState)||(Jt=!0),t.memoizedState=r,t.baseState=s,t.baseQueue=l,n.lastRenderedState=r}if(e=n.interleaved,e!==null){o=e;do i=o.lane,tt.lanes|=i,ko|=i,o=o.next;while(o!==e)}else o===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Ic(e){var t=Fn(),n=t.queue;if(n===null)throw Error(ne(311));n.lastRenderedReducer=e;var r=n.dispatch,o=n.pending,i=t.memoizedState;if(o!==null){n.pending=null;var s=o=o.next;do i=e(i,s.action),s=s.next;while(s!==o);Vn(i,t.memoizedState)||(Jt=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function R0(){}function j0(e,t){var n=tt,r=Fn(),o=t(),i=!Vn(r.memoizedState,o);if(i&&(r.memoizedState=o,Jt=!0),r=r.queue,cp(_0.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||bt!==null&&bt.memoizedState.tag&1){if(n.flags|=2048,Bs(9,F0.bind(null,n,r,o,t),void 0,null),St===null)throw Error(ne(349));So&30||P0(n,t,o)}return o}function P0(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=tt.updateQueue,t===null?(t={lastEffect:null,stores:null},tt.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function F0(e,t,n,r){t.value=n,t.getSnapshot=r,M0(t)&&$0(e)}function _0(e,t,n){return n(function(){M0(t)&&$0(e)})}function M0(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Vn(e,n)}catch{return!0}}function $0(e){var t=Sr(e,1);t!==null&&Wn(t,e,1,-1)}function am(e){var t=Jn();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Os,lastRenderedState:e},t.queue=e,e=e.dispatch=Kk.bind(null,tt,e),[t.memoizedState,e]}function Bs(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=tt.updateQueue,t===null?(t={lastEffect:null,stores:null},tt.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function A0(){return Fn().memoizedState}function cl(e,t,n,r){var o=Jn();tt.flags|=e,o.memoizedState=Bs(1|t,n,void 0,r===void 0?null:r)}function du(e,t,n,r){var o=Fn();r=r===void 0?null:r;var i=void 0;if(yt!==null){var s=yt.memoizedState;if(i=s.destroy,r!==null&&ap(r,s.deps)){o.memoizedState=Bs(t,n,i,r);return}}tt.flags|=e,o.memoizedState=Bs(1|t,n,i,r)}function lm(e,t){return cl(8390656,8,e,t)}function cp(e,t){return du(2048,8,e,t)}function N0(e,t){return du(4,2,e,t)}function L0(e,t){return du(4,4,e,t)}function z0(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function D0(e,t,n){return n=n!=null?n.concat([e]):null,du(4,4,z0.bind(null,t,e),n)}function dp(){}function O0(e,t){var n=Fn();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&ap(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function B0(e,t){var n=Fn();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&ap(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function W0(e,t,n){return So&21?(Vn(n,t)||(n=Kv(),tt.lanes|=n,ko|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Jt=!0),e.memoizedState=n)}function Uk(e,t){var n=Ne;Ne=n!==0&&4>n?n:4,e(!0);var r=Ec.transition;Ec.transition={};try{e(!1),t()}finally{Ne=n,Ec.transition=r}}function V0(){return Fn().memoizedState}function Zk(e,t,n){var r=Yr(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},H0(e))U0(t,n);else if(n=C0(e,t,n,r),n!==null){var o=Wt();Wn(n,e,r,o),Z0(n,t,r)}}function Kk(e,t,n){var r=Yr(e),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(H0(e))U0(t,o);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var s=t.lastRenderedState,a=i(s,n);if(o.hasEagerState=!0,o.eagerState=a,Vn(a,s)){var l=t.interleaved;l===null?(o.next=o,np(t)):(o.next=l.next,l.next=o),t.interleaved=o;return}}catch{}finally{}n=C0(e,t,o,r),n!==null&&(o=Wt(),Wn(n,e,r,o),Z0(n,t,r))}}function H0(e){var t=e.alternate;return e===tt||t!==null&&t===tt}function U0(e,t){xs=Ll=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Z0(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Wf(e,n)}}var zl={readContext:Pn,useCallback:$t,useContext:$t,useEffect:$t,useImperativeHandle:$t,useInsertionEffect:$t,useLayoutEffect:$t,useMemo:$t,useReducer:$t,useRef:$t,useState:$t,useDebugValue:$t,useDeferredValue:$t,useTransition:$t,useMutableSource:$t,useSyncExternalStore:$t,useId:$t,unstable_isNewReconciler:!1},Yk={readContext:Pn,useCallback:function(e,t){return Jn().memoizedState=[e,t===void 0?null:t],e},useContext:Pn,useEffect:lm,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,cl(4194308,4,z0.bind(null,t,e),n)},useLayoutEffect:function(e,t){return cl(4194308,4,e,t)},useInsertionEffect:function(e,t){return cl(4,2,e,t)},useMemo:function(e,t){var n=Jn();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Jn();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Zk.bind(null,tt,e),[r.memoizedState,e]},useRef:function(e){var t=Jn();return e={current:e},t.memoizedState=e},useState:am,useDebugValue:dp,useDeferredValue:function(e){return Jn().memoizedState=e},useTransition:function(){var e=am(!1),t=e[0];return e=Uk.bind(null,e[1]),Jn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=tt,o=Jn();if(Ge){if(n===void 0)throw Error(ne(407));n=n()}else{if(n=t(),St===null)throw Error(ne(349));So&30||P0(r,t,n)}o.memoizedState=n;var i={value:n,getSnapshot:t};return o.queue=i,lm(_0.bind(null,r,i,e),[e]),r.flags|=2048,Bs(9,F0.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Jn(),t=St.identifierPrefix;if(Ge){var n=yr,r=gr;n=(r&~(1<<32-Bn(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Ds++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=Hk++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},Gk={readContext:Pn,useCallback:O0,useContext:Pn,useEffect:cp,useImperativeHandle:D0,useInsertionEffect:N0,useLayoutEffect:L0,useMemo:B0,useReducer:Cc,useRef:A0,useState:function(){return Cc(Os)},useDebugValue:dp,useDeferredValue:function(e){var t=Fn();return W0(t,yt.memoizedState,e)},useTransition:function(){var e=Cc(Os)[0],t=Fn().memoizedState;return[e,t]},useMutableSource:R0,useSyncExternalStore:j0,useId:V0,unstable_isNewReconciler:!1},Xk={readContext:Pn,useCallback:O0,useContext:Pn,useEffect:cp,useImperativeHandle:D0,useInsertionEffect:N0,useLayoutEffect:L0,useMemo:B0,useReducer:Ic,useRef:A0,useState:function(){return Ic(Os)},useDebugValue:dp,useDeferredValue:function(e){var t=Fn();return yt===null?t.memoizedState=e:W0(t,yt.memoizedState,e)},useTransition:function(){var e=Ic(Os)[0],t=Fn().memoizedState;return[e,t]},useMutableSource:R0,useSyncExternalStore:j0,useId:V0,unstable_isNewReconciler:!1};function zn(e,t){if(e&&e.defaultProps){t=nt({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Wd(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:nt({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var fu={isMounted:function(e){return(e=e._reactInternals)?jo(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Wt(),o=Yr(e),i=wr(r,o);i.payload=t,n!=null&&(i.callback=n),t=Zr(e,i,o),t!==null&&(Wn(t,e,o,r),ll(t,e,o))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Wt(),o=Yr(e),i=wr(r,o);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Zr(e,i,o),t!==null&&(Wn(t,e,o,r),ll(t,e,o))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Wt(),r=Yr(e),o=wr(n,r);o.tag=2,t!=null&&(o.callback=t),t=Zr(e,o,r),t!==null&&(Wn(t,e,r,n),ll(t,e,r))}};function um(e,t,n,r,o,i,s){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,i,s):t.prototype&&t.prototype.isPureReactComponent?!Ms(n,r)||!Ms(o,i):!0}function K0(e,t,n){var r=!1,o=Jr,i=t.contextType;return typeof i=="object"&&i!==null?i=Pn(i):(o=en(t)?xo:Dt.current,r=t.contextTypes,i=(r=r!=null)?Si(e,o):Jr),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=fu,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=o,e.__reactInternalMemoizedMaskedChildContext=i),t}function cm(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&fu.enqueueReplaceState(t,t.state,null)}function Vd(e,t,n,r){var o=e.stateNode;o.props=n,o.state=e.memoizedState,o.refs={},rp(e);var i=t.contextType;typeof i=="object"&&i!==null?o.context=Pn(i):(i=en(t)?xo:Dt.current,o.context=Si(e,i)),o.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(Wd(e,t,i,n),o.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof o.getSnapshotBeforeUpdate=="function"||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(t=o.state,typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount(),t!==o.state&&fu.enqueueReplaceState(o,o.state,null),Al(e,n,o,r),o.state=e.memoizedState),typeof o.componentDidMount=="function"&&(e.flags|=4194308)}function Ii(e,t){try{var n="",r=t;do n+=ES(r),r=r.return;while(r);var o=n}catch(i){o=`
37
+ `+o[s].replace(" at new "," at ");return e.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",e.displayName)),l}while(1<=s&&0<=a);break}}}finally{cc=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?ls(e):""}function jS(e){switch(e.tag){case 5:return ls(e.type);case 16:return ls("Lazy");case 13:return ls("Suspense");case 19:return ls("SuspenseList");case 0:case 2:case 15:return e=dc(e.type,!1),e;case 11:return e=dc(e.type.render,!1),e;case 1:return e=dc(e.type,!0),e;default:return""}}function vd(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case qo:return"Fragment";case Xo:return"Portal";case md:return"Profiler";case Df:return"StrictMode";case gd:return"Suspense";case yd:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Fv:return(e.displayName||"Context")+".Consumer";case Pv:return(e._context.displayName||"Context")+".Provider";case Of:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Bf:return t=e.displayName||null,t!==null?t:vd(e.type)||"Memo";case Ar:t=e._payload,e=e._init;try{return vd(e(t))}catch{}}return null}function PS(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return vd(t);case 8:return t===Df?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function qr(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Mv(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function FS(e){var t=Mv(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var o=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(s){r=""+s,i.call(this,s)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function va(e){e._valueTracker||(e._valueTracker=FS(e))}function $v(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Mv(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function bl(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function wd(e,t){var n=t.checked;return nt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Ph(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=qr(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Av(e,t){t=t.checked,t!=null&&zf(e,"checked",t,!1)}function xd(e,t){Av(e,t);var n=qr(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?bd(e,t.type,n):t.hasOwnProperty("defaultValue")&&bd(e,t.type,qr(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Fh(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function bd(e,t,n){(t!=="number"||bl(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var us=Array.isArray;function fi(e,t,n,r){if(e=e.options,t){t={};for(var o=0;o<n.length;o++)t["$"+n[o]]=!0;for(n=0;n<e.length;n++)o=t.hasOwnProperty("$"+e[n].value),e[n].selected!==o&&(e[n].selected=o),o&&r&&(e[n].defaultSelected=!0)}else{for(n=""+qr(n),t=null,o=0;o<e.length;o++){if(e[o].value===n){e[o].selected=!0,r&&(e[o].defaultSelected=!0);return}t!==null||e[o].disabled||(t=e[o])}t!==null&&(t.selected=!0)}}function Sd(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(ne(91));return nt({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function _h(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(ne(92));if(us(n)){if(1<n.length)throw Error(ne(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:qr(n)}}function Nv(e,t){var n=qr(t.value),r=qr(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function Mh(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function Lv(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function kd(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?Lv(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var wa,zv=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,o){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,o)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(wa=wa||document.createElement("div"),wa.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=wa.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Ts(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var ms={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},_S=["Webkit","ms","Moz","O"];Object.keys(ms).forEach(function(e){_S.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ms[t]=ms[e]})});function Dv(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||ms.hasOwnProperty(e)&&ms[e]?(""+t).trim():t+"px"}function Ov(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=Dv(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}var MS=nt({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Ed(e,t){if(t){if(MS[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(ne(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(ne(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(ne(61))}if(t.style!=null&&typeof t.style!="object")throw Error(ne(62))}}function Cd(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Id=null;function Wf(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Td=null,pi=null,hi=null;function $h(e){if(e=Qs(e)){if(typeof Td!="function")throw Error(ne(280));var t=e.stateNode;t&&(t=cu(t),Td(e.stateNode,e.type,t))}}function Bv(e){pi?hi?hi.push(e):hi=[e]:pi=e}function Wv(){if(pi){var e=pi,t=hi;if(hi=pi=null,$h(e),t)for(e=0;e<t.length;e++)$h(t[e])}}function Vv(e,t){return e(t)}function Hv(){}var fc=!1;function Uv(e,t,n){if(fc)return e(t,n);fc=!0;try{return Vv(e,t,n)}finally{fc=!1,(pi!==null||hi!==null)&&(Hv(),Wv())}}function Rs(e,t){var n=e.stateNode;if(n===null)return null;var r=cu(n);if(r===null)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(ne(231,t,typeof n));return n}var Rd=!1;if(xr)try{var Zi={};Object.defineProperty(Zi,"passive",{get:function(){Rd=!0}}),window.addEventListener("test",Zi,Zi),window.removeEventListener("test",Zi,Zi)}catch{Rd=!1}function $S(e,t,n,r,o,i,s,a,l){var c=Array.prototype.slice.call(arguments,3);try{t.apply(n,c)}catch(f){this.onError(f)}}var gs=!1,Sl=null,kl=!1,jd=null,AS={onError:function(e){gs=!0,Sl=e}};function NS(e,t,n,r,o,i,s,a,l){gs=!1,Sl=null,$S.apply(AS,arguments)}function LS(e,t,n,r,o,i,s,a,l){if(NS.apply(this,arguments),gs){if(gs){var c=Sl;gs=!1,Sl=null}else throw Error(ne(198));kl||(kl=!0,jd=c)}}function Po(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function Zv(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function Ah(e){if(Po(e)!==e)throw Error(ne(188))}function zS(e){var t=e.alternate;if(!t){if(t=Po(e),t===null)throw Error(ne(188));return t!==e?null:e}for(var n=e,r=t;;){var o=n.return;if(o===null)break;var i=o.alternate;if(i===null){if(r=o.return,r!==null){n=r;continue}break}if(o.child===i.child){for(i=o.child;i;){if(i===n)return Ah(o),e;if(i===r)return Ah(o),t;i=i.sibling}throw Error(ne(188))}if(n.return!==r.return)n=o,r=i;else{for(var s=!1,a=o.child;a;){if(a===n){s=!0,n=o,r=i;break}if(a===r){s=!0,r=o,n=i;break}a=a.sibling}if(!s){for(a=i.child;a;){if(a===n){s=!0,n=i,r=o;break}if(a===r){s=!0,r=i,n=o;break}a=a.sibling}if(!s)throw Error(ne(189))}}if(n.alternate!==r)throw Error(ne(190))}if(n.tag!==3)throw Error(ne(188));return n.stateNode.current===n?e:t}function Kv(e){return e=zS(e),e!==null?Yv(e):null}function Yv(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Yv(e);if(t!==null)return t;e=e.sibling}return null}var Gv=pn.unstable_scheduleCallback,Nh=pn.unstable_cancelCallback,DS=pn.unstable_shouldYield,OS=pn.unstable_requestPaint,ut=pn.unstable_now,BS=pn.unstable_getCurrentPriorityLevel,Vf=pn.unstable_ImmediatePriority,Xv=pn.unstable_UserBlockingPriority,El=pn.unstable_NormalPriority,WS=pn.unstable_LowPriority,qv=pn.unstable_IdlePriority,su=null,rr=null;function VS(e){if(rr&&typeof rr.onCommitFiberRoot=="function")try{rr.onCommitFiberRoot(su,e,void 0,(e.current.flags&128)===128)}catch{}}var Bn=Math.clz32?Math.clz32:ZS,HS=Math.log,US=Math.LN2;function ZS(e){return e>>>=0,e===0?32:31-(HS(e)/US|0)|0}var xa=64,ba=4194304;function cs(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Cl(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,o=e.suspendedLanes,i=e.pingedLanes,s=n&268435455;if(s!==0){var a=s&~o;a!==0?r=cs(a):(i&=s,i!==0&&(r=cs(i)))}else s=n&~o,s!==0?r=cs(s):i!==0&&(r=cs(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&o)&&(o=r&-r,i=t&-t,o>=i||o===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-Bn(t),o=1<<n,r|=e[n],t&=~o;return r}function KS(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function YS(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,o=e.expirationTimes,i=e.pendingLanes;0<i;){var s=31-Bn(i),a=1<<s,l=o[s];l===-1?(!(a&n)||a&r)&&(o[s]=KS(a,t)):l<=t&&(e.expiredLanes|=a),i&=~a}}function Pd(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Jv(){var e=xa;return xa<<=1,!(xa&4194240)&&(xa=64),e}function pc(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function qs(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Bn(t),e[t]=n}function GS(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var o=31-Bn(n),i=1<<o;t[o]=0,r[o]=-1,e[o]=-1,n&=~i}}function Hf(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Bn(n),o=1<<r;o&t|e[r]&t&&(e[r]|=t),n&=~o}}var Ne=0;function Qv(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var e0,Uf,t0,n0,r0,Fd=!1,Sa=[],Wr=null,Vr=null,Hr=null,js=new Map,Ps=new Map,Lr=[],XS="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Lh(e,t){switch(e){case"focusin":case"focusout":Wr=null;break;case"dragenter":case"dragleave":Vr=null;break;case"mouseover":case"mouseout":Hr=null;break;case"pointerover":case"pointerout":js.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ps.delete(t.pointerId)}}function Ki(e,t,n,r,o,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[o]},t!==null&&(t=Qs(t),t!==null&&Uf(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function qS(e,t,n,r,o){switch(t){case"focusin":return Wr=Ki(Wr,e,t,n,r,o),!0;case"dragenter":return Vr=Ki(Vr,e,t,n,r,o),!0;case"mouseover":return Hr=Ki(Hr,e,t,n,r,o),!0;case"pointerover":var i=o.pointerId;return js.set(i,Ki(js.get(i)||null,e,t,n,r,o)),!0;case"gotpointercapture":return i=o.pointerId,Ps.set(i,Ki(Ps.get(i)||null,e,t,n,r,o)),!0}return!1}function o0(e){var t=ho(e.target);if(t!==null){var n=Po(t);if(n!==null){if(t=n.tag,t===13){if(t=Zv(n),t!==null){e.blockedOn=t,r0(e.priority,function(){t0(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function sl(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=_d(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Id=r,n.target.dispatchEvent(r),Id=null}else return t=Qs(n),t!==null&&Uf(t),e.blockedOn=n,!1;t.shift()}return!0}function zh(e,t,n){sl(e)&&n.delete(t)}function JS(){Fd=!1,Wr!==null&&sl(Wr)&&(Wr=null),Vr!==null&&sl(Vr)&&(Vr=null),Hr!==null&&sl(Hr)&&(Hr=null),js.forEach(zh),Ps.forEach(zh)}function Yi(e,t){e.blockedOn===t&&(e.blockedOn=null,Fd||(Fd=!0,pn.unstable_scheduleCallback(pn.unstable_NormalPriority,JS)))}function Fs(e){function t(o){return Yi(o,e)}if(0<Sa.length){Yi(Sa[0],e);for(var n=1;n<Sa.length;n++){var r=Sa[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Wr!==null&&Yi(Wr,e),Vr!==null&&Yi(Vr,e),Hr!==null&&Yi(Hr,e),js.forEach(t),Ps.forEach(t),n=0;n<Lr.length;n++)r=Lr[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Lr.length&&(n=Lr[0],n.blockedOn===null);)o0(n),n.blockedOn===null&&Lr.shift()}var mi=Er.ReactCurrentBatchConfig,Il=!0;function QS(e,t,n,r){var o=Ne,i=mi.transition;mi.transition=null;try{Ne=1,Zf(e,t,n,r)}finally{Ne=o,mi.transition=i}}function ek(e,t,n,r){var o=Ne,i=mi.transition;mi.transition=null;try{Ne=4,Zf(e,t,n,r)}finally{Ne=o,mi.transition=i}}function Zf(e,t,n,r){if(Il){var o=_d(e,t,n,r);if(o===null)kc(e,t,r,Tl,n),Lh(e,r);else if(qS(o,e,t,n,r))r.stopPropagation();else if(Lh(e,r),t&4&&-1<XS.indexOf(e)){for(;o!==null;){var i=Qs(o);if(i!==null&&e0(i),i=_d(e,t,n,r),i===null&&kc(e,t,r,Tl,n),i===o)break;o=i}o!==null&&r.stopPropagation()}else kc(e,t,r,null,n)}}var Tl=null;function _d(e,t,n,r){if(Tl=null,e=Wf(r),e=ho(e),e!==null)if(t=Po(e),t===null)e=null;else if(n=t.tag,n===13){if(e=Zv(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return Tl=e,null}function i0(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(BS()){case Vf:return 1;case Xv:return 4;case El:case WS:return 16;case qv:return 536870912;default:return 16}default:return 16}}var Or=null,Kf=null,al=null;function s0(){if(al)return al;var e,t=Kf,n=t.length,r,o="value"in Or?Or.value:Or.textContent,i=o.length;for(e=0;e<n&&t[e]===o[e];e++);var s=n-e;for(r=1;r<=s&&t[n-r]===o[i-r];r++);return al=o.slice(e,1<r?1-r:void 0)}function ll(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function ka(){return!0}function Dh(){return!1}function mn(e){function t(n,r,o,i,s){this._reactName=n,this._targetInst=o,this.type=r,this.nativeEvent=i,this.target=s,this.currentTarget=null;for(var a in e)e.hasOwnProperty(a)&&(n=e[a],this[a]=n?n(i):i[a]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?ka:Dh,this.isPropagationStopped=Dh,this}return nt(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=ka)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=ka)},persist:function(){},isPersistent:ka}),t}var Fi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Yf=mn(Fi),Js=nt({},Fi,{view:0,detail:0}),tk=mn(Js),hc,mc,Gi,au=nt({},Js,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Gf,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Gi&&(Gi&&e.type==="mousemove"?(hc=e.screenX-Gi.screenX,mc=e.screenY-Gi.screenY):mc=hc=0,Gi=e),hc)},movementY:function(e){return"movementY"in e?e.movementY:mc}}),Oh=mn(au),nk=nt({},au,{dataTransfer:0}),rk=mn(nk),ok=nt({},Js,{relatedTarget:0}),gc=mn(ok),ik=nt({},Fi,{animationName:0,elapsedTime:0,pseudoElement:0}),sk=mn(ik),ak=nt({},Fi,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),lk=mn(ak),uk=nt({},Fi,{data:0}),Bh=mn(uk),ck={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},dk={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},fk={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function pk(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=fk[e])?!!t[e]:!1}function Gf(){return pk}var hk=nt({},Js,{key:function(e){if(e.key){var t=ck[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=ll(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?dk[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Gf,charCode:function(e){return e.type==="keypress"?ll(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?ll(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),mk=mn(hk),gk=nt({},au,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Wh=mn(gk),yk=nt({},Js,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Gf}),vk=mn(yk),wk=nt({},Fi,{propertyName:0,elapsedTime:0,pseudoElement:0}),xk=mn(wk),bk=nt({},au,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Sk=mn(bk),kk=[9,13,27,32],Xf=xr&&"CompositionEvent"in window,ys=null;xr&&"documentMode"in document&&(ys=document.documentMode);var Ek=xr&&"TextEvent"in window&&!ys,a0=xr&&(!Xf||ys&&8<ys&&11>=ys),Vh=" ",Hh=!1;function l0(e,t){switch(e){case"keyup":return kk.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function u0(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Jo=!1;function Ck(e,t){switch(e){case"compositionend":return u0(t);case"keypress":return t.which!==32?null:(Hh=!0,Vh);case"textInput":return e=t.data,e===Vh&&Hh?null:e;default:return null}}function Ik(e,t){if(Jo)return e==="compositionend"||!Xf&&l0(e,t)?(e=s0(),al=Kf=Or=null,Jo=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return a0&&t.locale!=="ko"?null:t.data;default:return null}}var Tk={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Uh(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Tk[e.type]:t==="textarea"}function c0(e,t,n,r){Bv(r),t=Rl(t,"onChange"),0<t.length&&(n=new Yf("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var vs=null,_s=null;function Rk(e){b0(e,0)}function lu(e){var t=ti(e);if($v(t))return e}function jk(e,t){if(e==="change")return t}var d0=!1;if(xr){var yc;if(xr){var vc="oninput"in document;if(!vc){var Zh=document.createElement("div");Zh.setAttribute("oninput","return;"),vc=typeof Zh.oninput=="function"}yc=vc}else yc=!1;d0=yc&&(!document.documentMode||9<document.documentMode)}function Kh(){vs&&(vs.detachEvent("onpropertychange",f0),_s=vs=null)}function f0(e){if(e.propertyName==="value"&&lu(_s)){var t=[];c0(t,_s,e,Wf(e)),Uv(Rk,t)}}function Pk(e,t,n){e==="focusin"?(Kh(),vs=t,_s=n,vs.attachEvent("onpropertychange",f0)):e==="focusout"&&Kh()}function Fk(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return lu(_s)}function _k(e,t){if(e==="click")return lu(t)}function Mk(e,t){if(e==="input"||e==="change")return lu(t)}function $k(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Vn=typeof Object.is=="function"?Object.is:$k;function Ms(e,t){if(Vn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var o=n[r];if(!hd.call(t,o)||!Vn(e[o],t[o]))return!1}return!0}function Yh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Gh(e,t){var n=Yh(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Yh(n)}}function p0(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?p0(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function h0(){for(var e=window,t=bl();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=bl(e.document)}return t}function qf(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Ak(e){var t=h0(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&p0(n.ownerDocument.documentElement,n)){if(r!==null&&qf(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var o=n.textContent.length,i=Math.min(r.start,o);r=r.end===void 0?i:Math.min(r.end,o),!e.extend&&i>r&&(o=r,r=i,i=o),o=Gh(n,i);var s=Gh(n,r);o&&s&&(e.rangeCount!==1||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&(t=t.createRange(),t.setStart(o.node,o.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var Nk=xr&&"documentMode"in document&&11>=document.documentMode,Qo=null,Md=null,ws=null,$d=!1;function Xh(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;$d||Qo==null||Qo!==bl(r)||(r=Qo,"selectionStart"in r&&qf(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),ws&&Ms(ws,r)||(ws=r,r=Rl(Md,"onSelect"),0<r.length&&(t=new Yf("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Qo)))}function Ea(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var ei={animationend:Ea("Animation","AnimationEnd"),animationiteration:Ea("Animation","AnimationIteration"),animationstart:Ea("Animation","AnimationStart"),transitionend:Ea("Transition","TransitionEnd")},wc={},m0={};xr&&(m0=document.createElement("div").style,"AnimationEvent"in window||(delete ei.animationend.animation,delete ei.animationiteration.animation,delete ei.animationstart.animation),"TransitionEvent"in window||delete ei.transitionend.transition);function uu(e){if(wc[e])return wc[e];if(!ei[e])return e;var t=ei[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in m0)return wc[e]=t[n];return e}var g0=uu("animationend"),y0=uu("animationiteration"),v0=uu("animationstart"),w0=uu("transitionend"),x0=new Map,qh="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function to(e,t){x0.set(e,t),jo(t,[e])}for(var xc=0;xc<qh.length;xc++){var bc=qh[xc],Lk=bc.toLowerCase(),zk=bc[0].toUpperCase()+bc.slice(1);to(Lk,"on"+zk)}to(g0,"onAnimationEnd");to(y0,"onAnimationIteration");to(v0,"onAnimationStart");to("dblclick","onDoubleClick");to("focusin","onFocus");to("focusout","onBlur");to(w0,"onTransitionEnd");bi("onMouseEnter",["mouseout","mouseover"]);bi("onMouseLeave",["mouseout","mouseover"]);bi("onPointerEnter",["pointerout","pointerover"]);bi("onPointerLeave",["pointerout","pointerover"]);jo("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));jo("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));jo("onBeforeInput",["compositionend","keypress","textInput","paste"]);jo("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));jo("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));jo("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ds="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Dk=new Set("cancel close invalid load scroll toggle".split(" ").concat(ds));function Jh(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,LS(r,t,void 0,e),e.currentTarget=null}function b0(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],o=r.event;r=r.listeners;e:{var i=void 0;if(t)for(var s=r.length-1;0<=s;s--){var a=r[s],l=a.instance,c=a.currentTarget;if(a=a.listener,l!==i&&o.isPropagationStopped())break e;Jh(o,a,c),i=l}else for(s=0;s<r.length;s++){if(a=r[s],l=a.instance,c=a.currentTarget,a=a.listener,l!==i&&o.isPropagationStopped())break e;Jh(o,a,c),i=l}}}if(kl)throw e=jd,kl=!1,jd=null,e}function Ue(e,t){var n=t[Dd];n===void 0&&(n=t[Dd]=new Set);var r=e+"__bubble";n.has(r)||(S0(t,e,2,!1),n.add(r))}function Sc(e,t,n){var r=0;t&&(r|=4),S0(n,e,r,t)}var Ca="_reactListening"+Math.random().toString(36).slice(2);function $s(e){if(!e[Ca]){e[Ca]=!0,jv.forEach(function(n){n!=="selectionchange"&&(Dk.has(n)||Sc(n,!1,e),Sc(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Ca]||(t[Ca]=!0,Sc("selectionchange",!1,t))}}function S0(e,t,n,r){switch(i0(t)){case 1:var o=QS;break;case 4:o=ek;break;default:o=Zf}n=o.bind(null,t,n,e),o=void 0,!Rd||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(o=!0),r?o!==void 0?e.addEventListener(t,n,{capture:!0,passive:o}):e.addEventListener(t,n,!0):o!==void 0?e.addEventListener(t,n,{passive:o}):e.addEventListener(t,n,!1)}function kc(e,t,n,r,o){var i=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var a=r.stateNode.containerInfo;if(a===o||a.nodeType===8&&a.parentNode===o)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&(l=s.stateNode.containerInfo,l===o||l.nodeType===8&&l.parentNode===o))return;s=s.return}for(;a!==null;){if(s=ho(a),s===null)return;if(l=s.tag,l===5||l===6){r=i=s;continue e}a=a.parentNode}}r=r.return}Uv(function(){var c=i,f=Wf(n),p=[];e:{var m=x0.get(e);if(m!==void 0){var g=Yf,w=e;switch(e){case"keypress":if(ll(n)===0)break e;case"keydown":case"keyup":g=mk;break;case"focusin":w="focus",g=gc;break;case"focusout":w="blur",g=gc;break;case"beforeblur":case"afterblur":g=gc;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":g=Oh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":g=rk;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":g=vk;break;case g0:case y0:case v0:g=sk;break;case w0:g=xk;break;case"scroll":g=tk;break;case"wheel":g=Sk;break;case"copy":case"cut":case"paste":g=lk;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":g=Wh}var x=(t&4)!==0,k=!x&&e==="scroll",h=x?m!==null?m+"Capture":null:m;x=[];for(var y=c,v;y!==null;){v=y;var S=v.stateNode;if(v.tag===5&&S!==null&&(v=S,h!==null&&(S=Rs(y,h),S!=null&&x.push(As(y,S,v)))),k)break;y=y.return}0<x.length&&(m=new g(m,w,null,n,f),p.push({event:m,listeners:x}))}}if(!(t&7)){e:{if(m=e==="mouseover"||e==="pointerover",g=e==="mouseout"||e==="pointerout",m&&n!==Id&&(w=n.relatedTarget||n.fromElement)&&(ho(w)||w[br]))break e;if((g||m)&&(m=f.window===f?f:(m=f.ownerDocument)?m.defaultView||m.parentWindow:window,g?(w=n.relatedTarget||n.toElement,g=c,w=w?ho(w):null,w!==null&&(k=Po(w),w!==k||w.tag!==5&&w.tag!==6)&&(w=null)):(g=null,w=c),g!==w)){if(x=Oh,S="onMouseLeave",h="onMouseEnter",y="mouse",(e==="pointerout"||e==="pointerover")&&(x=Wh,S="onPointerLeave",h="onPointerEnter",y="pointer"),k=g==null?m:ti(g),v=w==null?m:ti(w),m=new x(S,y+"leave",g,n,f),m.target=k,m.relatedTarget=v,S=null,ho(f)===c&&(x=new x(h,y+"enter",w,n,f),x.target=v,x.relatedTarget=k,S=x),k=S,g&&w)t:{for(x=g,h=w,y=0,v=x;v;v=Do(v))y++;for(v=0,S=h;S;S=Do(S))v++;for(;0<y-v;)x=Do(x),y--;for(;0<v-y;)h=Do(h),v--;for(;y--;){if(x===h||h!==null&&x===h.alternate)break t;x=Do(x),h=Do(h)}x=null}else x=null;g!==null&&Qh(p,m,g,x,!1),w!==null&&k!==null&&Qh(p,k,w,x,!0)}}e:{if(m=c?ti(c):window,g=m.nodeName&&m.nodeName.toLowerCase(),g==="select"||g==="input"&&m.type==="file")var b=jk;else if(Uh(m))if(d0)b=Mk;else{b=Fk;var E=Pk}else(g=m.nodeName)&&g.toLowerCase()==="input"&&(m.type==="checkbox"||m.type==="radio")&&(b=_k);if(b&&(b=b(e,c))){c0(p,b,n,f);break e}E&&E(e,m,c),e==="focusout"&&(E=m._wrapperState)&&E.controlled&&m.type==="number"&&bd(m,"number",m.value)}switch(E=c?ti(c):window,e){case"focusin":(Uh(E)||E.contentEditable==="true")&&(Qo=E,Md=c,ws=null);break;case"focusout":ws=Md=Qo=null;break;case"mousedown":$d=!0;break;case"contextmenu":case"mouseup":case"dragend":$d=!1,Xh(p,n,f);break;case"selectionchange":if(Nk)break;case"keydown":case"keyup":Xh(p,n,f)}var I;if(Xf)e:{switch(e){case"compositionstart":var T="onCompositionStart";break e;case"compositionend":T="onCompositionEnd";break e;case"compositionupdate":T="onCompositionUpdate";break e}T=void 0}else Jo?l0(e,n)&&(T="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(T="onCompositionStart");T&&(a0&&n.locale!=="ko"&&(Jo||T!=="onCompositionStart"?T==="onCompositionEnd"&&Jo&&(I=s0()):(Or=f,Kf="value"in Or?Or.value:Or.textContent,Jo=!0)),E=Rl(c,T),0<E.length&&(T=new Bh(T,e,null,n,f),p.push({event:T,listeners:E}),I?T.data=I:(I=u0(n),I!==null&&(T.data=I)))),(I=Ek?Ck(e,n):Ik(e,n))&&(c=Rl(c,"onBeforeInput"),0<c.length&&(f=new Bh("onBeforeInput","beforeinput",null,n,f),p.push({event:f,listeners:c}),f.data=I))}b0(p,t)})}function As(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Rl(e,t){for(var n=t+"Capture",r=[];e!==null;){var o=e,i=o.stateNode;o.tag===5&&i!==null&&(o=i,i=Rs(e,n),i!=null&&r.unshift(As(e,i,o)),i=Rs(e,t),i!=null&&r.push(As(e,i,o))),e=e.return}return r}function Do(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Qh(e,t,n,r,o){for(var i=t._reactName,s=[];n!==null&&n!==r;){var a=n,l=a.alternate,c=a.stateNode;if(l!==null&&l===r)break;a.tag===5&&c!==null&&(a=c,o?(l=Rs(n,i),l!=null&&s.unshift(As(n,l,a))):o||(l=Rs(n,i),l!=null&&s.push(As(n,l,a)))),n=n.return}s.length!==0&&e.push({event:t,listeners:s})}var Ok=/\r\n?/g,Bk=/\u0000|\uFFFD/g;function em(e){return(typeof e=="string"?e:""+e).replace(Ok,`
38
+ `).replace(Bk,"")}function Ia(e,t,n){if(t=em(t),em(e)!==t&&n)throw Error(ne(425))}function jl(){}var Ad=null,Nd=null;function Ld(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var zd=typeof setTimeout=="function"?setTimeout:void 0,Wk=typeof clearTimeout=="function"?clearTimeout:void 0,tm=typeof Promise=="function"?Promise:void 0,Vk=typeof queueMicrotask=="function"?queueMicrotask:typeof tm<"u"?function(e){return tm.resolve(null).then(e).catch(Hk)}:zd;function Hk(e){setTimeout(function(){throw e})}function Ec(e,t){var n=t,r=0;do{var o=n.nextSibling;if(e.removeChild(n),o&&o.nodeType===8)if(n=o.data,n==="/$"){if(r===0){e.removeChild(o),Fs(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=o}while(n);Fs(t)}function Ur(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function nm(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var _i=Math.random().toString(36).slice(2),er="__reactFiber$"+_i,Ns="__reactProps$"+_i,br="__reactContainer$"+_i,Dd="__reactEvents$"+_i,Uk="__reactListeners$"+_i,Zk="__reactHandles$"+_i;function ho(e){var t=e[er];if(t)return t;for(var n=e.parentNode;n;){if(t=n[br]||n[er]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=nm(e);e!==null;){if(n=e[er])return n;e=nm(e)}return t}e=n,n=e.parentNode}return null}function Qs(e){return e=e[er]||e[br],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function ti(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(ne(33))}function cu(e){return e[Ns]||null}var Od=[],ni=-1;function no(e){return{current:e}}function Ke(e){0>ni||(e.current=Od[ni],Od[ni]=null,ni--)}function Ve(e,t){ni++,Od[ni]=e.current,e.current=t}var Jr={},Dt=no(Jr),Qt=no(!1),bo=Jr;function Si(e,t){var n=e.type.contextTypes;if(!n)return Jr;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var o={},i;for(i in n)o[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function en(e){return e=e.childContextTypes,e!=null}function Pl(){Ke(Qt),Ke(Dt)}function rm(e,t,n){if(Dt.current!==Jr)throw Error(ne(168));Ve(Dt,t),Ve(Qt,n)}function k0(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var o in r)if(!(o in t))throw Error(ne(108,PS(e)||"Unknown",o));return nt({},n,r)}function Fl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Jr,bo=Dt.current,Ve(Dt,e),Ve(Qt,Qt.current),!0}function om(e,t,n){var r=e.stateNode;if(!r)throw Error(ne(169));n?(e=k0(e,t,bo),r.__reactInternalMemoizedMergedChildContext=e,Ke(Qt),Ke(Dt),Ve(Dt,e)):Ke(Qt),Ve(Qt,n)}var hr=null,du=!1,Cc=!1;function E0(e){hr===null?hr=[e]:hr.push(e)}function Kk(e){du=!0,E0(e)}function ro(){if(!Cc&&hr!==null){Cc=!0;var e=0,t=Ne;try{var n=hr;for(Ne=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}hr=null,du=!1}catch(o){throw hr!==null&&(hr=hr.slice(e+1)),Gv(Vf,ro),o}finally{Ne=t,Cc=!1}}return null}var ri=[],oi=0,_l=null,Ml=0,En=[],Cn=0,So=null,gr=1,yr="";function fo(e,t){ri[oi++]=Ml,ri[oi++]=_l,_l=e,Ml=t}function C0(e,t,n){En[Cn++]=gr,En[Cn++]=yr,En[Cn++]=So,So=e;var r=gr;e=yr;var o=32-Bn(r)-1;r&=~(1<<o),n+=1;var i=32-Bn(t)+o;if(30<i){var s=o-o%5;i=(r&(1<<s)-1).toString(32),r>>=s,o-=s,gr=1<<32-Bn(t)+o|n<<o|r,yr=i+e}else gr=1<<i|n<<o|r,yr=e}function Jf(e){e.return!==null&&(fo(e,1),C0(e,1,0))}function Qf(e){for(;e===_l;)_l=ri[--oi],ri[oi]=null,Ml=ri[--oi],ri[oi]=null;for(;e===So;)So=En[--Cn],En[Cn]=null,yr=En[--Cn],En[Cn]=null,gr=En[--Cn],En[Cn]=null}var fn=null,dn=null,Ge=!1,On=null;function I0(e,t){var n=Tn(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function im(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,fn=e,dn=Ur(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,fn=e,dn=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=So!==null?{id:gr,overflow:yr}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Tn(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,fn=e,dn=null,!0):!1;default:return!1}}function Bd(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Wd(e){if(Ge){var t=dn;if(t){var n=t;if(!im(e,t)){if(Bd(e))throw Error(ne(418));t=Ur(n.nextSibling);var r=fn;t&&im(e,t)?I0(r,n):(e.flags=e.flags&-4097|2,Ge=!1,fn=e)}}else{if(Bd(e))throw Error(ne(418));e.flags=e.flags&-4097|2,Ge=!1,fn=e}}}function sm(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;fn=e}function Ta(e){if(e!==fn)return!1;if(!Ge)return sm(e),Ge=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Ld(e.type,e.memoizedProps)),t&&(t=dn)){if(Bd(e))throw T0(),Error(ne(418));for(;t;)I0(e,t),t=Ur(t.nextSibling)}if(sm(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(ne(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){dn=Ur(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}dn=null}}else dn=fn?Ur(e.stateNode.nextSibling):null;return!0}function T0(){for(var e=dn;e;)e=Ur(e.nextSibling)}function ki(){dn=fn=null,Ge=!1}function ep(e){On===null?On=[e]:On.push(e)}var Yk=Er.ReactCurrentBatchConfig;function Xi(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(ne(309));var r=n.stateNode}if(!r)throw Error(ne(147,e));var o=r,i=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===i?t.ref:(t=function(s){var a=o.refs;s===null?delete a[i]:a[i]=s},t._stringRef=i,t)}if(typeof e!="string")throw Error(ne(284));if(!n._owner)throw Error(ne(290,e))}return e}function Ra(e,t){throw e=Object.prototype.toString.call(t),Error(ne(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function am(e){var t=e._init;return t(e._payload)}function R0(e){function t(h,y){if(e){var v=h.deletions;v===null?(h.deletions=[y],h.flags|=16):v.push(y)}}function n(h,y){if(!e)return null;for(;y!==null;)t(h,y),y=y.sibling;return null}function r(h,y){for(h=new Map;y!==null;)y.key!==null?h.set(y.key,y):h.set(y.index,y),y=y.sibling;return h}function o(h,y){return h=Gr(h,y),h.index=0,h.sibling=null,h}function i(h,y,v){return h.index=v,e?(v=h.alternate,v!==null?(v=v.index,v<y?(h.flags|=2,y):v):(h.flags|=2,y)):(h.flags|=1048576,y)}function s(h){return e&&h.alternate===null&&(h.flags|=2),h}function a(h,y,v,S){return y===null||y.tag!==6?(y=_c(v,h.mode,S),y.return=h,y):(y=o(y,v),y.return=h,y)}function l(h,y,v,S){var b=v.type;return b===qo?f(h,y,v.props.children,S,v.key):y!==null&&(y.elementType===b||typeof b=="object"&&b!==null&&b.$$typeof===Ar&&am(b)===y.type)?(S=o(y,v.props),S.ref=Xi(h,y,v),S.return=h,S):(S=ml(v.type,v.key,v.props,null,h.mode,S),S.ref=Xi(h,y,v),S.return=h,S)}function c(h,y,v,S){return y===null||y.tag!==4||y.stateNode.containerInfo!==v.containerInfo||y.stateNode.implementation!==v.implementation?(y=Mc(v,h.mode,S),y.return=h,y):(y=o(y,v.children||[]),y.return=h,y)}function f(h,y,v,S,b){return y===null||y.tag!==7?(y=xo(v,h.mode,S,b),y.return=h,y):(y=o(y,v),y.return=h,y)}function p(h,y,v){if(typeof y=="string"&&y!==""||typeof y=="number")return y=_c(""+y,h.mode,v),y.return=h,y;if(typeof y=="object"&&y!==null){switch(y.$$typeof){case ya:return v=ml(y.type,y.key,y.props,null,h.mode,v),v.ref=Xi(h,null,y),v.return=h,v;case Xo:return y=Mc(y,h.mode,v),y.return=h,y;case Ar:var S=y._init;return p(h,S(y._payload),v)}if(us(y)||Ui(y))return y=xo(y,h.mode,v,null),y.return=h,y;Ra(h,y)}return null}function m(h,y,v,S){var b=y!==null?y.key:null;if(typeof v=="string"&&v!==""||typeof v=="number")return b!==null?null:a(h,y,""+v,S);if(typeof v=="object"&&v!==null){switch(v.$$typeof){case ya:return v.key===b?l(h,y,v,S):null;case Xo:return v.key===b?c(h,y,v,S):null;case Ar:return b=v._init,m(h,y,b(v._payload),S)}if(us(v)||Ui(v))return b!==null?null:f(h,y,v,S,null);Ra(h,v)}return null}function g(h,y,v,S,b){if(typeof S=="string"&&S!==""||typeof S=="number")return h=h.get(v)||null,a(y,h,""+S,b);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case ya:return h=h.get(S.key===null?v:S.key)||null,l(y,h,S,b);case Xo:return h=h.get(S.key===null?v:S.key)||null,c(y,h,S,b);case Ar:var E=S._init;return g(h,y,v,E(S._payload),b)}if(us(S)||Ui(S))return h=h.get(v)||null,f(y,h,S,b,null);Ra(y,S)}return null}function w(h,y,v,S){for(var b=null,E=null,I=y,T=y=0,j=null;I!==null&&T<v.length;T++){I.index>T?(j=I,I=null):j=I.sibling;var _=m(h,I,v[T],S);if(_===null){I===null&&(I=j);break}e&&I&&_.alternate===null&&t(h,I),y=i(_,y,T),E===null?b=_:E.sibling=_,E=_,I=j}if(T===v.length)return n(h,I),Ge&&fo(h,T),b;if(I===null){for(;T<v.length;T++)I=p(h,v[T],S),I!==null&&(y=i(I,y,T),E===null?b=I:E.sibling=I,E=I);return Ge&&fo(h,T),b}for(I=r(h,I);T<v.length;T++)j=g(I,h,T,v[T],S),j!==null&&(e&&j.alternate!==null&&I.delete(j.key===null?T:j.key),y=i(j,y,T),E===null?b=j:E.sibling=j,E=j);return e&&I.forEach(function(N){return t(h,N)}),Ge&&fo(h,T),b}function x(h,y,v,S){var b=Ui(v);if(typeof b!="function")throw Error(ne(150));if(v=b.call(v),v==null)throw Error(ne(151));for(var E=b=null,I=y,T=y=0,j=null,_=v.next();I!==null&&!_.done;T++,_=v.next()){I.index>T?(j=I,I=null):j=I.sibling;var N=m(h,I,_.value,S);if(N===null){I===null&&(I=j);break}e&&I&&N.alternate===null&&t(h,I),y=i(N,y,T),E===null?b=N:E.sibling=N,E=N,I=j}if(_.done)return n(h,I),Ge&&fo(h,T),b;if(I===null){for(;!_.done;T++,_=v.next())_=p(h,_.value,S),_!==null&&(y=i(_,y,T),E===null?b=_:E.sibling=_,E=_);return Ge&&fo(h,T),b}for(I=r(h,I);!_.done;T++,_=v.next())_=g(I,h,T,_.value,S),_!==null&&(e&&_.alternate!==null&&I.delete(_.key===null?T:_.key),y=i(_,y,T),E===null?b=_:E.sibling=_,E=_);return e&&I.forEach(function(W){return t(h,W)}),Ge&&fo(h,T),b}function k(h,y,v,S){if(typeof v=="object"&&v!==null&&v.type===qo&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case ya:e:{for(var b=v.key,E=y;E!==null;){if(E.key===b){if(b=v.type,b===qo){if(E.tag===7){n(h,E.sibling),y=o(E,v.props.children),y.return=h,h=y;break e}}else if(E.elementType===b||typeof b=="object"&&b!==null&&b.$$typeof===Ar&&am(b)===E.type){n(h,E.sibling),y=o(E,v.props),y.ref=Xi(h,E,v),y.return=h,h=y;break e}n(h,E);break}else t(h,E);E=E.sibling}v.type===qo?(y=xo(v.props.children,h.mode,S,v.key),y.return=h,h=y):(S=ml(v.type,v.key,v.props,null,h.mode,S),S.ref=Xi(h,y,v),S.return=h,h=S)}return s(h);case Xo:e:{for(E=v.key;y!==null;){if(y.key===E)if(y.tag===4&&y.stateNode.containerInfo===v.containerInfo&&y.stateNode.implementation===v.implementation){n(h,y.sibling),y=o(y,v.children||[]),y.return=h,h=y;break e}else{n(h,y);break}else t(h,y);y=y.sibling}y=Mc(v,h.mode,S),y.return=h,h=y}return s(h);case Ar:return E=v._init,k(h,y,E(v._payload),S)}if(us(v))return w(h,y,v,S);if(Ui(v))return x(h,y,v,S);Ra(h,v)}return typeof v=="string"&&v!==""||typeof v=="number"?(v=""+v,y!==null&&y.tag===6?(n(h,y.sibling),y=o(y,v),y.return=h,h=y):(n(h,y),y=_c(v,h.mode,S),y.return=h,h=y),s(h)):n(h,y)}return k}var Ei=R0(!0),j0=R0(!1),$l=no(null),Al=null,ii=null,tp=null;function np(){tp=ii=Al=null}function rp(e){var t=$l.current;Ke($l),e._currentValue=t}function Vd(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function gi(e,t){Al=e,tp=ii=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Jt=!0),e.firstContext=null)}function Pn(e){var t=e._currentValue;if(tp!==e)if(e={context:e,memoizedValue:t,next:null},ii===null){if(Al===null)throw Error(ne(308));ii=e,Al.dependencies={lanes:0,firstContext:e}}else ii=ii.next=e;return t}var mo=null;function op(e){mo===null?mo=[e]:mo.push(e)}function P0(e,t,n,r){var o=t.interleaved;return o===null?(n.next=n,op(t)):(n.next=o.next,o.next=n),t.interleaved=n,Sr(e,r)}function Sr(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Nr=!1;function ip(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function F0(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function wr(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Zr(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,_e&2){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,Sr(e,n)}return o=r.interleaved,o===null?(t.next=t,op(r)):(t.next=o.next,o.next=t),r.interleaved=t,Sr(e,n)}function ul(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Hf(e,n)}}function lm(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var o=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?o=i=s:i=i.next=s,n=n.next}while(n!==null);i===null?o=i=t:i=i.next=t}else o=i=t;n={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Nl(e,t,n,r){var o=e.updateQueue;Nr=!1;var i=o.firstBaseUpdate,s=o.lastBaseUpdate,a=o.shared.pending;if(a!==null){o.shared.pending=null;var l=a,c=l.next;l.next=null,s===null?i=c:s.next=c,s=l;var f=e.alternate;f!==null&&(f=f.updateQueue,a=f.lastBaseUpdate,a!==s&&(a===null?f.firstBaseUpdate=c:a.next=c,f.lastBaseUpdate=l))}if(i!==null){var p=o.baseState;s=0,f=c=l=null,a=i;do{var m=a.lane,g=a.eventTime;if((r&m)===m){f!==null&&(f=f.next={eventTime:g,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var w=e,x=a;switch(m=t,g=n,x.tag){case 1:if(w=x.payload,typeof w=="function"){p=w.call(g,p,m);break e}p=w;break e;case 3:w.flags=w.flags&-65537|128;case 0:if(w=x.payload,m=typeof w=="function"?w.call(g,p,m):w,m==null)break e;p=nt({},p,m);break e;case 2:Nr=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,m=o.effects,m===null?o.effects=[a]:m.push(a))}else g={eventTime:g,lane:m,tag:a.tag,payload:a.payload,callback:a.callback,next:null},f===null?(c=f=g,l=p):f=f.next=g,s|=m;if(a=a.next,a===null){if(a=o.shared.pending,a===null)break;m=a,a=m.next,m.next=null,o.lastBaseUpdate=m,o.shared.pending=null}}while(!0);if(f===null&&(l=p),o.baseState=l,o.firstBaseUpdate=c,o.lastBaseUpdate=f,t=o.shared.interleaved,t!==null){o=t;do s|=o.lane,o=o.next;while(o!==t)}else i===null&&(o.shared.lanes=0);Eo|=s,e.lanes=s,e.memoizedState=p}}function um(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],o=r.callback;if(o!==null){if(r.callback=null,r=n,typeof o!="function")throw Error(ne(191,o));o.call(r)}}}var ea={},or=no(ea),Ls=no(ea),zs=no(ea);function go(e){if(e===ea)throw Error(ne(174));return e}function sp(e,t){switch(Ve(zs,t),Ve(Ls,e),Ve(or,ea),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:kd(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=kd(t,e)}Ke(or),Ve(or,t)}function Ci(){Ke(or),Ke(Ls),Ke(zs)}function _0(e){go(zs.current);var t=go(or.current),n=kd(t,e.type);t!==n&&(Ve(Ls,e),Ve(or,n))}function ap(e){Ls.current===e&&(Ke(or),Ke(Ls))}var et=no(0);function Ll(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Ic=[];function lp(){for(var e=0;e<Ic.length;e++)Ic[e]._workInProgressVersionPrimary=null;Ic.length=0}var cl=Er.ReactCurrentDispatcher,Tc=Er.ReactCurrentBatchConfig,ko=0,tt=null,yt=null,bt=null,zl=!1,xs=!1,Ds=0,Gk=0;function $t(){throw Error(ne(321))}function up(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Vn(e[n],t[n]))return!1;return!0}function cp(e,t,n,r,o,i){if(ko=i,tt=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,cl.current=e===null||e.memoizedState===null?Qk:eE,e=n(r,o),xs){i=0;do{if(xs=!1,Ds=0,25<=i)throw Error(ne(301));i+=1,bt=yt=null,t.updateQueue=null,cl.current=tE,e=n(r,o)}while(xs)}if(cl.current=Dl,t=yt!==null&&yt.next!==null,ko=0,bt=yt=tt=null,zl=!1,t)throw Error(ne(300));return e}function dp(){var e=Ds!==0;return Ds=0,e}function Jn(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return bt===null?tt.memoizedState=bt=e:bt=bt.next=e,bt}function Fn(){if(yt===null){var e=tt.alternate;e=e!==null?e.memoizedState:null}else e=yt.next;var t=bt===null?tt.memoizedState:bt.next;if(t!==null)bt=t,yt=e;else{if(e===null)throw Error(ne(310));yt=e,e={memoizedState:yt.memoizedState,baseState:yt.baseState,baseQueue:yt.baseQueue,queue:yt.queue,next:null},bt===null?tt.memoizedState=bt=e:bt=bt.next=e}return bt}function Os(e,t){return typeof t=="function"?t(e):t}function Rc(e){var t=Fn(),n=t.queue;if(n===null)throw Error(ne(311));n.lastRenderedReducer=e;var r=yt,o=r.baseQueue,i=n.pending;if(i!==null){if(o!==null){var s=o.next;o.next=i.next,i.next=s}r.baseQueue=o=i,n.pending=null}if(o!==null){i=o.next,r=r.baseState;var a=s=null,l=null,c=i;do{var f=c.lane;if((ko&f)===f)l!==null&&(l=l.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),r=c.hasEagerState?c.eagerState:e(r,c.action);else{var p={lane:f,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};l===null?(a=l=p,s=r):l=l.next=p,tt.lanes|=f,Eo|=f}c=c.next}while(c!==null&&c!==i);l===null?s=r:l.next=a,Vn(r,t.memoizedState)||(Jt=!0),t.memoizedState=r,t.baseState=s,t.baseQueue=l,n.lastRenderedState=r}if(e=n.interleaved,e!==null){o=e;do i=o.lane,tt.lanes|=i,Eo|=i,o=o.next;while(o!==e)}else o===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function jc(e){var t=Fn(),n=t.queue;if(n===null)throw Error(ne(311));n.lastRenderedReducer=e;var r=n.dispatch,o=n.pending,i=t.memoizedState;if(o!==null){n.pending=null;var s=o=o.next;do i=e(i,s.action),s=s.next;while(s!==o);Vn(i,t.memoizedState)||(Jt=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function M0(){}function $0(e,t){var n=tt,r=Fn(),o=t(),i=!Vn(r.memoizedState,o);if(i&&(r.memoizedState=o,Jt=!0),r=r.queue,fp(L0.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||bt!==null&&bt.memoizedState.tag&1){if(n.flags|=2048,Bs(9,N0.bind(null,n,r,o,t),void 0,null),St===null)throw Error(ne(349));ko&30||A0(n,t,o)}return o}function A0(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=tt.updateQueue,t===null?(t={lastEffect:null,stores:null},tt.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function N0(e,t,n,r){t.value=n,t.getSnapshot=r,z0(t)&&D0(e)}function L0(e,t,n){return n(function(){z0(t)&&D0(e)})}function z0(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Vn(e,n)}catch{return!0}}function D0(e){var t=Sr(e,1);t!==null&&Wn(t,e,1,-1)}function cm(e){var t=Jn();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Os,lastRenderedState:e},t.queue=e,e=e.dispatch=Jk.bind(null,tt,e),[t.memoizedState,e]}function Bs(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=tt.updateQueue,t===null?(t={lastEffect:null,stores:null},tt.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function O0(){return Fn().memoizedState}function dl(e,t,n,r){var o=Jn();tt.flags|=e,o.memoizedState=Bs(1|t,n,void 0,r===void 0?null:r)}function fu(e,t,n,r){var o=Fn();r=r===void 0?null:r;var i=void 0;if(yt!==null){var s=yt.memoizedState;if(i=s.destroy,r!==null&&up(r,s.deps)){o.memoizedState=Bs(t,n,i,r);return}}tt.flags|=e,o.memoizedState=Bs(1|t,n,i,r)}function dm(e,t){return dl(8390656,8,e,t)}function fp(e,t){return fu(2048,8,e,t)}function B0(e,t){return fu(4,2,e,t)}function W0(e,t){return fu(4,4,e,t)}function V0(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function H0(e,t,n){return n=n!=null?n.concat([e]):null,fu(4,4,V0.bind(null,t,e),n)}function pp(){}function U0(e,t){var n=Fn();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&up(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Z0(e,t){var n=Fn();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&up(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function K0(e,t,n){return ko&21?(Vn(n,t)||(n=Jv(),tt.lanes|=n,Eo|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Jt=!0),e.memoizedState=n)}function Xk(e,t){var n=Ne;Ne=n!==0&&4>n?n:4,e(!0);var r=Tc.transition;Tc.transition={};try{e(!1),t()}finally{Ne=n,Tc.transition=r}}function Y0(){return Fn().memoizedState}function qk(e,t,n){var r=Yr(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},G0(e))X0(t,n);else if(n=P0(e,t,n,r),n!==null){var o=Wt();Wn(n,e,r,o),q0(n,t,r)}}function Jk(e,t,n){var r=Yr(e),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(G0(e))X0(t,o);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var s=t.lastRenderedState,a=i(s,n);if(o.hasEagerState=!0,o.eagerState=a,Vn(a,s)){var l=t.interleaved;l===null?(o.next=o,op(t)):(o.next=l.next,l.next=o),t.interleaved=o;return}}catch{}finally{}n=P0(e,t,o,r),n!==null&&(o=Wt(),Wn(n,e,r,o),q0(n,t,r))}}function G0(e){var t=e.alternate;return e===tt||t!==null&&t===tt}function X0(e,t){xs=zl=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function q0(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Hf(e,n)}}var Dl={readContext:Pn,useCallback:$t,useContext:$t,useEffect:$t,useImperativeHandle:$t,useInsertionEffect:$t,useLayoutEffect:$t,useMemo:$t,useReducer:$t,useRef:$t,useState:$t,useDebugValue:$t,useDeferredValue:$t,useTransition:$t,useMutableSource:$t,useSyncExternalStore:$t,useId:$t,unstable_isNewReconciler:!1},Qk={readContext:Pn,useCallback:function(e,t){return Jn().memoizedState=[e,t===void 0?null:t],e},useContext:Pn,useEffect:dm,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,dl(4194308,4,V0.bind(null,t,e),n)},useLayoutEffect:function(e,t){return dl(4194308,4,e,t)},useInsertionEffect:function(e,t){return dl(4,2,e,t)},useMemo:function(e,t){var n=Jn();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Jn();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=qk.bind(null,tt,e),[r.memoizedState,e]},useRef:function(e){var t=Jn();return e={current:e},t.memoizedState=e},useState:cm,useDebugValue:pp,useDeferredValue:function(e){return Jn().memoizedState=e},useTransition:function(){var e=cm(!1),t=e[0];return e=Xk.bind(null,e[1]),Jn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=tt,o=Jn();if(Ge){if(n===void 0)throw Error(ne(407));n=n()}else{if(n=t(),St===null)throw Error(ne(349));ko&30||A0(r,t,n)}o.memoizedState=n;var i={value:n,getSnapshot:t};return o.queue=i,dm(L0.bind(null,r,i,e),[e]),r.flags|=2048,Bs(9,N0.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Jn(),t=St.identifierPrefix;if(Ge){var n=yr,r=gr;n=(r&~(1<<32-Bn(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Ds++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=Gk++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},eE={readContext:Pn,useCallback:U0,useContext:Pn,useEffect:fp,useImperativeHandle:H0,useInsertionEffect:B0,useLayoutEffect:W0,useMemo:Z0,useReducer:Rc,useRef:O0,useState:function(){return Rc(Os)},useDebugValue:pp,useDeferredValue:function(e){var t=Fn();return K0(t,yt.memoizedState,e)},useTransition:function(){var e=Rc(Os)[0],t=Fn().memoizedState;return[e,t]},useMutableSource:M0,useSyncExternalStore:$0,useId:Y0,unstable_isNewReconciler:!1},tE={readContext:Pn,useCallback:U0,useContext:Pn,useEffect:fp,useImperativeHandle:H0,useInsertionEffect:B0,useLayoutEffect:W0,useMemo:Z0,useReducer:jc,useRef:O0,useState:function(){return jc(Os)},useDebugValue:pp,useDeferredValue:function(e){var t=Fn();return yt===null?t.memoizedState=e:K0(t,yt.memoizedState,e)},useTransition:function(){var e=jc(Os)[0],t=Fn().memoizedState;return[e,t]},useMutableSource:M0,useSyncExternalStore:$0,useId:Y0,unstable_isNewReconciler:!1};function zn(e,t){if(e&&e.defaultProps){t=nt({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Hd(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:nt({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var pu={isMounted:function(e){return(e=e._reactInternals)?Po(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Wt(),o=Yr(e),i=wr(r,o);i.payload=t,n!=null&&(i.callback=n),t=Zr(e,i,o),t!==null&&(Wn(t,e,o,r),ul(t,e,o))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Wt(),o=Yr(e),i=wr(r,o);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Zr(e,i,o),t!==null&&(Wn(t,e,o,r),ul(t,e,o))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Wt(),r=Yr(e),o=wr(n,r);o.tag=2,t!=null&&(o.callback=t),t=Zr(e,o,r),t!==null&&(Wn(t,e,r,n),ul(t,e,r))}};function fm(e,t,n,r,o,i,s){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,i,s):t.prototype&&t.prototype.isPureReactComponent?!Ms(n,r)||!Ms(o,i):!0}function J0(e,t,n){var r=!1,o=Jr,i=t.contextType;return typeof i=="object"&&i!==null?i=Pn(i):(o=en(t)?bo:Dt.current,r=t.contextTypes,i=(r=r!=null)?Si(e,o):Jr),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=pu,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=o,e.__reactInternalMemoizedMaskedChildContext=i),t}function pm(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&pu.enqueueReplaceState(t,t.state,null)}function Ud(e,t,n,r){var o=e.stateNode;o.props=n,o.state=e.memoizedState,o.refs={},ip(e);var i=t.contextType;typeof i=="object"&&i!==null?o.context=Pn(i):(i=en(t)?bo:Dt.current,o.context=Si(e,i)),o.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(Hd(e,t,i,n),o.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof o.getSnapshotBeforeUpdate=="function"||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(t=o.state,typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount(),t!==o.state&&pu.enqueueReplaceState(o,o.state,null),Nl(e,n,o,r),o.state=e.memoizedState),typeof o.componentDidMount=="function"&&(e.flags|=4194308)}function Ii(e,t){try{var n="",r=t;do n+=jS(r),r=r.return;while(r);var o=n}catch(i){o=`
39
39
  Error generating stack: `+i.message+`
40
- `+i.stack}return{value:e,source:t,stack:o,digest:null}}function Tc(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Hd(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var qk=typeof WeakMap=="function"?WeakMap:Map;function Y0(e,t,n){n=wr(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Ol||(Ol=!0,ef=r),Hd(e,t)},n}function G0(e,t,n){n=wr(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var o=t.value;n.payload=function(){return r(o)},n.callback=function(){Hd(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){Hd(e,t),typeof r!="function"&&(Kr===null?Kr=new Set([this]):Kr.add(this));var s=t.stack;this.componentDidCatch(t.value,{componentStack:s!==null?s:""})}),n}function dm(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new qk;var o=new Set;r.set(t,o)}else o=r.get(t),o===void 0&&(o=new Set,r.set(t,o));o.has(n)||(o.add(n),e=dE.bind(null,e,t,n),t.then(e,e))}function fm(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function pm(e,t,n,r,o){return e.mode&1?(e.flags|=65536,e.lanes=o,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=wr(-1,1),t.tag=2,Zr(n,t,1))),n.lanes|=1),e)}var Jk=Er.ReactCurrentOwner,Jt=!1;function Bt(e,t,n,r){t.child=e===null?E0(t,null,n,r):Ei(t,e.child,n,r)}function hm(e,t,n,r,o){n=n.render;var i=t.ref;return gi(t,o),r=lp(e,t,n,r,i,o),n=up(),e!==null&&!Jt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,kr(e,t,o)):(Ge&&n&&Xf(t),t.flags|=1,Bt(e,t,r,o),t.child)}function mm(e,t,n,r,o){if(e===null){var i=n.type;return typeof i=="function"&&!wp(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,X0(e,t,i,r,o)):(e=hl(n.type,null,r,t,t.mode,o),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&o)){var s=i.memoizedProps;if(n=n.compare,n=n!==null?n:Ms,n(s,r)&&e.ref===t.ref)return kr(e,t,o)}return t.flags|=1,e=Gr(i,r),e.ref=t.ref,e.return=t,t.child=e}function X0(e,t,n,r,o){if(e!==null){var i=e.memoizedProps;if(Ms(i,r)&&e.ref===t.ref)if(Jt=!1,t.pendingProps=r=i,(e.lanes&o)!==0)e.flags&131072&&(Jt=!0);else return t.lanes=e.lanes,kr(e,t,o)}return Ud(e,t,n,r,o)}function q0(e,t,n){var r=t.pendingProps,o=r.children,i=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ve(ai,cn),cn|=n;else{if(!(n&1073741824))return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Ve(ai,cn),cn|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,Ve(ai,cn),cn|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,Ve(ai,cn),cn|=r;return Bt(e,t,o,n),t.child}function J0(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Ud(e,t,n,r,o){var i=en(n)?xo:Dt.current;return i=Si(t,i),gi(t,o),n=lp(e,t,n,r,i,o),r=up(),e!==null&&!Jt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,kr(e,t,o)):(Ge&&r&&Xf(t),t.flags|=1,Bt(e,t,n,o),t.child)}function gm(e,t,n,r,o){if(en(n)){var i=!0;Pl(t)}else i=!1;if(gi(t,o),t.stateNode===null)dl(e,t),K0(t,n,r),Vd(t,n,r,o),r=!0;else if(e===null){var s=t.stateNode,a=t.memoizedProps;s.props=a;var l=s.context,c=n.contextType;typeof c=="object"&&c!==null?c=Pn(c):(c=en(n)?xo:Dt.current,c=Si(t,c));var f=n.getDerivedStateFromProps,p=typeof f=="function"||typeof s.getSnapshotBeforeUpdate=="function";p||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(a!==r||l!==c)&&cm(t,s,r,c),Nr=!1;var m=t.memoizedState;s.state=m,Al(t,r,s,o),l=t.memoizedState,a!==r||m!==l||Qt.current||Nr?(typeof f=="function"&&(Wd(t,n,f,r),l=t.memoizedState),(a=Nr||um(t,n,a,r,m,l,c))?(p||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount()),typeof s.componentDidMount=="function"&&(t.flags|=4194308)):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),s.props=r,s.state=l,s.context=c,r=a):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{s=t.stateNode,I0(e,t),a=t.memoizedProps,c=t.type===t.elementType?a:zn(t.type,a),s.props=c,p=t.pendingProps,m=s.context,l=n.contextType,typeof l=="object"&&l!==null?l=Pn(l):(l=en(n)?xo:Dt.current,l=Si(t,l));var g=n.getDerivedStateFromProps;(f=typeof g=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(a!==p||m!==l)&&cm(t,s,r,l),Nr=!1,m=t.memoizedState,s.state=m,Al(t,r,s,o);var w=t.memoizedState;a!==p||m!==w||Qt.current||Nr?(typeof g=="function"&&(Wd(t,n,g,r),w=t.memoizedState),(c=Nr||um(t,n,c,r,m,w,l)||!1)?(f||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(r,w,l),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(r,w,l)),typeof s.componentDidUpdate=="function"&&(t.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof s.componentDidUpdate!="function"||a===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=w),s.props=r,s.state=w,s.context=l,r=c):(typeof s.componentDidUpdate!="function"||a===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),r=!1)}return Zd(e,t,n,r,i,o)}function Zd(e,t,n,r,o,i){J0(e,t);var s=(t.flags&128)!==0;if(!r&&!s)return o&&tm(t,n,!1),kr(e,t,i);r=t.stateNode,Jk.current=t;var a=s&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&s?(t.child=Ei(t,e.child,null,i),t.child=Ei(t,null,a,i)):Bt(e,t,a,i),t.memoizedState=r.state,o&&tm(t,n,!0),t.child}function Q0(e){var t=e.stateNode;t.pendingContext?em(e,t.pendingContext,t.pendingContext!==t.context):t.context&&em(e,t.context,!1),op(e,t.containerInfo)}function ym(e,t,n,r,o){return ki(),Jf(o),t.flags|=256,Bt(e,t,n,r),t.child}var Kd={dehydrated:null,treeContext:null,retryLane:0};function Yd(e){return{baseLanes:e,cachePool:null,transitions:null}}function ew(e,t,n){var r=t.pendingProps,o=et.current,i=!1,s=(t.flags&128)!==0,a;if((a=s)||(a=e!==null&&e.memoizedState===null?!1:(o&2)!==0),a?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(o|=1),Ve(et,o&1),e===null)return Od(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(s=r.children,e=r.fallback,i?(r=t.mode,i=t.child,s={mode:"hidden",children:s},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=s):i=mu(s,r,0,null),e=wo(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=Yd(n),t.memoizedState=Kd,e):fp(t,s));if(o=e.memoizedState,o!==null&&(a=o.dehydrated,a!==null))return Qk(e,t,s,r,a,o,n);if(i){i=r.fallback,s=t.mode,o=e.child,a=o.sibling;var l={mode:"hidden",children:r.children};return!(s&1)&&t.child!==o?(r=t.child,r.childLanes=0,r.pendingProps=l,t.deletions=null):(r=Gr(o,l),r.subtreeFlags=o.subtreeFlags&14680064),a!==null?i=Gr(a,i):(i=wo(i,s,n,null),i.flags|=2),i.return=t,r.return=t,r.sibling=i,t.child=r,r=i,i=t.child,s=e.child.memoizedState,s=s===null?Yd(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},i.memoizedState=s,i.childLanes=e.childLanes&~n,t.memoizedState=Kd,r}return i=e.child,e=i.sibling,r=Gr(i,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function fp(e,t){return t=mu({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function ja(e,t,n,r){return r!==null&&Jf(r),Ei(t,e.child,null,n),e=fp(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Qk(e,t,n,r,o,i,s){if(n)return t.flags&256?(t.flags&=-257,r=Tc(Error(ne(422))),ja(e,t,s,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,o=t.mode,r=mu({mode:"visible",children:r.children},o,0,null),i=wo(i,o,s,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&Ei(t,e.child,null,s),t.child.memoizedState=Yd(s),t.memoizedState=Kd,i);if(!(t.mode&1))return ja(e,t,s,null);if(o.data==="$!"){if(r=o.nextSibling&&o.nextSibling.dataset,r)var a=r.dgst;return r=a,i=Error(ne(419)),r=Tc(i,r,void 0),ja(e,t,s,r)}if(a=(s&e.childLanes)!==0,Jt||a){if(r=St,r!==null){switch(s&-s){case 4:o=2;break;case 16:o=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:o=32;break;case 536870912:o=268435456;break;default:o=0}o=o&(r.suspendedLanes|s)?0:o,o!==0&&o!==i.retryLane&&(i.retryLane=o,Sr(e,o),Wn(r,e,o,-1))}return vp(),r=Tc(Error(ne(421))),ja(e,t,s,r)}return o.data==="$?"?(t.flags|=128,t.child=e.child,t=fE.bind(null,e),o._reactRetry=t,null):(e=i.treeContext,dn=Ur(o.nextSibling),fn=t,Ge=!0,On=null,e!==null&&(En[Cn++]=gr,En[Cn++]=yr,En[Cn++]=bo,gr=e.id,yr=e.overflow,bo=t),t=fp(t,r.children),t.flags|=4096,t)}function vm(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Bd(e.return,t,n)}function Rc(e,t,n,r,o){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:o}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=o)}function tw(e,t,n){var r=t.pendingProps,o=r.revealOrder,i=r.tail;if(Bt(e,t,r.children,n),r=et.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&vm(e,n,t);else if(e.tag===19)vm(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(Ve(et,r),!(t.mode&1))t.memoizedState=null;else switch(o){case"forwards":for(n=t.child,o=null;n!==null;)e=n.alternate,e!==null&&Nl(e)===null&&(o=n),n=n.sibling;n=o,n===null?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),Rc(t,!1,o,n,i);break;case"backwards":for(n=null,o=t.child,t.child=null;o!==null;){if(e=o.alternate,e!==null&&Nl(e)===null){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}Rc(t,!0,n,null,i);break;case"together":Rc(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function dl(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function kr(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),ko|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(ne(153));if(t.child!==null){for(e=t.child,n=Gr(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Gr(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function eE(e,t,n){switch(t.tag){case 3:Q0(t),ki();break;case 5:T0(t);break;case 1:en(t.type)&&Pl(t);break;case 4:op(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,o=t.memoizedProps.value;Ve(Ml,r._currentValue),r._currentValue=o;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(Ve(et,et.current&1),t.flags|=128,null):n&t.child.childLanes?ew(e,t,n):(Ve(et,et.current&1),e=kr(e,t,n),e!==null?e.sibling:null);Ve(et,et.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return tw(e,t,n);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),Ve(et,et.current),r)break;return null;case 22:case 23:return t.lanes=0,q0(e,t,n)}return kr(e,t,n)}var nw,Gd,rw,ow;nw=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Gd=function(){};rw=function(e,t,n,r){var o=e.memoizedProps;if(o!==r){e=t.stateNode,mo(or.current);var i=null;switch(n){case"input":o=yd(e,o),r=yd(e,r),i=[];break;case"select":o=nt({},o,{value:void 0}),r=nt({},r,{value:void 0}),i=[];break;case"textarea":o=xd(e,o),r=xd(e,r),i=[];break;default:typeof o.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Rl)}Sd(n,r);var s;n=null;for(c in o)if(!r.hasOwnProperty(c)&&o.hasOwnProperty(c)&&o[c]!=null)if(c==="style"){var a=o[c];for(s in a)a.hasOwnProperty(s)&&(n||(n={}),n[s]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(Is.hasOwnProperty(c)?i||(i=[]):(i=i||[]).push(c,null));for(c in r){var l=r[c];if(a=o!=null?o[c]:void 0,r.hasOwnProperty(c)&&l!==a&&(l!=null||a!=null))if(c==="style")if(a){for(s in a)!a.hasOwnProperty(s)||l&&l.hasOwnProperty(s)||(n||(n={}),n[s]="");for(s in l)l.hasOwnProperty(s)&&a[s]!==l[s]&&(n||(n={}),n[s]=l[s])}else n||(i||(i=[]),i.push(c,n)),n=l;else c==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(i=i||[]).push(c,l)):c==="children"?typeof l!="string"&&typeof l!="number"||(i=i||[]).push(c,""+l):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(Is.hasOwnProperty(c)?(l!=null&&c==="onScroll"&&Ue("scroll",e),i||a===l||(i=[])):(i=i||[]).push(c,l))}n&&(i=i||[]).push("style",n);var c=i;(t.updateQueue=c)&&(t.flags|=4)}};ow=function(e,t,n,r){n!==r&&(t.flags|=4)};function qi(e,t){if(!Ge)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function At(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var o=e.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags&14680064,r|=o.flags&14680064,o.return=e,o=o.sibling;else for(o=e.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags,r|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function tE(e,t,n){var r=t.pendingProps;switch(qf(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return At(t),null;case 1:return en(t.type)&&jl(),At(t),null;case 3:return r=t.stateNode,Ci(),Ke(Qt),Ke(Dt),sp(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Ta(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,On!==null&&(rf(On),On=null))),Gd(e,t),At(t),null;case 5:ip(t);var o=mo(zs.current);if(n=t.type,e!==null&&t.stateNode!=null)rw(e,t,n,r,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(ne(166));return At(t),null}if(e=mo(or.current),Ta(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[er]=t,r[Ns]=i,e=(t.mode&1)!==0,n){case"dialog":Ue("cancel",r),Ue("close",r);break;case"iframe":case"object":case"embed":Ue("load",r);break;case"video":case"audio":for(o=0;o<ds.length;o++)Ue(ds[o],r);break;case"source":Ue("error",r);break;case"img":case"image":case"link":Ue("error",r),Ue("load",r);break;case"details":Ue("toggle",r);break;case"input":Th(r,i),Ue("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},Ue("invalid",r);break;case"textarea":jh(r,i),Ue("invalid",r)}Sd(n,i),o=null;for(var s in i)if(i.hasOwnProperty(s)){var a=i[s];s==="children"?typeof a=="string"?r.textContent!==a&&(i.suppressHydrationWarning!==!0&&Ia(r.textContent,a,e),o=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(i.suppressHydrationWarning!==!0&&Ia(r.textContent,a,e),o=["children",""+a]):Is.hasOwnProperty(s)&&a!=null&&s==="onScroll"&&Ue("scroll",r)}switch(n){case"input":va(r),Rh(r,i,!0);break;case"textarea":va(r),Ph(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=Rl)}r=o,t.updateQueue=r,r!==null&&(t.flags|=4)}else{s=o.nodeType===9?o:o.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=_v(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=s.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=s.createElement(n,{is:r.is}):(e=s.createElement(n),n==="select"&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,n),e[er]=t,e[Ns]=r,nw(e,t,!1,!1),t.stateNode=e;e:{switch(s=kd(n,r),n){case"dialog":Ue("cancel",e),Ue("close",e),o=r;break;case"iframe":case"object":case"embed":Ue("load",e),o=r;break;case"video":case"audio":for(o=0;o<ds.length;o++)Ue(ds[o],e);o=r;break;case"source":Ue("error",e),o=r;break;case"img":case"image":case"link":Ue("error",e),Ue("load",e),o=r;break;case"details":Ue("toggle",e),o=r;break;case"input":Th(e,r),o=yd(e,r),Ue("invalid",e);break;case"option":o=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},o=nt({},r,{value:void 0}),Ue("invalid",e);break;case"textarea":jh(e,r),o=xd(e,r),Ue("invalid",e);break;default:o=r}Sd(n,o),a=o;for(i in a)if(a.hasOwnProperty(i)){var l=a[i];i==="style"?Av(e,l):i==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&Mv(e,l)):i==="children"?typeof l=="string"?(n!=="textarea"||l!=="")&&Ts(e,l):typeof l=="number"&&Ts(e,""+l):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(Is.hasOwnProperty(i)?l!=null&&i==="onScroll"&&Ue("scroll",e):l!=null&&Nf(e,i,l,s))}switch(n){case"input":va(e),Rh(e,r,!1);break;case"textarea":va(e),Ph(e);break;case"option":r.value!=null&&e.setAttribute("value",""+qr(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?fi(e,!!r.multiple,i,!1):r.defaultValue!=null&&fi(e,!!r.multiple,r.defaultValue,!0);break;default:typeof o.onClick=="function"&&(e.onclick=Rl)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return At(t),null;case 6:if(e&&t.stateNode!=null)ow(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(ne(166));if(n=mo(zs.current),mo(or.current),Ta(t)){if(r=t.stateNode,n=t.memoizedProps,r[er]=t,(i=r.nodeValue!==n)&&(e=fn,e!==null))switch(e.tag){case 3:Ia(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Ia(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[er]=t,t.stateNode=r}return At(t),null;case 13:if(Ke(et),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Ge&&dn!==null&&t.mode&1&&!(t.flags&128))S0(),ki(),t.flags|=98560,i=!1;else if(i=Ta(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(ne(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(ne(317));i[er]=t}else ki(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;At(t),i=!1}else On!==null&&(rf(On),On=null),i=!0;if(!i)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||et.current&1?vt===0&&(vt=3):vp())),t.updateQueue!==null&&(t.flags|=4),At(t),null);case 4:return Ci(),Gd(e,t),e===null&&$s(t.stateNode.containerInfo),At(t),null;case 10:return tp(t.type._context),At(t),null;case 17:return en(t.type)&&jl(),At(t),null;case 19:if(Ke(et),i=t.memoizedState,i===null)return At(t),null;if(r=(t.flags&128)!==0,s=i.rendering,s===null)if(r)qi(i,!1);else{if(vt!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(s=Nl(e),s!==null){for(t.flags|=128,qi(i,!1),r=s.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)i=n,e=r,i.flags&=14680066,s=i.alternate,s===null?(i.childLanes=0,i.lanes=e,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=s.childLanes,i.lanes=s.lanes,i.child=s.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=s.memoizedProps,i.memoizedState=s.memoizedState,i.updateQueue=s.updateQueue,i.type=s.type,e=s.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return Ve(et,et.current&1|2),t.child}e=e.sibling}i.tail!==null&&ut()>Ti&&(t.flags|=128,r=!0,qi(i,!1),t.lanes=4194304)}else{if(!r)if(e=Nl(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),qi(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!Ge)return At(t),null}else 2*ut()-i.renderingStartTime>Ti&&n!==1073741824&&(t.flags|=128,r=!0,qi(i,!1),t.lanes=4194304);i.isBackwards?(s.sibling=t.child,t.child=s):(n=i.last,n!==null?n.sibling=s:t.child=s,i.last=s)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=ut(),t.sibling=null,n=et.current,Ve(et,r?n&1|2:n&1),t):(At(t),null);case 22:case 23:return yp(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?cn&1073741824&&(At(t),t.subtreeFlags&6&&(t.flags|=8192)):At(t),null;case 24:return null;case 25:return null}throw Error(ne(156,t.tag))}function nE(e,t){switch(qf(t),t.tag){case 1:return en(t.type)&&jl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ci(),Ke(Qt),Ke(Dt),sp(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return ip(t),null;case 13:if(Ke(et),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(ne(340));ki()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ke(et),null;case 4:return Ci(),null;case 10:return tp(t.type._context),null;case 22:case 23:return yp(),null;case 24:return null;default:return null}}var Pa=!1,Lt=!1,rE=typeof WeakSet=="function"?WeakSet:Set,pe=null;function si(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){st(e,t,r)}else n.current=null}function Xd(e,t,n){try{n()}catch(r){st(e,t,r)}}var wm=!1;function oE(e,t){if(Md=Cl,e=u0(),Gf(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var o=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var s=0,a=-1,l=-1,c=0,f=0,p=e,m=null;t:for(;;){for(var g;p!==n||o!==0&&p.nodeType!==3||(a=s+o),p!==i||r!==0&&p.nodeType!==3||(l=s+r),p.nodeType===3&&(s+=p.nodeValue.length),(g=p.firstChild)!==null;)m=p,p=g;for(;;){if(p===e)break t;if(m===n&&++c===o&&(a=s),m===i&&++f===r&&(l=s),(g=p.nextSibling)!==null)break;p=m,m=p.parentNode}p=g}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for($d={focusedElem:e,selectionRange:n},Cl=!1,pe=t;pe!==null;)if(t=pe,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,pe=e;else for(;pe!==null;){t=pe;try{var w=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(w!==null){var x=w.memoizedProps,k=w.memoizedState,h=t.stateNode,y=h.getSnapshotBeforeUpdate(t.elementType===t.type?x:zn(t.type,x),k);h.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var v=t.stateNode.containerInfo;v.nodeType===1?v.textContent="":v.nodeType===9&&v.documentElement&&v.removeChild(v.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(ne(163))}}catch(S){st(t,t.return,S)}if(e=t.sibling,e!==null){e.return=t.return,pe=e;break}pe=t.return}return w=wm,wm=!1,w}function bs(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var o=r=r.next;do{if((o.tag&e)===e){var i=o.destroy;o.destroy=void 0,i!==void 0&&Xd(t,n,i)}o=o.next}while(o!==r)}}function pu(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function qd(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function iw(e){var t=e.alternate;t!==null&&(e.alternate=null,iw(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[er],delete t[Ns],delete t[Ld],delete t[Ok],delete t[Bk])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function sw(e){return e.tag===5||e.tag===3||e.tag===4}function xm(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||sw(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Jd(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Rl));else if(r!==4&&(e=e.child,e!==null))for(Jd(e,t,n),e=e.sibling;e!==null;)Jd(e,t,n),e=e.sibling}function Qd(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Qd(e,t,n),e=e.sibling;e!==null;)Qd(e,t,n),e=e.sibling}var Tt=null,Dn=!1;function Pr(e,t,n){for(n=n.child;n!==null;)aw(e,t,n),n=n.sibling}function aw(e,t,n){if(rr&&typeof rr.onCommitFiberUnmount=="function")try{rr.onCommitFiberUnmount(iu,n)}catch{}switch(n.tag){case 5:Lt||si(n,t);case 6:var r=Tt,o=Dn;Tt=null,Pr(e,t,n),Tt=r,Dn=o,Tt!==null&&(Dn?(e=Tt,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Tt.removeChild(n.stateNode));break;case 18:Tt!==null&&(Dn?(e=Tt,n=n.stateNode,e.nodeType===8?bc(e.parentNode,n):e.nodeType===1&&bc(e,n),Fs(e)):bc(Tt,n.stateNode));break;case 4:r=Tt,o=Dn,Tt=n.stateNode.containerInfo,Dn=!0,Pr(e,t,n),Tt=r,Dn=o;break;case 0:case 11:case 14:case 15:if(!Lt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){o=r=r.next;do{var i=o,s=i.destroy;i=i.tag,s!==void 0&&(i&2||i&4)&&Xd(n,t,s),o=o.next}while(o!==r)}Pr(e,t,n);break;case 1:if(!Lt&&(si(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){st(n,t,a)}Pr(e,t,n);break;case 21:Pr(e,t,n);break;case 22:n.mode&1?(Lt=(r=Lt)||n.memoizedState!==null,Pr(e,t,n),Lt=r):Pr(e,t,n);break;default:Pr(e,t,n)}}function bm(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new rE),t.forEach(function(r){var o=pE.bind(null,e,r);n.has(r)||(n.add(r),r.then(o,o))})}}function Nn(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var o=n[r];try{var i=e,s=t,a=s;e:for(;a!==null;){switch(a.tag){case 5:Tt=a.stateNode,Dn=!1;break e;case 3:Tt=a.stateNode.containerInfo,Dn=!0;break e;case 4:Tt=a.stateNode.containerInfo,Dn=!0;break e}a=a.return}if(Tt===null)throw Error(ne(160));aw(i,s,o),Tt=null,Dn=!1;var l=o.alternate;l!==null&&(l.return=null),o.return=null}catch(c){st(o,t,c)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)lw(t,e),t=t.sibling}function lw(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Nn(t,e),Xn(e),r&4){try{bs(3,e,e.return),pu(3,e)}catch(x){st(e,e.return,x)}try{bs(5,e,e.return)}catch(x){st(e,e.return,x)}}break;case 1:Nn(t,e),Xn(e),r&512&&n!==null&&si(n,n.return);break;case 5:if(Nn(t,e),Xn(e),r&512&&n!==null&&si(n,n.return),e.flags&32){var o=e.stateNode;try{Ts(o,"")}catch(x){st(e,e.return,x)}}if(r&4&&(o=e.stateNode,o!=null)){var i=e.memoizedProps,s=n!==null?n.memoizedProps:i,a=e.type,l=e.updateQueue;if(e.updateQueue=null,l!==null)try{a==="input"&&i.type==="radio"&&i.name!=null&&Pv(o,i),kd(a,s);var c=kd(a,i);for(s=0;s<l.length;s+=2){var f=l[s],p=l[s+1];f==="style"?Av(o,p):f==="dangerouslySetInnerHTML"?Mv(o,p):f==="children"?Ts(o,p):Nf(o,f,p,c)}switch(a){case"input":vd(o,i);break;case"textarea":Fv(o,i);break;case"select":var m=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!i.multiple;var g=i.value;g!=null?fi(o,!!i.multiple,g,!1):m!==!!i.multiple&&(i.defaultValue!=null?fi(o,!!i.multiple,i.defaultValue,!0):fi(o,!!i.multiple,i.multiple?[]:"",!1))}o[Ns]=i}catch(x){st(e,e.return,x)}}break;case 6:if(Nn(t,e),Xn(e),r&4){if(e.stateNode===null)throw Error(ne(162));o=e.stateNode,i=e.memoizedProps;try{o.nodeValue=i}catch(x){st(e,e.return,x)}}break;case 3:if(Nn(t,e),Xn(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Fs(t.containerInfo)}catch(x){st(e,e.return,x)}break;case 4:Nn(t,e),Xn(e);break;case 13:Nn(t,e),Xn(e),o=e.child,o.flags&8192&&(i=o.memoizedState!==null,o.stateNode.isHidden=i,!i||o.alternate!==null&&o.alternate.memoizedState!==null||(mp=ut())),r&4&&bm(e);break;case 22:if(f=n!==null&&n.memoizedState!==null,e.mode&1?(Lt=(c=Lt)||f,Nn(t,e),Lt=c):Nn(t,e),Xn(e),r&8192){if(c=e.memoizedState!==null,(e.stateNode.isHidden=c)&&!f&&e.mode&1)for(pe=e,f=e.child;f!==null;){for(p=pe=f;pe!==null;){switch(m=pe,g=m.child,m.tag){case 0:case 11:case 14:case 15:bs(4,m,m.return);break;case 1:si(m,m.return);var w=m.stateNode;if(typeof w.componentWillUnmount=="function"){r=m,n=m.return;try{t=r,w.props=t.memoizedProps,w.state=t.memoizedState,w.componentWillUnmount()}catch(x){st(r,n,x)}}break;case 5:si(m,m.return);break;case 22:if(m.memoizedState!==null){km(p);continue}}g!==null?(g.return=m,pe=g):km(p)}f=f.sibling}e:for(f=null,p=e;;){if(p.tag===5){if(f===null){f=p;try{o=p.stateNode,c?(i=o.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(a=p.stateNode,l=p.memoizedProps.style,s=l!=null&&l.hasOwnProperty("display")?l.display:null,a.style.display=$v("display",s))}catch(x){st(e,e.return,x)}}}else if(p.tag===6){if(f===null)try{p.stateNode.nodeValue=c?"":p.memoizedProps}catch(x){st(e,e.return,x)}}else if((p.tag!==22&&p.tag!==23||p.memoizedState===null||p===e)&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===e)break e;for(;p.sibling===null;){if(p.return===null||p.return===e)break e;f===p&&(f=null),p=p.return}f===p&&(f=null),p.sibling.return=p.return,p=p.sibling}}break;case 19:Nn(t,e),Xn(e),r&4&&bm(e);break;case 21:break;default:Nn(t,e),Xn(e)}}function Xn(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(sw(n)){var r=n;break e}n=n.return}throw Error(ne(160))}switch(r.tag){case 5:var o=r.stateNode;r.flags&32&&(Ts(o,""),r.flags&=-33);var i=xm(e);Qd(e,i,o);break;case 3:case 4:var s=r.stateNode.containerInfo,a=xm(e);Jd(e,a,s);break;default:throw Error(ne(161))}}catch(l){st(e,e.return,l)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function iE(e,t,n){pe=e,uw(e)}function uw(e,t,n){for(var r=(e.mode&1)!==0;pe!==null;){var o=pe,i=o.child;if(o.tag===22&&r){var s=o.memoizedState!==null||Pa;if(!s){var a=o.alternate,l=a!==null&&a.memoizedState!==null||Lt;a=Pa;var c=Lt;if(Pa=s,(Lt=l)&&!c)for(pe=o;pe!==null;)s=pe,l=s.child,s.tag===22&&s.memoizedState!==null?Em(o):l!==null?(l.return=s,pe=l):Em(o);for(;i!==null;)pe=i,uw(i),i=i.sibling;pe=o,Pa=a,Lt=c}Sm(e)}else o.subtreeFlags&8772&&i!==null?(i.return=o,pe=i):Sm(e)}}function Sm(e){for(;pe!==null;){var t=pe;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Lt||pu(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!Lt)if(n===null)r.componentDidMount();else{var o=t.elementType===t.type?n.memoizedProps:zn(t.type,n.memoizedProps);r.componentDidUpdate(o,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&sm(t,i,r);break;case 3:var s=t.updateQueue;if(s!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}sm(t,s,n)}break;case 5:var a=t.stateNode;if(n===null&&t.flags&4){n=a;var l=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&n.focus();break;case"img":l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var c=t.alternate;if(c!==null){var f=c.memoizedState;if(f!==null){var p=f.dehydrated;p!==null&&Fs(p)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(ne(163))}Lt||t.flags&512&&qd(t)}catch(m){st(t,t.return,m)}}if(t===e){pe=null;break}if(n=t.sibling,n!==null){n.return=t.return,pe=n;break}pe=t.return}}function km(e){for(;pe!==null;){var t=pe;if(t===e){pe=null;break}var n=t.sibling;if(n!==null){n.return=t.return,pe=n;break}pe=t.return}}function Em(e){for(;pe!==null;){var t=pe;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{pu(4,t)}catch(l){st(t,n,l)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var o=t.return;try{r.componentDidMount()}catch(l){st(t,o,l)}}var i=t.return;try{qd(t)}catch(l){st(t,i,l)}break;case 5:var s=t.return;try{qd(t)}catch(l){st(t,s,l)}}}catch(l){st(t,t.return,l)}if(t===e){pe=null;break}var a=t.sibling;if(a!==null){a.return=t.return,pe=a;break}pe=t.return}}var sE=Math.ceil,Dl=Er.ReactCurrentDispatcher,pp=Er.ReactCurrentOwner,jn=Er.ReactCurrentBatchConfig,Fe=0,St=null,pt=null,Rt=0,cn=0,ai=no(0),vt=0,Ws=null,ko=0,hu=0,hp=0,Ss=null,qt=null,mp=0,Ti=1/0,pr=null,Ol=!1,ef=null,Kr=null,Fa=!1,Br=null,Bl=0,ks=0,tf=null,fl=-1,pl=0;function Wt(){return Fe&6?ut():fl!==-1?fl:fl=ut()}function Yr(e){return e.mode&1?Fe&2&&Rt!==0?Rt&-Rt:Vk.transition!==null?(pl===0&&(pl=Kv()),pl):(e=Ne,e!==0||(e=window.event,e=e===void 0?16:e0(e.type)),e):1}function Wn(e,t,n,r){if(50<ks)throw ks=0,tf=null,Error(ne(185));qs(e,n,r),(!(Fe&2)||e!==St)&&(e===St&&(!(Fe&2)&&(hu|=n),vt===4&&zr(e,Rt)),tn(e,r),n===1&&Fe===0&&!(t.mode&1)&&(Ti=ut()+500,cu&&ro()))}function tn(e,t){var n=e.callbackNode;VS(e,t);var r=El(e,e===St?Rt:0);if(r===0)n!==null&&Mh(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&Mh(n),t===1)e.tag===0?Wk(Cm.bind(null,e)):w0(Cm.bind(null,e)),zk(function(){!(Fe&6)&&ro()}),n=null;else{switch(Yv(r)){case 1:n=Bf;break;case 4:n=Uv;break;case 16:n=kl;break;case 536870912:n=Zv;break;default:n=kl}n=yw(n,cw.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function cw(e,t){if(fl=-1,pl=0,Fe&6)throw Error(ne(327));var n=e.callbackNode;if(yi()&&e.callbackNode!==n)return null;var r=El(e,e===St?Rt:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=Wl(e,r);else{t=r;var o=Fe;Fe|=2;var i=fw();(St!==e||Rt!==t)&&(pr=null,Ti=ut()+500,vo(e,t));do try{uE();break}catch(a){dw(e,a)}while(!0);ep(),Dl.current=i,Fe=o,pt!==null?t=0:(St=null,Rt=0,t=vt)}if(t!==0){if(t===2&&(o=Rd(e),o!==0&&(r=o,t=nf(e,o))),t===1)throw n=Ws,vo(e,0),zr(e,r),tn(e,ut()),n;if(t===6)zr(e,r);else{if(o=e.current.alternate,!(r&30)&&!aE(o)&&(t=Wl(e,r),t===2&&(i=Rd(e),i!==0&&(r=i,t=nf(e,i))),t===1))throw n=Ws,vo(e,0),zr(e,r),tn(e,ut()),n;switch(e.finishedWork=o,e.finishedLanes=r,t){case 0:case 1:throw Error(ne(345));case 2:fo(e,qt,pr);break;case 3:if(zr(e,r),(r&130023424)===r&&(t=mp+500-ut(),10<t)){if(El(e,0)!==0)break;if(o=e.suspendedLanes,(o&r)!==r){Wt(),e.pingedLanes|=e.suspendedLanes&o;break}e.timeoutHandle=Nd(fo.bind(null,e,qt,pr),t);break}fo(e,qt,pr);break;case 4:if(zr(e,r),(r&4194240)===r)break;for(t=e.eventTimes,o=-1;0<r;){var s=31-Bn(r);i=1<<s,s=t[s],s>o&&(o=s),r&=~i}if(r=o,r=ut()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*sE(r/1960))-r,10<r){e.timeoutHandle=Nd(fo.bind(null,e,qt,pr),r);break}fo(e,qt,pr);break;case 5:fo(e,qt,pr);break;default:throw Error(ne(329))}}}return tn(e,ut()),e.callbackNode===n?cw.bind(null,e):null}function nf(e,t){var n=Ss;return e.current.memoizedState.isDehydrated&&(vo(e,t).flags|=256),e=Wl(e,t),e!==2&&(t=qt,qt=n,t!==null&&rf(t)),e}function rf(e){qt===null?qt=e:qt.push.apply(qt,e)}function aE(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var o=n[r],i=o.getSnapshot;o=o.value;try{if(!Vn(i(),o))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function zr(e,t){for(t&=~hp,t&=~hu,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Bn(t),r=1<<n;e[n]=-1,t&=~r}}function Cm(e){if(Fe&6)throw Error(ne(327));yi();var t=El(e,0);if(!(t&1))return tn(e,ut()),null;var n=Wl(e,t);if(e.tag!==0&&n===2){var r=Rd(e);r!==0&&(t=r,n=nf(e,r))}if(n===1)throw n=Ws,vo(e,0),zr(e,t),tn(e,ut()),n;if(n===6)throw Error(ne(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,fo(e,qt,pr),tn(e,ut()),null}function gp(e,t){var n=Fe;Fe|=1;try{return e(t)}finally{Fe=n,Fe===0&&(Ti=ut()+500,cu&&ro())}}function Eo(e){Br!==null&&Br.tag===0&&!(Fe&6)&&yi();var t=Fe;Fe|=1;var n=jn.transition,r=Ne;try{if(jn.transition=null,Ne=1,e)return e()}finally{Ne=r,jn.transition=n,Fe=t,!(Fe&6)&&ro()}}function yp(){cn=ai.current,Ke(ai)}function vo(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,Lk(n)),pt!==null)for(n=pt.return;n!==null;){var r=n;switch(qf(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&jl();break;case 3:Ci(),Ke(Qt),Ke(Dt),sp();break;case 5:ip(r);break;case 4:Ci();break;case 13:Ke(et);break;case 19:Ke(et);break;case 10:tp(r.type._context);break;case 22:case 23:yp()}n=n.return}if(St=e,pt=e=Gr(e.current,null),Rt=cn=t,vt=0,Ws=null,hp=hu=ko=0,qt=Ss=null,ho!==null){for(t=0;t<ho.length;t++)if(n=ho[t],r=n.interleaved,r!==null){n.interleaved=null;var o=r.next,i=n.pending;if(i!==null){var s=i.next;i.next=o,r.next=s}n.pending=r}ho=null}return e}function dw(e,t){do{var n=pt;try{if(ep(),ul.current=zl,Ll){for(var r=tt.memoizedState;r!==null;){var o=r.queue;o!==null&&(o.pending=null),r=r.next}Ll=!1}if(So=0,bt=yt=tt=null,xs=!1,Ds=0,pp.current=null,n===null||n.return===null){vt=1,Ws=t,pt=null;break}e:{var i=e,s=n.return,a=n,l=t;if(t=Rt,a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var c=l,f=a,p=f.tag;if(!(f.mode&1)&&(p===0||p===11||p===15)){var m=f.alternate;m?(f.updateQueue=m.updateQueue,f.memoizedState=m.memoizedState,f.lanes=m.lanes):(f.updateQueue=null,f.memoizedState=null)}var g=fm(s);if(g!==null){g.flags&=-257,pm(g,s,a,i,t),g.mode&1&&dm(i,c,t),t=g,l=c;var w=t.updateQueue;if(w===null){var x=new Set;x.add(l),t.updateQueue=x}else w.add(l);break e}else{if(!(t&1)){dm(i,c,t),vp();break e}l=Error(ne(426))}}else if(Ge&&a.mode&1){var k=fm(s);if(k!==null){!(k.flags&65536)&&(k.flags|=256),pm(k,s,a,i,t),Jf(Ii(l,a));break e}}i=l=Ii(l,a),vt!==4&&(vt=2),Ss===null?Ss=[i]:Ss.push(i),i=s;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var h=Y0(i,l,t);im(i,h);break e;case 1:a=l;var y=i.type,v=i.stateNode;if(!(i.flags&128)&&(typeof y.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(Kr===null||!Kr.has(v)))){i.flags|=65536,t&=-t,i.lanes|=t;var S=G0(i,a,t);im(i,S);break e}}i=i.return}while(i!==null)}hw(n)}catch(b){t=b,pt===n&&n!==null&&(pt=n=n.return);continue}break}while(!0)}function fw(){var e=Dl.current;return Dl.current=zl,e===null?zl:e}function vp(){(vt===0||vt===3||vt===2)&&(vt=4),St===null||!(ko&268435455)&&!(hu&268435455)||zr(St,Rt)}function Wl(e,t){var n=Fe;Fe|=2;var r=fw();(St!==e||Rt!==t)&&(pr=null,vo(e,t));do try{lE();break}catch(o){dw(e,o)}while(!0);if(ep(),Fe=n,Dl.current=r,pt!==null)throw Error(ne(261));return St=null,Rt=0,vt}function lE(){for(;pt!==null;)pw(pt)}function uE(){for(;pt!==null&&!$S();)pw(pt)}function pw(e){var t=gw(e.alternate,e,cn);e.memoizedProps=e.pendingProps,t===null?hw(e):pt=t,pp.current=null}function hw(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=nE(n,t),n!==null){n.flags&=32767,pt=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{vt=6,pt=null;return}}else if(n=tE(n,t,cn),n!==null){pt=n;return}if(t=t.sibling,t!==null){pt=t;return}pt=t=e}while(t!==null);vt===0&&(vt=5)}function fo(e,t,n){var r=Ne,o=jn.transition;try{jn.transition=null,Ne=1,cE(e,t,n,r)}finally{jn.transition=o,Ne=r}return null}function cE(e,t,n,r){do yi();while(Br!==null);if(Fe&6)throw Error(ne(327));n=e.finishedWork;var o=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(ne(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(HS(e,i),e===St&&(pt=St=null,Rt=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Fa||(Fa=!0,yw(kl,function(){return yi(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=jn.transition,jn.transition=null;var s=Ne;Ne=1;var a=Fe;Fe|=4,pp.current=null,oE(e,n),lw(n,e),Pk($d),Cl=!!Md,$d=Md=null,e.current=n,iE(n),AS(),Fe=a,Ne=s,jn.transition=i}else e.current=n;if(Fa&&(Fa=!1,Br=e,Bl=o),i=e.pendingLanes,i===0&&(Kr=null),zS(n.stateNode),tn(e,ut()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)o=t[n],r(o.value,{componentStack:o.stack,digest:o.digest});if(Ol)throw Ol=!1,e=ef,ef=null,e;return Bl&1&&e.tag!==0&&yi(),i=e.pendingLanes,i&1?e===tf?ks++:(ks=0,tf=e):ks=0,ro(),null}function yi(){if(Br!==null){var e=Yv(Bl),t=jn.transition,n=Ne;try{if(jn.transition=null,Ne=16>e?16:e,Br===null)var r=!1;else{if(e=Br,Br=null,Bl=0,Fe&6)throw Error(ne(331));var o=Fe;for(Fe|=4,pe=e.current;pe!==null;){var i=pe,s=i.child;if(pe.flags&16){var a=i.deletions;if(a!==null){for(var l=0;l<a.length;l++){var c=a[l];for(pe=c;pe!==null;){var f=pe;switch(f.tag){case 0:case 11:case 15:bs(8,f,i)}var p=f.child;if(p!==null)p.return=f,pe=p;else for(;pe!==null;){f=pe;var m=f.sibling,g=f.return;if(iw(f),f===c){pe=null;break}if(m!==null){m.return=g,pe=m;break}pe=g}}}var w=i.alternate;if(w!==null){var x=w.child;if(x!==null){w.child=null;do{var k=x.sibling;x.sibling=null,x=k}while(x!==null)}}pe=i}}if(i.subtreeFlags&2064&&s!==null)s.return=i,pe=s;else e:for(;pe!==null;){if(i=pe,i.flags&2048)switch(i.tag){case 0:case 11:case 15:bs(9,i,i.return)}var h=i.sibling;if(h!==null){h.return=i.return,pe=h;break e}pe=i.return}}var y=e.current;for(pe=y;pe!==null;){s=pe;var v=s.child;if(s.subtreeFlags&2064&&v!==null)v.return=s,pe=v;else e:for(s=y;pe!==null;){if(a=pe,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:pu(9,a)}}catch(b){st(a,a.return,b)}if(a===s){pe=null;break e}var S=a.sibling;if(S!==null){S.return=a.return,pe=S;break e}pe=a.return}}if(Fe=o,ro(),rr&&typeof rr.onPostCommitFiberRoot=="function")try{rr.onPostCommitFiberRoot(iu,e)}catch{}r=!0}return r}finally{Ne=n,jn.transition=t}}return!1}function Im(e,t,n){t=Ii(n,t),t=Y0(e,t,1),e=Zr(e,t,1),t=Wt(),e!==null&&(qs(e,1,t),tn(e,t))}function st(e,t,n){if(e.tag===3)Im(e,e,n);else for(;t!==null;){if(t.tag===3){Im(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Kr===null||!Kr.has(r))){e=Ii(n,e),e=G0(t,e,1),t=Zr(t,e,1),e=Wt(),t!==null&&(qs(t,1,e),tn(t,e));break}}t=t.return}}function dE(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Wt(),e.pingedLanes|=e.suspendedLanes&n,St===e&&(Rt&n)===n&&(vt===4||vt===3&&(Rt&130023424)===Rt&&500>ut()-mp?vo(e,0):hp|=n),tn(e,t)}function mw(e,t){t===0&&(e.mode&1?(t=ba,ba<<=1,!(ba&130023424)&&(ba=4194304)):t=1);var n=Wt();e=Sr(e,t),e!==null&&(qs(e,t,n),tn(e,n))}function fE(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),mw(e,n)}function pE(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,o=e.memoizedState;o!==null&&(n=o.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(ne(314))}r!==null&&r.delete(t),mw(e,n)}var gw;gw=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Qt.current)Jt=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Jt=!1,eE(e,t,n);Jt=!!(e.flags&131072)}else Jt=!1,Ge&&t.flags&1048576&&x0(t,_l,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;dl(e,t),e=t.pendingProps;var o=Si(t,Dt.current);gi(t,n),o=lp(null,t,r,e,o,n);var i=up();return t.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,en(r)?(i=!0,Pl(t)):i=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,rp(t),o.updater=fu,t.stateNode=o,o._reactInternals=t,Vd(t,r,e,n),t=Zd(null,t,r,!0,i,n)):(t.tag=0,Ge&&i&&Xf(t),Bt(null,t,o,n),t=t.child),t;case 16:r=t.elementType;e:{switch(dl(e,t),e=t.pendingProps,o=r._init,r=o(r._payload),t.type=r,o=t.tag=mE(r),e=zn(r,e),o){case 0:t=Ud(null,t,r,e,n);break e;case 1:t=gm(null,t,r,e,n);break e;case 11:t=hm(null,t,r,e,n);break e;case 14:t=mm(null,t,r,zn(r.type,e),n);break e}throw Error(ne(306,r,""))}return t;case 0:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:zn(r,o),Ud(e,t,r,o,n);case 1:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:zn(r,o),gm(e,t,r,o,n);case 3:e:{if(Q0(t),e===null)throw Error(ne(387));r=t.pendingProps,i=t.memoizedState,o=i.element,I0(e,t),Al(t,r,null,n);var s=t.memoizedState;if(r=s.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){o=Ii(Error(ne(423)),t),t=ym(e,t,r,n,o);break e}else if(r!==o){o=Ii(Error(ne(424)),t),t=ym(e,t,r,n,o);break e}else for(dn=Ur(t.stateNode.containerInfo.firstChild),fn=t,Ge=!0,On=null,n=E0(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(ki(),r===o){t=kr(e,t,n);break e}Bt(e,t,r,n)}t=t.child}return t;case 5:return T0(t),e===null&&Od(t),r=t.type,o=t.pendingProps,i=e!==null?e.memoizedProps:null,s=o.children,Ad(r,o)?s=null:i!==null&&Ad(r,i)&&(t.flags|=32),J0(e,t),Bt(e,t,s,n),t.child;case 6:return e===null&&Od(t),null;case 13:return ew(e,t,n);case 4:return op(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ei(t,null,r,n):Bt(e,t,r,n),t.child;case 11:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:zn(r,o),hm(e,t,r,o,n);case 7:return Bt(e,t,t.pendingProps,n),t.child;case 8:return Bt(e,t,t.pendingProps.children,n),t.child;case 12:return Bt(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,o=t.pendingProps,i=t.memoizedProps,s=o.value,Ve(Ml,r._currentValue),r._currentValue=s,i!==null)if(Vn(i.value,s)){if(i.children===o.children&&!Qt.current){t=kr(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var a=i.dependencies;if(a!==null){s=i.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(i.tag===1){l=wr(-1,n&-n),l.tag=2;var c=i.updateQueue;if(c!==null){c=c.shared;var f=c.pending;f===null?l.next=l:(l.next=f.next,f.next=l),c.pending=l}}i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),Bd(i.return,n,t),a.lanes|=n;break}l=l.next}}else if(i.tag===10)s=i.type===t.type?null:i.child;else if(i.tag===18){if(s=i.return,s===null)throw Error(ne(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),Bd(s,n,t),s=i.sibling}else s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===t){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}Bt(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,r=t.pendingProps.children,gi(t,n),o=Pn(o),r=r(o),t.flags|=1,Bt(e,t,r,n),t.child;case 14:return r=t.type,o=zn(r,t.pendingProps),o=zn(r.type,o),mm(e,t,r,o,n);case 15:return X0(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:zn(r,o),dl(e,t),t.tag=1,en(r)?(e=!0,Pl(t)):e=!1,gi(t,n),K0(t,r,o),Vd(t,r,o,n),Zd(null,t,r,!0,e,n);case 19:return tw(e,t,n);case 22:return q0(e,t,n)}throw Error(ne(156,t.tag))};function yw(e,t){return Hv(e,t)}function hE(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Tn(e,t,n,r){return new hE(e,t,n,r)}function wp(e){return e=e.prototype,!(!e||!e.isReactComponent)}function mE(e){if(typeof e=="function")return wp(e)?1:0;if(e!=null){if(e=e.$$typeof,e===zf)return 11;if(e===Df)return 14}return 2}function Gr(e,t){var n=e.alternate;return n===null?(n=Tn(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function hl(e,t,n,r,o,i){var s=2;if(r=e,typeof e=="function")wp(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case qo:return wo(n.children,o,i,t);case Lf:s=8,o|=8;break;case pd:return e=Tn(12,n,t,o|2),e.elementType=pd,e.lanes=i,e;case hd:return e=Tn(13,n,t,o),e.elementType=hd,e.lanes=i,e;case md:return e=Tn(19,n,t,o),e.elementType=md,e.lanes=i,e;case Tv:return mu(n,o,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Cv:s=10;break e;case Iv:s=9;break e;case zf:s=11;break e;case Df:s=14;break e;case Ar:s=16,r=null;break e}throw Error(ne(130,e==null?e:typeof e,""))}return t=Tn(s,n,t,o),t.elementType=e,t.type=r,t.lanes=i,t}function wo(e,t,n,r){return e=Tn(7,e,r,t),e.lanes=n,e}function mu(e,t,n,r){return e=Tn(22,e,r,t),e.elementType=Tv,e.lanes=n,e.stateNode={isHidden:!1},e}function jc(e,t,n){return e=Tn(6,e,null,t),e.lanes=n,e}function Pc(e,t,n){return t=Tn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function gE(e,t,n,r,o){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=cc(0),this.expirationTimes=cc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=cc(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function xp(e,t,n,r,o,i,s,a,l){return e=new gE(e,t,n,a,l),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Tn(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},rp(i),e}function yE(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Xo,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function vw(e){if(!e)return Jr;e=e._reactInternals;e:{if(jo(e)!==e||e.tag!==1)throw Error(ne(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(en(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(ne(171))}if(e.tag===1){var n=e.type;if(en(n))return v0(e,n,t)}return t}function ww(e,t,n,r,o,i,s,a,l){return e=xp(n,r,!0,e,o,i,s,a,l),e.context=vw(null),n=e.current,r=Wt(),o=Yr(n),i=wr(r,o),i.callback=t??null,Zr(n,i,o),e.current.lanes=o,qs(e,o,r),tn(e,r),e}function gu(e,t,n,r){var o=t.current,i=Wt(),s=Yr(o);return n=vw(n),t.context===null?t.context=n:t.pendingContext=n,t=wr(i,s),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Zr(o,t,s),e!==null&&(Wn(e,o,s,i),ll(e,o,s)),s}function Vl(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function Tm(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function bp(e,t){Tm(e,t),(e=e.alternate)&&Tm(e,t)}function vE(){return null}var xw=typeof reportError=="function"?reportError:function(e){console.error(e)};function Sp(e){this._internalRoot=e}yu.prototype.render=Sp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(ne(409));gu(e,t,null,null)};yu.prototype.unmount=Sp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Eo(function(){gu(null,e,null,null)}),t[br]=null}};function yu(e){this._internalRoot=e}yu.prototype.unstable_scheduleHydration=function(e){if(e){var t=qv();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Lr.length&&t!==0&&t<Lr[n].priority;n++);Lr.splice(n,0,e),n===0&&Qv(e)}};function kp(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function vu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Rm(){}function wE(e,t,n,r,o){if(o){if(typeof r=="function"){var i=r;r=function(){var c=Vl(s);i.call(c)}}var s=ww(t,r,e,0,null,!1,!1,"",Rm);return e._reactRootContainer=s,e[br]=s.current,$s(e.nodeType===8?e.parentNode:e),Eo(),s}for(;o=e.lastChild;)e.removeChild(o);if(typeof r=="function"){var a=r;r=function(){var c=Vl(l);a.call(c)}}var l=xp(e,0,!1,null,null,!1,!1,"",Rm);return e._reactRootContainer=l,e[br]=l.current,$s(e.nodeType===8?e.parentNode:e),Eo(function(){gu(t,l,n,r)}),l}function wu(e,t,n,r,o){var i=n._reactRootContainer;if(i){var s=i;if(typeof o=="function"){var a=o;o=function(){var l=Vl(s);a.call(l)}}gu(t,s,e,o)}else s=wE(n,t,e,o,r);return Vl(s)}Gv=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=cs(t.pendingLanes);n!==0&&(Wf(t,n|1),tn(t,ut()),!(Fe&6)&&(Ti=ut()+500,ro()))}break;case 13:Eo(function(){var r=Sr(e,1);if(r!==null){var o=Wt();Wn(r,e,1,o)}}),bp(e,1)}};Vf=function(e){if(e.tag===13){var t=Sr(e,134217728);if(t!==null){var n=Wt();Wn(t,e,134217728,n)}bp(e,134217728)}};Xv=function(e){if(e.tag===13){var t=Yr(e),n=Sr(e,t);if(n!==null){var r=Wt();Wn(n,e,t,r)}bp(e,t)}};qv=function(){return Ne};Jv=function(e,t){var n=Ne;try{return Ne=e,t()}finally{Ne=n}};Cd=function(e,t,n){switch(t){case"input":if(vd(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var o=uu(r);if(!o)throw Error(ne(90));jv(r),vd(r,o)}}}break;case"textarea":Fv(e,n);break;case"select":t=n.value,t!=null&&fi(e,!!n.multiple,t,!1)}};zv=gp;Dv=Eo;var xE={usingClientEntryPoint:!1,Events:[Qs,ti,uu,Nv,Lv,gp]},Ji={findFiberByHostInstance:po,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},bE={bundleType:Ji.bundleType,version:Ji.version,rendererPackageName:Ji.rendererPackageName,rendererConfig:Ji.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Er.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Wv(e),e===null?null:e.stateNode},findFiberByHostInstance:Ji.findFiberByHostInstance||vE,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var _a=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!_a.isDisabled&&_a.supportsFiber)try{iu=_a.inject(bE),rr=_a}catch{}}hn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=xE;hn.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!kp(t))throw Error(ne(200));return yE(e,t,null,n)};hn.createRoot=function(e,t){if(!kp(e))throw Error(ne(299));var n=!1,r="",o=xw;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=xp(e,1,!1,null,null,n,!1,r,o),e[br]=t.current,$s(e.nodeType===8?e.parentNode:e),new Sp(t)};hn.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(ne(188)):(e=Object.keys(e).join(","),Error(ne(268,e)));return e=Wv(t),e=e===null?null:e.stateNode,e};hn.flushSync=function(e){return Eo(e)};hn.hydrate=function(e,t,n){if(!vu(t))throw Error(ne(200));return wu(null,e,t,!0,n)};hn.hydrateRoot=function(e,t,n){if(!kp(e))throw Error(ne(405));var r=n!=null&&n.hydratedSources||null,o=!1,i="",s=xw;if(n!=null&&(n.unstable_strictMode===!0&&(o=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=ww(t,null,e,1,n??null,o,!1,i,s),e[br]=t.current,$s(e),r)for(e=0;e<r.length;e++)n=r[e],o=n._getVersion,o=o(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,o]:t.mutableSourceEagerHydrationData.push(n,o);return new yu(t)};hn.render=function(e,t,n){if(!vu(t))throw Error(ne(200));return wu(null,e,t,!1,n)};hn.unmountComponentAtNode=function(e){if(!vu(e))throw Error(ne(40));return e._reactRootContainer?(Eo(function(){wu(null,null,e,!1,function(){e._reactRootContainer=null,e[br]=null})}),!0):!1};hn.unstable_batchedUpdates=gp;hn.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!vu(n))throw Error(ne(200));if(e==null||e._reactInternals===void 0)throw Error(ne(38));return wu(e,t,n,!1,r)};hn.version="18.3.1-next-f1338f8080-20240426";function bw(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(bw)}catch(e){console.error(e)}}bw(),bv.exports=hn;var of=bv.exports,jm=of;dd.createRoot=jm.createRoot,dd.hydrateRoot=jm.hydrateRoot;var SE=Object.defineProperty,Sw=(e,t)=>{for(var n in t)SE(e,n,{get:t[n],enumerable:!0,configurable:!0,set:r=>t[n]=()=>r})};if(typeof d.createContext!="function"){const e=['Remotion requires React.createContext, but it is "undefined".','If you are in a React Server Component, turn it into a client component by adding "use client" at the top of the file.',"","Before:",' import {useCurrentFrame} from "remotion";',"","After:",' "use client";',' import {useCurrentFrame} from "remotion";'];throw new Error(e.join(`
41
- `))}var Po=d.createContext(!1),sf=({children:e})=>u.jsx(Po.Provider,{value:!0,children:e}),kw=d.createContext({setError:()=>{},clearError:()=>{}}),Pm=()=>{try{return typeof __webpack_module__>"u"?null:__webpack_module__.hot??null}catch{return null}};class kE extends le.Component{constructor(){super(...arguments);Ae(this,"state",{hasError:!1});Ae(this,"hmrStatusHandler",null)}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(n){this.props.onError(n),this.subscribeToHmrReset()}componentDidMount(){this.state.hasError||this.props.onClear()}componentDidUpdate(n,r){r.hasError&&!this.state.hasError&&this.props.onClear()}componentWillUnmount(){this.unsubscribeFromHmrReset()}subscribeToHmrReset(){if(this.hmrStatusHandler)return;const n=Pm();if(!n)return;const r=o=>{o==="idle"&&(this.unsubscribeFromHmrReset(),this.setState({hasError:!1}))};this.hmrStatusHandler=r,n.addStatusHandler(r)}unsubscribeFromHmrReset(){const n=this.hmrStatusHandler;if(!n)return;this.hmrStatusHandler=null;const r=Pm();r&&r.removeStatusHandler(n)}render(){return this.state.hasError?null:this.props.children}}var Mi=d.createContext({compositions:[],folders:[],currentCompositionMetadata:null,canvasContent:null}),ta=d.createContext({registerComposition:()=>{},unregisterComposition:()=>{},registerFolder:()=>{},unregisterFolder:()=>{},setCanvasContent:()=>{},onlyRenderComposition:null}),na=d.createContext({getNonce:()=>0}),ml=0;try{typeof __webpack_module__<"u"&&__webpack_module__.hot&&__webpack_module__.hot.addStatusHandler(e=>{e==="idle"&&ml++})}catch{}var xu=()=>{const t=d.useContext(na).getNonce(),n=d.useRef(t);n.current=t;const r=d.useRef([[ml,t]]),o=d.useCallback(()=>(ml!==r.current[r.current.length-1][0]&&(r.current=[...r.current,[ml,n.current]]),r.current),[r]);return d.useMemo(()=>({get:o}),[o])};function $i(e){return!!e}var Ew=()=>/^([a-zA-Z0-9-\u4E00-\u9FFF])+$/g,Cw=e=>e.match(Ew()),EE=e=>{if(e==null)throw new TypeError("You must pass a name to a <Folder />.");if(typeof e!="string")throw new TypeError(`The "name" you pass into <Folder /> must be a string. Got: ${typeof e}`);if(!Cw(e))throw new Error(`Folder name can only contain a-z, A-Z, 0-9 and -. You passed ${e}`)},CE=`Folder name must match ${String(Ew())}`,af=d.createContext({folderName:null,parentName:null}),IE=e=>{const{name:t,children:n}=e,r=d.useContext(af),{registerFolder:o,unregisterFolder:i}=d.useContext(ta),s=xu(),a=e.stack??null;EE(t);const l=[r.parentName,r.folderName].filter($i),c=l.length===0?null:l.join("/"),f=d.useMemo(()=>({folderName:t,parentName:c}),[t,c]);return d.useEffect(()=>(o(t,c,s.get(),a),()=>{i(t,c)}),[t,r.folderName,c,o,i,s,a]),u.jsx(af.Provider,{value:f,children:n})};function Fm(){return["NOD","E_EN","V"].join("")}var _m=()=>["e","nv"].join(""),Rn=()=>{const e=typeof window<"u"&&window.remotion_isPlayer,t=typeof window<"u"&&typeof window.process<"u"&&typeof window.process.env<"u"&&(window.process[_m()][Fm()]==="test"||window.process[_m()][Fm()]==="production"&&typeof window<"u"&&typeof window.remotion_puppeteerTimeout<"u"),n=typeof window<"u"&&window.remotion_isStudio,r=typeof window<"u"&&window.remotion_isReadOnlyStudio;return{isStudio:n,isRendering:t,isPlayer:e,isReadOnlyStudio:r,isClientSideRendering:!1}},lf="remotion-date:",Vs="remotion-file:",TE=({data:e,indent:t,staticBase:n})=>{let r=!1,o=!1,i=!1,s=!1;try{return{serializedString:JSON.stringify(e,function(l,c){const f=this[l];return f instanceof Date?(r=!0,`${lf}${f.toISOString()}`):f instanceof Map?(i=!0,c):f instanceof Set?(s=!0,c):typeof f=="string"&&n!==null&&f.startsWith(n)?(o=!0,`${Vs}${f.replace(n+"/","")}`):c},t),customDateUsed:r,customFileUsed:o,mapUsed:i,setUsed:s}}catch(a){throw new Error("Could not serialize the passed input props to JSON: "+a.message)}},Iw=e=>JSON.parse(e,(t,n)=>typeof n=="string"&&n.startsWith(lf)?new Date(n.replace(lf,"")):typeof n=="string"&&n.startsWith(Vs)?`${window.remotion_staticBase}/${n.replace(Vs,"")}`:n),RE=e=>Iw(TE({data:e,indent:2,staticBase:window.remotion_staticBase}).serializedString),uf=e=>Rn().isStudio?RE(e):e,Tw=d.createContext(!1),jE=({children:e})=>u.jsx(Tw.Provider,{value:!0,children:e}),Ep=()=>d.useContext(Tw),Fr=({className:e,classPrefix:t,type:n})=>{if(!e)return!1;if(n==="exact"){const r=e.split(" ");return t.some(o=>r.some(i=>i.trim()===o||i.trim().endsWith(`:${o}`)||i.trim().endsWith(`!${o}`)))}return t.some(r=>e.startsWith(r)||e.includes(` ${r}`)||e.includes(`!${r}`)||e.includes(`:${r}`))},PE=(e,t)=>{const{style:n,...r}=e,o=d.useMemo(()=>({position:"absolute",top:Fr({className:r.className,classPrefix:["top-","inset-"],type:"prefix"})?void 0:0,left:Fr({className:r.className,classPrefix:["left-","inset-"],type:"prefix"})?void 0:0,right:Fr({className:r.className,classPrefix:["right-","inset-"],type:"prefix"})?void 0:0,bottom:Fr({className:r.className,classPrefix:["bottom-","inset-"],type:"prefix"})?void 0:0,width:Fr({className:r.className,classPrefix:["w-"],type:"prefix"})?void 0:"100%",height:Fr({className:r.className,classPrefix:["h-"],type:"prefix"})?void 0:"100%",display:Fr({className:r.className,classPrefix:["block","inline-block","inline","flex","inline-flex","flow-root","grid","inline-grid","contents","list-item","hidden"],type:"exact"})?void 0:"flex",flexDirection:Fr({className:r.className,classPrefix:["flex-row","flex-col","flex-row-reverse","flex-col-reverse"],type:"exact"})?void 0:"column",...n}),[r.className,n]);return u.jsx("div",{ref:t,style:o,...r})},Hn=d.forwardRef(PE),FE={transform:"rotate(90deg)"},Mm=40,_E={color:"white",fontSize:14,fontFamily:"sans-serif"},ME={justifyContent:"center",alignItems:"center"},$E=()=>u.jsxs(Hn,{style:ME,id:"remotion-comp-loading",children:[u.jsx("style",{type:"text/css",children:`
40
+ `+i.stack}return{value:e,source:t,stack:o,digest:null}}function Pc(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Zd(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var nE=typeof WeakMap=="function"?WeakMap:Map;function Q0(e,t,n){n=wr(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Bl||(Bl=!0,nf=r),Zd(e,t)},n}function ew(e,t,n){n=wr(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var o=t.value;n.payload=function(){return r(o)},n.callback=function(){Zd(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){Zd(e,t),typeof r!="function"&&(Kr===null?Kr=new Set([this]):Kr.add(this));var s=t.stack;this.componentDidCatch(t.value,{componentStack:s!==null?s:""})}),n}function hm(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new nE;var o=new Set;r.set(t,o)}else o=r.get(t),o===void 0&&(o=new Set,r.set(t,o));o.has(n)||(o.add(n),e=gE.bind(null,e,t,n),t.then(e,e))}function mm(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function gm(e,t,n,r,o){return e.mode&1?(e.flags|=65536,e.lanes=o,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=wr(-1,1),t.tag=2,Zr(n,t,1))),n.lanes|=1),e)}var rE=Er.ReactCurrentOwner,Jt=!1;function Bt(e,t,n,r){t.child=e===null?j0(t,null,n,r):Ei(t,e.child,n,r)}function ym(e,t,n,r,o){n=n.render;var i=t.ref;return gi(t,o),r=cp(e,t,n,r,i,o),n=dp(),e!==null&&!Jt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,kr(e,t,o)):(Ge&&n&&Jf(t),t.flags|=1,Bt(e,t,r,o),t.child)}function vm(e,t,n,r,o){if(e===null){var i=n.type;return typeof i=="function"&&!bp(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,tw(e,t,i,r,o)):(e=ml(n.type,null,r,t,t.mode,o),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&o)){var s=i.memoizedProps;if(n=n.compare,n=n!==null?n:Ms,n(s,r)&&e.ref===t.ref)return kr(e,t,o)}return t.flags|=1,e=Gr(i,r),e.ref=t.ref,e.return=t,t.child=e}function tw(e,t,n,r,o){if(e!==null){var i=e.memoizedProps;if(Ms(i,r)&&e.ref===t.ref)if(Jt=!1,t.pendingProps=r=i,(e.lanes&o)!==0)e.flags&131072&&(Jt=!0);else return t.lanes=e.lanes,kr(e,t,o)}return Kd(e,t,n,r,o)}function nw(e,t,n){var r=t.pendingProps,o=r.children,i=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ve(ai,cn),cn|=n;else{if(!(n&1073741824))return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Ve(ai,cn),cn|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,Ve(ai,cn),cn|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,Ve(ai,cn),cn|=r;return Bt(e,t,o,n),t.child}function rw(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Kd(e,t,n,r,o){var i=en(n)?bo:Dt.current;return i=Si(t,i),gi(t,o),n=cp(e,t,n,r,i,o),r=dp(),e!==null&&!Jt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,kr(e,t,o)):(Ge&&r&&Jf(t),t.flags|=1,Bt(e,t,n,o),t.child)}function wm(e,t,n,r,o){if(en(n)){var i=!0;Fl(t)}else i=!1;if(gi(t,o),t.stateNode===null)fl(e,t),J0(t,n,r),Ud(t,n,r,o),r=!0;else if(e===null){var s=t.stateNode,a=t.memoizedProps;s.props=a;var l=s.context,c=n.contextType;typeof c=="object"&&c!==null?c=Pn(c):(c=en(n)?bo:Dt.current,c=Si(t,c));var f=n.getDerivedStateFromProps,p=typeof f=="function"||typeof s.getSnapshotBeforeUpdate=="function";p||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(a!==r||l!==c)&&pm(t,s,r,c),Nr=!1;var m=t.memoizedState;s.state=m,Nl(t,r,s,o),l=t.memoizedState,a!==r||m!==l||Qt.current||Nr?(typeof f=="function"&&(Hd(t,n,f,r),l=t.memoizedState),(a=Nr||fm(t,n,a,r,m,l,c))?(p||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount()),typeof s.componentDidMount=="function"&&(t.flags|=4194308)):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),s.props=r,s.state=l,s.context=c,r=a):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{s=t.stateNode,F0(e,t),a=t.memoizedProps,c=t.type===t.elementType?a:zn(t.type,a),s.props=c,p=t.pendingProps,m=s.context,l=n.contextType,typeof l=="object"&&l!==null?l=Pn(l):(l=en(n)?bo:Dt.current,l=Si(t,l));var g=n.getDerivedStateFromProps;(f=typeof g=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(a!==p||m!==l)&&pm(t,s,r,l),Nr=!1,m=t.memoizedState,s.state=m,Nl(t,r,s,o);var w=t.memoizedState;a!==p||m!==w||Qt.current||Nr?(typeof g=="function"&&(Hd(t,n,g,r),w=t.memoizedState),(c=Nr||fm(t,n,c,r,m,w,l)||!1)?(f||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(r,w,l),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(r,w,l)),typeof s.componentDidUpdate=="function"&&(t.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof s.componentDidUpdate!="function"||a===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=w),s.props=r,s.state=w,s.context=l,r=c):(typeof s.componentDidUpdate!="function"||a===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),r=!1)}return Yd(e,t,n,r,i,o)}function Yd(e,t,n,r,o,i){rw(e,t);var s=(t.flags&128)!==0;if(!r&&!s)return o&&om(t,n,!1),kr(e,t,i);r=t.stateNode,rE.current=t;var a=s&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&s?(t.child=Ei(t,e.child,null,i),t.child=Ei(t,null,a,i)):Bt(e,t,a,i),t.memoizedState=r.state,o&&om(t,n,!0),t.child}function ow(e){var t=e.stateNode;t.pendingContext?rm(e,t.pendingContext,t.pendingContext!==t.context):t.context&&rm(e,t.context,!1),sp(e,t.containerInfo)}function xm(e,t,n,r,o){return ki(),ep(o),t.flags|=256,Bt(e,t,n,r),t.child}var Gd={dehydrated:null,treeContext:null,retryLane:0};function Xd(e){return{baseLanes:e,cachePool:null,transitions:null}}function iw(e,t,n){var r=t.pendingProps,o=et.current,i=!1,s=(t.flags&128)!==0,a;if((a=s)||(a=e!==null&&e.memoizedState===null?!1:(o&2)!==0),a?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(o|=1),Ve(et,o&1),e===null)return Wd(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(s=r.children,e=r.fallback,i?(r=t.mode,i=t.child,s={mode:"hidden",children:s},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=s):i=gu(s,r,0,null),e=xo(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=Xd(n),t.memoizedState=Gd,e):hp(t,s));if(o=e.memoizedState,o!==null&&(a=o.dehydrated,a!==null))return oE(e,t,s,r,a,o,n);if(i){i=r.fallback,s=t.mode,o=e.child,a=o.sibling;var l={mode:"hidden",children:r.children};return!(s&1)&&t.child!==o?(r=t.child,r.childLanes=0,r.pendingProps=l,t.deletions=null):(r=Gr(o,l),r.subtreeFlags=o.subtreeFlags&14680064),a!==null?i=Gr(a,i):(i=xo(i,s,n,null),i.flags|=2),i.return=t,r.return=t,r.sibling=i,t.child=r,r=i,i=t.child,s=e.child.memoizedState,s=s===null?Xd(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},i.memoizedState=s,i.childLanes=e.childLanes&~n,t.memoizedState=Gd,r}return i=e.child,e=i.sibling,r=Gr(i,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function hp(e,t){return t=gu({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function ja(e,t,n,r){return r!==null&&ep(r),Ei(t,e.child,null,n),e=hp(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function oE(e,t,n,r,o,i,s){if(n)return t.flags&256?(t.flags&=-257,r=Pc(Error(ne(422))),ja(e,t,s,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,o=t.mode,r=gu({mode:"visible",children:r.children},o,0,null),i=xo(i,o,s,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&Ei(t,e.child,null,s),t.child.memoizedState=Xd(s),t.memoizedState=Gd,i);if(!(t.mode&1))return ja(e,t,s,null);if(o.data==="$!"){if(r=o.nextSibling&&o.nextSibling.dataset,r)var a=r.dgst;return r=a,i=Error(ne(419)),r=Pc(i,r,void 0),ja(e,t,s,r)}if(a=(s&e.childLanes)!==0,Jt||a){if(r=St,r!==null){switch(s&-s){case 4:o=2;break;case 16:o=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:o=32;break;case 536870912:o=268435456;break;default:o=0}o=o&(r.suspendedLanes|s)?0:o,o!==0&&o!==i.retryLane&&(i.retryLane=o,Sr(e,o),Wn(r,e,o,-1))}return xp(),r=Pc(Error(ne(421))),ja(e,t,s,r)}return o.data==="$?"?(t.flags|=128,t.child=e.child,t=yE.bind(null,e),o._reactRetry=t,null):(e=i.treeContext,dn=Ur(o.nextSibling),fn=t,Ge=!0,On=null,e!==null&&(En[Cn++]=gr,En[Cn++]=yr,En[Cn++]=So,gr=e.id,yr=e.overflow,So=t),t=hp(t,r.children),t.flags|=4096,t)}function bm(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Vd(e.return,t,n)}function Fc(e,t,n,r,o){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:o}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=o)}function sw(e,t,n){var r=t.pendingProps,o=r.revealOrder,i=r.tail;if(Bt(e,t,r.children,n),r=et.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&bm(e,n,t);else if(e.tag===19)bm(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(Ve(et,r),!(t.mode&1))t.memoizedState=null;else switch(o){case"forwards":for(n=t.child,o=null;n!==null;)e=n.alternate,e!==null&&Ll(e)===null&&(o=n),n=n.sibling;n=o,n===null?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),Fc(t,!1,o,n,i);break;case"backwards":for(n=null,o=t.child,t.child=null;o!==null;){if(e=o.alternate,e!==null&&Ll(e)===null){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}Fc(t,!0,n,null,i);break;case"together":Fc(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function fl(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function kr(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Eo|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(ne(153));if(t.child!==null){for(e=t.child,n=Gr(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Gr(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function iE(e,t,n){switch(t.tag){case 3:ow(t),ki();break;case 5:_0(t);break;case 1:en(t.type)&&Fl(t);break;case 4:sp(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,o=t.memoizedProps.value;Ve($l,r._currentValue),r._currentValue=o;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(Ve(et,et.current&1),t.flags|=128,null):n&t.child.childLanes?iw(e,t,n):(Ve(et,et.current&1),e=kr(e,t,n),e!==null?e.sibling:null);Ve(et,et.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return sw(e,t,n);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),Ve(et,et.current),r)break;return null;case 22:case 23:return t.lanes=0,nw(e,t,n)}return kr(e,t,n)}var aw,qd,lw,uw;aw=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};qd=function(){};lw=function(e,t,n,r){var o=e.memoizedProps;if(o!==r){e=t.stateNode,go(or.current);var i=null;switch(n){case"input":o=wd(e,o),r=wd(e,r),i=[];break;case"select":o=nt({},o,{value:void 0}),r=nt({},r,{value:void 0}),i=[];break;case"textarea":o=Sd(e,o),r=Sd(e,r),i=[];break;default:typeof o.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=jl)}Ed(n,r);var s;n=null;for(c in o)if(!r.hasOwnProperty(c)&&o.hasOwnProperty(c)&&o[c]!=null)if(c==="style"){var a=o[c];for(s in a)a.hasOwnProperty(s)&&(n||(n={}),n[s]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(Is.hasOwnProperty(c)?i||(i=[]):(i=i||[]).push(c,null));for(c in r){var l=r[c];if(a=o!=null?o[c]:void 0,r.hasOwnProperty(c)&&l!==a&&(l!=null||a!=null))if(c==="style")if(a){for(s in a)!a.hasOwnProperty(s)||l&&l.hasOwnProperty(s)||(n||(n={}),n[s]="");for(s in l)l.hasOwnProperty(s)&&a[s]!==l[s]&&(n||(n={}),n[s]=l[s])}else n||(i||(i=[]),i.push(c,n)),n=l;else c==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(i=i||[]).push(c,l)):c==="children"?typeof l!="string"&&typeof l!="number"||(i=i||[]).push(c,""+l):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(Is.hasOwnProperty(c)?(l!=null&&c==="onScroll"&&Ue("scroll",e),i||a===l||(i=[])):(i=i||[]).push(c,l))}n&&(i=i||[]).push("style",n);var c=i;(t.updateQueue=c)&&(t.flags|=4)}};uw=function(e,t,n,r){n!==r&&(t.flags|=4)};function qi(e,t){if(!Ge)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function At(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var o=e.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags&14680064,r|=o.flags&14680064,o.return=e,o=o.sibling;else for(o=e.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags,r|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function sE(e,t,n){var r=t.pendingProps;switch(Qf(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return At(t),null;case 1:return en(t.type)&&Pl(),At(t),null;case 3:return r=t.stateNode,Ci(),Ke(Qt),Ke(Dt),lp(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Ta(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,On!==null&&(sf(On),On=null))),qd(e,t),At(t),null;case 5:ap(t);var o=go(zs.current);if(n=t.type,e!==null&&t.stateNode!=null)lw(e,t,n,r,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(ne(166));return At(t),null}if(e=go(or.current),Ta(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[er]=t,r[Ns]=i,e=(t.mode&1)!==0,n){case"dialog":Ue("cancel",r),Ue("close",r);break;case"iframe":case"object":case"embed":Ue("load",r);break;case"video":case"audio":for(o=0;o<ds.length;o++)Ue(ds[o],r);break;case"source":Ue("error",r);break;case"img":case"image":case"link":Ue("error",r),Ue("load",r);break;case"details":Ue("toggle",r);break;case"input":Ph(r,i),Ue("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},Ue("invalid",r);break;case"textarea":_h(r,i),Ue("invalid",r)}Ed(n,i),o=null;for(var s in i)if(i.hasOwnProperty(s)){var a=i[s];s==="children"?typeof a=="string"?r.textContent!==a&&(i.suppressHydrationWarning!==!0&&Ia(r.textContent,a,e),o=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(i.suppressHydrationWarning!==!0&&Ia(r.textContent,a,e),o=["children",""+a]):Is.hasOwnProperty(s)&&a!=null&&s==="onScroll"&&Ue("scroll",r)}switch(n){case"input":va(r),Fh(r,i,!0);break;case"textarea":va(r),Mh(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=jl)}r=o,t.updateQueue=r,r!==null&&(t.flags|=4)}else{s=o.nodeType===9?o:o.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=Lv(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=s.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=s.createElement(n,{is:r.is}):(e=s.createElement(n),n==="select"&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,n),e[er]=t,e[Ns]=r,aw(e,t,!1,!1),t.stateNode=e;e:{switch(s=Cd(n,r),n){case"dialog":Ue("cancel",e),Ue("close",e),o=r;break;case"iframe":case"object":case"embed":Ue("load",e),o=r;break;case"video":case"audio":for(o=0;o<ds.length;o++)Ue(ds[o],e);o=r;break;case"source":Ue("error",e),o=r;break;case"img":case"image":case"link":Ue("error",e),Ue("load",e),o=r;break;case"details":Ue("toggle",e),o=r;break;case"input":Ph(e,r),o=wd(e,r),Ue("invalid",e);break;case"option":o=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},o=nt({},r,{value:void 0}),Ue("invalid",e);break;case"textarea":_h(e,r),o=Sd(e,r),Ue("invalid",e);break;default:o=r}Ed(n,o),a=o;for(i in a)if(a.hasOwnProperty(i)){var l=a[i];i==="style"?Ov(e,l):i==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&zv(e,l)):i==="children"?typeof l=="string"?(n!=="textarea"||l!=="")&&Ts(e,l):typeof l=="number"&&Ts(e,""+l):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(Is.hasOwnProperty(i)?l!=null&&i==="onScroll"&&Ue("scroll",e):l!=null&&zf(e,i,l,s))}switch(n){case"input":va(e),Fh(e,r,!1);break;case"textarea":va(e),Mh(e);break;case"option":r.value!=null&&e.setAttribute("value",""+qr(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?fi(e,!!r.multiple,i,!1):r.defaultValue!=null&&fi(e,!!r.multiple,r.defaultValue,!0);break;default:typeof o.onClick=="function"&&(e.onclick=jl)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return At(t),null;case 6:if(e&&t.stateNode!=null)uw(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(ne(166));if(n=go(zs.current),go(or.current),Ta(t)){if(r=t.stateNode,n=t.memoizedProps,r[er]=t,(i=r.nodeValue!==n)&&(e=fn,e!==null))switch(e.tag){case 3:Ia(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Ia(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[er]=t,t.stateNode=r}return At(t),null;case 13:if(Ke(et),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Ge&&dn!==null&&t.mode&1&&!(t.flags&128))T0(),ki(),t.flags|=98560,i=!1;else if(i=Ta(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(ne(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(ne(317));i[er]=t}else ki(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;At(t),i=!1}else On!==null&&(sf(On),On=null),i=!0;if(!i)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||et.current&1?vt===0&&(vt=3):xp())),t.updateQueue!==null&&(t.flags|=4),At(t),null);case 4:return Ci(),qd(e,t),e===null&&$s(t.stateNode.containerInfo),At(t),null;case 10:return rp(t.type._context),At(t),null;case 17:return en(t.type)&&Pl(),At(t),null;case 19:if(Ke(et),i=t.memoizedState,i===null)return At(t),null;if(r=(t.flags&128)!==0,s=i.rendering,s===null)if(r)qi(i,!1);else{if(vt!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(s=Ll(e),s!==null){for(t.flags|=128,qi(i,!1),r=s.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)i=n,e=r,i.flags&=14680066,s=i.alternate,s===null?(i.childLanes=0,i.lanes=e,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=s.childLanes,i.lanes=s.lanes,i.child=s.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=s.memoizedProps,i.memoizedState=s.memoizedState,i.updateQueue=s.updateQueue,i.type=s.type,e=s.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return Ve(et,et.current&1|2),t.child}e=e.sibling}i.tail!==null&&ut()>Ti&&(t.flags|=128,r=!0,qi(i,!1),t.lanes=4194304)}else{if(!r)if(e=Ll(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),qi(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!Ge)return At(t),null}else 2*ut()-i.renderingStartTime>Ti&&n!==1073741824&&(t.flags|=128,r=!0,qi(i,!1),t.lanes=4194304);i.isBackwards?(s.sibling=t.child,t.child=s):(n=i.last,n!==null?n.sibling=s:t.child=s,i.last=s)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=ut(),t.sibling=null,n=et.current,Ve(et,r?n&1|2:n&1),t):(At(t),null);case 22:case 23:return wp(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?cn&1073741824&&(At(t),t.subtreeFlags&6&&(t.flags|=8192)):At(t),null;case 24:return null;case 25:return null}throw Error(ne(156,t.tag))}function aE(e,t){switch(Qf(t),t.tag){case 1:return en(t.type)&&Pl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ci(),Ke(Qt),Ke(Dt),lp(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return ap(t),null;case 13:if(Ke(et),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(ne(340));ki()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ke(et),null;case 4:return Ci(),null;case 10:return rp(t.type._context),null;case 22:case 23:return wp(),null;case 24:return null;default:return null}}var Pa=!1,Lt=!1,lE=typeof WeakSet=="function"?WeakSet:Set,pe=null;function si(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){st(e,t,r)}else n.current=null}function Jd(e,t,n){try{n()}catch(r){st(e,t,r)}}var Sm=!1;function uE(e,t){if(Ad=Il,e=h0(),qf(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var o=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var s=0,a=-1,l=-1,c=0,f=0,p=e,m=null;t:for(;;){for(var g;p!==n||o!==0&&p.nodeType!==3||(a=s+o),p!==i||r!==0&&p.nodeType!==3||(l=s+r),p.nodeType===3&&(s+=p.nodeValue.length),(g=p.firstChild)!==null;)m=p,p=g;for(;;){if(p===e)break t;if(m===n&&++c===o&&(a=s),m===i&&++f===r&&(l=s),(g=p.nextSibling)!==null)break;p=m,m=p.parentNode}p=g}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(Nd={focusedElem:e,selectionRange:n},Il=!1,pe=t;pe!==null;)if(t=pe,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,pe=e;else for(;pe!==null;){t=pe;try{var w=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(w!==null){var x=w.memoizedProps,k=w.memoizedState,h=t.stateNode,y=h.getSnapshotBeforeUpdate(t.elementType===t.type?x:zn(t.type,x),k);h.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var v=t.stateNode.containerInfo;v.nodeType===1?v.textContent="":v.nodeType===9&&v.documentElement&&v.removeChild(v.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(ne(163))}}catch(S){st(t,t.return,S)}if(e=t.sibling,e!==null){e.return=t.return,pe=e;break}pe=t.return}return w=Sm,Sm=!1,w}function bs(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var o=r=r.next;do{if((o.tag&e)===e){var i=o.destroy;o.destroy=void 0,i!==void 0&&Jd(t,n,i)}o=o.next}while(o!==r)}}function hu(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Qd(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function cw(e){var t=e.alternate;t!==null&&(e.alternate=null,cw(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[er],delete t[Ns],delete t[Dd],delete t[Uk],delete t[Zk])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function dw(e){return e.tag===5||e.tag===3||e.tag===4}function km(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||dw(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function ef(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=jl));else if(r!==4&&(e=e.child,e!==null))for(ef(e,t,n),e=e.sibling;e!==null;)ef(e,t,n),e=e.sibling}function tf(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(tf(e,t,n),e=e.sibling;e!==null;)tf(e,t,n),e=e.sibling}var Tt=null,Dn=!1;function Pr(e,t,n){for(n=n.child;n!==null;)fw(e,t,n),n=n.sibling}function fw(e,t,n){if(rr&&typeof rr.onCommitFiberUnmount=="function")try{rr.onCommitFiberUnmount(su,n)}catch{}switch(n.tag){case 5:Lt||si(n,t);case 6:var r=Tt,o=Dn;Tt=null,Pr(e,t,n),Tt=r,Dn=o,Tt!==null&&(Dn?(e=Tt,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Tt.removeChild(n.stateNode));break;case 18:Tt!==null&&(Dn?(e=Tt,n=n.stateNode,e.nodeType===8?Ec(e.parentNode,n):e.nodeType===1&&Ec(e,n),Fs(e)):Ec(Tt,n.stateNode));break;case 4:r=Tt,o=Dn,Tt=n.stateNode.containerInfo,Dn=!0,Pr(e,t,n),Tt=r,Dn=o;break;case 0:case 11:case 14:case 15:if(!Lt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){o=r=r.next;do{var i=o,s=i.destroy;i=i.tag,s!==void 0&&(i&2||i&4)&&Jd(n,t,s),o=o.next}while(o!==r)}Pr(e,t,n);break;case 1:if(!Lt&&(si(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){st(n,t,a)}Pr(e,t,n);break;case 21:Pr(e,t,n);break;case 22:n.mode&1?(Lt=(r=Lt)||n.memoizedState!==null,Pr(e,t,n),Lt=r):Pr(e,t,n);break;default:Pr(e,t,n)}}function Em(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new lE),t.forEach(function(r){var o=vE.bind(null,e,r);n.has(r)||(n.add(r),r.then(o,o))})}}function Nn(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var o=n[r];try{var i=e,s=t,a=s;e:for(;a!==null;){switch(a.tag){case 5:Tt=a.stateNode,Dn=!1;break e;case 3:Tt=a.stateNode.containerInfo,Dn=!0;break e;case 4:Tt=a.stateNode.containerInfo,Dn=!0;break e}a=a.return}if(Tt===null)throw Error(ne(160));fw(i,s,o),Tt=null,Dn=!1;var l=o.alternate;l!==null&&(l.return=null),o.return=null}catch(c){st(o,t,c)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)pw(t,e),t=t.sibling}function pw(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Nn(t,e),Xn(e),r&4){try{bs(3,e,e.return),hu(3,e)}catch(x){st(e,e.return,x)}try{bs(5,e,e.return)}catch(x){st(e,e.return,x)}}break;case 1:Nn(t,e),Xn(e),r&512&&n!==null&&si(n,n.return);break;case 5:if(Nn(t,e),Xn(e),r&512&&n!==null&&si(n,n.return),e.flags&32){var o=e.stateNode;try{Ts(o,"")}catch(x){st(e,e.return,x)}}if(r&4&&(o=e.stateNode,o!=null)){var i=e.memoizedProps,s=n!==null?n.memoizedProps:i,a=e.type,l=e.updateQueue;if(e.updateQueue=null,l!==null)try{a==="input"&&i.type==="radio"&&i.name!=null&&Av(o,i),Cd(a,s);var c=Cd(a,i);for(s=0;s<l.length;s+=2){var f=l[s],p=l[s+1];f==="style"?Ov(o,p):f==="dangerouslySetInnerHTML"?zv(o,p):f==="children"?Ts(o,p):zf(o,f,p,c)}switch(a){case"input":xd(o,i);break;case"textarea":Nv(o,i);break;case"select":var m=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!i.multiple;var g=i.value;g!=null?fi(o,!!i.multiple,g,!1):m!==!!i.multiple&&(i.defaultValue!=null?fi(o,!!i.multiple,i.defaultValue,!0):fi(o,!!i.multiple,i.multiple?[]:"",!1))}o[Ns]=i}catch(x){st(e,e.return,x)}}break;case 6:if(Nn(t,e),Xn(e),r&4){if(e.stateNode===null)throw Error(ne(162));o=e.stateNode,i=e.memoizedProps;try{o.nodeValue=i}catch(x){st(e,e.return,x)}}break;case 3:if(Nn(t,e),Xn(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Fs(t.containerInfo)}catch(x){st(e,e.return,x)}break;case 4:Nn(t,e),Xn(e);break;case 13:Nn(t,e),Xn(e),o=e.child,o.flags&8192&&(i=o.memoizedState!==null,o.stateNode.isHidden=i,!i||o.alternate!==null&&o.alternate.memoizedState!==null||(yp=ut())),r&4&&Em(e);break;case 22:if(f=n!==null&&n.memoizedState!==null,e.mode&1?(Lt=(c=Lt)||f,Nn(t,e),Lt=c):Nn(t,e),Xn(e),r&8192){if(c=e.memoizedState!==null,(e.stateNode.isHidden=c)&&!f&&e.mode&1)for(pe=e,f=e.child;f!==null;){for(p=pe=f;pe!==null;){switch(m=pe,g=m.child,m.tag){case 0:case 11:case 14:case 15:bs(4,m,m.return);break;case 1:si(m,m.return);var w=m.stateNode;if(typeof w.componentWillUnmount=="function"){r=m,n=m.return;try{t=r,w.props=t.memoizedProps,w.state=t.memoizedState,w.componentWillUnmount()}catch(x){st(r,n,x)}}break;case 5:si(m,m.return);break;case 22:if(m.memoizedState!==null){Im(p);continue}}g!==null?(g.return=m,pe=g):Im(p)}f=f.sibling}e:for(f=null,p=e;;){if(p.tag===5){if(f===null){f=p;try{o=p.stateNode,c?(i=o.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(a=p.stateNode,l=p.memoizedProps.style,s=l!=null&&l.hasOwnProperty("display")?l.display:null,a.style.display=Dv("display",s))}catch(x){st(e,e.return,x)}}}else if(p.tag===6){if(f===null)try{p.stateNode.nodeValue=c?"":p.memoizedProps}catch(x){st(e,e.return,x)}}else if((p.tag!==22&&p.tag!==23||p.memoizedState===null||p===e)&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===e)break e;for(;p.sibling===null;){if(p.return===null||p.return===e)break e;f===p&&(f=null),p=p.return}f===p&&(f=null),p.sibling.return=p.return,p=p.sibling}}break;case 19:Nn(t,e),Xn(e),r&4&&Em(e);break;case 21:break;default:Nn(t,e),Xn(e)}}function Xn(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(dw(n)){var r=n;break e}n=n.return}throw Error(ne(160))}switch(r.tag){case 5:var o=r.stateNode;r.flags&32&&(Ts(o,""),r.flags&=-33);var i=km(e);tf(e,i,o);break;case 3:case 4:var s=r.stateNode.containerInfo,a=km(e);ef(e,a,s);break;default:throw Error(ne(161))}}catch(l){st(e,e.return,l)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function cE(e,t,n){pe=e,hw(e)}function hw(e,t,n){for(var r=(e.mode&1)!==0;pe!==null;){var o=pe,i=o.child;if(o.tag===22&&r){var s=o.memoizedState!==null||Pa;if(!s){var a=o.alternate,l=a!==null&&a.memoizedState!==null||Lt;a=Pa;var c=Lt;if(Pa=s,(Lt=l)&&!c)for(pe=o;pe!==null;)s=pe,l=s.child,s.tag===22&&s.memoizedState!==null?Tm(o):l!==null?(l.return=s,pe=l):Tm(o);for(;i!==null;)pe=i,hw(i),i=i.sibling;pe=o,Pa=a,Lt=c}Cm(e)}else o.subtreeFlags&8772&&i!==null?(i.return=o,pe=i):Cm(e)}}function Cm(e){for(;pe!==null;){var t=pe;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Lt||hu(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!Lt)if(n===null)r.componentDidMount();else{var o=t.elementType===t.type?n.memoizedProps:zn(t.type,n.memoizedProps);r.componentDidUpdate(o,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&um(t,i,r);break;case 3:var s=t.updateQueue;if(s!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}um(t,s,n)}break;case 5:var a=t.stateNode;if(n===null&&t.flags&4){n=a;var l=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&n.focus();break;case"img":l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var c=t.alternate;if(c!==null){var f=c.memoizedState;if(f!==null){var p=f.dehydrated;p!==null&&Fs(p)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(ne(163))}Lt||t.flags&512&&Qd(t)}catch(m){st(t,t.return,m)}}if(t===e){pe=null;break}if(n=t.sibling,n!==null){n.return=t.return,pe=n;break}pe=t.return}}function Im(e){for(;pe!==null;){var t=pe;if(t===e){pe=null;break}var n=t.sibling;if(n!==null){n.return=t.return,pe=n;break}pe=t.return}}function Tm(e){for(;pe!==null;){var t=pe;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{hu(4,t)}catch(l){st(t,n,l)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var o=t.return;try{r.componentDidMount()}catch(l){st(t,o,l)}}var i=t.return;try{Qd(t)}catch(l){st(t,i,l)}break;case 5:var s=t.return;try{Qd(t)}catch(l){st(t,s,l)}}}catch(l){st(t,t.return,l)}if(t===e){pe=null;break}var a=t.sibling;if(a!==null){a.return=t.return,pe=a;break}pe=t.return}}var dE=Math.ceil,Ol=Er.ReactCurrentDispatcher,mp=Er.ReactCurrentOwner,jn=Er.ReactCurrentBatchConfig,_e=0,St=null,pt=null,Rt=0,cn=0,ai=no(0),vt=0,Ws=null,Eo=0,mu=0,gp=0,Ss=null,qt=null,yp=0,Ti=1/0,pr=null,Bl=!1,nf=null,Kr=null,Fa=!1,Br=null,Wl=0,ks=0,rf=null,pl=-1,hl=0;function Wt(){return _e&6?ut():pl!==-1?pl:pl=ut()}function Yr(e){return e.mode&1?_e&2&&Rt!==0?Rt&-Rt:Yk.transition!==null?(hl===0&&(hl=Jv()),hl):(e=Ne,e!==0||(e=window.event,e=e===void 0?16:i0(e.type)),e):1}function Wn(e,t,n,r){if(50<ks)throw ks=0,rf=null,Error(ne(185));qs(e,n,r),(!(_e&2)||e!==St)&&(e===St&&(!(_e&2)&&(mu|=n),vt===4&&zr(e,Rt)),tn(e,r),n===1&&_e===0&&!(t.mode&1)&&(Ti=ut()+500,du&&ro()))}function tn(e,t){var n=e.callbackNode;YS(e,t);var r=Cl(e,e===St?Rt:0);if(r===0)n!==null&&Nh(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&Nh(n),t===1)e.tag===0?Kk(Rm.bind(null,e)):E0(Rm.bind(null,e)),Vk(function(){!(_e&6)&&ro()}),n=null;else{switch(Qv(r)){case 1:n=Vf;break;case 4:n=Xv;break;case 16:n=El;break;case 536870912:n=qv;break;default:n=El}n=Sw(n,mw.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function mw(e,t){if(pl=-1,hl=0,_e&6)throw Error(ne(327));var n=e.callbackNode;if(yi()&&e.callbackNode!==n)return null;var r=Cl(e,e===St?Rt:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=Vl(e,r);else{t=r;var o=_e;_e|=2;var i=yw();(St!==e||Rt!==t)&&(pr=null,Ti=ut()+500,wo(e,t));do try{hE();break}catch(a){gw(e,a)}while(!0);np(),Ol.current=i,_e=o,pt!==null?t=0:(St=null,Rt=0,t=vt)}if(t!==0){if(t===2&&(o=Pd(e),o!==0&&(r=o,t=of(e,o))),t===1)throw n=Ws,wo(e,0),zr(e,r),tn(e,ut()),n;if(t===6)zr(e,r);else{if(o=e.current.alternate,!(r&30)&&!fE(o)&&(t=Vl(e,r),t===2&&(i=Pd(e),i!==0&&(r=i,t=of(e,i))),t===1))throw n=Ws,wo(e,0),zr(e,r),tn(e,ut()),n;switch(e.finishedWork=o,e.finishedLanes=r,t){case 0:case 1:throw Error(ne(345));case 2:po(e,qt,pr);break;case 3:if(zr(e,r),(r&130023424)===r&&(t=yp+500-ut(),10<t)){if(Cl(e,0)!==0)break;if(o=e.suspendedLanes,(o&r)!==r){Wt(),e.pingedLanes|=e.suspendedLanes&o;break}e.timeoutHandle=zd(po.bind(null,e,qt,pr),t);break}po(e,qt,pr);break;case 4:if(zr(e,r),(r&4194240)===r)break;for(t=e.eventTimes,o=-1;0<r;){var s=31-Bn(r);i=1<<s,s=t[s],s>o&&(o=s),r&=~i}if(r=o,r=ut()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*dE(r/1960))-r,10<r){e.timeoutHandle=zd(po.bind(null,e,qt,pr),r);break}po(e,qt,pr);break;case 5:po(e,qt,pr);break;default:throw Error(ne(329))}}}return tn(e,ut()),e.callbackNode===n?mw.bind(null,e):null}function of(e,t){var n=Ss;return e.current.memoizedState.isDehydrated&&(wo(e,t).flags|=256),e=Vl(e,t),e!==2&&(t=qt,qt=n,t!==null&&sf(t)),e}function sf(e){qt===null?qt=e:qt.push.apply(qt,e)}function fE(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var o=n[r],i=o.getSnapshot;o=o.value;try{if(!Vn(i(),o))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function zr(e,t){for(t&=~gp,t&=~mu,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Bn(t),r=1<<n;e[n]=-1,t&=~r}}function Rm(e){if(_e&6)throw Error(ne(327));yi();var t=Cl(e,0);if(!(t&1))return tn(e,ut()),null;var n=Vl(e,t);if(e.tag!==0&&n===2){var r=Pd(e);r!==0&&(t=r,n=of(e,r))}if(n===1)throw n=Ws,wo(e,0),zr(e,t),tn(e,ut()),n;if(n===6)throw Error(ne(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,po(e,qt,pr),tn(e,ut()),null}function vp(e,t){var n=_e;_e|=1;try{return e(t)}finally{_e=n,_e===0&&(Ti=ut()+500,du&&ro())}}function Co(e){Br!==null&&Br.tag===0&&!(_e&6)&&yi();var t=_e;_e|=1;var n=jn.transition,r=Ne;try{if(jn.transition=null,Ne=1,e)return e()}finally{Ne=r,jn.transition=n,_e=t,!(_e&6)&&ro()}}function wp(){cn=ai.current,Ke(ai)}function wo(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,Wk(n)),pt!==null)for(n=pt.return;n!==null;){var r=n;switch(Qf(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Pl();break;case 3:Ci(),Ke(Qt),Ke(Dt),lp();break;case 5:ap(r);break;case 4:Ci();break;case 13:Ke(et);break;case 19:Ke(et);break;case 10:rp(r.type._context);break;case 22:case 23:wp()}n=n.return}if(St=e,pt=e=Gr(e.current,null),Rt=cn=t,vt=0,Ws=null,gp=mu=Eo=0,qt=Ss=null,mo!==null){for(t=0;t<mo.length;t++)if(n=mo[t],r=n.interleaved,r!==null){n.interleaved=null;var o=r.next,i=n.pending;if(i!==null){var s=i.next;i.next=o,r.next=s}n.pending=r}mo=null}return e}function gw(e,t){do{var n=pt;try{if(np(),cl.current=Dl,zl){for(var r=tt.memoizedState;r!==null;){var o=r.queue;o!==null&&(o.pending=null),r=r.next}zl=!1}if(ko=0,bt=yt=tt=null,xs=!1,Ds=0,mp.current=null,n===null||n.return===null){vt=1,Ws=t,pt=null;break}e:{var i=e,s=n.return,a=n,l=t;if(t=Rt,a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var c=l,f=a,p=f.tag;if(!(f.mode&1)&&(p===0||p===11||p===15)){var m=f.alternate;m?(f.updateQueue=m.updateQueue,f.memoizedState=m.memoizedState,f.lanes=m.lanes):(f.updateQueue=null,f.memoizedState=null)}var g=mm(s);if(g!==null){g.flags&=-257,gm(g,s,a,i,t),g.mode&1&&hm(i,c,t),t=g,l=c;var w=t.updateQueue;if(w===null){var x=new Set;x.add(l),t.updateQueue=x}else w.add(l);break e}else{if(!(t&1)){hm(i,c,t),xp();break e}l=Error(ne(426))}}else if(Ge&&a.mode&1){var k=mm(s);if(k!==null){!(k.flags&65536)&&(k.flags|=256),gm(k,s,a,i,t),ep(Ii(l,a));break e}}i=l=Ii(l,a),vt!==4&&(vt=2),Ss===null?Ss=[i]:Ss.push(i),i=s;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var h=Q0(i,l,t);lm(i,h);break e;case 1:a=l;var y=i.type,v=i.stateNode;if(!(i.flags&128)&&(typeof y.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(Kr===null||!Kr.has(v)))){i.flags|=65536,t&=-t,i.lanes|=t;var S=ew(i,a,t);lm(i,S);break e}}i=i.return}while(i!==null)}ww(n)}catch(b){t=b,pt===n&&n!==null&&(pt=n=n.return);continue}break}while(!0)}function yw(){var e=Ol.current;return Ol.current=Dl,e===null?Dl:e}function xp(){(vt===0||vt===3||vt===2)&&(vt=4),St===null||!(Eo&268435455)&&!(mu&268435455)||zr(St,Rt)}function Vl(e,t){var n=_e;_e|=2;var r=yw();(St!==e||Rt!==t)&&(pr=null,wo(e,t));do try{pE();break}catch(o){gw(e,o)}while(!0);if(np(),_e=n,Ol.current=r,pt!==null)throw Error(ne(261));return St=null,Rt=0,vt}function pE(){for(;pt!==null;)vw(pt)}function hE(){for(;pt!==null&&!DS();)vw(pt)}function vw(e){var t=bw(e.alternate,e,cn);e.memoizedProps=e.pendingProps,t===null?ww(e):pt=t,mp.current=null}function ww(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=aE(n,t),n!==null){n.flags&=32767,pt=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{vt=6,pt=null;return}}else if(n=sE(n,t,cn),n!==null){pt=n;return}if(t=t.sibling,t!==null){pt=t;return}pt=t=e}while(t!==null);vt===0&&(vt=5)}function po(e,t,n){var r=Ne,o=jn.transition;try{jn.transition=null,Ne=1,mE(e,t,n,r)}finally{jn.transition=o,Ne=r}return null}function mE(e,t,n,r){do yi();while(Br!==null);if(_e&6)throw Error(ne(327));n=e.finishedWork;var o=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(ne(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(GS(e,i),e===St&&(pt=St=null,Rt=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Fa||(Fa=!0,Sw(El,function(){return yi(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=jn.transition,jn.transition=null;var s=Ne;Ne=1;var a=_e;_e|=4,mp.current=null,uE(e,n),pw(n,e),Ak(Nd),Il=!!Ad,Nd=Ad=null,e.current=n,cE(n),OS(),_e=a,Ne=s,jn.transition=i}else e.current=n;if(Fa&&(Fa=!1,Br=e,Wl=o),i=e.pendingLanes,i===0&&(Kr=null),VS(n.stateNode),tn(e,ut()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)o=t[n],r(o.value,{componentStack:o.stack,digest:o.digest});if(Bl)throw Bl=!1,e=nf,nf=null,e;return Wl&1&&e.tag!==0&&yi(),i=e.pendingLanes,i&1?e===rf?ks++:(ks=0,rf=e):ks=0,ro(),null}function yi(){if(Br!==null){var e=Qv(Wl),t=jn.transition,n=Ne;try{if(jn.transition=null,Ne=16>e?16:e,Br===null)var r=!1;else{if(e=Br,Br=null,Wl=0,_e&6)throw Error(ne(331));var o=_e;for(_e|=4,pe=e.current;pe!==null;){var i=pe,s=i.child;if(pe.flags&16){var a=i.deletions;if(a!==null){for(var l=0;l<a.length;l++){var c=a[l];for(pe=c;pe!==null;){var f=pe;switch(f.tag){case 0:case 11:case 15:bs(8,f,i)}var p=f.child;if(p!==null)p.return=f,pe=p;else for(;pe!==null;){f=pe;var m=f.sibling,g=f.return;if(cw(f),f===c){pe=null;break}if(m!==null){m.return=g,pe=m;break}pe=g}}}var w=i.alternate;if(w!==null){var x=w.child;if(x!==null){w.child=null;do{var k=x.sibling;x.sibling=null,x=k}while(x!==null)}}pe=i}}if(i.subtreeFlags&2064&&s!==null)s.return=i,pe=s;else e:for(;pe!==null;){if(i=pe,i.flags&2048)switch(i.tag){case 0:case 11:case 15:bs(9,i,i.return)}var h=i.sibling;if(h!==null){h.return=i.return,pe=h;break e}pe=i.return}}var y=e.current;for(pe=y;pe!==null;){s=pe;var v=s.child;if(s.subtreeFlags&2064&&v!==null)v.return=s,pe=v;else e:for(s=y;pe!==null;){if(a=pe,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:hu(9,a)}}catch(b){st(a,a.return,b)}if(a===s){pe=null;break e}var S=a.sibling;if(S!==null){S.return=a.return,pe=S;break e}pe=a.return}}if(_e=o,ro(),rr&&typeof rr.onPostCommitFiberRoot=="function")try{rr.onPostCommitFiberRoot(su,e)}catch{}r=!0}return r}finally{Ne=n,jn.transition=t}}return!1}function jm(e,t,n){t=Ii(n,t),t=Q0(e,t,1),e=Zr(e,t,1),t=Wt(),e!==null&&(qs(e,1,t),tn(e,t))}function st(e,t,n){if(e.tag===3)jm(e,e,n);else for(;t!==null;){if(t.tag===3){jm(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Kr===null||!Kr.has(r))){e=Ii(n,e),e=ew(t,e,1),t=Zr(t,e,1),e=Wt(),t!==null&&(qs(t,1,e),tn(t,e));break}}t=t.return}}function gE(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Wt(),e.pingedLanes|=e.suspendedLanes&n,St===e&&(Rt&n)===n&&(vt===4||vt===3&&(Rt&130023424)===Rt&&500>ut()-yp?wo(e,0):gp|=n),tn(e,t)}function xw(e,t){t===0&&(e.mode&1?(t=ba,ba<<=1,!(ba&130023424)&&(ba=4194304)):t=1);var n=Wt();e=Sr(e,t),e!==null&&(qs(e,t,n),tn(e,n))}function yE(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),xw(e,n)}function vE(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,o=e.memoizedState;o!==null&&(n=o.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(ne(314))}r!==null&&r.delete(t),xw(e,n)}var bw;bw=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Qt.current)Jt=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Jt=!1,iE(e,t,n);Jt=!!(e.flags&131072)}else Jt=!1,Ge&&t.flags&1048576&&C0(t,Ml,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;fl(e,t),e=t.pendingProps;var o=Si(t,Dt.current);gi(t,n),o=cp(null,t,r,e,o,n);var i=dp();return t.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,en(r)?(i=!0,Fl(t)):i=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,ip(t),o.updater=pu,t.stateNode=o,o._reactInternals=t,Ud(t,r,e,n),t=Yd(null,t,r,!0,i,n)):(t.tag=0,Ge&&i&&Jf(t),Bt(null,t,o,n),t=t.child),t;case 16:r=t.elementType;e:{switch(fl(e,t),e=t.pendingProps,o=r._init,r=o(r._payload),t.type=r,o=t.tag=xE(r),e=zn(r,e),o){case 0:t=Kd(null,t,r,e,n);break e;case 1:t=wm(null,t,r,e,n);break e;case 11:t=ym(null,t,r,e,n);break e;case 14:t=vm(null,t,r,zn(r.type,e),n);break e}throw Error(ne(306,r,""))}return t;case 0:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:zn(r,o),Kd(e,t,r,o,n);case 1:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:zn(r,o),wm(e,t,r,o,n);case 3:e:{if(ow(t),e===null)throw Error(ne(387));r=t.pendingProps,i=t.memoizedState,o=i.element,F0(e,t),Nl(t,r,null,n);var s=t.memoizedState;if(r=s.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){o=Ii(Error(ne(423)),t),t=xm(e,t,r,n,o);break e}else if(r!==o){o=Ii(Error(ne(424)),t),t=xm(e,t,r,n,o);break e}else for(dn=Ur(t.stateNode.containerInfo.firstChild),fn=t,Ge=!0,On=null,n=j0(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(ki(),r===o){t=kr(e,t,n);break e}Bt(e,t,r,n)}t=t.child}return t;case 5:return _0(t),e===null&&Wd(t),r=t.type,o=t.pendingProps,i=e!==null?e.memoizedProps:null,s=o.children,Ld(r,o)?s=null:i!==null&&Ld(r,i)&&(t.flags|=32),rw(e,t),Bt(e,t,s,n),t.child;case 6:return e===null&&Wd(t),null;case 13:return iw(e,t,n);case 4:return sp(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ei(t,null,r,n):Bt(e,t,r,n),t.child;case 11:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:zn(r,o),ym(e,t,r,o,n);case 7:return Bt(e,t,t.pendingProps,n),t.child;case 8:return Bt(e,t,t.pendingProps.children,n),t.child;case 12:return Bt(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,o=t.pendingProps,i=t.memoizedProps,s=o.value,Ve($l,r._currentValue),r._currentValue=s,i!==null)if(Vn(i.value,s)){if(i.children===o.children&&!Qt.current){t=kr(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var a=i.dependencies;if(a!==null){s=i.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(i.tag===1){l=wr(-1,n&-n),l.tag=2;var c=i.updateQueue;if(c!==null){c=c.shared;var f=c.pending;f===null?l.next=l:(l.next=f.next,f.next=l),c.pending=l}}i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),Vd(i.return,n,t),a.lanes|=n;break}l=l.next}}else if(i.tag===10)s=i.type===t.type?null:i.child;else if(i.tag===18){if(s=i.return,s===null)throw Error(ne(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),Vd(s,n,t),s=i.sibling}else s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===t){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}Bt(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,r=t.pendingProps.children,gi(t,n),o=Pn(o),r=r(o),t.flags|=1,Bt(e,t,r,n),t.child;case 14:return r=t.type,o=zn(r,t.pendingProps),o=zn(r.type,o),vm(e,t,r,o,n);case 15:return tw(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:zn(r,o),fl(e,t),t.tag=1,en(r)?(e=!0,Fl(t)):e=!1,gi(t,n),J0(t,r,o),Ud(t,r,o,n),Yd(null,t,r,!0,e,n);case 19:return sw(e,t,n);case 22:return nw(e,t,n)}throw Error(ne(156,t.tag))};function Sw(e,t){return Gv(e,t)}function wE(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Tn(e,t,n,r){return new wE(e,t,n,r)}function bp(e){return e=e.prototype,!(!e||!e.isReactComponent)}function xE(e){if(typeof e=="function")return bp(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Of)return 11;if(e===Bf)return 14}return 2}function Gr(e,t){var n=e.alternate;return n===null?(n=Tn(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function ml(e,t,n,r,o,i){var s=2;if(r=e,typeof e=="function")bp(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case qo:return xo(n.children,o,i,t);case Df:s=8,o|=8;break;case md:return e=Tn(12,n,t,o|2),e.elementType=md,e.lanes=i,e;case gd:return e=Tn(13,n,t,o),e.elementType=gd,e.lanes=i,e;case yd:return e=Tn(19,n,t,o),e.elementType=yd,e.lanes=i,e;case _v:return gu(n,o,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Pv:s=10;break e;case Fv:s=9;break e;case Of:s=11;break e;case Bf:s=14;break e;case Ar:s=16,r=null;break e}throw Error(ne(130,e==null?e:typeof e,""))}return t=Tn(s,n,t,o),t.elementType=e,t.type=r,t.lanes=i,t}function xo(e,t,n,r){return e=Tn(7,e,r,t),e.lanes=n,e}function gu(e,t,n,r){return e=Tn(22,e,r,t),e.elementType=_v,e.lanes=n,e.stateNode={isHidden:!1},e}function _c(e,t,n){return e=Tn(6,e,null,t),e.lanes=n,e}function Mc(e,t,n){return t=Tn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function bE(e,t,n,r,o){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=pc(0),this.expirationTimes=pc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=pc(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function Sp(e,t,n,r,o,i,s,a,l){return e=new bE(e,t,n,a,l),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Tn(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},ip(i),e}function SE(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Xo,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function kw(e){if(!e)return Jr;e=e._reactInternals;e:{if(Po(e)!==e||e.tag!==1)throw Error(ne(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(en(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(ne(171))}if(e.tag===1){var n=e.type;if(en(n))return k0(e,n,t)}return t}function Ew(e,t,n,r,o,i,s,a,l){return e=Sp(n,r,!0,e,o,i,s,a,l),e.context=kw(null),n=e.current,r=Wt(),o=Yr(n),i=wr(r,o),i.callback=t??null,Zr(n,i,o),e.current.lanes=o,qs(e,o,r),tn(e,r),e}function yu(e,t,n,r){var o=t.current,i=Wt(),s=Yr(o);return n=kw(n),t.context===null?t.context=n:t.pendingContext=n,t=wr(i,s),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Zr(o,t,s),e!==null&&(Wn(e,o,s,i),ul(e,o,s)),s}function Hl(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function Pm(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function kp(e,t){Pm(e,t),(e=e.alternate)&&Pm(e,t)}function kE(){return null}var Cw=typeof reportError=="function"?reportError:function(e){console.error(e)};function Ep(e){this._internalRoot=e}vu.prototype.render=Ep.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(ne(409));yu(e,t,null,null)};vu.prototype.unmount=Ep.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Co(function(){yu(null,e,null,null)}),t[br]=null}};function vu(e){this._internalRoot=e}vu.prototype.unstable_scheduleHydration=function(e){if(e){var t=n0();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Lr.length&&t!==0&&t<Lr[n].priority;n++);Lr.splice(n,0,e),n===0&&o0(e)}};function Cp(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function wu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Fm(){}function EE(e,t,n,r,o){if(o){if(typeof r=="function"){var i=r;r=function(){var c=Hl(s);i.call(c)}}var s=Ew(t,r,e,0,null,!1,!1,"",Fm);return e._reactRootContainer=s,e[br]=s.current,$s(e.nodeType===8?e.parentNode:e),Co(),s}for(;o=e.lastChild;)e.removeChild(o);if(typeof r=="function"){var a=r;r=function(){var c=Hl(l);a.call(c)}}var l=Sp(e,0,!1,null,null,!1,!1,"",Fm);return e._reactRootContainer=l,e[br]=l.current,$s(e.nodeType===8?e.parentNode:e),Co(function(){yu(t,l,n,r)}),l}function xu(e,t,n,r,o){var i=n._reactRootContainer;if(i){var s=i;if(typeof o=="function"){var a=o;o=function(){var l=Hl(s);a.call(l)}}yu(t,s,e,o)}else s=EE(n,t,e,o,r);return Hl(s)}e0=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=cs(t.pendingLanes);n!==0&&(Hf(t,n|1),tn(t,ut()),!(_e&6)&&(Ti=ut()+500,ro()))}break;case 13:Co(function(){var r=Sr(e,1);if(r!==null){var o=Wt();Wn(r,e,1,o)}}),kp(e,1)}};Uf=function(e){if(e.tag===13){var t=Sr(e,134217728);if(t!==null){var n=Wt();Wn(t,e,134217728,n)}kp(e,134217728)}};t0=function(e){if(e.tag===13){var t=Yr(e),n=Sr(e,t);if(n!==null){var r=Wt();Wn(n,e,t,r)}kp(e,t)}};n0=function(){return Ne};r0=function(e,t){var n=Ne;try{return Ne=e,t()}finally{Ne=n}};Td=function(e,t,n){switch(t){case"input":if(xd(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var o=cu(r);if(!o)throw Error(ne(90));$v(r),xd(r,o)}}}break;case"textarea":Nv(e,n);break;case"select":t=n.value,t!=null&&fi(e,!!n.multiple,t,!1)}};Vv=vp;Hv=Co;var CE={usingClientEntryPoint:!1,Events:[Qs,ti,cu,Bv,Wv,vp]},Ji={findFiberByHostInstance:ho,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},IE={bundleType:Ji.bundleType,version:Ji.version,rendererPackageName:Ji.rendererPackageName,rendererConfig:Ji.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Er.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Kv(e),e===null?null:e.stateNode},findFiberByHostInstance:Ji.findFiberByHostInstance||kE,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var _a=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!_a.isDisabled&&_a.supportsFiber)try{su=_a.inject(IE),rr=_a}catch{}}hn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=CE;hn.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Cp(t))throw Error(ne(200));return SE(e,t,null,n)};hn.createRoot=function(e,t){if(!Cp(e))throw Error(ne(299));var n=!1,r="",o=Cw;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=Sp(e,1,!1,null,null,n,!1,r,o),e[br]=t.current,$s(e.nodeType===8?e.parentNode:e),new Ep(t)};hn.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(ne(188)):(e=Object.keys(e).join(","),Error(ne(268,e)));return e=Kv(t),e=e===null?null:e.stateNode,e};hn.flushSync=function(e){return Co(e)};hn.hydrate=function(e,t,n){if(!wu(t))throw Error(ne(200));return xu(null,e,t,!0,n)};hn.hydrateRoot=function(e,t,n){if(!Cp(e))throw Error(ne(405));var r=n!=null&&n.hydratedSources||null,o=!1,i="",s=Cw;if(n!=null&&(n.unstable_strictMode===!0&&(o=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=Ew(t,null,e,1,n??null,o,!1,i,s),e[br]=t.current,$s(e),r)for(e=0;e<r.length;e++)n=r[e],o=n._getVersion,o=o(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,o]:t.mutableSourceEagerHydrationData.push(n,o);return new vu(t)};hn.render=function(e,t,n){if(!wu(t))throw Error(ne(200));return xu(null,e,t,!1,n)};hn.unmountComponentAtNode=function(e){if(!wu(e))throw Error(ne(40));return e._reactRootContainer?(Co(function(){xu(null,null,e,!1,function(){e._reactRootContainer=null,e[br]=null})}),!0):!1};hn.unstable_batchedUpdates=vp;hn.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!wu(n))throw Error(ne(200));if(e==null||e._reactInternals===void 0)throw Error(ne(38));return xu(e,t,n,!1,r)};hn.version="18.3.1-next-f1338f8080-20240426";function Iw(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Iw)}catch(e){console.error(e)}}Iw(),Iv.exports=hn;var af=Iv.exports,_m=af;pd.createRoot=_m.createRoot,pd.hydrateRoot=_m.hydrateRoot;var TE=Object.defineProperty,Tw=(e,t)=>{for(var n in t)TE(e,n,{get:t[n],enumerable:!0,configurable:!0,set:r=>t[n]=()=>r})};if(typeof d.createContext!="function"){const e=['Remotion requires React.createContext, but it is "undefined".','If you are in a React Server Component, turn it into a client component by adding "use client" at the top of the file.',"","Before:",' import {useCurrentFrame} from "remotion";',"","After:",' "use client";',' import {useCurrentFrame} from "remotion";'];throw new Error(e.join(`
41
+ `))}var Fo=d.createContext(!1),lf=({children:e})=>u.jsx(Fo.Provider,{value:!0,children:e}),Rw=d.createContext({setError:()=>{},clearError:()=>{}}),Mm=()=>{try{return typeof __webpack_module__>"u"?null:__webpack_module__.hot??null}catch{return null}};class RE extends le.Component{constructor(){super(...arguments);Ae(this,"state",{hasError:!1});Ae(this,"hmrStatusHandler",null)}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(n){this.props.onError(n),this.subscribeToHmrReset()}componentDidMount(){this.state.hasError||this.props.onClear()}componentDidUpdate(n,r){r.hasError&&!this.state.hasError&&this.props.onClear()}componentWillUnmount(){this.unsubscribeFromHmrReset()}subscribeToHmrReset(){if(this.hmrStatusHandler)return;const n=Mm();if(!n)return;const r=o=>{o==="idle"&&(this.unsubscribeFromHmrReset(),this.setState({hasError:!1}))};this.hmrStatusHandler=r,n.addStatusHandler(r)}unsubscribeFromHmrReset(){const n=this.hmrStatusHandler;if(!n)return;this.hmrStatusHandler=null;const r=Mm();r&&r.removeStatusHandler(n)}render(){return this.state.hasError?null:this.props.children}}var Mi=d.createContext({compositions:[],folders:[],currentCompositionMetadata:null,canvasContent:null}),ta=d.createContext({registerComposition:()=>{},unregisterComposition:()=>{},registerFolder:()=>{},unregisterFolder:()=>{},setCanvasContent:()=>{},onlyRenderComposition:null}),na=d.createContext({getNonce:()=>0}),gl=0;try{typeof __webpack_module__<"u"&&__webpack_module__.hot&&__webpack_module__.hot.addStatusHandler(e=>{e==="idle"&&gl++})}catch{}var bu=()=>{const t=d.useContext(na).getNonce(),n=d.useRef(t);n.current=t;const r=d.useRef([[gl,t]]),o=d.useCallback(()=>(gl!==r.current[r.current.length-1][0]&&(r.current=[...r.current,[gl,n.current]]),r.current),[r]);return d.useMemo(()=>({get:o}),[o])};function $i(e){return!!e}var jw=()=>/^([a-zA-Z0-9-\u4E00-\u9FFF])+$/g,Pw=e=>e.match(jw()),jE=e=>{if(e==null)throw new TypeError("You must pass a name to a <Folder />.");if(typeof e!="string")throw new TypeError(`The "name" you pass into <Folder /> must be a string. Got: ${typeof e}`);if(!Pw(e))throw new Error(`Folder name can only contain a-z, A-Z, 0-9 and -. You passed ${e}`)},PE=`Folder name must match ${String(jw())}`,uf=d.createContext({folderName:null,parentName:null}),FE=e=>{const{name:t,children:n}=e,r=d.useContext(uf),{registerFolder:o,unregisterFolder:i}=d.useContext(ta),s=bu(),a=e.stack??null;jE(t);const l=[r.parentName,r.folderName].filter($i),c=l.length===0?null:l.join("/"),f=d.useMemo(()=>({folderName:t,parentName:c}),[t,c]);return d.useEffect(()=>(o(t,c,s.get(),a),()=>{i(t,c)}),[t,r.folderName,c,o,i,s,a]),u.jsx(uf.Provider,{value:f,children:n})};function $m(){return["NOD","E_EN","V"].join("")}var Am=()=>["e","nv"].join(""),Rn=()=>{const e=typeof window<"u"&&window.remotion_isPlayer,t=typeof window<"u"&&typeof window.process<"u"&&typeof window.process.env<"u"&&(window.process[Am()][$m()]==="test"||window.process[Am()][$m()]==="production"&&typeof window<"u"&&typeof window.remotion_puppeteerTimeout<"u"),n=typeof window<"u"&&window.remotion_isStudio,r=typeof window<"u"&&window.remotion_isReadOnlyStudio;return{isStudio:n,isRendering:t,isPlayer:e,isReadOnlyStudio:r,isClientSideRendering:!1}},cf="remotion-date:",Vs="remotion-file:",_E=({data:e,indent:t,staticBase:n})=>{let r=!1,o=!1,i=!1,s=!1;try{return{serializedString:JSON.stringify(e,function(l,c){const f=this[l];return f instanceof Date?(r=!0,`${cf}${f.toISOString()}`):f instanceof Map?(i=!0,c):f instanceof Set?(s=!0,c):typeof f=="string"&&n!==null&&f.startsWith(n)?(o=!0,`${Vs}${f.replace(n+"/","")}`):c},t),customDateUsed:r,customFileUsed:o,mapUsed:i,setUsed:s}}catch(a){throw new Error("Could not serialize the passed input props to JSON: "+a.message)}},Fw=e=>JSON.parse(e,(t,n)=>typeof n=="string"&&n.startsWith(cf)?new Date(n.replace(cf,"")):typeof n=="string"&&n.startsWith(Vs)?`${window.remotion_staticBase}/${n.replace(Vs,"")}`:n),ME=e=>Fw(_E({data:e,indent:2,staticBase:window.remotion_staticBase}).serializedString),df=e=>Rn().isStudio?ME(e):e,_w=d.createContext(!1),$E=({children:e})=>u.jsx(_w.Provider,{value:!0,children:e}),Ip=()=>d.useContext(_w),Fr=({className:e,classPrefix:t,type:n})=>{if(!e)return!1;if(n==="exact"){const r=e.split(" ");return t.some(o=>r.some(i=>i.trim()===o||i.trim().endsWith(`:${o}`)||i.trim().endsWith(`!${o}`)))}return t.some(r=>e.startsWith(r)||e.includes(` ${r}`)||e.includes(`!${r}`)||e.includes(`:${r}`))},AE=(e,t)=>{const{style:n,...r}=e,o=d.useMemo(()=>({position:"absolute",top:Fr({className:r.className,classPrefix:["top-","inset-"],type:"prefix"})?void 0:0,left:Fr({className:r.className,classPrefix:["left-","inset-"],type:"prefix"})?void 0:0,right:Fr({className:r.className,classPrefix:["right-","inset-"],type:"prefix"})?void 0:0,bottom:Fr({className:r.className,classPrefix:["bottom-","inset-"],type:"prefix"})?void 0:0,width:Fr({className:r.className,classPrefix:["w-"],type:"prefix"})?void 0:"100%",height:Fr({className:r.className,classPrefix:["h-"],type:"prefix"})?void 0:"100%",display:Fr({className:r.className,classPrefix:["block","inline-block","inline","flex","inline-flex","flow-root","grid","inline-grid","contents","list-item","hidden"],type:"exact"})?void 0:"flex",flexDirection:Fr({className:r.className,classPrefix:["flex-row","flex-col","flex-row-reverse","flex-col-reverse"],type:"exact"})?void 0:"column",...n}),[r.className,n]);return u.jsx("div",{ref:t,style:o,...r})},Hn=d.forwardRef(AE),NE={transform:"rotate(90deg)"},Nm=40,LE={color:"white",fontSize:14,fontFamily:"sans-serif"},zE={justifyContent:"center",alignItems:"center"},DE=()=>u.jsxs(Hn,{style:zE,id:"remotion-comp-loading",children:[u.jsx("style",{type:"text/css",children:`
42
42
  @keyframes anim {
43
43
  from {
44
44
  opacity: 0
@@ -51,10 +51,10 @@ Error generating stack: `+i.message+`
51
51
  animation: anim 2s;
52
52
  animation-fill-mode: forwards;
53
53
  }
54
- `}),u.jsx("svg",{width:Mm,height:Mm,viewBox:"-100 -100 400 400",style:FE,children:u.jsx("path",{fill:"#555",stroke:"#555",strokeWidth:"100",strokeLinejoin:"round",d:"M 2 172 a 196 100 0 0 0 195 5 A 196 240 0 0 0 100 2.259 A 196 240 0 0 0 2 172 z"})}),u.jsxs("p",{style:_E,children:["Resolving ","<Suspense>","..."]})]}),on=null,cf=()=>{if(!on){if(typeof document>"u")throw new Error("Tried to call an API that only works in the browser from outside the browser");on=document.createElement("div"),on.style.position="absolute",on.style.top="0px",on.style.left="0px",on.style.right="0px",on.style.bottom="0px",on.style.width="100%",on.style.height="100%",on.style.display="flex",on.style.flexDirection="column";const e=document.createElement("div");e.style.position="fixed",e.style.top="-999999px",e.appendChild(on),document.body.appendChild(e)}return on},df=()=>"remotion_inputPropsOverride"+window.location.origin,Rw=()=>{if(typeof localStorage>"u")return null;const e=localStorage.getItem(df());return e?JSON.parse(e):null},AE=e=>{if(!(typeof localStorage>"u")){if(e===null){localStorage.removeItem(df());return}localStorage.setItem(df(),JSON.stringify(e))}},$m=!1,NE=()=>{$m||($m=!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()"))},LE=()=>{if(typeof window>"u")return NE(),{};if(Rn().isPlayer)throw new Error("You cannot call `getInputProps()` from a <Player>. Instead, the props are available as React props from component that you passed as `component` prop.");const e=Rw();if(e)return e;if(typeof window>"u"||typeof window.remotion_inputProps>"u")throw new 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.");const t=window.remotion_inputProps;return t?Iw(t):{}},Cp=d.createContext({props:{},updateProps:()=>{throw new Error("Not implemented")}}),zE=le.createRef(),jw=({children:e})=>{const[t,n]=le.useState({}),r=d.useCallback(({defaultProps:i,id:s,newProps:a})=>{n(l=>({...l,[s]:typeof a=="function"?a(l[s]??i):a}))},[]),o=d.useMemo(()=>({props:t,updateProps:r}),[t,r]);return u.jsx(Cp.Provider,{value:o,children:e})},Pw=le.createContext(null),ct=()=>{const e=d.useContext(Pw),[t]=d.useState(()=>Rn());return e??t};function Hl(e,t,n){if(typeof e!="number")throw new Error(`The "${t}" prop ${n} must be a number, but you passed a value of type ${typeof e}`);if(isNaN(e))throw new TypeError(`The "${t}" prop ${n} must not be NaN, but is NaN.`);if(!Number.isFinite(e))throw new TypeError(`The "${t}" prop ${n} must be finite, but is ${e}.`);if(e%1!==0)throw new TypeError(`The "${t}" prop ${n} must be an integer, but is ${e}.`);if(e<=0)throw new TypeError(`The "${t}" prop ${n} must be positive, but got ${e}.`)}function bu(e,t){const{allowFloats:n,component:r}=t;if(typeof e>"u")throw new Error(`The "durationInFrames" prop ${r} is missing.`);if(typeof e!="number")throw new Error(`The "durationInFrames" prop ${r} must be a number, but you passed a value of type ${typeof e}`);if(e<=0)throw new TypeError(`The "durationInFrames" prop ${r} must be positive, but got ${e}.`);if(!n&&e%1!==0)throw new TypeError(`The "durationInFrames" prop ${r} must be an integer, but got ${e}.`);if(!Number.isFinite(e))throw new TypeError(`The "durationInFrames" prop ${r} must be finite, but got ${e}.`)}function Su(e,t,n){if(typeof e!="number")throw new Error(`"fps" must be a number, but you passed a value of type ${typeof e} ${t}`);if(!Number.isFinite(e))throw new Error(`"fps" must be a finite, but you passed ${e} ${t}`);if(isNaN(e))throw new Error(`"fps" must not be NaN, but got ${e} ${t}`);if(e<=0)throw new TypeError(`"fps" must be positive, but got ${e} ${t}`)}var ku=d.createContext(null),DE=d.createRef(),OE=e=>!!e.calculateMetadata,Ip=e=>{const t=d.useContext(ku),{props:n}=d.useContext(Cp),{compositions:r,canvasContent:o,currentCompositionMetadata:i}=d.useContext(Mi),s=(o==null?void 0:o.type)==="composition"?o.compositionId:null,a=e??s,l=r.find(p=>p.id===a),c=d.useMemo(()=>l?n[l.id]??{}:{},[n,l]),f=ct();return d.useMemo(()=>l?i?{type:"success",metadataSource:null,result:{...i,id:l.id,defaultProps:l.defaultProps??{}}}:OE(l)?!t||!t[l.id]?null:t[l.id]:(bu(l.durationInFrames,{allowFloats:!1,component:`in <Composition id="${l.id}">`}),Su(l.fps,`in <Composition id="${l.id}">`),Hl(l.width,"width",`in <Composition id="${l.id}">`),Hl(l.height,"height",`in <Composition id="${l.id}">`),{type:"success",metadataSource:null,result:{width:l.width,height:l.height,fps:l.fps,id:l.id,durationInFrames:l.durationInFrames,defaultProps:l.defaultProps??{},props:{...l.defaultProps??{},...c??{},...typeof window>"u"||f.isPlayer||!window.remotion_inputProps?{}:LE()??{}},defaultCodec:null,defaultOutName:null,defaultVideoImageFormat:null,defaultPixelFormat:null,defaultProResProfile:null,defaultSampleRate:null}}):null,[l,t,i,c,f.isPlayer])},Fw=e=>{const t=e.stack??"";return t.startsWith("Error:")?t:`${e.message}
55
- ${t}`},BE=e=>e instanceof Error?!0:!(e===null||typeof e!="object"||!("stack"in e)||typeof e.stack!="string"||!("message"in e)||typeof e.message!="string");function Tp(e,t){let n;throw BE(t)?(n=t,n.stack||(n.stack=new Error(n.message).stack)):typeof t=="string"?n=Error(t):n=Error("Rendering was cancelled"),e&&(e.remotion_cancelledError=Fw(n)),n}function Hs(e){return Tp(typeof window<"u"?window:void 0,e)}var WE=["trace","verbose","info","warn","error"],Am=e=>WE.indexOf(e),Eu=(e,t)=>Am(e)<=Am(t),ra=({args:e,logLevel:t,tag:n})=>{const r=[...e];return Rn().isRendering&&!Rn().isClientSideRendering&&r.unshift(Symbol.for(`__remotion_level_${t}`)),n&&Rn().isRendering&&!Rn().isClientSideRendering&&r.unshift(Symbol.for(`__remotion_tag_${n}`)),r},VE=(e,...t)=>{if(Eu(e.logLevel,"verbose"))return console.debug(...ra({args:t,logLevel:"verbose",tag:e.tag}))},HE=(e,...t)=>{if(Eu(e.logLevel,"trace"))return console.debug(...ra({args:t,logLevel:"trace",tag:e.tag}))},UE=(e,...t)=>{if(Eu(e.logLevel,"info"))return console.log(...ra({args:t,logLevel:"info",tag:e.tag}))},ZE=(e,...t)=>{if(Eu(e.logLevel,"warn"))return console.warn(...ra({args:t,logLevel:"warn",tag:e.tag}))},KE=(e,...t)=>console.error(...ra({args:t,logLevel:"error",tag:e.tag})),kt={trace:HE,verbose:VE,info:UE,warn:ZE,error:KE};typeof window<"u"&&(window.remotion_renderReady=!1,window.remotion_delayRenderTimeouts||(window.remotion_delayRenderTimeouts={}),window.remotion_delayRenderHandles=[]);var YE="The delayRender was called:",GE="Retries left: ",XE="- Rendering the frame will be retried.",qE="handle was cleared after",JE=3e4,_w=({scope:e,environment:t,label:n,options:r})=>{var s;if(typeof n!="string"&&n!==null)throw new Error("The label parameter of delayRender() must be a string or undefined, got: "+JSON.stringify(n));const o=Math.random();e.remotion_delayRenderHandles.push(o);const i=((s=Error().stack)==null?void 0:s.replace(/^Error/g,""))??"";if(t.isRendering){const a=((r==null?void 0:r.timeoutInMilliseconds)??e.remotion_puppeteerTimeout??JE)-2e3,l=((r==null?void 0:r.retries)??0)-(e.remotion_attempt-1);e.remotion_delayRenderTimeouts[o]={label:n??null,startTime:Date.now(),timeout:setTimeout(()=>{const c=["A delayRender()",n?`"${n}"`:null,`was called but not cleared after ${a}ms. See https://remotion.dev/docs/timeout for help.`,l>0?GE+l:null,l>0?XE:null,YE,i].filter($i).join(" ");t.isClientSideRendering?e.remotion_cancelledError=Fw(Error(c)):Tp(e,Error(c))},a)}}return e.remotion_renderReady=!1,o},QE=(e,t)=>typeof window>"u"?Math.random():_w({scope:window,environment:Rn(),label:e??null,options:{}}),Mw=({scope:e,handle:t,environment:n,logLevel:r})=>{if(typeof t>"u")throw new TypeError("The continueRender() method must be called with a parameter that is the return value of delayRender(). No value was passed.");if(typeof t!="number")throw new TypeError("The parameter passed into continueRender() must be the return value of delayRender() which is a number. Got: "+JSON.stringify(t));const o=e.remotion_delayRenderHandles.includes(t),i=e.remotion_delayRenderTimeouts[t];if(o&&n.isRendering&&i){const{label:s,startTime:a,timeout:l}=i;clearTimeout(l);const c=[s?`"${s}"`:"A handle",qE,`${Date.now()-a}ms`].filter($i).join(" ");kt.verbose({logLevel:r,tag:"delayRender()"},c),delete e.remotion_delayRenderTimeouts[t]}e.remotion_delayRenderHandles=e.remotion_delayRenderHandles.filter(s=>s!==t),e.remotion_delayRenderHandles.length===0&&(e.remotion_renderReady=!0)},eC=e=>{typeof window>"u"||Mw({scope:window,handle:e,environment:Rn(),logLevel:window.remotion_logLevel??"info"})},Fo=d.createContext({logLevel:"info",mountTime:0}),sr=()=>{const{logLevel:e}=d.useContext(Fo);if(e===null)throw new Error("useLogLevel must be used within a LogLevelProvider");return e},oa=()=>{const{mountTime:e}=d.useContext(Fo);if(e===null)throw new Error("useMountTime must be used within a LogLevelProvider");return e},$w=d.createContext(null),Un=()=>{const e=ct(),t=d.useContext($w)??(typeof window<"u"?window:void 0),n=sr(),r=d.useCallback((s,a)=>t?_w({scope:t,environment:e,label:s??null,options:a??{}}):Math.random(),[e,t]),o=d.useCallback(s=>{t&&Mw({scope:t,handle:s,environment:e,logLevel:n})},[e,n,t]),i=d.useCallback(s=>Tp(t??(typeof window<"u"?window:void 0),s),[t]);return{delayRender:r,continueRender:o,cancelRender:i}},Aw=({compProps:e,componentName:t,noSuspense:n})=>{const r=d.useRef(null);return"component"in e&&(r.current=e.component),d.useMemo(()=>{if("component"in e){if(typeof document>"u"||n)return e.component;if(typeof e.component>"u")throw new Error(`A value of \`undefined\` was passed to the \`component\` prop. Check the value you are passing to the <${t}/> component.`);return s=>{const a=r.current;return le.createElement(a,s)}}if("lazyComponent"in e&&typeof e.lazyComponent<"u"){if(typeof e.lazyComponent>"u")throw new Error(`A value of \`undefined\` was passed to the \`lazyComponent\` prop. Check the value you are passing to the <${t}/> component.`);return le.lazy(e.lazyComponent)}throw new Error("You must pass either 'component' or 'lazyComponent'")},[e.lazyComponent])},Cu=()=>{const{canvasContent:e,compositions:t,currentCompositionMetadata:n}=d.useContext(Mi),r=t.find(i=>(e==null?void 0:e.type)==="composition"&&i.id===e.compositionId),o=Ip((r==null?void 0:r.id)??null);return d.useMemo(()=>!o||o.type==="error"||o.type==="loading"||!r?null:{...o.result,defaultProps:r.defaultProps??{},id:r.id,...n??{},component:r.component},[n,o,r])},Nw=()=>/^([a-zA-Z0-9-\u4E00-\u9FFF])+$/g,Lw=e=>e.match(Nw()),tC=e=>{if(!Lw(e))throw new Error(`Composition id can only contain a-z, A-Z, 0-9, CJK characters and -. You passed ${e}`)},nC=`Composition ID must match ${String(Nw())}`,rC=(e,t,n)=>{if(e){if(typeof e!="object")throw new Error(`"${t}" must be an object, but you passed a value of type ${typeof e}`);if(Array.isArray(e))throw new Error(`"${t}" must be an object, an array was passed ${n?`for composition "${n}"`:""}`)}},oC=()=>{const{continueRender:e,delayRender:t}=Un();return d.useEffect(()=>{const n=t("Waiting for Root component to unsuspend");return()=>e(n)},[e,t]),null},iC=({width:e,height:t,fps:n,durationInFrames:r,id:o,defaultProps:i,schema:s,...a})=>{const l=d.useContext(ta),{registerComposition:c,unregisterComposition:f}=l,p=Cu(),m=Aw({compProps:a,componentName:"Composition",noSuspense:!1}),g=xu(),w=Ep(),x=ct(),k=d.useContext(Po);if(typeof window<"u"&&(window.remotion_seenCompositionIds=Array.from(new Set([...window.remotion_seenCompositionIds??[],o]))),k)throw w?new Error("<Composition> was mounted inside the `component` that was passed to the <Player>. See https://remotion.dev/docs/wrong-composition-mount for help."):new Error("<Composition> mounted inside another composition. See https://remotion.dev/docs/wrong-composition-mount for help.");const{folderName:h,parentName:y}=d.useContext(af),v=a.stack??null,S="component"in a?a.component:null;d.useEffect(()=>{if(!o)throw new Error("No id for composition passed.");return tC(o),rC(i,"defaultProps",o),c({durationInFrames:r??void 0,fps:n??void 0,height:t??void 0,width:e??void 0,id:o,folderName:h,component:m,defaultProps:uf(i??{}),nonce:g.get(),parentFolderName:y,componentFromProps:S,schema:s??null,calculateMetadata:a.calculateMetadata??null,stack:v}),()=>{f(o)}},[r,n,t,m,o,h,i,e,g,y,S,s,a.calculateMetadata,v,c,f]);const b=Ip(o),{setError:E,clearError:I}=d.useContext(kw),T=d.useCallback(F=>{E(F)},[E]),R=d.useCallback(()=>{I()},[I]);if(x.isStudio&&p&&p.component===m&&p.id===o){const F=m;return b===null||b.type!=="success"&&b.type!=="success-and-refreshing"?null:of.createPortal(u.jsx(sf,{children:u.jsx(kE,{onError:T,onClear:R,children:u.jsx(d.Suspense,{fallback:u.jsx($E,{}),children:u.jsx(F,{...b.result.props??{}})})})}),cf())}if(x.isRendering&&p&&p.component===m&&p.id===o){const F=m;return b===null||b.type!=="success"&&b.type!=="success-and-refreshing"?null:of.createPortal(u.jsx(sf,{children:u.jsx(d.Suspense,{fallback:u.jsx(oC,{}),children:u.jsx(F,{...b.result.props??{}})})}),cf())}return null},Ul=e=>{const{onlyRenderComposition:t}=d.useContext(ta);return t&&t!==e.id?null:u.jsx(iC,{...e})},zw=[],Dw=null,sC=()=>zw,Zt=e=>{zw.push(e)},aC=e=>{Dw=e},lC=()=>Dw,uC=e=>{const t=le.Children.toArray(e);if(t.length!==1)return null;const n=t[0];return!le.isValidElement(n)||typeof n.type!="function"&&typeof n.type!="object"?null:n.type},fs="4.0.499",cC=()=>{if(typeof globalThis>"u")return;const e=()=>{globalThis.remotion_imported=fs,typeof window<"u"&&(window.remotion_imported=fs)},t=globalThis.remotion_imported||typeof window<"u"&&window.remotion_imported;if(t){if(t===fs)return;if(typeof t=="string"&&t.includes("webcodecs")){e();return}throw new TypeError(`🚨 Multiple versions of Remotion detected: ${[fs,typeof t=="string"?t:"an older version"].filter($i).join(" and ")}. This will cause things to break in an unexpected way.
56
- Check that all your Remotion packages are on the same version. If your dependencies depend on Remotion, make them peer dependencies. You can also run \`npx remotion versions\` from your terminal to see which versions are mismatching.`)}e()},xt=d.createContext(null),ff={};Sw(ff,{useTimelineSetFrame:()=>Zw,useTimelinePosition:()=>io,useTimelineContext:()=>oo,usePlayingState:()=>Kw,usePlaybackRate:()=>Fp,useAbsoluteTimelinePosition:()=>Uw,persistCurrentFrame:()=>Ow,getInitialFrameState:()=>Bw,getFrameForComposition:()=>Ww,clampFrameToCompositionRange:()=>Vw});function Nm(e){let t=e+1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function dC(e){let t=0,n=0,r=0;for(t=0;t<e.length;t++)n=e.charCodeAt(t),r=(r<<5)-r+n,r|=0;return r}var _o=(e,t)=>{if(e===null)return Math.random();if(typeof e=="string")return Nm(dC(e));if(typeof e=="number")return Nm(e*1e10);throw new Error("random() argument must be a number or a string")},Ai=d.createContext({setFrame:()=>{throw new Error("default")},setPlaying:()=>{throw new Error("default")}}),Ni=d.createContext(null),Rp=d.createContext(null),jp=d.createContext(null),fC=({children:e,frameState:t})=>{const[n,r]=d.useState(!1),o=d.useRef(!1),[i,s]=d.useState(1),a=d.useRef([]),[l]=d.useState(()=>String(_o(null))),[c,f]=d.useState(()=>Bw()),p=t??c,{delayRender:m,continueRender:g}=Un();typeof window<"u"&&d.useLayoutEffect(()=>{window.remotion_setFrame=(h,y,v)=>{window.remotion_attempt=v;const S=m(`Setting the current frame to ${h}`);let b=!0;f(E=>(E[y]??window.remotion_initialFrame)===h?(b=!1,E):{...E,[y]:h}),b?requestAnimationFrame(()=>g(S)):g(S)},window.remotion_isPlayer=!1},[g,m]);const w=d.useMemo(()=>({frame:p,playing:n,imperativePlaying:o,rootId:l,audioAndVideoTags:a}),[p,n,l]),x=d.useMemo(()=>({playbackRate:i,setPlaybackRate:s}),[i]),k=d.useMemo(()=>({setFrame:f,setPlaying:r}),[]);return u.jsx(jp.Provider,{value:w,children:u.jsx(Rp.Provider,{value:x,children:u.jsx(Ni.Provider,{value:w,children:u.jsx(Ai.Provider,{value:k,children:e})})})})},Pp=()=>"remotion.time-all",Ow=e=>{localStorage.setItem(Pp(),JSON.stringify(e))},Bw=()=>{const e=localStorage.getItem(Pp())??"{}";return JSON.parse(e)},Ww=e=>{const t=localStorage.getItem(Pp())??"{}",n=JSON.parse(t);return n[e]!==void 0?Number(n[e]):typeof window>"u"?0:window.remotion_initialFrame??0},Vw=(e,t)=>Math.max(0,Math.min(Math.max(0,t-1),e)),Hw=e=>{const t=Cu(),n=ct();if(!t)return typeof window>"u"?0:window.remotion_initialFrame??0;const r=e.frame[t.id]??(n.isPlayer?0:Ww(t.id));return Vw(r,t.durationInFrames)},oo=()=>{const e=d.useContext(Ni);if(e===null)throw new Error("TimelineContext is not available. This hook must be used inside a <Player> or the Remotion Studio.");return e},Fp=()=>{const e=d.useContext(Rp);if(e===null)throw new Error("PlaybackRateContext is not available. This hook must be used inside a <Player> or the Remotion Studio.");return e},io=()=>{const e=oo();return Hw(e)},Uw=()=>{const e=d.useContext(jp);if(e===null)throw new Error("AbsoluteTimeContext is not available. This hook must be used inside a <Player> or the Remotion Studio.");return Hw(e)},Zw=()=>{const{setFrame:e}=d.useContext(Ai);return e},Kw=()=>{const{playing:e,imperativePlaying:t}=oo(),{setPlaying:n}=d.useContext(Ai);return d.useMemo(()=>[e,n,t],[t,e,n])},Ft=()=>{const e=d.useContext(Po),t=ct();if(!e)throw t.isPlayer?new Error("useCurrentFrame can only be called inside a component that was passed to <Player>. See: https://www.remotion.dev/docs/player/examples"):new 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");const n=io(),r=d.useContext(xt),o=r?r.cumulatedFrom+r.relativeFrom:0;return n-o},Iu=()=>{const e=d.useContext(xt),t=(e==null?void 0:e.width)??null,n=(e==null?void 0:e.height)??null,r=(e==null?void 0:e.durationInFrames)??null,o=Cu();return d.useMemo(()=>{if(!o)return null;const{id:i,durationInFrames:s,fps:a,height:l,width:c,defaultProps:f,props:p,defaultCodec:m,defaultOutName:g,defaultVideoImageFormat:w,defaultPixelFormat:x,defaultProResProfile:k,defaultSampleRate:h}=o;return{id:i,width:t??c,height:n??l,fps:a,durationInFrames:r??s,defaultProps:f,props:p,defaultCodec:m,defaultOutName:g,defaultVideoImageFormat:w,defaultPixelFormat:x,defaultProResProfile:k,defaultSampleRate:h}},[r,n,t,o])},ht=()=>{const e=Iu(),t=d.useContext(Po),n=Ep();if(!e)throw typeof window<"u"&&window.remotion_isPlayer||n?new Error(["No video config found. Likely reasons:","- You are probably calling useVideoConfig() from outside the component passed to <Player />. 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."].join("-")):new Error("No video config found. You are probably calling useVideoConfig() from a component which has not been registered as a <Composition />. See https://www.remotion.dev/docs/the-fundamentals#defining-compositions for more information.");if(!t)throw new Error("Called useVideoConfig() outside a Remotion composition.");return e},ia=({frame:e,children:t,active:n=!0})=>{const r=Ft(),o=ht();if(typeof e>"u")throw new Error("The <Freeze /> component requires a 'frame' prop, but none was passed.");if(typeof e!="number")throw new Error(`The 'frame' prop of <Freeze /> must be a number, but is of type ${typeof e}`);if(Number.isNaN(e))throw new Error("The 'frame' prop of <Freeze /> must be a real number, but it is NaN.");if(!Number.isFinite(e))throw new Error(`The 'frame' prop of <Freeze /> must be a finite number, but it is ${e}.`);const i=d.useMemo(()=>{if(typeof n=="boolean")return n;if(typeof n=="function")return n(r)},[n,r]),s=oo(),a=d.useContext(xt),l=(a==null?void 0:a.relativeFrom)??0,c=d.useMemo(()=>i?{...s,playing:!1,imperativePlaying:{current:!1},frame:{[o.id]:e+l}}:s,[i,s,o.id,e,l]),f=d.useMemo(()=>a?i?{...a,cumulatedFrom:0}:a:null,[a,i]);return u.jsx(Ni.Provider,{value:c,children:u.jsx(xt.Provider,{value:f,children:t})})},ar={"style.transformOrigin":{type:"transform-origin",step:1,default:"50% 50%",description:"Transform origin"},"style.translate":{type:"translate",step:1,default:"0px 0px",description:"Offset"},"style.scale":{type:"scale",max:100,step:.01,default:1,description:"Scale",defaultKeyframeOutput:"perceptual-scale"},"style.rotate":{type:"rotation-css",step:1,default:"0deg",description:"Rotation"},"style.opacity":{type:"number",min:0,max:1,step:.01,default:1,description:"Opacity",hiddenFromList:!1}},pC=ar,Tu={"style.color":{type:"color",default:void 0,description:"Color"},"style.fontFamily":{type:"font-family",default:void 0,description:"Font family",keyframable:!1},"style.fontSize":{type:"number",default:void 0,min:0,step:1,description:"Font size",hiddenFromList:!1},"style.lineHeight":{type:"number",default:void 0,min:0,step:.05,description:"Line height",hiddenFromList:!1},"style.fontWeight":{type:"enum",default:"400",description:"Font weight",variants:{100:{},200:{},300:{},400:{},500:{},600:{},700:{},800:{},900:{},normal:{},bold:{}}},"style.fontStyle":{type:"enum",default:"normal",description:"Font style",variants:{normal:{},italic:{},oblique:{}}},"style.textAlign":{type:"enum",default:"left",description:"Text align",variants:{left:{},center:{},right:{},justify:{},start:{},end:{}}},"style.letterSpacing":{type:"number",default:void 0,step:.1,description:"Letter spacing",hiddenFromList:!1}},so={"style.borderWidth":{type:"number",default:void 0,min:0,step:1,description:"Border width",hiddenFromList:!1},"style.borderStyle":{type:"enum",default:"none",description:"Border style",variants:{none:{},hidden:{},solid:{},dashed:{},dotted:{},double:{},groove:{},ridge:{},inset:{},outset:{}}},"style.borderColor":{type:"color",default:void 0,description:"Border color"}},ao={"style.backgroundColor":{type:"color",default:"transparent",description:"Color"}},Yw={children:{type:"text-content",default:"",description:"Text",keyframable:!1}},Li={premountFor:{type:"number",default:0,description:"Premount For",min:0,step:1,hiddenFromList:!1,keyframable:!1},postmountFor:{type:"number",default:0,min:0,step:1,hiddenFromList:!0,keyframable:!1}},Gw={...Li},Xw={...ar,...ao,...so,...Gw},_p={type:"boolean",default:!1,description:"Hidden"},qw={type:"hidden"},Mp={type:"hidden"},hC=e=>({name:Mp,...e}),$p={type:"number",default:void 0,min:1,step:1,hiddenFromList:!0},Jw={type:"number",default:0,step:1,hiddenFromList:!0},Qw={type:"number",default:0,min:0,step:1,hiddenFromList:!0},Ap={type:"number",default:null,step:1,hiddenFromList:!0},Cr={durationInFrames:$p,from:Jw,trimBefore:Qw,freeze:Ap,hidden:_p,name:Mp,showInTimeline:qw},Ri={...Cr,layout:{type:"enum",default:"absolute-fill",description:"Layout",variants:{"absolute-fill":Xw,none:{}}}},mC={durationInFrames:$p,trimBefore:Qw,freeze:Ap,hidden:_p,name:Mp,showInTimeline:qw},gC={...mC,layout:Ri.layout},yC={...Ri,layout:{...Ri.layout,default:"none"}},zi=le.createContext({registerSequence:()=>{throw new Error("SequenceManagerContext not initialized")},unregisterSequence:()=>{throw new Error("SequenceManagerContext not initialized")},sequences:[]}),Ru=le.createContext({current:[]}),mr=e=>`${e.absolutePath}\0${e.nodePath.join(".")}\0${e.sequenceKeys.join(".")}\0${e.effectKeys.map(t=>t.join(".")).join(".")}`,ju=le.createContext({propStatuses:{}}),Pu=le.createContext({current:{}}),Fu=le.createContext({getDragOverrides:()=>{throw new Error("VisualModeDragOverridesContext not initialized")},getEffectDragOverrides:()=>{throw new Error("VisualModeDragOverridesContext not initialized")}}),ex=le.createContext({setDragOverrides:()=>{throw new Error("VisualModeSettersContext not initialized")},clearDragOverrides:()=>{throw new Error("VisualModeSettersContext not initialized")},setEffectDragOverrides:()=>{throw new Error("VisualModeSettersContext not initialized")},clearEffectDragOverrides:()=>{throw new Error("VisualModeSettersContext not initialized")},setPropStatuses:()=>{throw new Error("VisualModeSettersContext not initialized")}}),Fc=(e,t)=>`${mr(e)}.effects.${t}`,vC=({children:e})=>{const[t,n]=d.useState([]),r=d.useRef(t);r.current=t;const[o,i]=d.useState({}),s=d.useRef(o);s.current=o;const[a,l]=d.useState({}),[c,f]=d.useState({}),p=d.useRef(c);p.current=c;const m=d.useCallback((R,F,A)=>{i(W=>({...W,[mr(R)]:{...W[mr(R)],[F]:A}}))},[]),g=d.useCallback(R=>{i(F=>{const A=mr(R);if(!F[A])return F;const W={...F};return delete W[A],W})},[]),w=d.useCallback((R,F,A,W)=>{l(M=>{const $=Fc(R,F);return{...M,[$]:{...M[$],[A]:W}}})},[]),x=d.useCallback((R,F)=>{l(A=>{const W=Fc(R,F);if(!A[W])return A;const M={...A};return delete M[W],M})},[]),k=d.useCallback((R,F)=>{f(A=>{const W=mr(R),M=A[W],$=F(M);return M===$?A:{...A,[W]:$}})},[]),h=d.useCallback(R=>{n(F=>[...F,R])},[]),y=d.useCallback(R=>{n(F=>F.filter(A=>A.id!==R))},[]),v=d.useMemo(()=>({registerSequence:h,sequences:t,unregisterSequence:y}),[h,t,y]),S=d.useCallback(R=>o[mr(R)]??{},[o]),b=d.useCallback((R,F)=>a[Fc(R,F)]??{},[a]),E=d.useMemo(()=>({propStatuses:c}),[c]),I=d.useMemo(()=>({getDragOverrides:S,getEffectDragOverrides:b}),[S,b]),T=d.useMemo(()=>({setDragOverrides:m,clearDragOverrides:g,setEffectDragOverrides:w,clearEffectDragOverrides:x,setPropStatuses:k}),[m,g,w,x,k]);return u.jsx(Ru.Provider,{value:r,children:u.jsx(zi.Provider,{value:v,children:u.jsx(Pu.Provider,{value:p,children:u.jsx(ju.Provider,{value:E,children:u.jsx(Fu.Provider,{value:I,children:u.jsx(ex.Provider,{value:T,children:e})})})})})})},_u=d.createContext(!1),wC=({children:e})=>u.jsx(_u.Provider,{value:!0,children:e}),tx=({children:e})=>u.jsx(_u.Provider,{value:!1,children:e}),xC=()=>{if(!le.useContext(_u))throw new Error("This component must be inside a <Series /> component.")},nx=d.createContext({premountFramesRemaining:0}),bC=!1,sa=e=>e??bC,aa=({from:e,durationInFrames:t,premountFor:n,postmountFor:r,style:o,styleWhilePremounted:i,styleWhilePostmounted:s,hideWhilePremounted:a})=>{const l=d.useContext(nx),c=Ft()-l.premountFramesRemaining,f=ct(),{fps:p}=ht(),m=n??0,g=r??0,w=Math.ceil(e+t-1),x=!f.isRendering&&c<e&&c>=e-m,k=!f.isRendering&&c>w&&c<=w+g,h=x||k,y=x?e:k?e+t-1:0,v=d.useMemo(()=>h?{...o,...a==="opacity"?{opacity:0}:{display:"none"},pointerEvents:"none",...x?i:{},...k?s:{}}:o,[h,a,k,x,o,s,i]);return{effectivePremountFor:m,effectivePostmountFor:g,premountingActive:x,postmountingActive:k,isPremountingOrPostmounting:h,freezeFrame:y,premountingStyle:v}},SC=(e,t)=>{for(const n of t){const r=n.split("."),o=[e];let i=e;for(let s=0;s<r.length-1;s++){const a=r[s],l=i[a];if(l==null){i=null;break}i=l,o.push(i)}if(i!==null){delete i[r[r.length-1]];for(let s=o.length-1;s>0;s--){const a=o[s];if(Object.keys(a).length===0){const l=r[s-1];delete o[s-1][l]}else break}}}return e},kC=4,EC=.001,CC=1e-7,IC=10,ps=11,Ma=1/(ps-1),TC=typeof Float32Array=="function";function rx(e,t){return 1-3*t+3*e}function ox(e,t){return 3*t-6*e}function ix(e){return 3*e}function Zl(e,t,n){return((rx(t,n)*e+ox(t,n))*e+ix(t))*e}function sx(e,t,n){return 3*rx(t,n)*e*e+2*ox(t,n)*e+ix(t)}function RC({aX:e,_aA:t,_aB:n,mX1:r,mX2:o}){let i,s,a=0,l=t,c=n;do s=l+(c-l)/2,i=Zl(s,r,o)-e,i>0?c=s:l=s;while(Math.abs(i)>CC&&++a<IC);return s}function jC(e,t,n,r){let o=t;for(let i=0;i<kC;++i){const s=sx(o,n,r);if(s===0)return o;const a=Zl(o,n,r)-e;o-=a/s}return o}function ax(e,t,n,r){if(!(e>=0&&e<=1&&n>=0&&n<=1))throw new Error("bezier x values must be in [0, 1] range");const o=TC?new Float32Array(ps):new Array(ps);if(e!==t||n!==r)for(let s=0;s<ps;++s)o[s]=Zl(s*Ma,e,n);function i(s){let a=0,l=1;const c=ps-1;for(;l!==c&&o[l]<=s;++l)a+=Ma;--l;const f=(s-o[l])/(o[l+1]-o[l]),p=a+f*Ma,m=sx(p,e,n);return m>=EC?jC(s,p,e,n):m===0?p:RC({aX:s,_aA:a,_aB:a+Ma,mX1:e,mX2:n})}return function(s){const a=Math.min(1,Math.max(0,s));return e===t&&n===r?a:a===0?0:a===1?1:Zl(i(a),t,r)}}var PC=e=>Math.round(e*1e6)/1e6,FC=new Set(["deg","rad","grad","turn"]),lx=new Set(["%","cap","ch","cm","cqb","cqh","cqi","cqmax","cqmin","cqw","dvh","dvw","em","ex","ic","in","lh","lvh","lvw","mm","pc","pt","px","q","rem","rlh","svh","svw","vb","vh","vi","vmax","vmin","vw"]),ux=/^([+-]?(?:\d+\.?\d*|\.\d+))([a-zA-Z%]+)?$/,cx=new Set(["left","center","right","top","bottom"]),li=e=>e==="left"?[{axis:"x",value:{value:0,unit:"%"}}]:e==="right"?[{axis:"x",value:{value:100,unit:"%"}}]:e==="top"?[{axis:"y",value:{value:0,unit:"%"}}]:e==="bottom"?[{axis:"y",value:{value:100,unit:"%"}}]:[{axis:"x",value:{value:50,unit:"%"}},{axis:"y",value:{value:50,unit:"%"}}],Qi={value:50,unit:"%"},Lm=e=>String(PC(e)),_C=(e,t)=>{const n=ux.exec(e);if(n===null)throw new TypeError(`Cannot interpolate "${t}" because "${e}" is not a supported scale, translate, or rotate value`);const r=n[2]??null,o=Number(n[1]);if(!Number.isFinite(o))throw new TypeError(`Cannot interpolate "${t}" because "${e}" is not finite`);if(r===null)return{kind:"scale",value:o,unit:null};if(FC.has(r))return{kind:"rotate",value:o,unit:r};if(lx.has(r))return{kind:"translate",value:o,unit:r};throw new TypeError(`Cannot interpolate "${t}" because "${r}" is not a supported translate or rotate unit`)},dx=({component:e,value:t,allowPercentage:n})=>{const r=ux.exec(e);if(r===null)throw new TypeError(`Cannot interpolate "${t}" because "${e}" is not a supported transform-origin ${n?"length-percentage":"z length"}`);const o=r[2]??null,i=Number(r[1]);if(!Number.isFinite(i))throw new TypeError(`Cannot interpolate "${t}" because "${e}" is not finite`);if(o===null||!lx.has(o)||!n&&o==="%")throw new TypeError(`Cannot interpolate "${t}" because "${e}" is not a supported transform-origin ${n?"length-percentage":"z length"}`);return{value:i,unit:o}},_c=(e,t)=>{const n=e.toLowerCase();return cx.has(n)?{type:"keyword",keyword:n}:{type:"length-percentage",parsed:dx({component:e,value:t,allowPercentage:!0})}},MC=(e,t,n)=>{const r=[];for(const o of li(e))for(const i of li(t))o.axis!==i.axis&&r.push(o.axis==="x"?[o.value,i.value]:[i.value,o.value]);if(r.length===0)throw new TypeError(`Cannot interpolate "${n}" because "${e} ${t}" is not a valid transform-origin keyword pair`);return r[0]},$C=(e,t)=>{if(e.length===1){const a=_c(e[0],t);return a.type==="length-percentage"?[a.parsed,Qi]:a.keyword==="top"||a.keyword==="bottom"?[Qi,li(a.keyword)[0].value]:[li(a.keyword)[0].value,Qi]}const n=_c(e[0],t),r=_c(e[1],t);if(n.type==="length-percentage"&&r.type==="length-percentage")return[n.parsed,r.parsed];if(n.type==="keyword"&&r.type==="keyword")return MC(n.keyword,r.keyword,t);const o=n.type==="keyword"?n:r.type==="keyword"?r:null,i=n.type==="length-percentage"?n.parsed:r.type==="length-percentage"?r.parsed:null;if(o===null||i===null)throw new Error("Expected a keyword and a length-percentage value");const s=n.type==="keyword";if(o.keyword==="left"||o.keyword==="right"){if(!s)throw new TypeError(`Cannot interpolate "${t}" because horizontal transform-origin keywords must come before a length-percentage value`);return[li(o.keyword)[0].value,i]}return o.keyword==="top"||o.keyword==="bottom"?[i,li(o.keyword)[0].value]:s?[Qi,i]:[i,Qi]},AC=(e,t)=>{const[n,r]=$C(t.slice(0,2),e),o=t[2]===void 0?{value:0,unit:null}:dx({component:t[2],value:e,allowPercentage:!1});return{kind:"translate",values:[n.value,r.value,o.value],units:[n.unit,r.unit,o.unit],dimensions:t[2]===void 0?2:3}},NC=e=>{var o,i,s,a,l,c;if(typeof e=="number"){if(!Number.isFinite(e))throw new Error(`outputRange must contain only finite numbers, but got [${e}]`);return{kind:"scale",values:[e,e,1],units:[null,null,null],dimensions:1}}const t=e.trim().split(/\s+/);if(t.length<1||t.length>3||t[0]==="")throw new TypeError(`String outputRange values must contain 1 to 3 components, but got "${e}"`);if(t.some(f=>cx.has(f.toLowerCase())))return AC(e,t);const n=t.map(f=>_C(f,e)),[{kind:r}]=n;for(const f of n)if(f.kind!==r)throw new TypeError(`Cannot interpolate "${e}" because it mixes ${r} and ${f.kind} values`);if(r==="scale"){const f=n[0].value,p=((o=n[1])==null?void 0:o.value)??f,m=((i=n[2])==null?void 0:i.value)??1;return{kind:r,values:[f,p,m],units:[null,null,null],dimensions:n.length}}return{kind:r,values:[n[0].value,((s=n[1])==null?void 0:s.value)??0,((a=n[2])==null?void 0:a.value)??0],units:[n[0].unit,((l=n[1])==null?void 0:l.unit)??null,((c=n[2])==null?void 0:c.unit)??null],dimensions:n.length}},LC=({kind:e,values:t,units:n,dimensions:r})=>e==="scale"?t.slice(0,r).map(o=>Lm(o)).join(" "):t.slice(0,r).map((o,i)=>`${Lm(o)}${n[i]}`).join(" "),zm=e=>e===0?0:Math.sign(e)*e*e,zC=e=>e===0?0:Math.sign(e)*Math.sqrt(Math.abs(e));function DC(e,t,n,r){const{extrapolateLeft:o,extrapolateRight:i,easing:s,output:a}=r;let l=e;const[c,f]=t,[p,m]=n;if(l<c){if(o==="identity")return l;if(o==="clamp")l=c;else if(o==="wrap"){const g=f-c;l=((l-c)%g+g)%g+c}}if(l>f){if(i==="identity")return l;if(i==="clamp")l=f;else if(i==="wrap"){const g=f-c;l=((l-c)%g+g)%g+c}}if(p===m)return p;if(l=(l-c)/(f-c),l=s(l),a==="perceptual-scale"){const g=zm(p),w=zm(m);l=zC(l*(w-g)+g)}else l=l*(m-p)+p;return l}function OC(e,t){let n;for(n=1;n<t.length-1&&!(t[n]>=e);++n);return n-1}var BC=e=>e,WC=e=>e??"linear",fx=e=>e.remotionShouldExtendRight===!0,Dm=({easing:e,segmentIndex:t})=>e===void 0?BC:typeof e=="function"?e:e[t],Om=({input:e,inputRange:t,outputRange:n,easing:r,extrapolateLeft:o,extrapolateRight:i,output:s})=>DC(e,t,n,{easing:r,extrapolateLeft:o,extrapolateRight:e>t[1]&&i==="clamp"&&fx(r)?"extend":i,output:s}),Np=({input:e,inputRange:t,outputRange:n,options:r})=>{const o=WC(r==null?void 0:r.output);if(t.length===1)return n[0];const i=r==null?void 0:r.easing;let s="extend";(r==null?void 0:r.extrapolateLeft)!==void 0&&(s=r.extrapolateLeft);let a="extend";(r==null?void 0:r.extrapolateRight)!==void 0&&(a=r.extrapolateRight);const l=(r==null?void 0:r.posterize)===void 0?e:Math.floor(e/r.posterize)*r.posterize,c=OC(l,t),f=Dm({easing:i,segmentIndex:c});let p=Om({input:l,inputRange:[t[c],t[c+1]],outputRange:[n[c],n[c+1]],easing:f,extrapolateLeft:s,extrapolateRight:a,output:o});for(let m=0;m<c;m++){const g=Dm({easing:i,segmentIndex:m});if(!fx(g))continue;const w=t[m+1];if(l<=w)continue;const x=Om({input:l,inputRange:[t[m],w],outputRange:[n[m],n[m+1]],easing:g,extrapolateLeft:s,extrapolateRight:"extend",output:o});p+=x-n[m+1]}return p},VC=({input:e,inputRange:t,outputRange:n,options:r})=>{var c;const o=n.map(NC),i=(c=o[0])==null?void 0:c.kind;if(i===void 0)throw new Error("outputRange must have at least 1 element");for(const f of o)if(f.kind!==i)throw new TypeError(`Cannot interpolate ${i} values with ${f.kind} values`);const s=Math.max(...o.map(f=>f.dimensions)),a=[null,null,null];if(i!=="scale")for(let f=0;f<s;f++){for(const p of o){const m=p.units[f];if(m!==null){if(a[f]===null){a[f]=m;continue}if(a[f]!==m)throw new TypeError(`Cannot interpolate ${i} values with different units on axis ${f+1}: ${a[f]} and ${m}`)}}if(a[f]===null)throw new TypeError(`Cannot interpolate ${i} values because axis ${f+1} has no unit`)}const l=[0,0,0];for(let f=0;f<s;f++)l[f]=Np({input:e,inputRange:t,outputRange:o.map(p=>p.values[f]),options:r});return LC({kind:i,values:l,units:a,dimensions:s})},HC=e=>{var n;const t=(n=e[0])==null?void 0:n.length;if(t===void 0)throw new Error("outputRange must have at least 1 element");if(t===0)throw new TypeError("outputRange tuples must contain at least 1 number");for(const r of e){if(r.length!==t)throw new TypeError(`outputRange tuples must all have the same length, but got ${t} and ${r.length}`);for(const o of r)if(typeof o!="number"||!Number.isFinite(o))throw new TypeError(`outputRange tuples must contain only finite numbers, but got [${r.join(",")}]`)}return t},UC=({input:e,inputRange:t,outputRange:n,options:r})=>{const o=HC(n);return new Array(o).fill(!0).map((i,s)=>Np({input:e,inputRange:t,outputRange:n.map(a=>a[s]),options:r}))};function ZC(e){for(let t=1;t<e.length;++t)if(!(e[t]>e[t-1]))throw new Error(`inputRange must be strictly monotonically increasing but got [${e.join(",")}]`)}function Bm(e,t){if(t.length<1)throw new Error(e+" must have at least 1 element");for(const n of t){if(typeof n!="number")throw new Error(`${e} must contain only numbers`);if(!Number.isFinite(n))throw new Error(`${e} must contain only finite numbers, but got [${t.join(",")}]`)}}function KC(e,t){if(e===void 0||typeof e=="function")return;const n=t-1;if(e.length!==n)throw new Error(`When easing is an array, it must have one entry per segment between keyframes (length inputRange.length - 1 = ${n}), but got length ${e.length}`);for(let r=0;r<e.length;r++)if(typeof e[r]!="function")throw new Error(`easing[${r}] must be a function`)}function YC(e){if(e!==void 0&&(typeof e!="number"||!Number.isFinite(e)||e<=0))throw new Error(`posterize must be a positive finite number, but got ${e}`)}function GC(e){if(!(e===void 0||e==="linear"||e==="perceptual-scale"))throw new Error(`output must be "linear" or "perceptual-scale", but got ${String(e)}`)}function Di(e,t,n,r){if(typeof e>"u")throw new Error("input can not be undefined");if(typeof t>"u")throw new Error("inputRange can not be undefined");if(typeof n>"u")throw new Error("outputRange can not be undefined");if(t.length!==n.length)throw new Error("inputRange ("+t.length+") and outputRange ("+n.length+") must have the same length");if(Bm("inputRange",t),ZC(t),KC(r==null?void 0:r.easing,t.length),YC(r==null?void 0:r.posterize),GC(r==null?void 0:r.output),typeof e!="number")throw new TypeError("Cannot interpolate an input which is not a number");if(!Array.isArray(n))throw new Error("outputRange must contain only numbers");if(n.some(i=>typeof i=="string")){if(!n.every(i=>typeof i=="string"||typeof i=="number"))throw new TypeError("outputRange must contain only numbers, or supported scale, translate, and rotate strings");return VC({input:e,inputRange:t,outputRange:n,options:r})}if(n.every(i=>Array.isArray(i)))return UC({input:e,inputRange:t,outputRange:n,options:r});if(!n.every(i=>typeof i=="number"))throw new TypeError("outputRange must contain only numbers, numeric tuples, or supported scale, translate, and rotate strings");return Bm("outputRange",n),Np({input:e,inputRange:t,outputRange:n,options:r})}var XC=({allowFloats:e,durationInFrames:t,frame:n})=>{if(typeof n>"u")throw new TypeError('Argument missing for parameter "frame"');if(typeof n!="number")throw new TypeError(`Argument passed for "frame" is not a number: ${n}`);if(!Number.isFinite(n))throw new RangeError(`Frame ${n} is not finite`);if(n<0&&n<-t)throw new RangeError(`Cannot use frame ${n}: Duration of composition is ${t}, therefore the lowest frame that can be rendered is ${-t}`);if(n>t-1)throw new RangeError(`Cannot use frame ${n}: Duration of composition is ${t}, therefore the highest frame that can be rendered is ${t-1}`)},qC=e=>{if(!(typeof e>"u")){if(typeof e!="number")throw new TypeError(`A "duration" of a spring must be a "number" but is "${typeof e}"`);if(Number.isNaN(e))throw new TypeError('A "duration" of a spring is NaN, which it must not be');if(!Number.isFinite(e))throw new TypeError('A "duration" of a spring must be finite, but is '+e);if(e<=0)throw new TypeError('A "duration" of a spring must be positive, but is '+e)}},JC={damping:10,mass:1,stiffness:100,overshootClamping:!1},Mc={};function QC({animation:e,now:t,config:n}){const{toValue:r,lastTimestamp:o,current:i,velocity:s}=e,a=Math.min(t-o,64);if(n.damping<=0)throw new Error("Spring damping must be greater than 0, otherwise the spring() animation will never end, causing an infinite loop.");const l=n.damping,c=n.mass,f=n.stiffness,p=[r,o,i,s,l,c,f,t].join("-");if(Mc[p])return Mc[p];const m=-s,g=r-i,w=l/(2*Math.sqrt(f*c)),x=Math.sqrt(f/c),k=x*Math.sqrt(1-w**2),h=a/1e3,y=Math.sin(k*h),v=Math.cos(k*h),S=Math.exp(-w*x*h),b=S*(y*((m+w*x*g)/k)+g*v),E=r-b,I=w*x*b-S*(v*(m+w*x*g)-k*g*y),T=Math.exp(-x*h),R=r-T*(g+(m+x*g)*h),F=T*(m*(h*x-1)+h*g*x*x),A={toValue:r,prevPosition:i,lastTimestamp:t,current:w<1?E:R,velocity:w<1?I:F};return Mc[p]=A,A}var $c={};function px({frame:e,fps:t,config:n={}}){const i=[e,t,n.damping,n.mass,n.overshootClamping,n.stiffness].join("-");if($c[i])return $c[i];let s={lastTimestamp:0,current:0,toValue:1,velocity:0,prevPosition:0};const a=Math.max(0,e),l=a%1;for(let c=0;c<=Math.floor(a);c++){c===Math.floor(a)&&(c+=l);const f=c/t*1e3;s=QC({animation:s,now:f,config:{...JC,...n}})}return $c[i]=s,s}var Ac=new Map;function hx({fps:e,config:t={},threshold:n=.005}){if(typeof n!="number")throw new TypeError(`threshold must be a number, got ${n} of type ${typeof n}`);if(n===0)return 1/0;if(n===1)return 0;if(isNaN(n))throw new TypeError("Threshold is NaN");if(!Number.isFinite(n))throw new TypeError("Threshold is not finite");if(n<0)throw new TypeError("Threshold is below 0");const r=[e,t.damping,t.mass,t.overshootClamping,t.stiffness,n].join("-");if(Ac.has(r))return Ac.get(r);Su(e,"to the measureSpring() function");let o=0,i=0;const s=()=>px({fps:e,frame:o,config:t});let a=s();const l=()=>Math.abs(a.current-a.toValue);let c=l();for(;c>=n;)o++,a=s(),c=l();i=o;for(let f=0;f<20;f++)o++,a=s(),c=l(),c>=n&&(f=0,i=o+1);return Ac.set(r,i),i}function pf({frame:e,fps:t,config:n={},from:r=0,to:o=1,durationInFrames:i,durationRestThreshold:s,delay:a=0,reverse:l=!1}){qC(i),XC({frame:e,durationInFrames:1/0,allowFloats:!0}),Su(t,"to spring()");const c=l||typeof i<"u",f=c?hx({fps:t,config:n,threshold:s}):void 0,p=c?{get:()=>f}:{get:()=>{throw new Error("did not calculate natural duration, this is an error with Remotion. Please report")}},g=(l?(i??p.get())-e:e)+(l?a:-a),w=i===void 0?g:g/(i/p.get());if(i&&g>i)return o;const x=px({fps:t,frame:w,config:n}),k=n.overshootClamping?o>=r?Math.min(x.current,o):Math.max(x.current,o):x.current;return r===0&&o===1?k:Di(k,[0,1],[r,o])}var Wm=e=>Math.min(1,Math.max(0,e)),es=30;class Kl{static step0(t){return t>0?1:0}static step1(t){return t>=1?1:0}static linear(t){return t}static ease(t){return Kl.bezier(.42,0,1,1)(t)}static quad(t){return t*t}static cubic(t){return t*t*t}static poly(t){return n=>n**t}static sin(t){return 1-Math.cos(t*Math.PI/2)}static circle(t){const n=Wm(t);return 1-Math.sqrt(1-n*n)}static exp(t){return 2**(10*(t-1))}static elastic(t=1){const n=t*Math.PI;return r=>1-Math.cos(r*Math.PI/2)**3*Math.cos(r*n)}static back(t=1.70158){return n=>n*n*((t+1)*n-t)}static spring({allowTail:t=!1,durationRestThreshold:n,...r}={}){return Object.assign(i=>i<=0?0:!t&&i>=1?1:pf(t?{fps:es,frame:i*hx({fps:es,config:r,threshold:n}),config:r}:{fps:es,frame:i*es,config:r,durationInFrames:es,durationRestThreshold:n}),{remotionShouldExtendRight:t})}static bounce(t){const n=Wm(t);if(n<1/2.75)return 7.5625*n*n;if(n<2/2.75){const o=n-.5454545454545454;return 7.5625*o*o+.75}if(n<2.5/2.75){const o=n-.8181818181818182;return 7.5625*o*o+.9375}const r=n-2.625/2.75;return 7.5625*r*r+.984375}static bezier(t,n,r,o){return ax(t,n,r,o)}static in(t){return t}static out(t){return n=>1-t(1-n)}static inOut(t){return n=>n<.5?t(n*2)/2:1-t((1-n)*2)/2}}var Ln="[-+]?\\d*\\.?\\d+",$a=Ln+"%";function Aa(...e){return"\\(\\s*("+e.join(")\\s*,\\s*(")+")\\s*\\)"}var Na="(?:none|[-+]?\\d*\\.?\\d+(?:%|deg|rad|grad|turn)?)";function ts(e){return new RegExp(e+"\\(\\s*("+Na+")\\s+("+Na+")\\s+("+Na+")(?:\\s*\\/\\s*("+Na+"))?\\s*\\)")}function e2(){const e={rgb:void 0,rgba:void 0,hsl:void 0,hsla:void 0,hex3:void 0,hex4:void 0,hex5:void 0,hex6:void 0,hex8:void 0,oklch:void 0,oklab:void 0,lab:void 0,lch:void 0,hwb:void 0};return e.rgb===void 0&&(e.rgb=new RegExp("rgb"+Aa(Ln,Ln,Ln)),e.rgba=new RegExp("rgba"+Aa(Ln,Ln,Ln,Ln)),e.hsl=new RegExp("hsl"+Aa(Ln,$a,$a)),e.hsla=new RegExp("hsla"+Aa(Ln,$a,$a,Ln)),e.hex3=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,e.hex4=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,e.hex6=/^#([0-9a-fA-F]{6})$/,e.hex8=/^#([0-9a-fA-F]{8})$/,e.oklch=ts("oklch"),e.oklab=ts("oklab"),e.lab=ts("lab"),e.lch=ts("lch"),e.hwb=ts("hwb")),e}function vi(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function Vm(e,t,n){const r=n<.5?n*(1+t):n+t-n*t,o=2*n-r,i=vi(o,r,e+1/3),s=vi(o,r,e),a=vi(o,r,e-1/3);return Math.round(i*255)<<24|Math.round(s*255)<<16|Math.round(a*255)<<8}function Do(e){const t=Number.parseInt(e,10);return t<0?0:t>255?255:t}function Hm(e){return(Number.parseFloat(e)%360+360)%360/360}function Um(e){const t=Number.parseFloat(e);return t<0?0:t>1?255:Math.round(t*255)}function La(e){const t=Number.parseFloat(e);return t<0?0:t>100?1:t/100}function Sn(e,t){return e==="none"?0:e.endsWith("%")?Number.parseFloat(e)/100*t:Number.parseFloat(e)}function Nc(e){return e==="none"?0:e.endsWith("rad")?Number.parseFloat(e)*180/Math.PI:e.endsWith("grad")?Number.parseFloat(e)*.9:e.endsWith("turn")?Number.parseFloat(e)*360:Number.parseFloat(e)}function ns(e){return e===void 0||e==="none"?1:e.endsWith("%")?Math.max(0,Math.min(1,Number.parseFloat(e)/100)):Math.max(0,Math.min(1,Number.parseFloat(e)))}function wi(e){return e<=.0031308?12.92*e:1.055*e**(1/2.4)-.055}function za(e){return Math.max(0,Math.min(1,e))}function rs(e,t,n,r){const o=Math.round(za(e)*255),i=Math.round(za(t)*255),s=Math.round(za(n)*255),a=Math.round(za(r)*255);return(o<<24|i<<16|s<<8|a)>>>0}function Zm(e,t,n){const r=e+.3963377774*t+.2158037573*n,o=e-.1055613458*t-.0638541728*n,i=e-.0894841775*t-1.291485548*n,s=r*r*r,a=o*o*o,l=i*i*i,c=4.0767416621*s-3.3077115913*a+.2309699292*l,f=-1.2684380046*s+2.6097574011*a-.3413193965*l,p=-.0041960863*s-.7034186147*a+1.707614701*l;return[wi(c),wi(f),wi(p)]}function Km(e,t,n){const r=.008856451679035631,o=24389/27,i=.95047,s=1,a=1.08883,l=(e+16)/116,c=t/500+l,f=l-n/200,p=c*c*c,m=f*f*f,g=p>r?p:(116*c-16)/o,w=e>o*r?((e+16)/116)**3:e/o,x=m>r?m:(116*f-16)/o,k=g*i,h=w*s,y=x*a,v=3.2404542*k-1.5371385*h-.4985314*y,S=-.969266*k+1.8760108*h+.041556*y,b=.0556434*k-.2040259*h+1.0572252*y;return[wi(v),wi(S),wi(b)]}function t2(e,t,n){if(t+n>=1){const c=t/(t+n);return[c,c,c]}const r=1,o=0,i=vi(o,r,e+1/3),s=vi(o,r,e),a=vi(o,r,e-1/3),l=1-t-n;return[i*l+t,s*l+t,a*l+t]}var Ym={transparent:0,aliceblue:4042850303,antiquewhite:4209760255,aqua:16777215,aquamarine:2147472639,azure:4043309055,beige:4126530815,bisque:4293182719,black:255,blanchedalmond:4293643775,blue:65535,blueviolet:2318131967,brown:2771004159,burlywood:3736635391,burntsienna:3934150143,cadetblue:1604231423,chartreuse:2147418367,chocolate:3530104575,coral:4286533887,cornflowerblue:1687547391,cornsilk:4294499583,crimson:3692313855,cyan:16777215,darkblue:35839,darkcyan:9145343,darkgoldenrod:3095792639,darkgray:2846468607,darkgreen:6553855,darkgrey:2846468607,darkkhaki:3182914559,darkmagenta:2332068863,darkolivegreen:1433087999,darkorange:4287365375,darkorchid:2570243327,darkred:2332033279,darksalmon:3918953215,darkseagreen:2411499519,darkslateblue:1211993087,darkslategray:793726975,darkslategrey:793726975,darkturquoise:13554175,darkviolet:2483082239,deeppink:4279538687,deepskyblue:12582911,dimgray:1768516095,dimgrey:1768516095,dodgerblue:512819199,firebrick:2988581631,floralwhite:4294635775,forestgreen:579543807,fuchsia:4278255615,gainsboro:3705462015,ghostwhite:4177068031,gold:4292280575,goldenrod:3668254975,gray:2155905279,green:8388863,greenyellow:2919182335,grey:2155905279,honeydew:4043305215,hotpink:4285117695,indianred:3445382399,indigo:1258324735,ivory:4294963455,khaki:4041641215,lavender:3873897215,lavenderblush:4293981695,lawngreen:2096890111,lemonchiffon:4294626815,lightblue:2916673279,lightcoral:4034953471,lightcyan:3774873599,lightgoldenrodyellow:4210742015,lightgray:3553874943,lightgreen:2431553791,lightgrey:3553874943,lightpink:4290167295,lightsalmon:4288707327,lightseagreen:548580095,lightskyblue:2278488831,lightslategray:2005441023,lightslategrey:2005441023,lightsteelblue:2965692159,lightyellow:4294959359,lime:16711935,limegreen:852308735,linen:4210091775,magenta:4278255615,maroon:2147483903,mediumaquamarine:1724754687,mediumblue:52735,mediumorchid:3126187007,mediumpurple:2473647103,mediumseagreen:1018393087,mediumslateblue:2070474495,mediumspringgreen:16423679,mediumturquoise:1221709055,mediumvioletred:3340076543,midnightblue:421097727,mintcream:4127193855,mistyrose:4293190143,moccasin:4293178879,navajowhite:4292783615,navy:33023,oldlace:4260751103,olive:2155872511,olivedrab:1804477439,orange:4289003775,orangered:4282712319,orchid:3664828159,palegoldenrod:4008225535,palegreen:2566625535,paleturquoise:2951671551,palevioletred:3681588223,papayawhip:4293907967,peachpuff:4292524543,peru:3448061951,pink:4290825215,plum:3718307327,powderblue:2967529215,purple:2147516671,rebeccapurple:1714657791,red:4278190335,rosybrown:3163525119,royalblue:1097458175,saddlebrown:2336560127,salmon:4202722047,sandybrown:4104413439,seagreen:780883967,seashell:4294307583,sienna:2689740287,silver:3233857791,skyblue:2278484991,slateblue:1784335871,slategray:1887473919,slategrey:1887473919,snow:4294638335,springgreen:16744447,steelblue:1182971135,tan:3535047935,teal:8421631,thistle:3636451583,tomato:4284696575,turquoise:1088475391,violet:4001558271,wheat:4125012991,white:4294967295,whitesmoke:4126537215,yellow:4294902015,yellowgreen:2597139199};function n2(e){const t=e2();let n;if(t.hex6&&(n=t.hex6.exec(e)))return Number.parseInt(n[1]+"ff",16)>>>0;if(Ym[e]!==void 0)return Ym[e];if(t.rgb&&(n=t.rgb.exec(e)))return(Do(n[1])<<24|Do(n[2])<<16|Do(n[3])<<8|255)>>>0;if(t.rgba&&(n=t.rgba.exec(e)))return(Do(n[1])<<24|Do(n[2])<<16|Do(n[3])<<8|Um(n[4]))>>>0;if(t.hex3&&(n=t.hex3.exec(e)))return Number.parseInt(n[1]+n[1]+n[2]+n[2]+n[3]+n[3]+"ff",16)>>>0;if(t.hex8&&(n=t.hex8.exec(e)))return Number.parseInt(n[1],16)>>>0;if(t.hex4&&(n=t.hex4.exec(e)))return Number.parseInt(n[1]+n[1]+n[2]+n[2]+n[3]+n[3]+n[4]+n[4],16)>>>0;if(t.hsl&&(n=t.hsl.exec(e)))return(Vm(Hm(n[1]),La(n[2]),La(n[3]))|255)>>>0;if(t.hsla&&(n=t.hsla.exec(e)))return(Vm(Hm(n[1]),La(n[2]),La(n[3]))|Um(n[4]))>>>0;if(t.oklch&&(n=t.oklch.exec(e))){const r=Sn(n[1],1),o=Sn(n[2],.4),i=Nc(n[3]),s=ns(n[4]),a=i*Math.PI/180,[l,c,f]=Zm(r,o*Math.cos(a),o*Math.sin(a));return rs(l,c,f,s)}if(t.oklab&&(n=t.oklab.exec(e))){const r=Sn(n[1],1),o=Sn(n[2],.4),i=Sn(n[3],.4),s=ns(n[4]),[a,l,c]=Zm(r,o,i);return rs(a,l,c,s)}if(t.lab&&(n=t.lab.exec(e))){const r=Sn(n[1],100),o=Sn(n[2],125),i=Sn(n[3],125),s=ns(n[4]),[a,l,c]=Km(r,o,i);return rs(a,l,c,s)}if(t.lch&&(n=t.lch.exec(e))){const r=Sn(n[1],100),o=Sn(n[2],150),i=Nc(n[3]),s=ns(n[4]),a=i*Math.PI/180,[l,c,f]=Km(r,o*Math.cos(a),o*Math.sin(a));return rs(l,c,f,s)}if(t.hwb&&(n=t.hwb.exec(e))){const r=Nc(n[1]),o=Sn(n[2],1),i=Sn(n[3],1),s=ns(n[4]),[a,l,c]=t2(r/360,o,i);return rs(a,l,c,s)}throw new Error(`invalid color string ${e} provided`)}var Gm=e=>(e>>24&255)/255,r2=e=>e>>16&255,o2=e=>e>>8&255,i2=e=>e&255,s2=(e,t,n,r)=>`rgba(${e}, ${t}, ${n}, ${r})`;function a2(e){const t=n2(e);return(t<<24|t>>>8)>>>0}var l2=(e,t,n,r)=>{const[o,i,s,a]=[r2,o2,i2,Gm].map(l=>{const c=Di(e,t,n.map(f=>l(f)),{easing:r==null?void 0:r.easing,extrapolateLeft:"clamp",extrapolateRight:"clamp",posterize:r==null?void 0:r.posterize});return l===Gm?Number(c.toFixed(3)):Math.round(c)});return s2(o,i,s,a)},u2=(e,t,n,r)=>{if(typeof e>"u")throw new TypeError("input can not be undefined");if(typeof t>"u")throw new TypeError("inputRange can not be undefined");if(typeof n>"u")throw new TypeError("outputRange can not be undefined");if(t.length!==n.length)throw new TypeError("inputRange ("+t.length+" values provided) and outputRange ("+n.length+" values provided) must have the same length");const o=n.map(i=>a2(i));return l2(e,t,o,r)},Xm=({easing:e,forceSpringAllowTail:t})=>{switch(e.type){case"linear":return Kl.linear;case"spring":return Kl.spring({allowTail:t??e.allowTail??void 0,damping:e.damping,durationRestThreshold:e.durationRestThreshold??void 0,mass:e.mass,overshootClamping:e.overshootClamping,stiffness:e.stiffness});case"bezier":return ax(e.x1,e.y1,e.x2,e.y2);default:throw new TypeError(`Unsupported easing: ${JSON.stringify(e)}`)}},la=({frame:e,forceSpringAllowTail:t,status:n})=>{const{keyframes:r,easing:o,clamping:i,interpolationFunction:s}=n;if(r.length===0)return null;const a=[...r].sort((f,p)=>f.frame-p.frame),l=a.map(f=>f.frame),c=a.map(f=>f.value);if(s==="interpolateColors"){if(!c.every(f=>typeof f=="string"))return null;if(r.length===1)return c[0];try{return u2(e,l,c,{easing:o.map(f=>Xm({easing:f,forceSpringAllowTail:t})),posterize:n.posterize})}catch{return null}}if(s!=="interpolate")return null;try{return Di(e,l,c,{easing:o.map(f=>Xm({easing:f,forceSpringAllowTail:t})),extrapolateLeft:i.left,extrapolateRight:i.right,output:n.output,posterize:n.posterize})}catch{return null}},Mu=({dragOverrideValue:e,frame:t})=>{if(e===void 0)return{type:"none"};if(e.type==="static")return{type:"resolved",value:e.value};if(t===null)return{type:"none"};const n=la({forceSpringAllowTail:null,frame:t,status:e.status});return n===null?{type:"none"}:{type:"resolved",value:n}},mx=({propStatus:e,dragOverrideValue:t,defaultValue:n,frame:r=null,shouldResortToDefaultValueIfUndefined:o=!1})=>{const i=Mu({dragOverrideValue:t,frame:r});return i.type==="resolved"&&i.value!==void 0?i.value:e.status==="keyframed"?r!==null?la({forceSpringAllowTail:null,frame:r,status:e}):o?n:void 0:e.codeValue===void 0&&o?n:e.codeValue},Lp=d.createContext({overrideIdToNodePathMappings:{}}),c2=d.createContext({setOverrideIdToNodePath:()=>{throw new Error("OverrideIdsToNodePathsSettersContext not initialized")}}),d2=({descriptor:e,propStatusOverrides:t,dragOverrides:n,frame:r})=>{if(!t&&!n)return{params:e.params,effectKey:e.effectKey};const o={...e.params};if(t)for(const[i,s]of Object.entries(t))s!==void 0&&(o[i]=s);if(n)for(const[i,s]of Object.entries(n)){const a=Mu({dragOverrideValue:s,frame:r});a.type==="resolved"&&(o[i]=a.value)}return{params:o,effectKey:e.definition.calculateKey(o)}},f2=(e,t)=>{if(!e)return null;const n={};let r=!1;for(const[o,i]of Object.entries(e)){if(i.status==="static"){n[o]=i.codeValue,r=!0;continue}if(i.status==="keyframed"){const s=la({forceSpringAllowTail:null,frame:t,status:i});s!==null&&(n[o]=s,r=!0)}}return r?n:null},ua=e=>{const t=d.useRef(null),n=e.map(i=>i.definition),r=t.current;return r!==null&&r.length===n.length&&r.every((i,s)=>i===n[s])?r:(t.current=n,n)},gx=({propStatuses:e,nodePath:t,effectIndex:n})=>{const r=e[mr(t)];if(!r)return{type:"cannot-update-sequence",reason:"not-found"};if(!r.canUpdate)return{type:"cannot-update-sequence",reason:r.reason};const o=r.effects.find(i=>i.effectIndex===n);return o?o.canUpdate?{type:"can-update-effect",props:o.props}:{type:"cannot-update-effect",reason:o.reason}:{type:"cannot-update-effect",reason:"not-found"}},yx=(e,t)=>{const n=e[mr(t)];if(n&&n.canUpdate)return n.props},ca=({effects:e,overrideId:t})=>{const n=d.useRef(null),{propStatuses:r}=d.useContext(ju),{getEffectDragOverrides:o}=d.useContext(Fu),i=Ft(),{overrideIdToNodePathMappings:s}=d.useContext(Lp),a=n.current,l=t?s[t]??null:null,c=e.map((m,g)=>{if(l===null)return{descriptor:m,params:m.params,effectKey:m.effectKey};const w=gx({propStatuses:r,nodePath:l,effectIndex:g}),x=w.type==="can-update-effect"?f2(w.props,i):null,k=o(l,g),h=Object.keys(k).length===0?null:k,{params:y,effectKey:v}=d2({descriptor:m,propStatusOverrides:x,dragOverrides:h,frame:i});return{descriptor:m,params:y,effectKey:v}});if(a!==null&&a.length===c.length&&a.every((m,g)=>m.definition===c[g].descriptor.definition&&m.effectKey===c[g].effectKey))return a;const p=c.map(({descriptor:m,params:g,effectKey:w})=>({definition:m.definition,effectKey:w,params:g,memoized:!0}));return n.current=p,p},zp=(e,t)=>{const n={};for(const r of Object.keys(e)){const o=e[r];if(o.type!=="hidden")if(o.type==="enum"){n[r]=o;const i=t(r)??o.default,s=o.variants[i];s&&Object.assign(n,zp(s,t))}else n[r]=o}return n},Dp=e=>{const t={},n=(r,o)=>{r in t||(t[r]=o)};for(const r of Object.keys(e)){const o=e[r];if(n(r,o),o.type==="enum")for(const i of Object.values(o.variants)){const s=Dp(i);for(const a of Object.keys(s))n(a,s[a])}}return t},vx=({schema:e,key:t,value:n})=>{const r=e[t];if(!r)throw new Error("Key "+JSON.stringify(t)+" not found in schema");if(typeof n!="string")throw new Error("Value must be a string, but is "+JSON.stringify(n));if(r.type!=="enum")throw new Error("Key "+JSON.stringify(t)+" is not an enum");if(!r.variants[n])throw new Error("Value for "+JSON.stringify(t)+" must be one of "+Object.keys(r.variants).map(a=>JSON.stringify(a)).join(", ")+", got "+JSON.stringify(n));const i=Object.keys(r.variants).filter(a=>a!==n),s=new Set;for(const a of i){const l=r.variants[a],c=Object.keys(l);for(const f of c)s.add(f)}return[...s]},qm={type:"linear"},p2=({insertedKeyframeIndex:e,easingLength:t,keyframeCount:n})=>!(e>0&&e<n-1)||t===0?null:Math.min(e-1,t-1),h2=e=>({type:"static",value:e}),m2=({status:e,frame:t,value:n})=>{const r=e.keyframes.findIndex(s=>s.frame===t),o=r===-1?[...e.keyframes,{frame:t,value:n}].sort((s,a)=>s.frame-a.frame):e.keyframes.map((s,a)=>a===r?{frame:t,value:n}:s),i=[...e.easing];if(r===-1){const s=o.findIndex(c=>c.frame===t),a=p2({insertedKeyframeIndex:s,easingLength:i.length,keyframeCount:o.length}),l=a===null?qm:i[a];i.splice(s,0,l)}for(;i.length<o.length-1;)i.push(qm);return i.length>o.length-1&&(i.length=o.length-1),{type:"keyframed",status:{...e,keyframes:o,easing:i}}},g2=e=>{if((e==null?void 0:e.type)==="static")return e.value},y2=e=>e!==null&&e.status==="keyframed",wx=(e,t)=>{if(t in e)return e[t];for(const n of Object.values(e))if(n.type==="enum")for(const r of Object.values(n.variants)){const o=wx(r,t);if(o)return o}},xx=({schema:e,currentValue:t,overrideValues:n,propStatus:r,frame:o})=>{var a;const i={},s=new Set;for(const l of Object.keys(t)){const c=(r==null?void 0:r[l])??null,f=wx(e,l);if((f==null?void 0:f.type)==="hidden")continue;let p;if(c===null)p=t[l];else if(y2(c))if((f==null?void 0:f.type)==="array"||(f==null?void 0:f.keyframable)===!1)p=t[l];else{const m=Mu({dragOverrideValue:n[l],frame:o});m.type==="resolved"?p=m.value:o!==null?p=la({forceSpringAllowTail:null,frame:o,status:c})??t[l]:p=t[l]}else c.status==="computed"?p=t[l]:p=mx({propStatus:c,dragOverrideValue:n[l],defaultValue:f==null?void 0:f.default,frame:o,shouldResortToDefaultValueIfUndefined:!1});(f==null?void 0:f.type)==="asset"&&typeof p=="string"&&p.startsWith(Vs)&&(p=`${window.remotion_staticBase}/${p.slice(Vs.length)}`),p===void 0&&s.add(l),i[l]=p}for(const l of Object.keys(n))if(((a=e[l])==null?void 0:a.type)==="enum"){const c=vx({schema:e,key:l,value:i[l]});for(const f of c)s.add(f)}return{merged:i,propsToDelete:s}},bx=(e,t)=>{const n=t.split(".");let r=e;for(const o of n){if(r==null||typeof r!="object")return;r=r[o]}return r},Sx=({flatSchema:e,key:t,props:n})=>{var o;const r=bx(n,t);if(!(((o=e[t])==null?void 0:o.type)==="text-content"&&typeof r!="string"))return r},v2=(e,t,n)=>{const r={};for(const o of t)r[o]=n?Sx({flatSchema:n,key:o,props:e}):bx(e,o);return r},w2=(e,t)=>Object.keys(zp(e,n=>t[n])),x2=({flatSchema:e,props:t,valuesDotNotation:n,schemaKeys:r,propsToDelete:o})=>{var a;const i={...t};for(const l of r){const c=n[l];if(((a=e[l])==null?void 0:a.type)==="text-content"&&c===void 0)continue;const f=l.split(".");if(f.length===1){i[l]=c;continue}let p=i;for(let m=0;m<f.length-1;m++){const g=f[m];typeof p[g]=="object"&&p[g]!==null?p[g]={...p[g]}:p[g]={},p=p[g]}p[f[f.length-1]]=c}const s=new Set([...o].filter(l=>{var c;return!(((c=e[l])==null?void 0:c.type)==="text-content"&&n[l]===void 0)}));return SC(i,s),i},Jm={},Ir=({Component:e,componentName:t,componentIdentity:n,schema:r,supportsEffects:o})=>{const i=hC(r),s=Dp(i),a=Object.keys(s),l=d.forwardRef((c,f)=>{const p=ct();if(!p.isStudio||p.isReadOnlyStudio||p.isRendering)return le.createElement(e,{...c,controls:null,ref:f});const{propStatuses:m}=d.useContext(ju),{getDragOverrides:g}=d.useContext(Fu),w=d.useContext(Lp),x=Ft();if(c.controls)return le.createElement(e,{...c,ref:f});const[k]=d.useState(()=>{const{stack:R}=c;if(!R)return String(Math.random());const F=Jm[R];if(F)return F;const A=String(Math.random());return Jm[R]=A,A}),h=w.overrideIdToNodePathMappings[k]??null,y=a.map(R=>Sx({flatSchema:s,key:R,props:c})),v=d.useMemo(()=>v2(c,a,s),y),S=d.useMemo(()=>({schema:i,currentRuntimeValueDotNotation:v,overrideId:k,supportsEffects:o,componentIdentity:n,componentName:t}),[v,k]),{merged:b,propsToDelete:E}=d.useMemo(()=>xx({schema:i,currentValue:v,overrideValues:h===null?{}:g(h),propStatus:h===null?void 0:yx(m,h),frame:x}),[v,g,h,m,x]),I=w2(i,b),T=x2({flatSchema:s,props:c,valuesDotNotation:b,schemaKeys:I,propsToDelete:E});return le.createElement(e,{...T,controls:S,ref:f})});return l.displayName=`withInteractivitySchema(${e.displayName||e.name||"Component"})`,l},Lc=[],b2=({from:e=0,trimBefore:t=0,freeze:n,durationInFrames:r=1/0,children:o,name:i,height:s,width:a,showInTimeline:l=!0,hidden:c=!1,controls:f,_remotionInternalEffects:p,_remotionInternalLoopDisplay:m,_remotionInternalStack:g,_remotionInternalDocumentationLink:w,_remotionInternalSingleChildComponent:x,_remotionInternalPremountDisplay:k,_remotionInternalPostmountDisplay:h,_remotionInternalIsMedia:y,outlineRef:v,...S},b)=>{const{layout:E="absolute-fill"}=S,[I]=d.useState(()=>String(Math.random())),T=d.useContext(xt),{rootId:R}=oo(),F=T?T.cumulatedFrom+T.relativeFrom:0,A=xu();if(E!=="absolute-fill"&&E!=="none")throw new TypeError(`The layout prop of <Sequence /> expects either "absolute-fill" or "none", but you passed: ${E}`);if(E==="none"&&typeof S.style<"u")throw new TypeError('If layout="none", you may not pass a style. Passed: '+JSON.stringify(S.style));if(typeof r!="number")throw new TypeError(`You passed to durationInFrames an argument of type ${typeof r}, but it must be a number.`);if(r<=0)throw new TypeError(`durationInFrames must be positive, but got ${r}`);if(typeof e!="number")throw new TypeError(`You passed to the "from" props of your <Sequence> an argument of type ${typeof e}, but it must be a number.`);if(!Number.isFinite(e))throw new TypeError(`The "from" prop of a sequence must be finite, but got ${e}.`);if(typeof t!="number")throw new TypeError(`You passed to the "trimBefore" prop of your <Sequence> an argument of type ${typeof t}, but it must be a number.`);if(t<0)throw new TypeError(`The "trimBefore" prop of <Sequence /> must be greater than or equal to 0, but got ${t}.`);if(Number.isNaN(t))throw new TypeError('The "trimBefore" prop of <Sequence /> must be a real number, but it is NaN.');if(!Number.isFinite(t))throw new TypeError(`The "trimBefore" prop of <Sequence /> must be finite, but it is ${t}.`);if(typeof n<"u"&&n!==null){if(typeof n!="number")throw new TypeError(`The "freeze" prop of <Sequence /> must be a number, but is of type ${typeof n}.`);if(Number.isNaN(n))throw new TypeError('The "freeze" prop of <Sequence /> must be a real number, but it is NaN.');if(!Number.isFinite(n))throw new TypeError(`The "freeze" prop of <Sequence /> must be finite, but it is ${n}.`)}const W=io(),M=ht(),$=e-t,V=((T==null?void 0:T.absoluteFrom)??0)+$,D=T?Math.min(T.durationInFrames-$,r):r,L=Math.max(0,Math.min(M.durationInFrames-e,D)),{registerSequence:j,unregisterSequence:C}=d.useContext(zi),P=d.useRef(null),N=S.layout==="none"?v??null:v??P,O=d.useMemo(()=>(T==null?void 0:T.premounting)||!!S._remotionInternalIsPremounting,[S._remotionInternalIsPremounting,T==null?void 0:T.premounting]),z=d.useMemo(()=>(T==null?void 0:T.postmounting)||!!S._remotionInternalIsPostmounting,[S._remotionInternalIsPostmounting,T==null?void 0:T.postmounting]),Z=F+$,H=T?T.cumulatedFrom+T.relativeFrom:0,G=T?H-T.cumulatedNegativeFrom:0,B=Math.max(0,G,Z),X=Z-B,ae=d.useMemo(()=>({absoluteFrom:V,cumulatedFrom:F,relativeFrom:$,cumulatedNegativeFrom:X,durationInFrames:L,parentFrom:(T==null?void 0:T.relativeFrom)??0,id:I,height:s??(T==null?void 0:T.height)??null,width:a??(T==null?void 0:T.width)??null,premounting:O,postmounting:z,premountDisplay:k??null,postmountDisplay:h??null}),[F,V,$,L,T,I,s,a,O,z,k,h,X]),oe=d.useMemo(()=>i??"",[i]),Y=w??"https://www.remotion.dev/docs/sequence",q=ct(),xe=d.useContext(_u),Se=(S==null?void 0:S.stack)??null,de=d.useRef(null);de.current=g??Se;const K=typeof n=="number"?n:null,ee=t===0?null:t,ue=(T==null?void 0:T.cumulatedNegativeFrom)??0,se=y&&y.type!=="image"?y.data.startMediaFrom+ue-X:null,Re=y&&y.type!=="image"?y.data.startMediaFrom+ue:null,Ie=y&&y.type!=="image"&&Re!==null?K===null?null:Re+(m?K%m.durationInFrames:K)*y.data.playbackRate:null;d.useEffect(()=>{if(q.isStudio)return y?(y.type==="image"?j({type:"image",controls:f??null,effects:p??Lc,displayName:oe,documentationLink:Y,duration:L,from:e,trimBefore:ee,id:I,loopDisplay:m,nonce:A.get(),parent:(T==null?void 0:T.id)??null,postmountDisplay:h??null,premountDisplay:k??null,rootId:R,showInTimeline:l,src:y.src,getStack:()=>de.current,refForOutline:N??null,isInsideSeries:xe,frozenFrame:K,singleChildComponent:x??null}):j({type:y.type,controls:f??null,effects:p??Lc,displayName:oe,documentationLink:Y,doesVolumeChange:y.data.doesVolumeChange,duration:L,from:e,trimBefore:ee,id:I,loopDisplay:m,nonce:A.get(),parent:(T==null?void 0:T.id)??null,playbackRate:y.data.playbackRate,postmountDisplay:h??null,premountDisplay:k??null,rootId:R,showInTimeline:l,src:y.data.src,getStack:()=>de.current,startMediaFrom:se??y.data.startMediaFrom,mediaFrameAtSequenceZero:Re,volume:y.data.volumes,refForOutline:N??null,isInsideSeries:xe,frozenFrame:K,frozenMediaFrame:Ie,singleChildComponent:x??null}),()=>{C(I)}):(j({from:e,trimBefore:ee,duration:L,id:I,displayName:oe,documentationLink:Y,parent:(T==null?void 0:T.id)??null,type:"sequence",rootId:R,showInTimeline:l,nonce:A.get(),loopDisplay:m,getStack:()=>de.current,premountDisplay:k??null,postmountDisplay:h??null,controls:f??null,effects:p??Lc,refForOutline:N??null,isInsideSeries:xe,frozenFrame:K,singleChildComponent:x??null}),()=>{C(I)})},[r,I,i,j,oe,C,T==null?void 0:T.id,L,R,e,t,ee,l,A,m,k,h,q.isStudio,f,p,y,Y,N,xe,K,se,Re,Ie,x]);const De=Math.ceil(F+e+r-1),Qe=W<F+e||W>De?null:o,ke=Qe===null||typeof n>"u"||n===null?Qe:u.jsx(ia,{frame:n,children:Qe}),Ee=S.layout==="none"?void 0:S.style,je=d.useCallback(Le=>{P.current=Le,typeof b=="function"?b(Le):b&&(b.current=Le)},[b]),_e=d.useMemo(()=>({flexDirection:void 0,...a?{width:a}:{},...s?{height:s}:{},...Ee??{}}),[s,Ee,a]);if(b!==null&&E==="none")throw new TypeError('It is not supported to pass both a `ref` and `layout="none"` to <Sequence />.');return c?null:u.jsx(xt.Provider,{value:ae,children:ke===null?null:S.layout==="none"?ke:u.jsx(Hn,{ref:je,style:_e,className:S.className,children:ke})})},S2=d.forwardRef(b2),k2=(e,t)=>{if(e.layout==="none")throw new Error('`<Sequence>` with `premountFor` and `postmountFor` props does not support layout="none"');const{style:n,from:r=0,durationInFrames:o=1/0,premountFor:i=0,postmountFor:s=0,styleWhilePremounted:a,styleWhilePostmounted:l,...c}=e,{freezeFrame:f,isPremountingOrPostmounting:p,postmountingActive:m,premountingActive:g,premountingStyle:w}=aa({from:r,durationInFrames:o,premountFor:i,postmountFor:s,style:n??null,styleWhilePremounted:a??null,styleWhilePostmounted:l??null,hideWhilePremounted:"opacity"});return u.jsx(ia,{frame:f,active:p,children:u.jsx($u,{ref:t,from:r,durationInFrames:o,style:w??void 0,_remotionInternalPremountDisplay:i,_remotionInternalPostmountDisplay:s,_remotionInternalIsPremounting:g,_remotionInternalIsPostmounting:m,...c})})},E2=d.forwardRef(k2),C2=(e,t)=>{const n=ct(),{fps:r}=ht();if(e.layout!=="none"&&!n.isRendering){const o=e.premountFor;if(o||e.postmountFor)return u.jsx(E2,{ref:t,...e,premountFor:o})}return u.jsx(S2,{...e,ref:t})},$u=d.forwardRef(C2),kx=$u,_t=Ir({Component:$u,componentName:"<Sequence>",componentIdentity:"dev.remotion.remotion.Sequence",schema:Ri,supportsEffects:!1});Ir({Component:$u,componentName:"<Sequence>",componentIdentity:null,schema:gC,supportsEffects:!1});var Ex=(e,t,n)=>{switch(e){case"fill":return[0,0,t.width,t.height,0,0,n.width,n.height];case"contain":{const r=Math.min(n.width/t.width,n.height/t.height),o=(n.width-t.width*r)/2,i=(n.height-t.height*r)/2;return[0,0,t.width,t.height,o,i,t.width*r,t.height*r]}case"cover":{const r=Math.max(n.width/t.width,n.height/t.height),o=(n.width-t.width*r)/2,i=(n.height-t.height*r)/2;return[0,0,t.width,t.height,o,i,t.width*r,t.height*r]}default:throw new Error("Unknown fit: "+e)}},I2="https://remotion.dev/docs/troubleshooting/webgl2-context",Cx=(e,t)=>`Failed to acquire ${e} context for ${t}. Pass --gl=angle when using the CLI, set chromiumOptions: { gl: "angle" } when using SSR APIs, or set "OpenGL render backend" to "angle" in the Advanced section when rendering in the Studio. See ${I2}`,T2=e=>new Error(Cx("WebGL",e)),Ix=e=>new Error(Cx("WebGL2",e));class R2{constructor(t,n){Ae(this,"width");Ae(this,"height");Ae(this,"pairs",new Map);Ae(this,"lostContexts",new Set);this.width=t,this.height=n}getPair(t){const n=this.pairs.get(t);if(n)return n;const r=[this.allocateCanvas(t),this.allocateCanvas(t)];return this.pairs.set(t,r),r}assertContextNotLost(t){if(this.lostContexts.has(t))throw new Error("WebGL context was lost during canvas effect rendering. This typically happens in headless or memory-constrained environments (e.g. Remotion Lambda). Try reducing concurrency or increasing the Lambda function memory.")}allocateCanvas(t){const n=document.createElement("canvas");switch(n.width=this.width,n.height=this.height,t){case"2d":{if(!n.getContext("2d",{colorSpace:"srgb"}))throw new Error("Failed to acquire 2D context for canvas effect");return n}case"webgl2":{const r=n.getContext("webgl2",{premultipliedAlpha:!0,alpha:!0,preserveDrawingBuffer:!0});if(!r)throw Ix("canvas effect");return n.addEventListener("webglcontextlost",o=>{o.preventDefault(),this.lostContexts.add(n)}),n.addEventListener("webglcontextrestored",()=>{this.lostContexts.delete(n)}),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),n}case"webgpu":{if(typeof navigator>"u"||!("gpu"in navigator))throw new Error("WebGPU is not available in this environment for canvas effect");return n}default:{const r=t;throw new Error(`Unknown effect backend: ${r}`)}}}}var j2=e=>{const t=[];let n=[],r=null;for(const o of e){const{backend:i}=o.definition;r===null||i===r?(n.push(o),r=i):(t.push({backend:r,effects:n}),n=[o],r=i)}return r!==null&&n.length>0&&t.push({backend:r,effects:n}),t},Da=null,P2=()=>Da||(Da=(async()=>{if(typeof navigator>"u"||!("gpu"in navigator))throw new Error("WebGPU is not available in this environment");const{gpu:e}=navigator,t=await e.requestAdapter();if(!t)throw new Error("No WebGPU adapter available");return t.requestDevice()})(),Da),Tx=(e,t)=>({pool:new R2(e,t),setupCache:new WeakMap,cleanupRegistry:[],currentRunId:0}),hf=e=>{e.currentRunId++;for(const t of e.cleanupRegistry)t.definition.cleanup(t.state)},F2=(e,t,n)=>{const r=t;let o=e.setupCache.get(r);if(o||(o=new WeakMap,e.setupCache.set(r,o)),o.has(n))return o.get(n);const i=t.setup(n);return o.set(n,i),e.cleanupRegistry.push({definition:r,state:i}),i},da=async({state:e,source:t,effects:n,output:r,width:o,height:i})=>{const s=++e.currentRunId,a=()=>e.currentRunId!==s,l=n.filter(k=>!k.params.disabled),c=j2(l);let f=t,p=null;if(c.length===0){if(t===r)return!0;const k=r.getContext("2d");if(!k)throw new Error("Failed to acquire 2D context for output canvas");return k.clearRect(0,0,o,i),k.drawImage(f,0,0,o,i),!0}let m=!1;for(const k of c)if(k.backend==="webgpu"){m=!0;break}const g=m?await P2():null;if(a())return!1;let w=!0;for(let k=0;k<c.length;k++){const h=c[k],[y,v]=e.pool.getPair(h.backend);let S=y;for(const E of h.effects){const I=E.definition,T=F2(e,I,S);I.apply({source:f,target:S,state:T,params:E.params,width:o,height:i,gpuDevice:g,flipSourceY:h.backend==="webgl2"?w:!1}),h.backend==="webgl2"&&(w=!0,e.pool.assertContextNotLost(S)),f=S,S=S===y?v:y}p=f??p;const b=c[k+1];if(b&&b.backend!==h.backend&&p)if(h.backend==="2d"&&b.backend==="webgl2")f=p,w=!0;else{const E=await createImageBitmap(p);if(a())return E.close(),!1;f=E,b.backend==="webgl2"&&(w=!1)}}if(!p)return!0;const x=r.getContext("2d");if(!x)throw new Error("Failed to acquire 2D context for output canvas");return x.clearRect(0,0,o,i),x.drawImage(p,0,0,o,i),!0},fa=()=>{const e=d.useRef(null),t=d.useRef(null);return d.useEffect(()=>()=>{e.current&&hf(e.current)},[]),d.useMemo(()=>({get:(n,r)=>((!t.current||t.current.width!==n||t.current.height!==r)&&(e.current&&hf(e.current),e.current=Tx(n,r),t.current={width:n,height:r}),e.current)}),[])},_2=({width:e,height:t,fit:n,className:r,style:o,effects:i,...s},a)=>{const l=d.useRef(null),c=fa(),f=d.useMemo(()=>typeof document>"u"?null:document.createElement("canvas"),[]),p=d.useCallback(m=>{const g=l.current,w=e??m.displayWidth,x=t??m.displayHeight;if(!g)throw new Error("Canvas ref is not set");if(!f)throw new Error("Source canvas is not available");f.width=w,f.height=x;const k=f.getContext("2d");if(!k)throw new Error("Could not get 2d context for source canvas");return k.drawImage(m,...Ex(n,{height:m.displayHeight,width:m.displayWidth},{width:w,height:x})),g.width=w,g.height=x,da({state:c.get(w,x),source:f,effects:i,output:g,width:w,height:x})},[c,i,n,t,f,e]);return d.useImperativeHandle(a,()=>({draw:p,getCanvas:()=>{if(!l.current)throw new Error("Canvas ref is not set");return l.current},clear:()=>{var g;const m=(g=l.current)==null?void 0:g.getContext("2d");if(!m)throw new Error("Could not get 2d context");m.clearRect(0,0,l.current.width,l.current.height)}}),[p]),u.jsx("canvas",{ref:l,className:r,style:o,...s})},M2=le.forwardRef(_2),Rx=async({resolvedSrc:e,signal:t,requestInit:n,contentType:r})=>{if(typeof ImageDecoder>"u")throw new Error("Your browser does not support the WebCodecs ImageDecoder API.");const o=await fetch(e,{...n,signal:t}),{body:i}=o;if(!i)throw new Error("Got no body");const s=new ImageDecoder({data:i,type:r??o.headers.get("Content-Type")??"image/gif"});await Promise.all([s.completed,s.tracks.ready]);const{selectedTrack:a}=s.tracks;if(!a)throw s.close(),new Error("No selected track");return{decoder:s,selectedTrack:a}},$2=5,Qm=({loopBehavior:e,durationFound:t,timeInSec:n})=>e==="loop"?t?n%t:n:Math.min(n,t||1/0),A2=async({resolvedSrc:e,signal:t,requestInit:n,currentTime:r,initialLoopBehavior:o})=>{const{decoder:i,selectedTrack:s}=await Rx({resolvedSrc:e,signal:t,requestInit:n,contentType:null}),a=[];let l=null;const c=async g=>{const w=a.find(k=>k.frameIndex===g);if(w&&w.frame)return w;const x=await i.decode({frameIndex:g,completeFramesOnly:!0});return w?w.frame=x.image:a.push({frame:x.image,frameIndex:g,timeInSeconds:x.image.timestamp/1e6}),{frame:x.image,frameIndex:g,timeInSeconds:x.image.timestamp/1e6}},f=g=>{const x=a.filter(k=>k.frame).sort((k,h)=>{const y=Math.abs(k.timeInSeconds-g),v=Math.abs(h.timeInSeconds-g);return y-v});for(let k=0;k<x.length;k++){if(k<$2)continue;const h=x[k];h.frame=null}},p=async({timeInSec:g,loopBehavior:w})=>{const x=Qm({durationFound:l,loopBehavior:w,timeInSec:g}),h=a.filter(v=>v.timeInSeconds<=x).map(v=>v.frameIndex).reduce((v,S)=>Math.max(v,S),0);let y=h;for(;;){const v=await c(y);if(y++,!v.frame)throw new Error("No frame found");if(!v.frame.duration||(y===s.frameCount&&l===null&&(l=(v.frame.timestamp+v.frame.duration)/1e6),v.timeInSeconds>x||y===s.frameCount))break}s.frameCount-h<3&&w==="loop"&&await c(0),f(x)};return await p({timeInSec:r,loopBehavior:o}),await p({timeInSec:r,loopBehavior:o}),{close:()=>{var g;for(const w of a)(g=w.frame)==null||g.close(),w.frame=null;i.close()},getFrame:async(g,w)=>{if(l!==null&&g>l&&w==="clear-after-finish")return null;const x=Qm({loopBehavior:w,durationFound:l,timeInSec:g});await p({timeInSec:x,loopBehavior:w});const h=a.filter(y=>y.frame).reduce((y,v)=>{const S=Math.abs(y.timeInSeconds-x),b=Math.abs(v.timeInSeconds-x);return S<b?y:v});if(!h.frame)throw new Error("No frame found");return h},frameCount:s.frameCount}},N2=({frame:e,playbackRate:t,fps:n})=>e*t/n,L2=e=>{if(!e)return null;const t={...e};delete t.signal;const{headers:n,...r}=t;return JSON.stringify({...r,headers:n?Array.from(new Headers(n).entries()):null})},z2=e=>typeof window>"u"?e:new URL(e,window.origin).href,D2={src:{type:"asset",default:void 0,description:"Source",keyframable:!1},...Cr,...Li,playbackRate:{type:"number",min:0,max:10,step:.1,default:1,description:"Playback rate",hiddenFromList:!1,keyframable:!1},...ar,...ao,...so},O2=e=>{const t={},n=t;for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(r.startsWith("data-")||r.startsWith("aria-"))&&(n[r]=e[r]);return t},jx=d.forwardRef(({src:e,width:t,height:n,onError:r,loopBehavior:o="loop",playbackRate:i=1,fit:s="fill",requestInit:a,effects:l,controls:c,...f},p)=>{const m=z2(e),[g,w]=d.useState(null),{delayRender:x,continueRender:k}=Un(),[h]=d.useState(()=>x(`Rendering <AnimatedImage/> with src="${m}"`)),y=Ft(),{fps:v}=ht(),S=N2({frame:y,playbackRate:i,fps:v}),b=d.useRef(S);b.current=S;const E=L2(a),I=d.useRef(a);I.current=a;const T=d.useRef(null),R=ca({effects:l,overrideId:(c==null?void 0:c.overrideId)??null});d.useImperativeHandle(p,()=>{var W;const A=(W=T.current)==null?void 0:W.getCanvas();if(!A)throw new Error("Canvas ref is not set");return A},[]);const[F]=d.useState(()=>o);return d.useEffect(()=>{const A=new AbortController;let W=!1,M=!1;const $=()=>{M||(M=!0,k(h))};return A2({resolvedSrc:m,signal:A.signal,requestInit:I.current,currentTime:b.current,initialLoopBehavior:F}).then(V=>{if(W){V.close();return}w(V),$()}).catch(V=>{if(!W){if(V.name==="AbortError"){$();return}r?(r==null||r(V),$()):Hs(V)}}),()=>{W=!0,A.abort(),$()}},[m,h,r,E,F,k]),d.useEffect(()=>()=>{g==null||g.close()},[g]),d.useLayoutEffect(()=>{if(!g)return;const A=x(`Rendering frame at ${S} of <AnimatedImage src="${e}"/>`);let W=!1;return g.getFrame(S,o).then(async M=>{var V,D;if(W)return;if(M===null){(V=T.current)==null||V.clear(),k(A);return}await((D=T.current)==null?void 0:D.draw(M.frame))&&!W&&k(A)}).catch(M=>{W||(r?(r(M),k(A)):Hs(M))}),()=>{W=!0,k(A)}},[S,g,o,r,e,k,x,R,s,t,n]),u.jsx(M2,{ref:T,width:t,height:n,fit:s,effects:R,...f})});jx.displayName="AnimatedImageContent";var B2=({src:e,width:t,height:n,onError:r,fit:o,playbackRate:i,loopBehavior:s,id:a,className:l,style:c,durationInFrames:f,from:p,premountFor:m,postmountFor:g,styleWhilePremounted:w,styleWhilePostmounted:x,requestInit:k,effects:h=[],controls:y,ref:v,...S})=>{const b=d.useRef(null),E=ua(h);d.useImperativeHandle(v,()=>b.current,[]);const{effectivePostmountFor:I,effectivePremountFor:T,freezeFrame:R,isPremountingOrPostmounting:F,postmountingActive:A,premountingActive:W,premountingStyle:M}=aa({from:p??0,durationInFrames:f??1/0,premountFor:m??null,postmountFor:g??null,style:c??null,styleWhilePremounted:w??null,styleWhilePostmounted:x??null,hideWhilePremounted:"display-none"}),$=O2(S),V={src:e,width:t,height:n,onError:r,fit:o,playbackRate:i,loopBehavior:s,id:a,className:l,style:M??void 0,requestInit:k,...$};return u.jsx(ia,{frame:R,active:F,children:u.jsx(_t,{layout:"none",from:p??0,durationInFrames:f??1/0,name:"<AnimatedImage>",_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/animatedimage",controls:y,_remotionInternalEffects:E,_remotionInternalPremountDisplay:T||null,_remotionInternalPostmountDisplay:I||null,_remotionInternalIsPremounting:W,_remotionInternalIsPostmounting:A,...S,outlineRef:b,children:u.jsx(jx,{...V,ref:b,effects:h,controls:y})})})},Px=Ir({Component:B2,componentName:"<AnimatedImage>",componentIdentity:"dev.remotion.remotion.AnimatedImage",schema:D2,supportsEffects:!0});Px.displayName="AnimatedImage";Zt(Px);var W2={type:"boolean",default:!1,description:"Disabled"},V2=e=>{const{calculateKey:t,validateParams:n}=e,r={...e,documentationLink:e.documentationLink??null,calculateKey:i=>{const s=i.disabled??!1;return`${t(i)}-disabled-${s}`},schema:{disabled:W2,...e.schema}};return(i={})=>(n(i),{definition:r,params:i,effectKey:r.calculateKey(i),memoized:!1})},H2=e=>{if(typeof e!="string")throw new TypeError(`The "filename" must be a string, but you passed a value of type ${typeof e}`);if(e.trim()==="")throw new Error("The `filename` must not be empty");if(!e.match(/^([0-9a-zA-Z-!_.*'()/:&$@=;+,?]+)/g))throw new Error('The `filename` must match "/^([0-9a-zA-Z-!_.*\'()/:&$@=;+,?]+)/g". Use forward slashes only, even on Windows.')},U2=e=>{if(typeof e!="string"&&!(e instanceof Uint8Array))throw new TypeError(`The "content" must be a string or Uint8Array, but you passed a value of type ${typeof e}`);if(typeof e=="string"&&e.trim()==="")throw new Error("The `content` must not be empty")},Fx=e=>{e.type==="artifact"&&(H2(e.filename),e.contentType!=="thumbnail"&&U2(e.content))},Mo=d.createContext({registerRenderAsset:()=>{},unregisterRenderAsset:()=>{},renderAssets:[]}),Z2=({children:e,collectAssets:t})=>{const[n,r]=d.useState([]),o=d.useRef([]),i=d.useCallback(l=>{Fx(l),o.current=[...o.current,l],r(o.current)},[]);t&&d.useImperativeHandle(t,()=>({collectAssets:()=>{const l=o.current;return o.current=[],r([]),l}}),[]);const s=d.useCallback(l=>{o.current=o.current.filter(c=>c.id!==l),r(o.current)},[]);d.useLayoutEffect(()=>{typeof window<"u"&&(window.remotion_collectAssets=()=>{const l=o.current;return o.current=[],r([]),l})},[]);const a=d.useMemo(()=>({registerRenderAsset:i,unregisterRenderAsset:s,renderAssets:n}),[n,i,s]);return u.jsx(Mo.Provider,{value:a,children:e})},ir=e=>typeof window>"u"||e.startsWith("http://")||e.startsWith("https://")||e.startsWith("file://")||e.startsWith("blob:")||e.startsWith("data:")?e:new URL(e,window.origin).href,Au=({trimAfter:e,mediaDurationInFrames:t,playbackRate:n,trimBefore:r})=>{let o=t;typeof e<"u"&&(o=e),typeof r<"u"&&(o-=r);const i=o/n;return Number(i.toFixed(10))},_x=d.createContext(null),K2=()=>le.useContext(_x),Nu=({durationInFrames:e,times:t=1/0,children:n,name:r,showInTimeline:o,...i})=>{const s=Ft(),{durationInFrames:a}=ht();if(bu(e,{component:"of the <Loop /> component",allowFloats:!0}),typeof t!="number")throw new TypeError(`You passed to "times" an argument of type ${typeof t}, but it must be a number.`);if(t!==1/0&&t%1!==0)throw new TypeError(`The "times" prop of a loop must be an integer, but got ${t}.`);if(t<0)throw new TypeError(`The "times" prop of a loop must be at least 0, but got ${t}`);const l=Math.ceil(a/e),c=Math.min(l,t),f=i.layout==="none"?void 0:i.style,p=e*(c-1),g=Math.floor(s/e)*e,w=Math.min(g,p),x=d.useMemo(()=>({numberOfTimes:Math.min(a/e,t),startOffset:-w,durationInFrames:e}),[a,e,w,t]),k=d.useMemo(()=>({iteration:Math.floor(s/e),durationInFrames:e}),[s,e]);return u.jsx(_x.Provider,{value:k,children:u.jsx(_t,{durationInFrames:e,from:w,name:r??"<Loop>",_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/loop",_remotionInternalLoopDisplay:x,layout:i.layout,style:f,showInTimeline:o,children:n})})};Nu.useLoop=K2;var zt=({logLevel:e,tag:t,message:n,mountTime:r})=>{const o=[r?Date.now()-r+"ms ":null,t].filter(Boolean).join(" ");kt.trace({logLevel:e,tag:null},`[${o}]`,n)},Lu=d.createContext({}),eg={},zc=[],Mx=({children:e})=>{const[t,n]=d.useState(()=>eg);return d.useEffect(()=>{const r=()=>{n(eg)};return zc.push(r),()=>{zc=zc.filter(o=>o!==r)}},[]),u.jsx(Lu.Provider,{value:t,children:e})},$x=e=>{const t=e.indexOf("#");return t===-1?null:t},Y2=e=>{const t=$x(e);return t===null?e:e.slice(0,t)},$o=e=>{const t=d.useContext(Lu),n=$x(e),r=Y2(e);return t[r]?n!==null?t[r]+e.slice(n):t[r]:e},zu=(e,t)=>{if(typeof e.volume!="number"&&typeof e.volume!="function"&&typeof e.volume<"u")throw new TypeError(`You have passed a volume of type ${typeof e.volume} to your <${t} /> component. Volume must be a number or a function with the signature '(frame: number) => number' undefined.`);if(typeof e.volume=="number"&&e.volume<0)throw new TypeError(`You have passed a volume below 0 to your <${t} /> component. Volume must be between 0 and 1`);if(typeof e.playbackRate!="number"&&typeof e.playbackRate<"u")throw new TypeError(`You have passed a playbackRate of type ${typeof e.playbackRate} to your <${t} /> component. Playback rate must a real number or undefined.`);if(typeof e.playbackRate=="number"&&(isNaN(e.playbackRate)||!Number.isFinite(e.playbackRate)||e.playbackRate<=0))throw new TypeError(`You have passed a playbackRate of ${e.playbackRate} to your <${t} /> component. Playback rate must be a real number above 0.`);if(typeof e.preservePitch!="boolean"&&typeof e.preservePitch<"u")throw new TypeError(`'preservePitch' must be a boolean or undefined but got '${typeof e.preservePitch}' instead`)},G2=(e,t)=>{if(typeof e<"u"){if(typeof e!="number")throw new TypeError(`type of startFrom prop must be a number, instead got type ${typeof e}.`);if(isNaN(e)||e===1/0)throw new TypeError("startFrom prop can not be NaN or Infinity.");if(e<0)throw new TypeError(`startFrom must be greater than equal to 0 instead got ${e}.`)}if(typeof t<"u"){if(typeof t!="number")throw new TypeError(`type of endAt prop must be a number, instead got type ${typeof t}.`);if(isNaN(t))throw new TypeError("endAt prop can not be NaN.");if(t<=0)throw new TypeError(`endAt must be a positive number, instead got ${t}.`)}if(t<e)throw new TypeError("endAt prop must be greater than startFrom prop.")},X2=(e,t)=>{if(typeof e<"u"){if(typeof e!="number")throw new TypeError(`type of trimBefore prop must be a number, instead got type ${typeof e}.`);if(isNaN(e)||e===1/0)throw new TypeError("trimBefore prop can not be NaN or Infinity.");if(e<0)throw new TypeError(`trimBefore must be greater than equal to 0 instead got ${e}.`)}if(typeof t<"u"){if(typeof t!="number")throw new TypeError(`type of trimAfter prop must be a number, instead got type ${typeof t}.`);if(isNaN(t))throw new TypeError("trimAfter prop can not be NaN.");if(t<=0)throw new TypeError(`trimAfter must be a positive number, instead got ${t}.`)}if(t<=e)throw new TypeError("trimAfter prop must be greater than trimBefore prop.")},Du=({startFrom:e,endAt:t,trimBefore:n,trimAfter:r})=>{if(typeof e<"u"&&typeof n<"u")throw new TypeError("Cannot use both startFrom and trimBefore props. Use trimBefore instead as startFrom is deprecated.");if(typeof t<"u"&&typeof r<"u")throw new TypeError("Cannot use both endAt and trimAfter props. Use trimAfter instead as endAt is deprecated.");typeof n<"u"||typeof r<"u"?X2(n,r):(typeof e<"u"||typeof t<"u")&&G2(e,t)},Ou=({startFrom:e,endAt:t,trimBefore:n,trimAfter:r})=>({trimBeforeValue:n??e??void 0,trimAfterValue:r??t??void 0}),q2=(e,t)=>{switch(t.type){case"got-duration":{const n=ir(t.src);return e[n]===t.durationInSeconds?e:{...e,[n]:t.durationInSeconds}}default:return e}},Op=d.createContext({durations:{},setDurations:()=>{throw new Error("context missing")}}),Ax=({children:e})=>{const[t,n]=d.useReducer(q2,{}),r=d.useMemo(()=>({durations:t,setDurations:n}),[t]);return u.jsx(Op.Provider,{value:r,children:e})},Bp=({crossOrigin:e,requestsVideoFrame:t,isClientSideRendering:n})=>{if(e!=null)return e;if(n||t)return"anonymous"},Yl=({mediaRef:e,mediaType:t,onAutoPlayError:n,logLevel:r,mountTime:o,reason:i,isPlayer:s})=>{const{current:a}=e;if(!a)return;zt({logLevel:r,tag:"play",message:`Attempting to play ${a.src}. Reason: ${i}`,mountTime:o});const l=a.play();l.catch&&l.catch(c=>{if(a&&!c.message.includes("request was interrupted by a call to pause")&&!c.message.includes("The operation was aborted.")&&!c.message.includes("The fetching process for the media resource was aborted by the user agent")&&!c.message.includes("request was interrupted by a new load request")&&!c.message.includes("because the media was removed from the document")&&!(c.message.includes("user didn't interact with the document")&&a.muted)&&(console.log(`Could not play ${t} due to following error: `,c),!a.muted)){if(n){n();return}t==="video"&&s&&(kt.info({logLevel:r,tag:"<"+t+">"},"The video will be muted and we'll retry playing it."),kt.info({logLevel:r,tag:"<"+t+">"},"Use onAutoPlayError() to handle this error yourself."),a.muted=!0,a.play())}})},Wp=({audioContext:e,ref:t})=>{let n=null,r=!1,o=e;return{setAudioContext:i=>{o=i},attemptToConnect:()=>{if(r)throw new Error("SharedElementSourceNode has been disposed");!n&&t.current&&o&&(n=o.createMediaElementSource(t.current))},get:()=>{if(!n)throw new Error("Audio element not connected");return n},cleanup:()=>{n&&(n.disconnect(),n=null),r=!0}}},tg=!1,J2=e=>{tg||(tg=!0,typeof window<"u"&&kt.warn({logLevel:e,tag:null},"AudioContext is not supported in this browser"))},Q2=({logLevel:e,latencyHint:t,audioEnabled:n,sampleRate:r})=>{const o=ct(),i=d.useRef(r);if(r!==i.current)throw new Error(`Changing the AudioContext sample rate dynamically is not supported. The sample rate was initialized with ${i.current} Hz, but ${r} Hz was passed later.`);return d.useMemo(()=>{if(o.isRendering||!n)return null;if(typeof AudioContext>"u")return J2(e),null;const a=new AudioContext({latencyHint:t,sampleRate:r}),l=a.createGain();l.connect(a.destination),kt.trace({logLevel:e,tag:"audio"},"Creating new audio context"),a.suspend();let c=null;return{audioContext:a,gainNode:l,getState:()=>{const g=a.state;return c==="running"&&g!=="running"?"suspended-to-running":c==="suspended"&&g!=="suspended"?"running-to-suspended":g},resume:()=>{c="running";const g=a.resume();return g.finally(()=>{c==="running"&&(c=null)}),g},suspend:()=>{c="suspended";const g=a.suspend();return g.finally(()=>{c==="suspended"&&(c=null)}),g}}},[e,t,o.isRendering,n,r])},eI=(e,t)=>new Promise(n=>{const r=e.currentTime,i=e.getOutputTimestamp().performanceTime,s=performance.now(),a=()=>{var p;const{currentTime:l}=e,c=e.getOutputTimestamp(),f=performance.now()-s;if(i!==void 0&&c.performanceTime!==void 0&&c.performanceTime>i&&c.contextTime!==void 0&&c.contextTime>r){kt.verbose({logLevel:t,tag:"audio"},`waitUntilActuallyResumed: getOutputTimestamp.performanceTime advanced from ${i.toFixed(6)} to ${c.performanceTime.toFixed(6)} after ${f.toFixed(1)}ms. currentTime=${l.toFixed(6)} (advanced by ${(l-r).toFixed(6)}), getOutputTimestamp.performanceTime=${((p=c.performanceTime)==null?void 0:p.toFixed(1))??"undefined"}`),n();return}requestAnimationFrame(a)};requestAnimationFrame(a)}),Dc="data:audio/mp3;base64,/+MYxAAJcAV8AAgAABn//////+/gQ5BAMA+D4Pg+BAQBAEAwD4Pg+D4EBAEAQDAPg++hYBH///hUFQVBUFREDQNHmf///////+MYxBUGkAGIMAAAAP/29Xt6lUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV/+MYxDUAAANIAAAAAFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV",tI=(e,t)=>{const n=Object.keys(e).sort(),r=Object.keys(t).sort();if(n.length!==r.length)return!1;for(let o=0;o<n.length;o++)if(n[o]!==r[o]||e[n[o]]!==t[r[o]])return!1;return!0},nI=(e,t,n)=>e==="src"&&!n.startsWith("data:")&&!t.startsWith("data:")?new URL(n,window.origin).toString()!==new URL(t,window.origin).toString():n!==t,Oi=d.createContext(null),Bu=d.createContext(null),rI=e=>{if(e==="suspended"||e==="running-to-suspended"||e==="interrupted")return!0;if(e==="running"||e==="suspended-to-running")return!1;throw new Error(`Unexpected audio context state: ${e}`)},Nx=({children:e,audioLatencyHint:t,audioEnabled:n,previewSampleRate:r})=>{const o=sr(),i=r??48e3;d.useEffect(()=>{typeof window>"u"||(window.remotion_sampleRate=i)},[i]);const s=Q2({logLevel:o,latencyHint:t,audioEnabled:n,sampleRate:i}),a=d.useRef(!1),l=d.useRef(null),c=d.useMemo(()=>({value:0}),[]),f=d.useRef([]),p=d.useMemo(()=>({dispatch:S=>{f.current.forEach(b=>b(S))},subscribe:S=>(f.current.push(S),{remove:()=>{f.current=f.current.filter(b=>b!==S)}})}),[]),m=d.useRef({scheduledEndTime:null,mediaEndTime:null}),g=d.useRef(new Map),w=d.useCallback(S=>{g.current.delete(S)},[]),x=d.useMemo(()=>({node:S,mediaTimestamp:b,sourceOffset:E,scheduledTime:I,duration:T,offset:R,originalUnloopedMediaTimestamp:F})=>{if(!s)throw new Error("Audio context not found");const A=s.getState();if(A==="closed")return{type:"not-started",reason:"audio context is closed"};const W=rI(A);T>0&&(W?g.current.set(S,{scheduledTime:I,offset:R,duration:T}):S.start(I,R,T));const M=I+T/S.playbackRate.value,$=b+R-E,V=$+T,D=s.audioContext.baseLatency+s.audioContext.outputLatency,L=I-s.audioContext.currentTime,j=m.current,C=j.scheduledEndTime!==null&&Math.abs(I-j.scheduledEndTime)>.001,P=j.mediaEndTime!==null&&Math.abs($-j.mediaEndTime)>.001;return kt.verbose({logLevel:o,tag:"audio-scheduling"},"scheduled %c%s%c %s %c%s%c %s %c%s%c %s %s %s %s %s",C?"color: red; font-weight: bold":"",I.toFixed(4),"",M.toFixed(4),P?"color: red; font-weight: bold":"",$.toFixed(4),"",V.toFixed(4),T<0||L<0?"color: red; font-weight: bold":"color: blue; font-weight: bold",T<0?"missed "+Math.abs(R).toFixed(2)+"s":Math.abs(L).toFixed(2)+(L<0?" delay":" ahead"),"","current="+s.audioContext.currentTime.toFixed(4),"offset="+R.toFixed(4),"latency="+D.toFixed(4),"state="+s.audioContext.state,F!==$?"original_ts="+F.toFixed(4):"","action="+(W?"schedule":"start"),""),j.scheduledEndTime=M,j.mediaEndTime=V,T>0?{type:"started",scheduledTime:I}:{type:"not-started",reason:"missed "+Math.abs(R).toFixed(2)+"s"}},[s,o]),k=d.useCallback(()=>{if(!s||a.current)return Promise.resolve();a.current=!0,s.gainNode.gain.cancelScheduledValues(s.audioContext.currentTime),s.gainNode.gain.setValueAtTime(0,s.audioContext.currentTime),s.gainNode.gain.linearRampToValueAtTime(1,s.audioContext.currentTime+.03),g.current.forEach((b,E)=>{E.start(b.scheduledTime,b.offset,b.duration)}),g.current.clear();const S=s.resume();return l.current=new Promise(b=>{eI(s.audioContext,o).then(b),S.catch(E=>{kt.warn({logLevel:o,tag:"audio"},"AudioContext resume rejected, continuing without audio sync",E),b()})}).finally(()=>{l.current=null}),S.catch(()=>{})},[s,o]),h=d.useCallback(()=>l.current,[]),y=d.useCallback(()=>!s||!a.current?Promise.resolve():(a.current=!1,s.suspend()),[s]),v=d.useMemo(()=>({audioContext:(s==null?void 0:s.audioContext)??null,getAudioContextState:()=>(s==null?void 0:s.getState())??null,gainNode:(s==null?void 0:s.gainNode)??null,audioSyncAnchor:c,audioSyncAnchorEmitter:p,scheduleAudioNode:x,resume:k,suspend:y,getIsResumingAudioContext:h,unscheduleAudioNode:w}),[s,c,p,x,k,y,h,w]);return u.jsx(Oi.Provider,{value:v,children:e})},Lx=({children:e,numberOfAudioTags:t})=>{const n=d.useRef([]),[r]=d.useState(t);if(t!==r)throw new Error("The number of shared audio tags has changed dynamically. Once you have set this property, you cannot change it afterwards.");const o=sr(),i=oa(),s=ct(),a=d.useContext(Oi),l=(a==null?void 0:a.audioContext)??null,c=a==null?void 0:a.resume,[f]=d.useState(()=>new Array(t).fill(!0).map(()=>{const S=d.createRef();return{id:Math.random(),ref:S,mediaElementSourceNode:Wp({audioContext:l,ref:S})}}));for(const{mediaElementSourceNode:S}of f)S==null||S.setAudioContext(l);(le.useInsertionEffect??le.useLayoutEffect)(()=>()=>{requestAnimationFrame(()=>{f.forEach(({mediaElementSourceNode:S})=>{S==null||S.cleanup()})})},[f]);const m=d.useRef(new Array(t).fill(!1)),g=d.useCallback(()=>{f.forEach(({ref:S,id:b})=>{var T;const E=(T=n.current)==null?void 0:T.find(R=>R.id===b),{current:I}=S;if(I){if(E===void 0){I.src!==Dc&&(I.src=Dc);return}if(!E)throw new TypeError("Expected audio data to be there");Object.keys(E.props).forEach(R=>{nI(R,E.props[R],I[R])&&(I[R]=E.props[R])})}})},[f]),w=d.useCallback(S=>{var D,L;const{aud:b,audioId:E,premounting:I,postmounting:T}=S,R=(D=n.current)==null?void 0:D.find(j=>j.audioId===E);if(R)return R;const F=m.current.findIndex(j=>j===!1);if(F===-1)throw new Error(`Tried to simultaneously mount ${t+1} <Html5Audio /> tags at the same time. With the current settings, the maximum amount of <Html5Audio /> tags is limited to ${t} 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.`);const{id:A,ref:W,mediaElementSourceNode:M}=f[F],$=[...m.current];$[F]=A,m.current=$;const V={props:b,id:A,el:W,audioId:E,mediaElementSourceNode:M,premounting:I,audioMounted:!!W.current,postmounting:T,cleanupOnMediaTagUnmount:()=>{}};return(L=n.current)==null||L.push(V),g(),V},[t,f,g]),x=d.useCallback(S=>{var I;const b=[...m.current],E=f.findIndex(T=>T.id===S);if(E===-1)throw new TypeError(`Unknown audio ref ${S}; refs: ${f.map(T=>T.id).join(", ")}`);b[E]=!1,m.current=b,n.current=(I=n.current)==null?void 0:I.filter(T=>T.id!==S),g()},[f,g]),k=d.useCallback(({aud:S,audioId:b,id:E,premounting:I,postmounting:T})=>{var F;let R=!1;n.current=(F=n.current)==null?void 0:F.map(A=>{const W=!!A.el.current;return A.audioMounted!==W&&(R=!0),A.id===E?tI(S,A.props)&&A.premounting===I&&A.postmounting===T?A.audioMounted===W?A:{...A,audioMounted:W}:(R=!0,{...A,props:S,premounting:I,postmounting:T,audioId:b,audioMounted:W}):A.audioMounted===W?A:{...A,audioMounted:W}}),R&&g()},[g]),h=d.useCallback(()=>{f.forEach(S=>{const b=n.current.find(E=>E.el===S.ref);b!=null&&b.premounting||Yl({mediaRef:S.ref,mediaType:"audio",onAutoPlayError:null,logLevel:o,mountTime:i,reason:"playing all audios",isPlayer:s.isPlayer})}),c==null||c()},[o,i,f,s.isPlayer,c]),y=d.useMemo(()=>({registerAudio:w,unregisterAudio:x,updateAudio:k,playAllAudios:h,numberOfAudioTags:t}),[t,h,w,x,k]),v=d.useMemo(()=>f.map(({id:S,ref:b})=>u.jsx("audio",{ref:b,preload:"metadata",src:Dc},S)),[f]);return u.jsxs(Bu.Provider,{value:y,children:[v,e]})},oI=({aud:e,audioId:t,premounting:n,postmounting:r})=>{var l;const o=d.useContext(Oi),i=d.useContext(Bu),[s]=d.useState(()=>{if(i&&i.numberOfAudioTags>0)return i.registerAudio({aud:e,audioId:t,premounting:n,postmounting:r});const c=le.createRef(),f=Wp({audioContext:(o==null?void 0:o.audioContext)??null,ref:c});return{el:c,id:Math.random(),props:e,audioId:t,mediaElementSourceNode:f,premounting:n,audioMounted:!!c.current,postmounting:r,cleanupOnMediaTagUnmount:()=>{f==null||f.cleanup()}}});(l=s.mediaElementSourceNode)==null||l.setAudioContext((o==null?void 0:o.audioContext)??null);const a=le.useInsertionEffect??le.useLayoutEffect;return typeof document<"u"&&(a(()=>{i&&i.numberOfAudioTags>0&&i.updateAudio({id:s.id,aud:e,audioId:t,premounting:n,postmounting:r})},[e,i,s.id,t,n,r]),a(()=>()=>{i&&i.numberOfAudioTags>0&&i.unregisterAudio(s.id)},[i,s.id])),s},iI=1e-5,Gl=(e,t)=>Math.abs(e-t)<iI,zx=(e,t)=>Math.round(e/t*100)/100,mf=()=>typeof window>"u"||!/AppleWebKit/.test(window.navigator.userAgent)?!1:!window.navigator.userAgent.includes("Chrome/"),Wu=()=>typeof window>"u"?!1:/iP(ad|od|hone)/i.test(window.navigator.userAgent)&&mf(),sI=e=>Wu()&&e.startsWith("blob:"),gf=({actualFrom:e,fps:t})=>zx(Math.max(0,-e),t),yf=({duration:e,fps:t})=>zx(e,t),aI=({actualSrc:e,actualFrom:t,duration:n,fps:r})=>{if(sI(e)||e.startsWith("data:")||!!new URL(e,(typeof window>"u"?null:window.location.href)??"http://localhost:3000").hash||!Number.isFinite(t))return e;const i=`${e}#t=${gf({actualFrom:t,fps:r})}`;return Number.isFinite(n)?`${i},${yf({duration:n,fps:r})}`:i},lI=({prevStartFrom:e,newStartFrom:t,prevDuration:n,newDuration:r,fps:o})=>{const i=gf({actualFrom:e,fps:o}),s=gf({actualFrom:t,fps:o}),a=yf({duration:n,fps:o}),l=yf({duration:r,fps:o});return!(s<i||l>a)},uI=({actualSrc:e,actualFrom:t,duration:n,fps:r})=>{const o=d.useRef(t),i=d.useRef(n),s=d.useRef(e);return(!lI({prevStartFrom:o.current,newStartFrom:t,prevDuration:i.current,newDuration:n,fps:r})||e!==s.current)&&(o.current=t,i.current=n,s.current=e),aI({actualSrc:s.current,actualFrom:o.current,duration:i.current,fps:r})},ng=!1,cI=e=>{ng||(ng=!0,kt.warn({logLevel:e,tag:null},"In Safari, setting a volume and a playback rate at the same time is buggy."),kt.warn({logLevel:e,tag:null},"In Desktop Safari, only volumes <= 1 will be applied."),kt.warn({logLevel:e,tag:null},e,"In Mobile Safari, the volume will be ignored and set to 1 if a playbackRate is set."))},Dx=({mediaRef:e,volume:t,logLevel:n,source:r,shouldUseWebAudioApi:o})=>{var m,g,w;const i=d.useRef(null),s=d.useRef(t);s.current=t;const a=d.useContext(Oi);if(!a)throw new Error("useAmplification must be used within a SharedAudioContext");const{audioContext:l,gainNode:c}=a;if(typeof window<"u"&&d.useLayoutEffect(()=>{var k,h;if(!l||!e.current||!o)return;if(e.current.playbackRate!==1&&mf()){cI(n);return}if(!r||!c)return;const x=new GainNode(l,{gain:s.current});return r.attemptToConnect(),r.get().connect(x),x.connect(c),i.current={gainNode:x},kt.trace({logLevel:n,tag:null},`Starting to amplify ${(k=e.current)==null?void 0:k.src}. Gain = ${s.current}, playbackRate = ${(h=e.current)==null?void 0:h.playbackRate}`),()=>{i.current=null,x.disconnect(),r.get().disconnect()}},[n,e,l,r,o,c]),i.current){const x=t;Gl(i.current.gainNode.gain.value,x)||(i.current.gainNode.gain.value=x,kt.trace({logLevel:n,tag:null},`Setting gain to ${x} for ${(m=e.current)==null?void 0:m.src}`))}return(mf()&&e.current&&((g=e.current)==null?void 0:g.playbackRate)!==1||!o)&&e.current&&!Gl(t,(w=e.current)==null?void 0:w.volume)&&(e.current.volume=Math.min(t,1)),i},Co=()=>{const e=d.useContext(xt);return(e==null?void 0:e.cumulatedNegativeFrom)??0},Bi=e=>{const t=Nu.useLoop(),n=Ft(),r=Co();return e==="repeat"||t===null?n+r:n+r+t.durationInFrames*t.iteration},Ox=e=>{if(/data:|blob:/.test(e.substring(0,5)))return"Data URL";const t=e.split("/").map(n=>n.split("\\")).flat(1);return t[t.length-1]},dI=({compositionDurationInFrames:e,playbackRate:t,trimBefore:n,trimAfter:r,parentSequenceDurationInFrames:o,loop:i})=>{if(i)return e;const s=Au({mediaDurationInFrames:e*t+(n??0),playbackRate:t,trimBefore:n,trimAfter:r});if(o!==null){const a=Math.min(o,s);return Number(a.toFixed(10))}return s},Ao=({frame:e,volume:t,mediaVolume:n=1})=>{if(typeof t=="number")return t*n;if(typeof t>"u")return Number(n);const r=t(e)*n;if(typeof r!="number")throw new TypeError(`You passed in a a function to the volume prop but it did not return a number but a value of type ${typeof r} for frame ${e}`);if(Number.isNaN(r))throw new TypeError(`You passed in a function to the volume prop but it returned NaN for frame ${e}.`);if(!Number.isFinite(r))throw new TypeError(`You passed in a function to the volume prop but it returned a non-finite number for frame ${e}.`);return Math.max(0,r)},rg={},fI=e=>{rg[e]||(console.warn(e),rg[e]=!0)},Bx=({volume:e,mediaVolume:t,mediaType:n,src:r,displayName:o,trimBefore:i,trimAfter:s,playbackRate:a,sequenceDurationInFrames:l,mediaStartsAt:c,loop:f})=>{if(!r)throw new Error("No src passed");const p=d.useContext(xt),[m]=d.useState(()=>e),g=dI({compositionDurationInFrames:l,playbackRate:a,trimBefore:i,trimAfter:s,parentSequenceDurationInFrames:(p==null?void 0:p.durationInFrames)??null,loop:f}),w=d.useMemo(()=>typeof e=="number"?e:new Array(Math.floor(Math.max(0,g+c))).fill(!0).map((S,b)=>Ao({frame:b+c,volume:e,mediaVolume:t})).join(","),[g,c,e,t]);d.useEffect(()=>{typeof e=="number"&&e!==m&&fI(`Remotion: The ${n} with src ${r} has changed it's volume. Prefer the callback syntax for setting volume to get better timeline display: https://www.remotion.dev/docs/audio/volume`)},[m,n,r,e]);const x=typeof e=="function",k=xu(),{rootId:h}=oo(),y=0-c+(i??0);return d.useMemo(()=>({volumes:w,duration:g,doesVolumeChange:x,nonce:k,rootId:h,finalDisplayName:o??Ox(r),startMediaFrom:y,src:r,playbackRate:a}),[w,g,x,k,h,o,r,y,a])},Vp=({volume:e,mediaVolume:t,src:n,mediaType:r,playbackRate:o,displayName:i,id:s,getStack:a,showInTimeline:l,premountDisplay:c,postmountDisplay:f,loopDisplay:p,documentationLink:m,refForOutline:g})=>{const w=d.useContext(xt),x=Co(),{registerSequence:k,unregisterSequence:h}=d.useContext(zi),{durationInFrames:y}=ht(),v=Co(),{volumes:S,duration:b,doesVolumeChange:E,nonce:I,rootId:T,finalDisplayName:R}=Bx({volume:e,mediaVolume:t,mediaType:r,src:n,displayName:i,trimAfter:void 0,trimBefore:void 0,playbackRate:o,sequenceDurationInFrames:y,mediaStartsAt:v,loop:!1}),{isStudio:F}=ct();d.useEffect(()=>{var A,W;if(!n)throw new Error("No src passed");if(!(!F&&((W=(A=window.process)==null?void 0:A.env)==null?void 0:W.NODE_ENV)!=="test")&&l)return k({type:r,src:n,id:s,duration:b,from:0,trimBefore:null,parent:(w==null?void 0:w.id)??null,displayName:R,documentationLink:m,rootId:T,volume:S,showInTimeline:!0,nonce:I.get(),startMediaFrom:0-x,mediaFrameAtSequenceZero:null,doesVolumeChange:E,loopDisplay:p,playbackRate:o,getStack:a,premountDisplay:c,postmountDisplay:f,controls:null,effects:[],refForOutline:g,isInsideSeries:!1,frozenFrame:null,frozenMediaFrame:null}),()=>{h(s)}},[b,s,w,n,k,h,S,E,I,r,x,o,a,l,c,f,p,m,T,R,F,g])},pI=(e,t)=>{const[n,r]=d.useState([]),[o,i]=d.useState([]),[s,a]=d.useState([]),c=ct().isRendering,f=d.useRef(!1),p=d.useCallback(w=>{if(c)return{unblock:()=>{}};let x=!1;return r(k=>[...k,w]),{unblock:()=>{x||(x=!0,r(k=>{const h=k.filter(y=>y!==w);return h.length===k.length?k:h}))}}},[c]),m=d.useCallback(w=>(i(x=>[...x,w]),{remove:()=>{i(x=>x.filter(k=>k!==w))}}),[]),g=d.useCallback(w=>(a(x=>[...x,w]),{remove:()=>{a(x=>x.filter(k=>k!==w))}}),[]);return d.useEffect(()=>{c||n.length>0&&!f.current&&(f.current=!0,o.forEach(w=>w()),zt({logLevel:e,message:"Player is entering buffer state",mountTime:t,tag:"player"}))},[n]),typeof window<"u"&&d.useLayoutEffect(()=>{c||n.length===0&&f.current&&(f.current=!1,s.forEach(w=>w()),zt({logLevel:e,message:"Player is exiting buffer state",mountTime:t,tag:"player"}))},[n]),d.useMemo(()=>({addBlock:p,listenForBuffering:m,listenForResume:g,buffering:f}),[p,f,m,g])},Wi=le.createContext(null),Wx=({children:e})=>{const{logLevel:t,mountTime:n}=d.useContext(Fo),r=pI(t??"info",n);return u.jsx(Wi.Provider,{value:r,children:e})},Vx=e=>{const[t,n]=d.useState(e.buffering.current);return d.useEffect(()=>{const r=()=>{n(!0)},o=()=>{n(!1)},i=e.listenForBuffering(r),s=e.listenForResume(o);return()=>{i.remove(),s.remove()}},[e]),t},Vu=()=>{const e=d.useContext(Wi),t=sr(),n=e?e.addBlock:null;return d.useMemo(()=>({delayPlayback:()=>{if(!n)throw new 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 <Composition>. 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");kt.trace({logLevel:t,tag:"[buffer-state]"},"Adding buffer handle",new Error().stack);const{unblock:r}=n({id:String(Math.random())});let o=!1;return{unblock:()=>{o||(o=!0,kt.trace({logLevel:t,tag:"[buffer-state]"},"Removing buffer handle"),r())}}}}),[n,t])},hI=()=>/^((?!chrome|android).)*safari/i.test(window.navigator.userAgent),mI=({mediaRef:e,mediaType:t,onVariableFpsVideoDetected:n,pauseWhenBuffering:r,logLevel:o,mountTime:i})=>{const s=d.useRef(!1),{delayPlayback:a}=Vu(),l=d.useCallback(c=>{var w;if(t!=="video"||!r)return;const f=e.current;if(!f)return;if(f.readyState>=f.HAVE_FUTURE_DATA&&!hI()){zt({logLevel:o,message:`Not using buffer until first frame, because readyState is ${f.readyState} and is not Safari or Desktop Chrome`,mountTime:i,tag:"buffer"});return}if(!f.requestVideoFrameCallback){zt({logLevel:o,message:"Not using buffer until first frame, because requestVideoFrameCallback is not supported",mountTime:i,tag:"buffer"});return}s.current=!0,zt({logLevel:o,message:`Buffering ${(w=e.current)==null?void 0:w.src} until the first frame is received`,mountTime:i,tag:"buffer"});const p=a(),m=()=>{p.unblock(),f.removeEventListener("ended",m,{once:!0}),f.removeEventListener("pause",m,{once:!0}),s.current=!1},g=()=>{m()};f.requestVideoFrameCallback((x,k)=>{Math.abs(k.mediaTime-c)>.5&&n(),m()}),f.addEventListener("ended",g,{once:!0}),f.addEventListener("pause",g,{once:!0}),f.addEventListener("canplay",g,{once:!0})},[a,o,e,t,i,n,r]);return d.useMemo(()=>({isBuffering:()=>s.current,bufferUntilFirstFrame:l}),[l])},gI=e=>{const{duration:t,currentTime:n,paused:r,ended:o,desiredUnclampedTime:i,mediaTagTime:s,mediaTagLastUpdate:a,rvcTime:l,rvcLastUpdate:c,isVariableFpsVideo:f,acceptableTimeShift:p,lastSeekDueToShift:m,playing:g,playbackRate:w,mediaTagBufferingOrStalled:x,playerBuffering:k,absoluteFrame:h,onlyWarnForMediaSeekingError:y,isPremounting:v,isPostmounting:S,pauseWhenBuffering:b}=e,E=!Number.isNaN(t)&&Number.isFinite(t)?Math.min(t,i):i,I=Math.abs(E-s),T=l?Math.abs(E-l):null,R=c&&l>a?T:I,F=T&&!f?R:I;if(F>p&&m!==E)return{type:"seek-due-to-shift",shouldBeTime:E,why:`because time shift is too big. shouldBeTime = ${E}, isTime = ${s}, requestVideoCallbackTime = ${l}, timeShift = ${F}${f?", isVariableFpsVideo = true":""}, isPremounting = ${v}, isPostmounting = ${S}, pauseWhenBuffering = ${b}`,bufferUntilFirstFrame:g&&w>0,playReason:g&&r?"player is playing but media tag is paused, and just seeked":null,warnAboutNonSeekable:!y};const A=g?.15:.01,W=Math.abs(n-E)>A;if(!g||k&&!x)return{type:"seek-if-not-playing",shouldBeTime:E,why:W?`not playing or something else is buffering. time offset is over seek threshold (${A})`:null};if(!g||k)return{type:"none"};const $=r&&!o;if($||h===0){const D=$?"media tag is paused":"absolute frame is 0";return{type:"play-and-seek",shouldBeTime:E,why:W?`is over timeshift threshold (threshold = ${A}) and ${D}`:null,playReason:`player is playing and ${D}`,bufferUntilFirstFrame:!f&&w>0}}return{type:"none"}},yI=e=>{var r,o;const t=le.useRef({time:((r=e.current)==null?void 0:r.currentTime)??0,lastUpdate:performance.now()}),n=((o=e.current)==null?void 0:o.currentTime)??null;return n!==null&&t.current.time!==n&&(t.current.time=n,t.current.lastUpdate=performance.now()),t},gl=({mediaRef:e,time:t,logLevel:n,why:r,mountTime:o})=>{const i=Wu()?Number(t.toFixed(1)):t;return zt({logLevel:n,tag:"seek",message:`Seeking from ${e.currentTime} to ${i}. src= ${e.src} Reason: ${r}`,mountTime:o}),e.currentTime=i,i},vI=({element:e,shouldBuffer:t,isPremounting:n,isPostmounting:r,logLevel:o,mountTime:i,src:s})=>{const a=Vu(),[l,c]=d.useState(!1);return d.useEffect(()=>{let f=[];const{current:p}=e;if(!p||!t)return;if(n||r){if((n||r)&&p.readyState<p.HAVE_FUTURE_DATA&&!navigator.userAgent.includes("Firefox/")){zt({logLevel:o,message:`Calling .load() on ${p.src} because readyState is ${p.readyState} and it is not Firefox. Element is premounted ${p.playbackRate}`,tag:"load",mountTime:i});const x=p.playbackRate;p.load(),p.playbackRate=x}return}const m=x=>{let k=!1;f.forEach(h=>{h(x),k=!0}),f=[],c(h=>(h&&(k=!0),!1)),k&&zt({logLevel:o,message:`Unmarking as buffering: ${p.src}. Reason: ${x}`,tag:"buffer",mountTime:i})},g=x=>{c(!0),zt({logLevel:o,message:`Marking as buffering: ${p.src}. Reason: ${x}`,tag:"buffer",mountTime:i});const{unblock:k}=a.delayPlayback(),h=()=>{m('"canplay" was fired'),w()},y=()=>{m('"error" event was occurred'),w()};p.addEventListener("canplay",h,{once:!0}),f.push(()=>{p.removeEventListener("canplay",h)}),p.addEventListener("error",y,{once:!0}),f.push(()=>{p.removeEventListener("error",y)}),f.push(v=>{zt({logLevel:o,message:`Unblocking ${p.src} from buffer. Reason: ${v}`,tag:"buffer",mountTime:i}),k()})},w=()=>{if(p.readyState<p.HAVE_FUTURE_DATA){if(g(`readyState is ${p.readyState}, which is less than HAVE_FUTURE_DATA`),!navigator.userAgent.includes("Firefox/")){zt({logLevel:o,message:`Calling .load() on ${s} because readyState is ${p.readyState} and it is not Firefox. ${p.playbackRate}`,tag:"load",mountTime:i});const x=p.playbackRate;p.load(),p.playbackRate=x}}else{const x=()=>{g('"waiting" event was fired')};p.addEventListener("waiting",x),f.push(()=>{p.removeEventListener("waiting",x)})}};return w(),()=>{m("element was unmounted or prop changed")}},[a,s,e,n,r,o,t,i]),l},wI=({mediaRef:e,mediaType:t,lastSeek:n,onVariableFpsVideoDetected:r})=>{const o=d.useRef(null);return d.useEffect(()=>{const{current:i}=e;if(i)o.current={time:i.currentTime,lastUpdate:performance.now()};else{o.current=null;return}if(t!=="video"){o.current=null;return}const s=i;if(!s.requestVideoFrameCallback)return;let a=()=>{};const l=()=>{if(!s)return;const c=s.requestVideoFrameCallback((f,p)=>{if(o.current!==null){const m=Math.abs(o.current.time-p.mediaTime),g=Math.abs(n.current===null?1/0:p.mediaTime-n.current);m>.5&&g>.5&&p.mediaTime>o.current.time&&r()}o.current={time:p.mediaTime,lastUpdate:performance.now()},l()});a=()=>{s.cancelVideoFrameCallback(c),a=()=>{}}};return l(),()=>{a()}},[n,e,t,r]),o},Hx=({frame:e,playbackRate:t,startFrom:n})=>Di(e,[-1,n,n+1],[-1,n,n+t]),Ux=({fps:e,frame:t,playbackRate:n,startFrom:r})=>{const o=Hx({frame:t,playbackRate:n,startFrom:r}),i=1e3/e;return o*i/1e3},og={},xI=(e,t)=>{if(e===null||e.seekable.length===0||e.seekable.length>1||og[e.src])return;const n={start:e.seekable.start(0),end:e.seekable.end(0)};if(n.start===0&&n.end===0){const r=[`The media ${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(`
57
- `);console.error(r),og[e.src]=!0}},Zx=({mediaRef:e,src:t,mediaType:n,playbackRate:r,preservePitch:o=!0,onlyWarnForMediaSeekingError:i,acceptableTimeshift:s,pauseWhenBuffering:a,isPremounting:l,isPostmounting:c,onAutoPlayError:f})=>{const{playbackRate:p}=Fp(),m=Ft(),g=io(),[w]=Kw(),x=d.useContext(Wi),{fps:k}=ht(),h=Co(),y=d.useRef(null),v=d.useRef(null),S=sr(),b=oa();if(!x)throw new Error("useMediaPlayback must be used inside a <BufferingContext>");const E=d.useRef({}),I=d.useCallback(()=>{t&&(E.current[t]||(kt.verbose({logLevel:S,tag:null},`Detected ${t} as a variable FPS video. Disabling buffering while seeking.`),E.current[t]=!0))},[S,t]),T=wI({mediaRef:e,mediaType:n,lastSeek:v,onVariableFpsVideoDetected:I}),R=yI(e),F=Ux({frame:m,playbackRate:r,startFrom:-h,fps:k}),A=vI({element:e,shouldBuffer:a,isPremounting:l,isPostmounting:c,logLevel:S,mountTime:b,src:t??null}),{bufferUntilFirstFrame:W,isBuffering:M}=mI({mediaRef:e,mediaType:n,onVariableFpsVideoDetected:I,pauseWhenBuffering:a,logLevel:S,mountTime:b}),$=r*p,V=(()=>{var N;return(N=e.current)!=null&&N.duration?Math.min(e.current.duration,s??.65):s??.65})(),D=Vx(x);d.useEffect(()=>{var P,N,O,z,Z;if((P=e.current)!=null&&P.paused)return;if(!w){zt({logLevel:S,tag:"pause",message:`Pausing ${(N=e.current)==null?void 0:N.src} because ${l?"media is premounting":c?"media is postmounting":"Player is not playing"}`,mountTime:b}),(O=e.current)==null||O.pause();return}const j=A||M();x.buffering.current&&!j&&(zt({logLevel:S,tag:"pause",message:`Pausing ${(z=e.current)==null?void 0:z.src} because player is buffering but media tag is not`,mountTime:b}),(Z=e.current)==null||Z.pause())},[M,A,x,D,l,S,e,n,b,w,c]);const L=ct();d.useLayoutEffect(()=>{const j=Math.max(0,$);e.current&&e.current.playbackRate!==j&&(e.current.playbackRate=j),e.current&&e.current.preservesPitch!==o&&(e.current.preservesPitch=o)},[e,$,o]),d.useEffect(()=>{var N,O;const j=n==="audio"?"<Html5Audio>":"<Html5Video>";if(!e.current)throw new Error(`No ${n} ref found`);if(!t)throw new Error(`No 'src' attribute was passed to the ${j} element.`);const{current:C}=e,P=gI({duration:C.duration,currentTime:C.currentTime,paused:C.paused,ended:C.ended,desiredUnclampedTime:F,mediaTagTime:R.current.time,mediaTagLastUpdate:R.current.lastUpdate,rvcTime:((N=T.current)==null?void 0:N.time)??null,rvcLastUpdate:((O=T.current)==null?void 0:O.lastUpdate)??null,isVariableFpsVideo:!!E.current[t],acceptableTimeShift:V,lastSeekDueToShift:y.current,playing:w,playbackRate:$,mediaTagBufferingOrStalled:A||M(),playerBuffering:x.buffering.current,absoluteFrame:g,onlyWarnForMediaSeekingError:i,isPremounting:l,isPostmounting:c,pauseWhenBuffering:a});if(P.type!=="none"){if(P.type==="seek-due-to-shift"){v.current=gl({mediaRef:C,time:P.shouldBeTime,logLevel:S,why:P.why,mountTime:b}),y.current=v.current,P.bufferUntilFirstFrame&&W(P.shouldBeTime),P.playReason!==null&&Yl({mediaRef:e,mediaType:n,onAutoPlayError:f,logLevel:S,mountTime:b,reason:P.playReason,isPlayer:L.isPlayer}),P.warnAboutNonSeekable&&xI(C);return}if(P.type==="seek-if-not-playing"){P.why!==null&&(v.current=gl({mediaRef:C,time:P.shouldBeTime,logLevel:S,why:P.why,mountTime:b}));return}P.why!==null&&(v.current=gl({mediaRef:C,time:P.shouldBeTime,logLevel:S,why:P.why,mountTime:b})),Yl({mediaRef:e,mediaType:n,onAutoPlayError:f,logLevel:S,mountTime:b,reason:P.playReason,isPlayer:L.isPlayer}),P.bufferUntilFirstFrame&&W(P.shouldBeTime)}},[g,V,W,x.buffering,T,S,F,M,A,e,n,i,$,w,t,f,l,c,a,b,R,L.isPlayer])},Kx=({mediaRef:e,id:t,mediaType:n,onAutoPlayError:r,isPremounting:o,isPostmounting:i})=>{const{audioAndVideoTags:s,imperativePlaying:a}=oo(),l=sr(),c=oa(),f=ct();d.useEffect(()=>{const p={id:t,play:m=>{if(a.current&&!(o||i))return Yl({mediaRef:e,mediaType:n,onAutoPlayError:r,logLevel:l,mountTime:c,reason:m,isPlayer:f.isPlayer})}};return s.current.push(p),()=>{s.current=s.current.filter(m=>m.id!==t)}},[s,t,e,n,r,a,o,i,l,c,f.isPlayer])},Hp=d.createContext({playerMuted:!1,mediaVolume:1}),Up=d.createContext({setPlayerMuted:()=>{throw new Error("default")},setMediaVolume:()=>{throw new Error("default")}}),Zp=()=>{const{mediaVolume:e}=d.useContext(Hp),{setMediaVolume:t}=d.useContext(Up);return d.useMemo(()=>[e,t],[e,t])},Kp=()=>{const{playerMuted:e}=d.useContext(Hp),{setPlayerMuted:t}=d.useContext(Up);return d.useMemo(()=>[e,t],[e,t])},Vi=e=>{if(e>=100)throw new Error(`Volume was set to ${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.`)},bI=(e,t)=>{const[n]=d.useState(e.shouldPreMountAudioTags);if(e.shouldPreMountAudioTags!==n)throw new Error("Cannot change the behavior for pre-mounting audio tags dynamically.");const r=sr(),{volume:o,muted:i,playbackRate:s,preservePitch:a,shouldPreMountAudioTags:l,src:c,onDuration:f,acceptableTimeShiftInSeconds:p,_remotionInternalNeedsDurationCalculation:m,_remotionInternalNativeLoopPassed:g,_remotionInternalStack:w,allowAmplificationDuringRender:x,name:k,pauseWhenBuffering:h,showInTimeline:y,loopVolumeCurveBehavior:v,stack:S,crossOrigin:b,delayRenderRetries:E,delayRenderTimeoutInMilliseconds:I,toneFrequency:T,useWebAudioApi:R,onError:F,onNativeError:A,audioStreamIndex:W,...M}=e,[$]=Zp(),[V]=Kp(),D=Bi(v??"repeat");if(!c)throw new TypeError("No 'src' was passed to <Html5Audio>.");const L=$o(c),j=d.useContext(xt),[C]=d.useState(()=>String(Math.random())),P=Ao({frame:D,volume:o,mediaVolume:$});Vi(P);const N=Bp({crossOrigin:b,requestsVideoFrame:!1,isClientSideRendering:!1}),O=d.useMemo(()=>({muted:i||V||P<=0,src:L,loop:g,crossOrigin:N,...M}),[g,V,i,M,L,P,N]),z=d.useMemo(()=>`audio-${_o(c??"")}-${j==null?void 0:j.relativeFrom}-${j==null?void 0:j.cumulatedFrom}-${j==null?void 0:j.durationInFrames}-muted:${e.muted}-loop:${e.loop}`,[c,j==null?void 0:j.relativeFrom,j==null?void 0:j.cumulatedFrom,j==null?void 0:j.durationInFrames,e.muted,e.loop]),{el:Z,mediaElementSourceNode:H,cleanupOnMediaTagUnmount:G}=oI({aud:O,audioId:z,premounting:!!(j!=null&&j.premounting),postmounting:!!(j!=null&&j.postmounting)}),B=d.useCallback(()=>w??null,[w]);Vp({volume:o,mediaVolume:$,src:c,mediaType:"audio",playbackRate:s??1,displayName:k??null,id:C,getStack:B,showInTimeline:y,premountDisplay:(j==null?void 0:j.premountDisplay)??null,postmountDisplay:(j==null?void 0:j.postmountDisplay)??null,loopDisplay:void 0,documentationLink:"https://www.remotion.dev/docs/html5-audio",refForOutline:null}),Zx({mediaRef:Z,src:c,mediaType:"audio",playbackRate:s??1,preservePitch:a,onlyWarnForMediaSeekingError:!1,acceptableTimeshift:p??null,isPremounting:!!(j!=null&&j.premounting),isPostmounting:!!(j!=null&&j.postmounting),pauseWhenBuffering:h,onAutoPlayError:null}),Kx({id:C,isPostmounting:!!(j!=null&&j.postmounting),isPremounting:!!(j!=null&&j.premounting),mediaRef:Z,mediaType:"audio",onAutoPlayError:null}),Dx({logLevel:r,mediaRef:Z,source:H,volume:P,shouldUseWebAudioApi:R??!1}),(le.useInsertionEffect??le.useLayoutEffect)(()=>()=>{requestAnimationFrame(()=>{G()})},[G]),d.useImperativeHandle(t,()=>Z.current,[Z]);const ae=d.useRef(f);return ae.current=f,d.useEffect(()=>{var q;const{current:oe}=Z;if(!oe)return;if(oe.duration){(q=ae.current)==null||q.call(ae,oe.src,oe.duration);return}const Y=()=>{var xe;(xe=ae.current)==null||xe.call(ae,oe.src,oe.duration)};return oe.addEventListener("loadedmetadata",Y),()=>{oe.removeEventListener("loadedmetadata",Y)}},[Z,c]),n?null:u.jsx("audio",{ref:Z,preload:"metadata",crossOrigin:N,...O})},Yx=d.forwardRef(bI),SI=(e,t)=>{const n=d.useRef(null),{volume:r,playbackRate:o,allowAmplificationDuringRender:i,onDuration:s,toneFrequency:a,_remotionInternalNeedsDurationCalculation:l,_remotionInternalNativeLoopPassed:c,acceptableTimeShiftInSeconds:f,name:p,onNativeError:m,delayRenderRetries:g,delayRenderTimeoutInMilliseconds:w,loopVolumeCurveBehavior:x,pauseWhenBuffering:k,audioStreamIndex:h,preservePitch:y,...v}=e,S=io(),b=Bi(x??"repeat"),E=Ft(),I=d.useContext(xt),{registerRenderAsset:T,unregisterRenderAsset:R}=d.useContext(Mo),{delayRender:F,continueRender:A}=Un(),W=d.useMemo(()=>`audio-${_o(e.src??"")}-${I==null?void 0:I.relativeFrom}-${I==null?void 0:I.cumulatedFrom}-${I==null?void 0:I.durationInFrames}`,[e.src,I==null?void 0:I.relativeFrom,I==null?void 0:I.cumulatedFrom,I==null?void 0:I.durationInFrames]),M=Ao({volume:r,frame:b,mediaVolume:1});Vi(M),d.useImperativeHandle(t,()=>n.current,[]),d.useEffect(()=>{if(!e.src)throw new Error("No src passed");if(window.remotion_audioEnabled&&!e.muted&&!(M<=0))return T({type:"audio",src:ir(e.src),id:W,frame:S,volume:M,mediaFrame:E,playbackRate:e.playbackRate??1,toneFrequency:a??1,audioStartFrame:Math.max(0,-((I==null?void 0:I.cumulatedNegativeFrom)??0)),audioStreamIndex:h??0}),()=>R(W)},[e.muted,e.src,T,S,W,R,M,b,E,o,e.playbackRate,a,I==null?void 0:I.cumulatedNegativeFrom,h]);const{src:$}=e,V=t||l;return d.useLayoutEffect(()=>{var C,P;if(((P=(C=window.process)==null?void 0:C.env)==null?void 0:P.NODE_ENV)==="test"||!V)return;const D=F("Loading <Html5Audio> duration with src="+$,{retries:g??void 0,timeoutInMilliseconds:w??void 0}),{current:L}=n,j=()=>{L!=null&&L.duration&&s(L.src,L.duration),A(D)};return L!=null&&L.duration?(s(L.src,L.duration),A(D)):L==null||L.addEventListener("loadedmetadata",j,{once:!0}),()=>{L==null||L.removeEventListener("loadedmetadata",j),A(D)}},[$,s,V,g,w,A,F]),V?u.jsx("audio",{ref:n,...v,onError:m}):null},kI=d.forwardRef(SI),EI=(e,t)=>{const n=d.useContext(Bu),r=e,{startFrom:o,endAt:i,trimBefore:s,trimAfter:a,name:l,stack:c,pauseWhenBuffering:f,showInTimeline:p,onError:m,freeze:g,...w}=r,{loop:x,freeze:k,...h}=r,{fps:y}=ht(),v=ct(),S=sa(f);if(v.isClientSideRendering)throw new Error("<Html5Audio> is not supported in @remotion/web-renderer. Use <Audio> from @remotion/media instead. See https://remotion.dev/docs/client-side-rendering/limitations");if(typeof g<"u")throw new TypeError('The "freeze" prop is not supported on <Html5Audio />. Use <Sequence freeze={...}> to freeze media playback.');const{durations:b,setDurations:E}=d.useContext(Op);if(typeof e.src!="string")throw new TypeError(`The \`<Html5Audio>\` tag requires a string for \`src\`, but got ${JSON.stringify(e.src)} instead.`);const I=$o(e.src),T=d.useCallback(M=>{console.log(M.currentTarget.error);const $=`Could not play audio with src ${I}: ${M.currentTarget.error}. See https://remotion.dev/docs/media-playback-error for help.`;if(x){if(m){m(new Error($));return}Hs(new Error($))}else m==null||m(new Error($)),console.warn($)},[x,m,I]),R=d.useCallback((M,$)=>{E({type:"got-duration",durationInSeconds:$,src:M})},[E]),F=b[ir(I)]??b[ir(e.src)];Du({startFrom:o,endAt:i,trimBefore:s,trimAfter:a});const{trimBeforeValue:A,trimAfterValue:W}=Ou({startFrom:o,endAt:i,trimBefore:s,trimAfter:a});if(x&&F!==void 0){if(!Number.isFinite(F))return u.jsx(yl,{...h,ref:t,_remotionInternalNativeLoopPassed:!0});const M=F*y;return u.jsx(Nu,{layout:"none",durationInFrames:Au({trimAfter:W,mediaDurationInFrames:M,playbackRate:e.playbackRate??1,trimBefore:A}),children:u.jsx(yl,{...h,ref:t,_remotionInternalNativeLoopPassed:!0})})}return typeof A<"u"||typeof W<"u"?u.jsx(_t,{layout:"none",from:0-(A??0),showInTimeline:!1,durationInFrames:W,name:l,children:u.jsx(yl,{_remotionInternalNeedsDurationCalculation:!!x,pauseWhenBuffering:S,...w,ref:t})}):(zu({playbackRate:e.playbackRate,preservePitch:e.preservePitch,volume:e.volume},"Html5Audio"),v.isRendering?u.jsx(kI,{onDuration:R,...e,ref:t,onNativeError:T,_remotionInternalNeedsDurationCalculation:!!x}):u.jsx(Yx,{_remotionInternalNativeLoopPassed:e._remotionInternalNativeLoopPassed??!1,_remotionInternalStack:c??null,shouldPreMountAudioTags:n!==null&&n.numberOfAudioTags>0,...e,ref:t,onNativeError:T,onDuration:R,pauseWhenBuffering:S,_remotionInternalNeedsDurationCalculation:!!x,showInTimeline:p??!0}))},yl=d.forwardRef(EI);Zt(yl);var CI=e=>{if(e===void 0)return 1;if(typeof e!="number"||!Number.isFinite(e)||e<=0)throw new Error(`<Solid>: \`pixelDensity\` must be a positive finite number. Received: ${String(e)}.`);return e},II={...Cr,color:{type:"color",default:"transparent",description:"Color"},width:{type:"number",min:1,step:1,default:1920,description:"Width",hiddenFromList:!1},height:{type:"number",min:1,step:1,default:1080,description:"Height",hiddenFromList:!1},pixelDensity:{type:"number",min:1,max:3,step:.1,default:1,description:"Pixel density",hiddenFromList:!1},...ar,...ao,...so},TI=({color:e,width:t,height:n,effects:r=[],className:o,style:i,pixelDensity:s,overrideId:a,reference:l})=>{const{delayRender:c,continueRender:f,cancelRender:p}=Un(),m=CI(s),g=Math.ceil(t*m),w=Math.ceil(n*m),[x,k]=d.useState(null),h=ca({effects:r,overrideId:a??null}),y=d.useMemo(()=>{if(typeof document>"u")return null;const E=document.createElement("canvas");return E.width=1,E.height=1,E},[]),v=fa(),S=d.useCallback(E=>{k(E),typeof l=="function"?l(E):l&&(l.current=E)},[l]);d.useEffect(()=>{if(!x||!y)return;const E=c("Solid effect chain");if(!v)return f(E),()=>{f(E)};const I=y.getContext("2d",{colorSpace:"srgb"});if(!I){p(new Error("Failed to acquire 2D context for <Solid> source"));return}return I.clearRect(0,0,1,1),e!==void 0&&(I.fillStyle=e,I.fillRect(0,0,1,1)),da({state:v.get(g,w),source:y,effects:h,output:x,width:g,height:w}).then(T=>{T&&f(E)}).catch(T=>{p(T)}),()=>{f(E)}},[e,x,y,v,g,w,c,f,p,h]);const b=d.useMemo(()=>({width:t,height:n,...i??{}}),[n,i,t]);return u.jsx("canvas",{ref:S,width:g,height:w,className:o,style:b})},RI=d.forwardRef(({effects:e=[],controls:t,color:n,height:r,width:o,className:i,durationInFrames:s,style:a,name:l,from:c,trimBefore:f,freeze:p,hidden:m,showInTimeline:g,pixelDensity:w,...x},k)=>{const h=ua(e),y=d.useRef(null);return d.useImperativeHandle(k,()=>y.current,[]),u.jsx(_t,{layout:"none",from:c,trimBefore:f,freeze:p,hidden:m,showInTimeline:g,controls:t,_remotionInternalEffects:h,durationInFrames:s,name:l??"<Solid>",outlineRef:y,_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/solid",...x,children:u.jsx(TI,{reference:y,overrideId:(t==null?void 0:t.overrideId)??null,color:n,height:r,width:o,className:i,style:a,effects:e,pixelDensity:w})})}),Gx=Ir({Component:RI,componentName:"<Solid>",componentIdentity:"dev.remotion.remotion.Solid",schema:II,supportsEffects:!0});Gx.displayName="Solid";Zt(Gx);var Oa=null,Xx=()=>{if(Oa!==null)return Oa;if(typeof document>"u")return!1;const e=document.createElement("canvas"),t=e.getContext("2d");return Oa=typeof(t==null?void 0:t.drawElementImage)=="function"&&typeof e.requestPaint=="function"&&typeof e.captureElementImage=="function"&&"transferControlToOffscreen"in HTMLCanvasElement.prototype,Oa},jI="HTML in Canvas is not supported. Two common causes: Chrome is older than version 148 (update Chrome), or the HTML-in-Canvas flag is disabled at chrome://flags/#canvas-draw-element (enable it and restart Chrome).";function PI(e,t){if(typeof e!="number"||typeof t!="number")throw new Error(`HtmlInCanvas: \`width\` and \`height\` must be numbers. Received width=${String(e)}, height=${String(t)}.`);if(!Number.isInteger(e)||e<=0)throw new Error(`HtmlInCanvas: \`width\` must be a positive integer. Received: ${String(e)}.`);if(!Number.isInteger(t)||t<=0)throw new Error(`HtmlInCanvas: \`height\` must be a positive integer. Received: ${String(t)}.`)}function FI(e){if(e===void 0)return 1;if(typeof e!="number"||!Number.isFinite(e)||e<=0)throw new Error(`HtmlInCanvas: \`pixelDensity\` must be a positive finite number. Received: ${String(e)}.`);return e}var Ba=e=>e instanceof DOMException&&e.name==="InvalidStateError",ig="HtmlInCanvas: Expected the element to be inside the viewport during rendering, but Chrome had no cached paint record for it.",sg=({target:e,width:t,height:n})=>{e.width!==t&&(e.width=t),e.height!==n&&(e.height=n)},_I=({canvas:e,element:t,elementImage:n})=>{const r=e.getContext("2d");if(!r)throw new Error("Failed to acquire 2D context for <HtmlInCanvas> canvas");r.reset();const o=r.drawElementImage(n,0,0);t.style.transform=o.toString()},ag=d.createContext(null),qx=d.forwardRef(({width:e,height:t,effects:n,children:r,onPaint:o,onInit:i,pixelDensity:s,controls:a,style:l},c)=>{const f=d.useContext(ag);PI(e,t);const p=FI(s),m=Math.ceil(e*p),g=Math.ceil(t*p),{delayRender:w,continueRender:x,cancelRender:k}=Un(),{isClientSideRendering:h,isRendering:y}=ct(),v=!y||h,S=o===void 0&&i===void 0;Xx()||k(new Error(jI));const b=d.useRef(null),E=d.useRef(null),I=d.useRef(null),T=`${e}x${t}@${p}-${S?"direct":"offscreen"}`,R=d.useCallback(Z=>{b.current=Z,typeof c=="function"?c(Z):c&&(c.current=Z)},[c]),F=fa(),A=ca({effects:n,overrideId:(a==null?void 0:a.overrideId)??null}),W=d.useRef(A);W.current=A;const M=d.useRef(o);M.current=o;const $=d.useRef(i);$.current=i;const V=d.useRef(!1),D=d.useRef(null),L=d.useRef(!1),j=d.useRef(f);j.current=f;const C=d.useCallback(async()=>{var G;const Z=I.current;if(!Z)throw new Error("Canvas or scene element not found");const H=E.current;if(!H)throw new Error("HtmlInCanvas: paint target is not ready because the canvas is remounting");sg({target:H,width:m,height:g});try{const B=b.current;if(!B)throw new Error("Canvas not found");const X=w("onPaint");if(!V.current){const oe=$.current;if(!oe)V.current=!0;else{let Y;try{Y=B.captureElementImage(Z)}catch(q){if(Ba(q)&&v){x(X);return}throw Ba(q)?new Error(ig):q}V.current=!0;try{if(H instanceof HTMLCanvasElement)throw new Error("HtmlInCanvas: onInit requires an OffscreenCanvas paint target");const q=await oe({canvas:H,element:Z,elementImage:Y,pixelDensity:p});if(typeof q!="function")throw new Error("HtmlInCanvas: when `onInit` is provided, it must return a cleanup function, or a Promise that resolves to one.");L.current?q():D.current=q}finally{Y.close()}}}let ae;try{ae=B.captureElementImage(Z)}catch(oe){if(Ba(oe)&&v){x(X);return}throw Ba(oe)?new Error(ig):oe}try{const oe=M.current;if(oe){if(H instanceof HTMLCanvasElement)throw new Error("HtmlInCanvas: onPaint requires an OffscreenCanvas paint target");const Y=oe({canvas:H,element:Z,elementImage:ae,pixelDensity:p});Y&&await Y}else _I({canvas:H,element:Z,elementImage:ae,pixelDensity:p});await da({state:F.get(m,g),source:H,effects:W.current,output:H,width:m,height:g})}finally{ae.close()}(G=j.current)==null||G.requestParentPaint(),x(X)}catch(B){k(B)}},[g,m,F,x,k,w,p,v]);d.useLayoutEffect(()=>{const Z=b.current;if(!Z)throw new Error("Canvas not found");Z.layoutSubtree=!0;const H=S?Z:Z.transferControlToOffscreen();return E.current=H,sg({target:H,width:m,height:g}),V.current=!1,L.current=!1,Z.addEventListener("paint",C),()=>{var G;Z.removeEventListener("paint",C),E.current=null,V.current=!1,L.current=!0,(G=D.current)==null||G.call(D),D.current=null}},[C,k,m,g,S]);const P=d.useRef(!1);d.useLayoutEffect(()=>{var H;if(!P.current){P.current=!0;return}const Z=b.current;Z&&((H=Z.requestPaint)==null||H.call(Z))},[o,A]),d.useLayoutEffect(()=>{const Z=b.current;if(!Z)return;const H=w("waiting for first paint after canvas resize");return Z.addEventListener("paint",()=>{x(H)},{once:!0}),()=>{x(H)}},[e,t,x,w,T]);const N=d.useMemo(()=>({width:e,height:t}),[e,t]),O=d.useMemo(()=>({width:e,height:t,...l??{}}),[t,l,e]),z=d.useMemo(()=>({requestParentPaint:()=>{var Z,H;(H=(Z=b.current)==null?void 0:Z.requestPaint)==null||H.call(Z)}}),[]);return u.jsx(ag.Provider,{value:z,children:u.jsx("canvas",{ref:R,width:m,height:g,style:O,children:u.jsx("div",{ref:I,style:N,children:r})},T)})});qx.displayName="HtmlInCanvasContent";var Jx=d.forwardRef(({width:e,height:t,effects:n=[],children:r,onPaint:o,onInit:i,pixelDensity:s,controls:a,style:l,durationInFrames:c,name:f,...p},m)=>{const g=ua(n),w=d.useRef(null),x=d.useCallback(k=>{w.current=k,typeof m=="function"?m(k):m&&(m.current=k)},[m]);return u.jsx(_t,{durationInFrames:c,name:f??"<HtmlInCanvas>",_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/remotion/html-in-canvas",controls:a,_remotionInternalEffects:g,outlineRef:w,layout:"none",...p,children:u.jsx(qx,{ref:x,width:e,height:t,effects:n,onPaint:o,onInit:i,pixelDensity:s,controls:a,style:l,children:r})})});Jx.displayName="HtmlInCanvas";var MI={...Cr,pixelDensity:{type:"number",min:1,max:3,step:.1,default:1,description:"Pixel density",hiddenFromList:!1},...ar,...ao,...so},$I=Ir({Component:Jx,componentName:"<HtmlInCanvas>",componentIdentity:"dev.remotion.remotion.HtmlInCanvas",schema:MI,supportsEffects:!0}),Qx=Object.assign($I,{isSupported:Xx});Qx.displayName="HtmlInCanvas";Zt(Qx);function vr(e){return e.startsWith("data:")&&e.length>100?e.slice(0,60)+"...["+e.length+" chars total]":e}var AI={...Cr,...Li,fit:{type:"enum",default:"fill",description:"Fit",variants:{fill:{},contain:{},cover:{}}},...ar,...ao,...so},NI=()=>{if(typeof DOMException<"u")return new DOMException("Image loading was aborted","AbortError");const e=new Error("Image loading was aborted");return e.name="AbortError",e},LI=({src:e,signal:t})=>new Promise((n,r)=>{const o=new Image;let i=!1;function s(){o.onload=null,o.onerror=null}function a(c){i||(i=!0,s(),c())}function l(){a(()=>r(NI()))}if(o.onload=()=>{var c;Promise.resolve((c=o.decode)==null?void 0:c.call(o)).catch(()=>{}).then(()=>{const f=o.naturalWidth||o.width,p=o.naturalHeight||o.height;if(f<=0||p<=0){a(()=>r(new Error(`Could not determine dimensions for <CanvasImage> with src="${vr(e)}"`)));return}a(()=>n({element:o,width:f,height:p}))})},o.onerror=()=>{a(()=>r(new Error(`Could not load <CanvasImage> with src="${vr(e)}"`)))},t.addEventListener("abort",l,{once:!0}),t.aborted){l();return}o.crossOrigin="anonymous",o.src=e});function zI(e){return 1e3*2**(e-1)}var DI=({onFrame:e})=>{if(typeof requestAnimationFrame>"u")return e(),()=>{};const t=requestAnimationFrame(e);return()=>cancelAnimationFrame(t)},e1=d.forwardRef(({src:e,width:t,height:n,fit:r="fill",effects:o,controls:i,onError:s,className:a,style:l,id:c,pauseWhenLoading:f,maxRetries:p=2,delayRenderRetries:m,delayRenderTimeoutInMilliseconds:g,refForOutline:w,...x},k)=>{const{delayRender:h,continueRender:y,cancelRender:v}=Un(),{delayPlayback:S}=Vu(),[b,E]=d.useState(null),[I,T]=d.useState(null),R=$o(e),F=fa(),A=ca({effects:o,overrideId:(i==null?void 0:i.overrideId)??null}),W=d.useContext(xt),M=d.useRef(null),[$,V]=d.useState(!1),D=!!(W!=null&&W.premounting),L=!!(W!=null&&W.postmounting),j=d.useCallback(({markAsReady:N})=>{const O=M.current;!O||O.continued||(O.continued=!0,N&&V(!1),y(O.handle),M.current=null)},[y]),C=d.useMemo(()=>typeof document>"u"?null:document.createElement("canvas"),[]),P=d.useCallback(N=>{E(N),w&&(w.current=N),typeof k=="function"?k(N):k&&(k.current=N)},[k,w]);return d.useLayoutEffect(()=>{if(!(!f||!$||D||L))return S().unblock},[S,$,L,D,f]),d.useLayoutEffect(()=>{const N=h(`Rendering <CanvasImage> with src="${vr(R)}"`,{retries:m??void 0,timeoutInMilliseconds:g??void 0}),O=new AbortController;let z=!1,Z=0,H=null;T(null),V(!0),M.current={handle:N,continued:!1};const G=()=>{LI({src:R,signal:O.signal}).then(B=>{z||T(B)}).catch(B=>{if(B.name==="AbortError"){j({markAsReady:!1});return}if(Z++,Z<=p){const X=zI(Z);console.warn(`Could not load <CanvasImage> with src="${vr(R)}", retrying in ${X}ms`),H=setTimeout(()=>{z||G()},X)}else s?(s(B),j({markAsReady:!0})):v(B)})};return G(),()=>{z=!0,H!==null&&clearTimeout(H),O.abort(),j({markAsReady:!1})}},[R,v,j,h,m,g,p,s]),d.useLayoutEffect(()=>{if(!I||!b||!C)return;const N=h(`Applying effects to <CanvasImage> with src="${vr(R)}"`);let O=!1,z=!1,Z=()=>{};const H=()=>{z||(z=!0,y(N))},G=t??I.width,B=n??I.height,X=C.getContext("2d",{colorSpace:"srgb"});return X?(C.width=G,C.height=B,b.width=G,b.height=B,X.clearRect(0,0,G,B),X.drawImage(I.element,...Ex(r,{width:I.width,height:I.height},{width:G,height:B})),da({state:F.get(G,B),source:C,effects:A,output:b,width:G,height:B}).then(ae=>{ae&&!O&&(Z=DI({onFrame:()=>{O||(H(),j({markAsReady:!0}))}}))}).catch(ae=>{O||(s?(s(ae),H(),j({markAsReady:!0})):v(ae))}),()=>{O=!0,Z(),H()}):(v(new Error("Could not get 2D context for <CanvasImage> source canvas")),H(),()=>{H()})},[R,v,F,y,j,h,r,n,I,A,s,b,C,t]),u.jsx("canvas",{...x,ref:P,width:t,height:n,className:a,style:l,id:c})});e1.displayName="CanvasImageContent";var OI=d.forwardRef(({src:e,width:t,height:n,fit:r,effects:o=[],className:i,style:s,id:a,onError:l,pauseWhenLoading:c,maxRetries:f,delayRenderRetries:p,delayRenderTimeoutInMilliseconds:m,durationInFrames:g,from:w,trimBefore:x,freeze:k,premountFor:h,postmountFor:y,styleWhilePremounted:v,styleWhilePostmounted:S,hidden:b,name:E,showInTimeline:I,stack:T,controls:R,_remotionInternalDocumentationLink:F,outlineRef:A,...W},M)=>{if(!e)throw new Error('No "src" prop was passed to <CanvasImage>.');const $=ua(o),V=d.useRef(null);d.useImperativeHandle(M,()=>V.current,[]);const{effectivePostmountFor:D,effectivePremountFor:L,freezeFrame:j,isPremountingOrPostmounting:C,postmountingActive:P,premountingActive:N,premountingStyle:O}=aa({from:w??0,durationInFrames:g??1/0,premountFor:h??null,postmountFor:y??null,style:s??null,styleWhilePremounted:v??null,styleWhilePostmounted:S??null,hideWhilePremounted:"display-none"});return u.jsx(ia,{frame:j,active:C,children:u.jsx(_t,{layout:"none",from:w??0,trimBefore:x,durationInFrames:g??1/0,freeze:k,hidden:b,showInTimeline:I??!0,name:E??"<CanvasImage>",_remotionInternalDocumentationLink:F??"https://www.remotion.dev/docs/canvasimage",controls:R,_remotionInternalEffects:$,_remotionInternalIsMedia:{type:"image",src:e},_remotionInternalStack:T,_remotionInternalPremountDisplay:L||null,_remotionInternalPostmountDisplay:D||null,_remotionInternalIsPremounting:N,_remotionInternalIsPostmounting:P,outlineRef:A??V,children:u.jsx(e1,{ref:V,src:e,width:t,height:n,fit:r,effects:o,controls:R,className:i,style:O??void 0,id:a,onError:l,pauseWhenLoading:c,maxRetries:f,delayRenderRetries:p,delayRenderTimeoutInMilliseconds:m,refForOutline:A??null,...W})})})}),Yp=Ir({Component:OI,componentName:"<CanvasImage>",componentIdentity:"dev.remotion.remotion.CanvasImage",schema:AI,supportsEffects:!0});Yp.displayName="CanvasImage";Zt(Yp);var BI=({onLoad:e,onError:t,delayRenderRetries:n,delayRenderTimeoutInMilliseconds:r,...o},i)=>{const{delayRender:s,continueRender:a}=Un(),[l]=d.useState(()=>s(`Loading <IFrame> with source ${o.src}`,{retries:n??void 0,timeoutInMilliseconds:r??void 0})),c=d.useCallback(p=>{a(l),e==null||e(p)},[l,e,a]),f=d.useCallback(p=>{a(l),t?t(p):console.error("Error loading iframe:",p,"Handle the event using the onError() prop to make this message disappear.")},[l,t,a]);return u.jsx("iframe",{referrerPolicy:"strict-origin-when-cross-origin",...o,ref:i,onError:f,onLoad:c})};d.forwardRef(BI);function WI(e){return 1e3*2**(e-1)}var VI=({onError:e,maxRetries:t=2,src:n,pauseWhenLoading:r,delayRenderRetries:o,delayRenderTimeoutInMilliseconds:i,onImageFrame:s,crossOrigin:a,decoding:l,ref:c,refForOutline:f,...p})=>{const m=d.useRef(null),g=d.useRef({}),{delayPlayback:w}=Vu(),x=d.useContext(xt),[k,h]=d.useState(!1),y=d.useCallback($=>{m.current=$,f.current=$,typeof c=="function"?c($):c&&(c.current=$)},[c,f]),v=$o(n),S=d.useCallback($=>{if(!m.current)return;const V=m.current.src;setTimeout(()=>{var L;if(!m.current)return;const D=(L=m.current)==null?void 0:L.src;D===V&&(m.current.removeAttribute("src"),m.current.setAttribute("src",D))},$)},[]),{delayRender:b,continueRender:E,cancelRender:I}=Un(),T=!!(x!=null&&x.premounting),R=!!(x!=null&&x.postmounting),F=d.useCallback($=>{var V,D,L,j,C,P,N;if(g.current){if(g.current[(V=m.current)==null?void 0:V.src]=(g.current[(D=m.current)==null?void 0:D.src]??0)+1,e&&(g.current[(L=m.current)==null?void 0:L.src]??0)>t){e($);return}if((g.current[(j=m.current)==null?void 0:j.src]??0)<=t){const O=WI(g.current[(C=m.current)==null?void 0:C.src]??0);console.warn(`Could not load image with source ${vr((P=m.current)==null?void 0:P.src)}, retrying again in ${O}ms`),S(O);return}try{I("Error loading image with src: "+vr((N=m.current)==null?void 0:N.src))}catch{}}},[I,t,e,S]);typeof window<"u"&&(d.useLayoutEffect(()=>{if(!(!r||!k||T||R))return w().unblock},[w,k,R,T,r]),d.useLayoutEffect(()=>{var j,C;if(((C=(j=window.process)==null?void 0:j.env)==null?void 0:C.NODE_ENV)==="test"){m.current&&(m.current.src=v);return}const{current:$}=m;if(!$)return;h(!0);const V=b("Loading <Img> with src="+vr(v),{retries:o??void 0,timeoutInMilliseconds:i??void 0});let D=!1;const L=()=>{var P,N,O;if(D){E(V);return}(g.current[(P=m.current)==null?void 0:P.src]??0)>0&&(delete g.current[(N=m.current)==null?void 0:N.src],console.info(`Retry successful - ${vr((O=m.current)==null?void 0:O.src)} is now loaded`)),$&&(s==null||s($)),h(!1),E(V)};if(!m.current){L();return}return $.src=v,$.decode().then(L).catch(P=>{console.warn(P),$.complete&&$.naturalWidth>0&&$.naturalHeight>0?L():$.addEventListener("load",L)}),()=>{D=!0,$.removeEventListener("load",L),E(V)}},[v,o,i,s,E,b]));const{isClientSideRendering:A,isRendering:W}=ct(),M=Bp({crossOrigin:a,requestsVideoFrame:!1,isClientSideRendering:A});return u.jsx("img",{...p,ref:y,crossOrigin:M,onError:F,decoding:W?"sync":l})},HI=({hidden:e,name:t,stack:n,showInTimeline:r,src:o,from:i,trimBefore:s,durationInFrames:a,freeze:l,premountFor:c,postmountFor:f,style:p,styleWhilePremounted:m,styleWhilePostmounted:g,controls:w,outlineRef:x,...k})=>{if(!o)throw new Error('No "src" prop was passed to <Img>.');const{effectivePostmountFor:h,effectivePremountFor:y,freezeFrame:v,isPremountingOrPostmounting:S,postmountingActive:b,premountingActive:E,premountingStyle:I}=aa({from:i??0,durationInFrames:a??1/0,premountFor:c??null,postmountFor:f??null,style:p??null,styleWhilePremounted:m??null,styleWhilePostmounted:g??null,hideWhilePremounted:"display-none"});return u.jsx(ia,{frame:v,active:S,children:u.jsx(_t,{layout:"none",from:i??0,trimBefore:s,durationInFrames:a??1/0,freeze:l,_remotionInternalStack:n,_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/img",_remotionInternalIsMedia:{type:"image",src:o},_remotionInternalPremountDisplay:y||null,_remotionInternalPostmountDisplay:h||null,_remotionInternalIsPremounting:E,_remotionInternalIsPostmounting:b,name:t??"<Img>",controls:w,showInTimeline:r??!0,hidden:e,outlineRef:x,children:u.jsx(VI,{src:o,refForOutline:x,style:I??void 0,...k})})})},UI=Yp,ZI={src:{type:"asset",default:void 0,description:"Source",keyframable:!1},...Cr,...Li,...ar,...ao,...so},KI=new Set(["alt","crossOrigin","decoding","fetchPriority","loading","onError","onImageFrame","onLoad","sizes","srcSet","useMap"]),YI=e=>Object.keys(e).filter(t=>e[t]!==void 0&&KI.has(t)),GI=e=>e.map(t=>`"${t}"`).join(", "),XI=({props:e,ref:t,width:n,height:r})=>{if(typeof n=="string"||typeof r=="string")throw new Error('The "width" and "height" props must be numbers on <Img> when effects are passed, because <Img> renders a <CanvasImage>. Use numeric props or CSS dimensions in "style".');const o=YI(e);if(t!=null&&o.unshift("ref"),o.length!==0)throw new Error(`The ${GI(o)} prop${o.length===1?"":"s"} cannot be used on <Img> when effects are passed, because <Img> renders a <canvas> instead of a native <img>. Remove ${o.length===1?"this prop":"these props"}.`)},qI=e=>{const t=e==null?void 0:e.objectFit;if(t==="fill"||t==="contain"||t==="cover")return t},JI=({effects:e=[],ref:t,hidden:n,name:r,stack:o,showInTimeline:i,src:s,from:a,trimBefore:l,durationInFrames:c,freeze:f,premountFor:p,postmountFor:m,styleWhilePremounted:g,styleWhilePostmounted:w,controls:x,width:k,height:h,className:y,style:v,id:S,pauseWhenLoading:b,maxRetries:E,delayRenderRetries:I,delayRenderTimeoutInMilliseconds:T,...R})=>{const F=d.useRef(null),A=sa(b);if(e.length===0)return u.jsx(HI,{...R,ref:t,hidden:n,name:r,stack:o,showInTimeline:i,src:s,from:a,trimBefore:l,durationInFrames:c,freeze:f,premountFor:p,postmountFor:m,styleWhilePremounted:g,styleWhilePostmounted:w,controls:x,width:k,height:h,className:y,style:v,id:S,pauseWhenLoading:A,maxRetries:E,delayRenderRetries:I,delayRenderTimeoutInMilliseconds:T,outlineRef:F});if(!s)throw new Error('No "src" prop was passed to <Img>.');XI({props:R,ref:t,width:k,height:h});const W=typeof k=="number"?k:void 0,M=typeof h=="number"?h:void 0,$=R,V=qI(v)??"fill";return u.jsx(UI,{src:s,width:W,height:M,fit:V,effects:e,className:y,style:v,id:S,pauseWhenLoading:A,maxRetries:E,delayRenderRetries:I,delayRenderTimeoutInMilliseconds:T,from:a,trimBefore:l,durationInFrames:c,freeze:f,premountFor:p,postmountFor:m,styleWhilePremounted:g,styleWhilePostmounted:w,hidden:n,name:r??"<Img>",showInTimeline:i,stack:o,_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/img",controls:x,outlineRef:F,...$})},Gp=Ir({Component:JI,componentName:"<Img>",componentIdentity:"dev.remotion.remotion.Img",schema:ZI,supportsEffects:!0});Zt(Gp);var QI=e=>{if(e==="remotion")return"dev.remotion.remotion";if(e.startsWith("@remotion/"))return`dev.remotion.${e.slice(10).replace(/-([a-z])/g,(n,r)=>r.toUpperCase())}`;throw new Error(`Unsupported Remotion package name: ${e}`)},t1=({packageName:e,componentName:t})=>`${QI(e)}.${t}`,Xp={...Cr,...ar},eT={...Xp,...ao},n1={...eT,...so},tT={...n1,...Tu,...Yw},nT={...Xp,...Tu,...Yw},rT=(e,t)=>{typeof e=="function"?e(t):e&&(e.current=t)},r1=e=>{const t=Ir(e);return Zt(t),t},Xl=(e,t,n)=>{const r=d.forwardRef((i,s)=>{const{durationInFrames:a,from:l,trimBefore:c,freeze:f,hidden:p,name:m,showInTimeline:g,stack:w,controls:x,...k}=i,h=d.useRef(null),y=d.useCallback(v=>{h.current=v,rT(s,v)},[s]);return u.jsx(_t,{layout:"none",from:l??0,trimBefore:c,durationInFrames:a??1/0,freeze:f,hidden:p,name:m??t,showInTimeline:g??!0,controls:x,_remotionInternalStack:w,_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/interactive",outlineRef:h,children:le.createElement(e,{...k,ref:y})})});r.displayName=t;const o=r1({Component:r,componentName:t,componentIdentity:t1({packageName:"remotion",componentName:t.slice(1,-1)}),schema:n,supportsEffects:!1});return o.displayName=t,o},Be=(e,t)=>Xl(e,t,tT),Oo=(e,t)=>Xl(e,t,Xp),$r={baseSchema:Cr,transformSchema:ar,textSchema:Tu,backgroundSchema:ao,borderSchema:so,premountSchema:Li,sequenceSchema:Ri,withSchema:r1,_internalMakeRemotionComponentIdentity:t1,A:Be("a","<Interactive.A>"),Article:Be("article","<Interactive.Article>"),Aside:Be("aside","<Interactive.Aside>"),Button:Be("button","<Interactive.Button>"),Circle:Oo("circle","<Interactive.Circle>"),Code:Be("code","<Interactive.Code>"),Div:Be("div","<Interactive.Div>"),Ellipse:Oo("ellipse","<Interactive.Ellipse>"),Em:Be("em","<Interactive.Em>"),Footer:Be("footer","<Interactive.Footer>"),G:Oo("g","<Interactive.G>"),H1:Be("h1","<Interactive.H1>"),H2:Be("h2","<Interactive.H2>"),H3:Be("h3","<Interactive.H3>"),H4:Be("h4","<Interactive.H4>"),H5:Be("h5","<Interactive.H5>"),H6:Be("h6","<Interactive.H6>"),Header:Be("header","<Interactive.Header>"),Label:Be("label","<Interactive.Label>"),Li:Be("li","<Interactive.Li>"),Line:Oo("line","<Interactive.Line>"),Main:Be("main","<Interactive.Main>"),Nav:Be("nav","<Interactive.Nav>"),Ol:Be("ol","<Interactive.Ol>"),P:Be("p","<Interactive.P>"),Path:Oo("path","<Interactive.Path>"),Pre:Be("pre","<Interactive.Pre>"),Rect:Oo("rect","<Interactive.Rect>"),Section:Be("section","<Interactive.Section>"),Small:Be("small","<Interactive.Small>"),Span:Be("span","<Interactive.Span>"),Strong:Be("strong","<Interactive.Strong>"),Svg:Xl("svg","<Interactive.Svg>",n1),Text:Xl("text","<Interactive.Text>",nT),Ul:Be("ul","<Interactive.Ul>")},oT=async({resolvedSrc:e,signal:t,requestInit:n,contentType:r})=>{const{decoder:o,selectedTrack:i}=await Rx({resolvedSrc:e,signal:t,requestInit:n,contentType:r});try{const{image:s}=await o.decode({frameIndex:i.frameCount-1,completeFramesOnly:!0});try{if(s.duration===null)throw new Error("Could not determine animated image duration");return(s.timestamp+s.duration)/1e6}finally{s.close()}}finally{o.close()}},o1=le.createRef(),iT=({children:e,onlyRenderComposition:t,currentCompositionMetadata:n,initialCompositions:r,initialCanvasContent:o})=>{const[i,s]=d.useState([]),[a,l]=d.useState(o),[c,f]=d.useState(r),p=d.useRef(c),m=d.useCallback(v=>{f(S=>{const b=v(S);return p.current=b,b})},[]),g=d.useCallback(v=>{m(S=>{if(S.find(b=>b.id===v.id))throw new Error(`Multiple composition with id ${v.id} are registered.`);return[...S,v]})},[m]),w=d.useCallback(v=>{f(S=>S.filter(b=>b.id!==v))},[]),x=d.useCallback((v,S,b,E)=>{s(I=>[...I,{name:v,parent:S,nonce:b,stack:E}])},[]),k=d.useCallback((v,S)=>{s(b=>b.filter(E=>!(E.name===v&&E.parent===S)))},[]);d.useImperativeHandle(o1,()=>({getCompositions:()=>p.current}),[]);const h=d.useMemo(()=>({registerComposition:g,unregisterComposition:w,registerFolder:x,unregisterFolder:k,setCanvasContent:l,onlyRenderComposition:t}),[g,x,w,k,t]),y=d.useMemo(()=>({compositions:c,folders:i,currentCompositionMetadata:n,canvasContent:a}),[c,i,n,a]);return u.jsx(Mi.Provider,{value:y,children:u.jsx(ta.Provider,{value:h,children:e})})},i1={};Sw(i1,{makeDefaultPreviewCSS:()=>aT,injectCSS:()=>sT,OBJECTFIT_CONTAIN_CLASS_NAME:()=>Us});var Wa={},sT=e=>{if(typeof document>"u")return()=>{};if(Wa[e])return()=>{};const t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");return n.appendChild(document.createTextNode(e)),t.prepend(n),Wa[e]=n,()=>{const r=Wa[e];r&&(r.parentNode&&r.parentNode.removeChild(r),delete Wa[e])}},Us="__remotion_objectfitcontain",aT=(e,t)=>e?`
54
+ `}),u.jsx("svg",{width:Nm,height:Nm,viewBox:"-100 -100 400 400",style:NE,children:u.jsx("path",{fill:"#555",stroke:"#555",strokeWidth:"100",strokeLinejoin:"round",d:"M 2 172 a 196 100 0 0 0 195 5 A 196 240 0 0 0 100 2.259 A 196 240 0 0 0 2 172 z"})}),u.jsxs("p",{style:LE,children:["Resolving ","<Suspense>","..."]})]}),on=null,ff=()=>{if(!on){if(typeof document>"u")throw new Error("Tried to call an API that only works in the browser from outside the browser");on=document.createElement("div"),on.style.position="absolute",on.style.top="0px",on.style.left="0px",on.style.right="0px",on.style.bottom="0px",on.style.width="100%",on.style.height="100%",on.style.display="flex",on.style.flexDirection="column";const e=document.createElement("div");e.style.position="fixed",e.style.top="-999999px",e.appendChild(on),document.body.appendChild(e)}return on},pf=()=>"remotion_inputPropsOverride"+window.location.origin,Mw=()=>{if(typeof localStorage>"u")return null;const e=localStorage.getItem(pf());return e?JSON.parse(e):null},OE=e=>{if(!(typeof localStorage>"u")){if(e===null){localStorage.removeItem(pf());return}localStorage.setItem(pf(),JSON.stringify(e))}},Lm=!1,BE=()=>{Lm||(Lm=!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()"))},WE=()=>{if(typeof window>"u")return BE(),{};if(Rn().isPlayer)throw new Error("You cannot call `getInputProps()` from a <Player>. Instead, the props are available as React props from component that you passed as `component` prop.");const e=Mw();if(e)return e;if(typeof window>"u"||typeof window.remotion_inputProps>"u")throw new 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.");const t=window.remotion_inputProps;return t?Fw(t):{}},Tp=d.createContext({props:{},updateProps:()=>{throw new Error("Not implemented")}}),VE=le.createRef(),$w=({children:e})=>{const[t,n]=le.useState({}),r=d.useCallback(({defaultProps:i,id:s,newProps:a})=>{n(l=>({...l,[s]:typeof a=="function"?a(l[s]??i):a}))},[]),o=d.useMemo(()=>({props:t,updateProps:r}),[t,r]);return u.jsx(Tp.Provider,{value:o,children:e})},Aw=le.createContext(null),ct=()=>{const e=d.useContext(Aw),[t]=d.useState(()=>Rn());return e??t};function Ul(e,t,n){if(typeof e!="number")throw new Error(`The "${t}" prop ${n} must be a number, but you passed a value of type ${typeof e}`);if(isNaN(e))throw new TypeError(`The "${t}" prop ${n} must not be NaN, but is NaN.`);if(!Number.isFinite(e))throw new TypeError(`The "${t}" prop ${n} must be finite, but is ${e}.`);if(e%1!==0)throw new TypeError(`The "${t}" prop ${n} must be an integer, but is ${e}.`);if(e<=0)throw new TypeError(`The "${t}" prop ${n} must be positive, but got ${e}.`)}function Su(e,t){const{allowFloats:n,component:r}=t;if(typeof e>"u")throw new Error(`The "durationInFrames" prop ${r} is missing.`);if(typeof e!="number")throw new Error(`The "durationInFrames" prop ${r} must be a number, but you passed a value of type ${typeof e}`);if(e<=0)throw new TypeError(`The "durationInFrames" prop ${r} must be positive, but got ${e}.`);if(!n&&e%1!==0)throw new TypeError(`The "durationInFrames" prop ${r} must be an integer, but got ${e}.`);if(!Number.isFinite(e))throw new TypeError(`The "durationInFrames" prop ${r} must be finite, but got ${e}.`)}function ku(e,t,n){if(typeof e!="number")throw new Error(`"fps" must be a number, but you passed a value of type ${typeof e} ${t}`);if(!Number.isFinite(e))throw new Error(`"fps" must be a finite, but you passed ${e} ${t}`);if(isNaN(e))throw new Error(`"fps" must not be NaN, but got ${e} ${t}`);if(e<=0)throw new TypeError(`"fps" must be positive, but got ${e} ${t}`)}var Eu=d.createContext(null),HE=d.createRef(),UE=e=>!!e.calculateMetadata,Rp=e=>{const t=d.useContext(Eu),{props:n}=d.useContext(Tp),{compositions:r,canvasContent:o,currentCompositionMetadata:i}=d.useContext(Mi),s=(o==null?void 0:o.type)==="composition"?o.compositionId:null,a=e??s,l=r.find(p=>p.id===a),c=d.useMemo(()=>l?n[l.id]??{}:{},[n,l]),f=ct();return d.useMemo(()=>l?i?{type:"success",metadataSource:null,result:{...i,id:l.id,defaultProps:l.defaultProps??{}}}:UE(l)?!t||!t[l.id]?null:t[l.id]:(Su(l.durationInFrames,{allowFloats:!1,component:`in <Composition id="${l.id}">`}),ku(l.fps,`in <Composition id="${l.id}">`),Ul(l.width,"width",`in <Composition id="${l.id}">`),Ul(l.height,"height",`in <Composition id="${l.id}">`),{type:"success",metadataSource:null,result:{width:l.width,height:l.height,fps:l.fps,id:l.id,durationInFrames:l.durationInFrames,defaultProps:l.defaultProps??{},props:{...l.defaultProps??{},...c??{},...typeof window>"u"||f.isPlayer||!window.remotion_inputProps?{}:WE()??{}},defaultCodec:null,defaultOutName:null,defaultVideoImageFormat:null,defaultPixelFormat:null,defaultProResProfile:null,defaultSampleRate:null}}):null,[l,t,i,c,f.isPlayer])},Nw=e=>{const t=e.stack??"";return t.startsWith("Error:")?t:`${e.message}
55
+ ${t}`},ZE=e=>e instanceof Error?!0:!(e===null||typeof e!="object"||!("stack"in e)||typeof e.stack!="string"||!("message"in e)||typeof e.message!="string");function jp(e,t){let n;throw ZE(t)?(n=t,n.stack||(n.stack=new Error(n.message).stack)):typeof t=="string"?n=Error(t):n=Error("Rendering was cancelled"),e&&(e.remotion_cancelledError=Nw(n)),n}function Hs(e){return jp(typeof window<"u"?window:void 0,e)}var KE=["trace","verbose","info","warn","error"],zm=e=>KE.indexOf(e),Cu=(e,t)=>zm(e)<=zm(t),ra=({args:e,logLevel:t,tag:n})=>{const r=[...e];return Rn().isRendering&&!Rn().isClientSideRendering&&r.unshift(Symbol.for(`__remotion_level_${t}`)),n&&Rn().isRendering&&!Rn().isClientSideRendering&&r.unshift(Symbol.for(`__remotion_tag_${n}`)),r},YE=(e,...t)=>{if(Cu(e.logLevel,"verbose"))return console.debug(...ra({args:t,logLevel:"verbose",tag:e.tag}))},GE=(e,...t)=>{if(Cu(e.logLevel,"trace"))return console.debug(...ra({args:t,logLevel:"trace",tag:e.tag}))},XE=(e,...t)=>{if(Cu(e.logLevel,"info"))return console.log(...ra({args:t,logLevel:"info",tag:e.tag}))},qE=(e,...t)=>{if(Cu(e.logLevel,"warn"))return console.warn(...ra({args:t,logLevel:"warn",tag:e.tag}))},JE=(e,...t)=>console.error(...ra({args:t,logLevel:"error",tag:e.tag})),kt={trace:GE,verbose:YE,info:XE,warn:qE,error:JE};typeof window<"u"&&(window.remotion_renderReady=!1,window.remotion_delayRenderTimeouts||(window.remotion_delayRenderTimeouts={}),window.remotion_delayRenderHandles=[]);var QE="The delayRender was called:",eC="Retries left: ",tC="- Rendering the frame will be retried.",nC="handle was cleared after",rC=3e4,Lw=({scope:e,environment:t,label:n,options:r})=>{var s;if(typeof n!="string"&&n!==null)throw new Error("The label parameter of delayRender() must be a string or undefined, got: "+JSON.stringify(n));const o=Math.random();e.remotion_delayRenderHandles.push(o);const i=((s=Error().stack)==null?void 0:s.replace(/^Error/g,""))??"";if(t.isRendering){const a=((r==null?void 0:r.timeoutInMilliseconds)??e.remotion_puppeteerTimeout??rC)-2e3,l=((r==null?void 0:r.retries)??0)-(e.remotion_attempt-1);e.remotion_delayRenderTimeouts[o]={label:n??null,startTime:Date.now(),timeout:setTimeout(()=>{const c=["A delayRender()",n?`"${n}"`:null,`was called but not cleared after ${a}ms. See https://remotion.dev/docs/timeout for help.`,l>0?eC+l:null,l>0?tC:null,QE,i].filter($i).join(" ");t.isClientSideRendering?e.remotion_cancelledError=Nw(Error(c)):jp(e,Error(c))},a)}}return e.remotion_renderReady=!1,o},oC=(e,t)=>typeof window>"u"?Math.random():Lw({scope:window,environment:Rn(),label:e??null,options:{}}),zw=({scope:e,handle:t,environment:n,logLevel:r})=>{if(typeof t>"u")throw new TypeError("The continueRender() method must be called with a parameter that is the return value of delayRender(). No value was passed.");if(typeof t!="number")throw new TypeError("The parameter passed into continueRender() must be the return value of delayRender() which is a number. Got: "+JSON.stringify(t));const o=e.remotion_delayRenderHandles.includes(t),i=e.remotion_delayRenderTimeouts[t];if(o&&n.isRendering&&i){const{label:s,startTime:a,timeout:l}=i;clearTimeout(l);const c=[s?`"${s}"`:"A handle",nC,`${Date.now()-a}ms`].filter($i).join(" ");kt.verbose({logLevel:r,tag:"delayRender()"},c),delete e.remotion_delayRenderTimeouts[t]}e.remotion_delayRenderHandles=e.remotion_delayRenderHandles.filter(s=>s!==t),e.remotion_delayRenderHandles.length===0&&(e.remotion_renderReady=!0)},iC=e=>{typeof window>"u"||zw({scope:window,handle:e,environment:Rn(),logLevel:window.remotion_logLevel??"info"})},_o=d.createContext({logLevel:"info",mountTime:0}),sr=()=>{const{logLevel:e}=d.useContext(_o);if(e===null)throw new Error("useLogLevel must be used within a LogLevelProvider");return e},oa=()=>{const{mountTime:e}=d.useContext(_o);if(e===null)throw new Error("useMountTime must be used within a LogLevelProvider");return e},Dw=d.createContext(null),Un=()=>{const e=ct(),t=d.useContext(Dw)??(typeof window<"u"?window:void 0),n=sr(),r=d.useCallback((s,a)=>t?Lw({scope:t,environment:e,label:s??null,options:a??{}}):Math.random(),[e,t]),o=d.useCallback(s=>{t&&zw({scope:t,handle:s,environment:e,logLevel:n})},[e,n,t]),i=d.useCallback(s=>jp(t??(typeof window<"u"?window:void 0),s),[t]);return{delayRender:r,continueRender:o,cancelRender:i}},Ow=({compProps:e,componentName:t,noSuspense:n})=>{const r=d.useRef(null);return"component"in e&&(r.current=e.component),d.useMemo(()=>{if("component"in e){if(typeof document>"u"||n)return e.component;if(typeof e.component>"u")throw new Error(`A value of \`undefined\` was passed to the \`component\` prop. Check the value you are passing to the <${t}/> component.`);return s=>{const a=r.current;return le.createElement(a,s)}}if("lazyComponent"in e&&typeof e.lazyComponent<"u"){if(typeof e.lazyComponent>"u")throw new Error(`A value of \`undefined\` was passed to the \`lazyComponent\` prop. Check the value you are passing to the <${t}/> component.`);return le.lazy(e.lazyComponent)}throw new Error("You must pass either 'component' or 'lazyComponent'")},[e.lazyComponent])},Iu=()=>{const{canvasContent:e,compositions:t,currentCompositionMetadata:n}=d.useContext(Mi),r=t.find(i=>(e==null?void 0:e.type)==="composition"&&i.id===e.compositionId),o=Rp((r==null?void 0:r.id)??null);return d.useMemo(()=>!o||o.type==="error"||o.type==="loading"||!r?null:{...o.result,defaultProps:r.defaultProps??{},id:r.id,...n??{},component:r.component},[n,o,r])},Bw=()=>/^([a-zA-Z0-9-\u4E00-\u9FFF])+$/g,Ww=e=>e.match(Bw()),sC=e=>{if(!Ww(e))throw new Error(`Composition id can only contain a-z, A-Z, 0-9, CJK characters and -. You passed ${e}`)},aC=`Composition ID must match ${String(Bw())}`,lC=(e,t,n)=>{if(e){if(typeof e!="object")throw new Error(`"${t}" must be an object, but you passed a value of type ${typeof e}`);if(Array.isArray(e))throw new Error(`"${t}" must be an object, an array was passed ${n?`for composition "${n}"`:""}`)}},uC=()=>{const{continueRender:e,delayRender:t}=Un();return d.useEffect(()=>{const n=t("Waiting for Root component to unsuspend");return()=>e(n)},[e,t]),null},cC=({width:e,height:t,fps:n,durationInFrames:r,id:o,defaultProps:i,schema:s,...a})=>{const l=d.useContext(ta),{registerComposition:c,unregisterComposition:f}=l,p=Iu(),m=Ow({compProps:a,componentName:"Composition",noSuspense:!1}),g=bu(),w=Ip(),x=ct(),k=d.useContext(Fo);if(typeof window<"u"&&(window.remotion_seenCompositionIds=Array.from(new Set([...window.remotion_seenCompositionIds??[],o]))),k)throw w?new Error("<Composition> was mounted inside the `component` that was passed to the <Player>. See https://remotion.dev/docs/wrong-composition-mount for help."):new Error("<Composition> mounted inside another composition. See https://remotion.dev/docs/wrong-composition-mount for help.");const{folderName:h,parentName:y}=d.useContext(uf),v=a.stack??null,S="component"in a?a.component:null;d.useEffect(()=>{if(!o)throw new Error("No id for composition passed.");return sC(o),lC(i,"defaultProps",o),c({durationInFrames:r??void 0,fps:n??void 0,height:t??void 0,width:e??void 0,id:o,folderName:h,component:m,defaultProps:df(i??{}),nonce:g.get(),parentFolderName:y,componentFromProps:S,schema:s??null,calculateMetadata:a.calculateMetadata??null,stack:v}),()=>{f(o)}},[r,n,t,m,o,h,i,e,g,y,S,s,a.calculateMetadata,v,c,f]);const b=Rp(o),{setError:E,clearError:I}=d.useContext(Rw),T=d.useCallback(_=>{E(_)},[E]),j=d.useCallback(()=>{I()},[I]);if(x.isStudio&&p&&p.component===m&&p.id===o){const _=m;return b===null||b.type!=="success"&&b.type!=="success-and-refreshing"?null:af.createPortal(u.jsx(lf,{children:u.jsx(RE,{onError:T,onClear:j,children:u.jsx(d.Suspense,{fallback:u.jsx(DE,{}),children:u.jsx(_,{...b.result.props??{}})})})}),ff())}if(x.isRendering&&p&&p.component===m&&p.id===o){const _=m;return b===null||b.type!=="success"&&b.type!=="success-and-refreshing"?null:af.createPortal(u.jsx(lf,{children:u.jsx(d.Suspense,{fallback:u.jsx(uC,{}),children:u.jsx(_,{...b.result.props??{}})})}),ff())}return null},Zl=e=>{const{onlyRenderComposition:t}=d.useContext(ta);return t&&t!==e.id?null:u.jsx(cC,{...e})},Vw=[],Hw=null,dC=()=>Vw,Zt=e=>{Vw.push(e)},fC=e=>{Hw=e},pC=()=>Hw,hC=e=>{const t=le.Children.toArray(e);if(t.length!==1)return null;const n=t[0];return!le.isValidElement(n)||typeof n.type!="function"&&typeof n.type!="object"?null:n.type},fs="4.0.499",mC=()=>{if(typeof globalThis>"u")return;const e=()=>{globalThis.remotion_imported=fs,typeof window<"u"&&(window.remotion_imported=fs)},t=globalThis.remotion_imported||typeof window<"u"&&window.remotion_imported;if(t){if(t===fs)return;if(typeof t=="string"&&t.includes("webcodecs")){e();return}throw new TypeError(`🚨 Multiple versions of Remotion detected: ${[fs,typeof t=="string"?t:"an older version"].filter($i).join(" and ")}. This will cause things to break in an unexpected way.
56
+ Check that all your Remotion packages are on the same version. If your dependencies depend on Remotion, make them peer dependencies. You can also run \`npx remotion versions\` from your terminal to see which versions are mismatching.`)}e()},xt=d.createContext(null),hf={};Tw(hf,{useTimelineSetFrame:()=>qw,useTimelinePosition:()=>io,useTimelineContext:()=>oo,usePlayingState:()=>Jw,usePlaybackRate:()=>Mp,useAbsoluteTimelinePosition:()=>Xw,persistCurrentFrame:()=>Uw,getInitialFrameState:()=>Zw,getFrameForComposition:()=>Kw,clampFrameToCompositionRange:()=>Yw});function Dm(e){let t=e+1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function gC(e){let t=0,n=0,r=0;for(t=0;t<e.length;t++)n=e.charCodeAt(t),r=(r<<5)-r+n,r|=0;return r}var Mo=(e,t)=>{if(e===null)return Math.random();if(typeof e=="string")return Dm(gC(e));if(typeof e=="number")return Dm(e*1e10);throw new Error("random() argument must be a number or a string")},Ai=d.createContext({setFrame:()=>{throw new Error("default")},setPlaying:()=>{throw new Error("default")}}),Ni=d.createContext(null),Pp=d.createContext(null),Fp=d.createContext(null),yC=({children:e,frameState:t})=>{const[n,r]=d.useState(!1),o=d.useRef(!1),[i,s]=d.useState(1),a=d.useRef([]),[l]=d.useState(()=>String(Mo(null))),[c,f]=d.useState(()=>Zw()),p=t??c,{delayRender:m,continueRender:g}=Un();typeof window<"u"&&d.useLayoutEffect(()=>{window.remotion_setFrame=(h,y,v)=>{window.remotion_attempt=v;const S=m(`Setting the current frame to ${h}`);let b=!0;f(E=>(E[y]??window.remotion_initialFrame)===h?(b=!1,E):{...E,[y]:h}),b?requestAnimationFrame(()=>g(S)):g(S)},window.remotion_isPlayer=!1},[g,m]);const w=d.useMemo(()=>({frame:p,playing:n,imperativePlaying:o,rootId:l,audioAndVideoTags:a}),[p,n,l]),x=d.useMemo(()=>({playbackRate:i,setPlaybackRate:s}),[i]),k=d.useMemo(()=>({setFrame:f,setPlaying:r}),[]);return u.jsx(Fp.Provider,{value:w,children:u.jsx(Pp.Provider,{value:x,children:u.jsx(Ni.Provider,{value:w,children:u.jsx(Ai.Provider,{value:k,children:e})})})})},_p=()=>"remotion.time-all",Uw=e=>{localStorage.setItem(_p(),JSON.stringify(e))},Zw=()=>{const e=localStorage.getItem(_p())??"{}";return JSON.parse(e)},Kw=e=>{const t=localStorage.getItem(_p())??"{}",n=JSON.parse(t);return n[e]!==void 0?Number(n[e]):typeof window>"u"?0:window.remotion_initialFrame??0},Yw=(e,t)=>Math.max(0,Math.min(Math.max(0,t-1),e)),Gw=e=>{const t=Iu(),n=ct();if(!t)return typeof window>"u"?0:window.remotion_initialFrame??0;const r=e.frame[t.id]??(n.isPlayer?0:Kw(t.id));return Yw(r,t.durationInFrames)},oo=()=>{const e=d.useContext(Ni);if(e===null)throw new Error("TimelineContext is not available. This hook must be used inside a <Player> or the Remotion Studio.");return e},Mp=()=>{const e=d.useContext(Pp);if(e===null)throw new Error("PlaybackRateContext is not available. This hook must be used inside a <Player> or the Remotion Studio.");return e},io=()=>{const e=oo();return Gw(e)},Xw=()=>{const e=d.useContext(Fp);if(e===null)throw new Error("AbsoluteTimeContext is not available. This hook must be used inside a <Player> or the Remotion Studio.");return Gw(e)},qw=()=>{const{setFrame:e}=d.useContext(Ai);return e},Jw=()=>{const{playing:e,imperativePlaying:t}=oo(),{setPlaying:n}=d.useContext(Ai);return d.useMemo(()=>[e,n,t],[t,e,n])},Ft=()=>{const e=d.useContext(Fo),t=ct();if(!e)throw t.isPlayer?new Error("useCurrentFrame can only be called inside a component that was passed to <Player>. See: https://www.remotion.dev/docs/player/examples"):new 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");const n=io(),r=d.useContext(xt),o=r?r.cumulatedFrom+r.relativeFrom:0;return n-o},Tu=()=>{const e=d.useContext(xt),t=(e==null?void 0:e.width)??null,n=(e==null?void 0:e.height)??null,r=(e==null?void 0:e.durationInFrames)??null,o=Iu();return d.useMemo(()=>{if(!o)return null;const{id:i,durationInFrames:s,fps:a,height:l,width:c,defaultProps:f,props:p,defaultCodec:m,defaultOutName:g,defaultVideoImageFormat:w,defaultPixelFormat:x,defaultProResProfile:k,defaultSampleRate:h}=o;return{id:i,width:t??c,height:n??l,fps:a,durationInFrames:r??s,defaultProps:f,props:p,defaultCodec:m,defaultOutName:g,defaultVideoImageFormat:w,defaultPixelFormat:x,defaultProResProfile:k,defaultSampleRate:h}},[r,n,t,o])},ht=()=>{const e=Tu(),t=d.useContext(Fo),n=Ip();if(!e)throw typeof window<"u"&&window.remotion_isPlayer||n?new Error(["No video config found. Likely reasons:","- You are probably calling useVideoConfig() from outside the component passed to <Player />. 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."].join("-")):new Error("No video config found. You are probably calling useVideoConfig() from a component which has not been registered as a <Composition />. See https://www.remotion.dev/docs/the-fundamentals#defining-compositions for more information.");if(!t)throw new Error("Called useVideoConfig() outside a Remotion composition.");return e},ia=({frame:e,children:t,active:n=!0})=>{const r=Ft(),o=ht();if(typeof e>"u")throw new Error("The <Freeze /> component requires a 'frame' prop, but none was passed.");if(typeof e!="number")throw new Error(`The 'frame' prop of <Freeze /> must be a number, but is of type ${typeof e}`);if(Number.isNaN(e))throw new Error("The 'frame' prop of <Freeze /> must be a real number, but it is NaN.");if(!Number.isFinite(e))throw new Error(`The 'frame' prop of <Freeze /> must be a finite number, but it is ${e}.`);const i=d.useMemo(()=>{if(typeof n=="boolean")return n;if(typeof n=="function")return n(r)},[n,r]),s=oo(),a=d.useContext(xt),l=(a==null?void 0:a.relativeFrom)??0,c=d.useMemo(()=>i?{...s,playing:!1,imperativePlaying:{current:!1},frame:{[o.id]:e+l}}:s,[i,s,o.id,e,l]),f=d.useMemo(()=>a?i?{...a,cumulatedFrom:0}:a:null,[a,i]);return u.jsx(Ni.Provider,{value:c,children:u.jsx(xt.Provider,{value:f,children:t})})},ar={"style.transformOrigin":{type:"transform-origin",step:1,default:"50% 50%",description:"Transform origin"},"style.translate":{type:"translate",step:1,default:"0px 0px",description:"Offset"},"style.scale":{type:"scale",max:100,step:.01,default:1,description:"Scale",defaultKeyframeOutput:"perceptual-scale"},"style.rotate":{type:"rotation-css",step:1,default:"0deg",description:"Rotation"},"style.opacity":{type:"number",min:0,max:1,step:.01,default:1,description:"Opacity",hiddenFromList:!1}},vC=ar,Ru={"style.color":{type:"color",default:void 0,description:"Color"},"style.fontFamily":{type:"font-family",default:void 0,description:"Font family",keyframable:!1},"style.fontSize":{type:"number",default:void 0,min:0,step:1,description:"Font size",hiddenFromList:!1},"style.lineHeight":{type:"number",default:void 0,min:0,step:.05,description:"Line height",hiddenFromList:!1},"style.fontWeight":{type:"enum",default:"400",description:"Font weight",variants:{100:{},200:{},300:{},400:{},500:{},600:{},700:{},800:{},900:{},normal:{},bold:{}}},"style.fontStyle":{type:"enum",default:"normal",description:"Font style",variants:{normal:{},italic:{},oblique:{}}},"style.textAlign":{type:"enum",default:"left",description:"Text align",variants:{left:{},center:{},right:{},justify:{},start:{},end:{}}},"style.letterSpacing":{type:"number",default:void 0,step:.1,description:"Letter spacing",hiddenFromList:!1}},so={"style.borderWidth":{type:"number",default:void 0,min:0,step:1,description:"Border width",hiddenFromList:!1},"style.borderStyle":{type:"enum",default:"none",description:"Border style",variants:{none:{},hidden:{},solid:{},dashed:{},dotted:{},double:{},groove:{},ridge:{},inset:{},outset:{}}},"style.borderColor":{type:"color",default:void 0,description:"Border color"}},ao={"style.backgroundColor":{type:"color",default:"transparent",description:"Color"}},Qw={children:{type:"text-content",default:"",description:"Text",keyframable:!1}},Li={premountFor:{type:"number",default:0,description:"Premount For",min:0,step:1,hiddenFromList:!1,keyframable:!1},postmountFor:{type:"number",default:0,min:0,step:1,hiddenFromList:!0,keyframable:!1}},ex={...Li},tx={...ar,...ao,...so,...ex},$p={type:"boolean",default:!1,description:"Hidden"},nx={type:"hidden"},Ap={type:"hidden"},wC=e=>({name:Ap,...e}),Np={type:"number",default:void 0,min:1,step:1,hiddenFromList:!0},rx={type:"number",default:0,step:1,hiddenFromList:!0},ox={type:"number",default:0,min:0,step:1,hiddenFromList:!0},Lp={type:"number",default:null,step:1,hiddenFromList:!0},Cr={durationInFrames:Np,from:rx,trimBefore:ox,freeze:Lp,hidden:$p,name:Ap,showInTimeline:nx},Ri={...Cr,layout:{type:"enum",default:"absolute-fill",description:"Layout",variants:{"absolute-fill":tx,none:{}}}},xC={durationInFrames:Np,trimBefore:ox,freeze:Lp,hidden:$p,name:Ap,showInTimeline:nx},bC={...xC,layout:Ri.layout},SC={...Ri,layout:{...Ri.layout,default:"none"}},zi=le.createContext({registerSequence:()=>{throw new Error("SequenceManagerContext not initialized")},unregisterSequence:()=>{throw new Error("SequenceManagerContext not initialized")},sequences:[]}),ju=le.createContext({current:[]}),mr=e=>`${e.absolutePath}\0${e.nodePath.join(".")}\0${e.sequenceKeys.join(".")}\0${e.effectKeys.map(t=>t.join(".")).join(".")}`,Pu=le.createContext({propStatuses:{}}),Fu=le.createContext({current:{}}),_u=le.createContext({getDragOverrides:()=>{throw new Error("VisualModeDragOverridesContext not initialized")},getEffectDragOverrides:()=>{throw new Error("VisualModeDragOverridesContext not initialized")}}),ix=le.createContext({setDragOverrides:()=>{throw new Error("VisualModeSettersContext not initialized")},clearDragOverrides:()=>{throw new Error("VisualModeSettersContext not initialized")},setEffectDragOverrides:()=>{throw new Error("VisualModeSettersContext not initialized")},clearEffectDragOverrides:()=>{throw new Error("VisualModeSettersContext not initialized")},setPropStatuses:()=>{throw new Error("VisualModeSettersContext not initialized")}}),$c=(e,t)=>`${mr(e)}.effects.${t}`,kC=({children:e})=>{const[t,n]=d.useState([]),r=d.useRef(t);r.current=t;const[o,i]=d.useState({}),s=d.useRef(o);s.current=o;const[a,l]=d.useState({}),[c,f]=d.useState({}),p=d.useRef(c);p.current=c;const m=d.useCallback((j,_,N)=>{i(W=>({...W,[mr(j)]:{...W[mr(j)],[_]:N}}))},[]),g=d.useCallback(j=>{i(_=>{const N=mr(j);if(!_[N])return _;const W={..._};return delete W[N],W})},[]),w=d.useCallback((j,_,N,W)=>{l(M=>{const $=$c(j,_);return{...M,[$]:{...M[$],[N]:W}}})},[]),x=d.useCallback((j,_)=>{l(N=>{const W=$c(j,_);if(!N[W])return N;const M={...N};return delete M[W],M})},[]),k=d.useCallback((j,_)=>{f(N=>{const W=mr(j),M=N[W],$=_(M);return M===$?N:{...N,[W]:$}})},[]),h=d.useCallback(j=>{n(_=>[..._,j])},[]),y=d.useCallback(j=>{n(_=>_.filter(N=>N.id!==j))},[]),v=d.useMemo(()=>({registerSequence:h,sequences:t,unregisterSequence:y}),[h,t,y]),S=d.useCallback(j=>o[mr(j)]??{},[o]),b=d.useCallback((j,_)=>a[$c(j,_)]??{},[a]),E=d.useMemo(()=>({propStatuses:c}),[c]),I=d.useMemo(()=>({getDragOverrides:S,getEffectDragOverrides:b}),[S,b]),T=d.useMemo(()=>({setDragOverrides:m,clearDragOverrides:g,setEffectDragOverrides:w,clearEffectDragOverrides:x,setPropStatuses:k}),[m,g,w,x,k]);return u.jsx(ju.Provider,{value:r,children:u.jsx(zi.Provider,{value:v,children:u.jsx(Fu.Provider,{value:p,children:u.jsx(Pu.Provider,{value:E,children:u.jsx(_u.Provider,{value:I,children:u.jsx(ix.Provider,{value:T,children:e})})})})})})},Mu=d.createContext(!1),EC=({children:e})=>u.jsx(Mu.Provider,{value:!0,children:e}),sx=({children:e})=>u.jsx(Mu.Provider,{value:!1,children:e}),CC=()=>{if(!le.useContext(Mu))throw new Error("This component must be inside a <Series /> component.")},ax=d.createContext({premountFramesRemaining:0}),IC=!1,sa=e=>e??IC,aa=({from:e,durationInFrames:t,premountFor:n,postmountFor:r,style:o,styleWhilePremounted:i,styleWhilePostmounted:s,hideWhilePremounted:a})=>{const l=d.useContext(ax),c=Ft()-l.premountFramesRemaining,f=ct(),{fps:p}=ht(),m=n??0,g=r??0,w=Math.ceil(e+t-1),x=!f.isRendering&&c<e&&c>=e-m,k=!f.isRendering&&c>w&&c<=w+g,h=x||k,y=x?e:k?e+t-1:0,v=d.useMemo(()=>h?{...o,...a==="opacity"?{opacity:0}:{display:"none"},pointerEvents:"none",...x?i:{},...k?s:{}}:o,[h,a,k,x,o,s,i]);return{effectivePremountFor:m,effectivePostmountFor:g,premountingActive:x,postmountingActive:k,isPremountingOrPostmounting:h,freezeFrame:y,premountingStyle:v}},TC=(e,t)=>{for(const n of t){const r=n.split("."),o=[e];let i=e;for(let s=0;s<r.length-1;s++){const a=r[s],l=i[a];if(l==null){i=null;break}i=l,o.push(i)}if(i!==null){delete i[r[r.length-1]];for(let s=o.length-1;s>0;s--){const a=o[s];if(Object.keys(a).length===0){const l=r[s-1];delete o[s-1][l]}else break}}}return e},RC=4,jC=.001,PC=1e-7,FC=10,ps=11,Ma=1/(ps-1),_C=typeof Float32Array=="function";function lx(e,t){return 1-3*t+3*e}function ux(e,t){return 3*t-6*e}function cx(e){return 3*e}function Kl(e,t,n){return((lx(t,n)*e+ux(t,n))*e+cx(t))*e}function dx(e,t,n){return 3*lx(t,n)*e*e+2*ux(t,n)*e+cx(t)}function MC({aX:e,_aA:t,_aB:n,mX1:r,mX2:o}){let i,s,a=0,l=t,c=n;do s=l+(c-l)/2,i=Kl(s,r,o)-e,i>0?c=s:l=s;while(Math.abs(i)>PC&&++a<FC);return s}function $C(e,t,n,r){let o=t;for(let i=0;i<RC;++i){const s=dx(o,n,r);if(s===0)return o;const a=Kl(o,n,r)-e;o-=a/s}return o}function fx(e,t,n,r){if(!(e>=0&&e<=1&&n>=0&&n<=1))throw new Error("bezier x values must be in [0, 1] range");const o=_C?new Float32Array(ps):new Array(ps);if(e!==t||n!==r)for(let s=0;s<ps;++s)o[s]=Kl(s*Ma,e,n);function i(s){let a=0,l=1;const c=ps-1;for(;l!==c&&o[l]<=s;++l)a+=Ma;--l;const f=(s-o[l])/(o[l+1]-o[l]),p=a+f*Ma,m=dx(p,e,n);return m>=jC?$C(s,p,e,n):m===0?p:MC({aX:s,_aA:a,_aB:a+Ma,mX1:e,mX2:n})}return function(s){const a=Math.min(1,Math.max(0,s));return e===t&&n===r?a:a===0?0:a===1?1:Kl(i(a),t,r)}}var AC=e=>Math.round(e*1e6)/1e6,NC=new Set(["deg","rad","grad","turn"]),px=new Set(["%","cap","ch","cm","cqb","cqh","cqi","cqmax","cqmin","cqw","dvh","dvw","em","ex","ic","in","lh","lvh","lvw","mm","pc","pt","px","q","rem","rlh","svh","svw","vb","vh","vi","vmax","vmin","vw"]),hx=/^([+-]?(?:\d+\.?\d*|\.\d+))([a-zA-Z%]+)?$/,mx=new Set(["left","center","right","top","bottom"]),li=e=>e==="left"?[{axis:"x",value:{value:0,unit:"%"}}]:e==="right"?[{axis:"x",value:{value:100,unit:"%"}}]:e==="top"?[{axis:"y",value:{value:0,unit:"%"}}]:e==="bottom"?[{axis:"y",value:{value:100,unit:"%"}}]:[{axis:"x",value:{value:50,unit:"%"}},{axis:"y",value:{value:50,unit:"%"}}],Qi={value:50,unit:"%"},Om=e=>String(AC(e)),LC=(e,t)=>{const n=hx.exec(e);if(n===null)throw new TypeError(`Cannot interpolate "${t}" because "${e}" is not a supported scale, translate, or rotate value`);const r=n[2]??null,o=Number(n[1]);if(!Number.isFinite(o))throw new TypeError(`Cannot interpolate "${t}" because "${e}" is not finite`);if(r===null)return{kind:"scale",value:o,unit:null};if(NC.has(r))return{kind:"rotate",value:o,unit:r};if(px.has(r))return{kind:"translate",value:o,unit:r};throw new TypeError(`Cannot interpolate "${t}" because "${r}" is not a supported translate or rotate unit`)},gx=({component:e,value:t,allowPercentage:n})=>{const r=hx.exec(e);if(r===null)throw new TypeError(`Cannot interpolate "${t}" because "${e}" is not a supported transform-origin ${n?"length-percentage":"z length"}`);const o=r[2]??null,i=Number(r[1]);if(!Number.isFinite(i))throw new TypeError(`Cannot interpolate "${t}" because "${e}" is not finite`);if(o===null||!px.has(o)||!n&&o==="%")throw new TypeError(`Cannot interpolate "${t}" because "${e}" is not a supported transform-origin ${n?"length-percentage":"z length"}`);return{value:i,unit:o}},Ac=(e,t)=>{const n=e.toLowerCase();return mx.has(n)?{type:"keyword",keyword:n}:{type:"length-percentage",parsed:gx({component:e,value:t,allowPercentage:!0})}},zC=(e,t,n)=>{const r=[];for(const o of li(e))for(const i of li(t))o.axis!==i.axis&&r.push(o.axis==="x"?[o.value,i.value]:[i.value,o.value]);if(r.length===0)throw new TypeError(`Cannot interpolate "${n}" because "${e} ${t}" is not a valid transform-origin keyword pair`);return r[0]},DC=(e,t)=>{if(e.length===1){const a=Ac(e[0],t);return a.type==="length-percentage"?[a.parsed,Qi]:a.keyword==="top"||a.keyword==="bottom"?[Qi,li(a.keyword)[0].value]:[li(a.keyword)[0].value,Qi]}const n=Ac(e[0],t),r=Ac(e[1],t);if(n.type==="length-percentage"&&r.type==="length-percentage")return[n.parsed,r.parsed];if(n.type==="keyword"&&r.type==="keyword")return zC(n.keyword,r.keyword,t);const o=n.type==="keyword"?n:r.type==="keyword"?r:null,i=n.type==="length-percentage"?n.parsed:r.type==="length-percentage"?r.parsed:null;if(o===null||i===null)throw new Error("Expected a keyword and a length-percentage value");const s=n.type==="keyword";if(o.keyword==="left"||o.keyword==="right"){if(!s)throw new TypeError(`Cannot interpolate "${t}" because horizontal transform-origin keywords must come before a length-percentage value`);return[li(o.keyword)[0].value,i]}return o.keyword==="top"||o.keyword==="bottom"?[i,li(o.keyword)[0].value]:s?[Qi,i]:[i,Qi]},OC=(e,t)=>{const[n,r]=DC(t.slice(0,2),e),o=t[2]===void 0?{value:0,unit:null}:gx({component:t[2],value:e,allowPercentage:!1});return{kind:"translate",values:[n.value,r.value,o.value],units:[n.unit,r.unit,o.unit],dimensions:t[2]===void 0?2:3}},BC=e=>{var o,i,s,a,l,c;if(typeof e=="number"){if(!Number.isFinite(e))throw new Error(`outputRange must contain only finite numbers, but got [${e}]`);return{kind:"scale",values:[e,e,1],units:[null,null,null],dimensions:1}}const t=e.trim().split(/\s+/);if(t.length<1||t.length>3||t[0]==="")throw new TypeError(`String outputRange values must contain 1 to 3 components, but got "${e}"`);if(t.some(f=>mx.has(f.toLowerCase())))return OC(e,t);const n=t.map(f=>LC(f,e)),[{kind:r}]=n;for(const f of n)if(f.kind!==r)throw new TypeError(`Cannot interpolate "${e}" because it mixes ${r} and ${f.kind} values`);if(r==="scale"){const f=n[0].value,p=((o=n[1])==null?void 0:o.value)??f,m=((i=n[2])==null?void 0:i.value)??1;return{kind:r,values:[f,p,m],units:[null,null,null],dimensions:n.length}}return{kind:r,values:[n[0].value,((s=n[1])==null?void 0:s.value)??0,((a=n[2])==null?void 0:a.value)??0],units:[n[0].unit,((l=n[1])==null?void 0:l.unit)??null,((c=n[2])==null?void 0:c.unit)??null],dimensions:n.length}},WC=({kind:e,values:t,units:n,dimensions:r})=>e==="scale"?t.slice(0,r).map(o=>Om(o)).join(" "):t.slice(0,r).map((o,i)=>`${Om(o)}${n[i]}`).join(" "),Bm=e=>e===0?0:Math.sign(e)*e*e,VC=e=>e===0?0:Math.sign(e)*Math.sqrt(Math.abs(e));function HC(e,t,n,r){const{extrapolateLeft:o,extrapolateRight:i,easing:s,output:a}=r;let l=e;const[c,f]=t,[p,m]=n;if(l<c){if(o==="identity")return l;if(o==="clamp")l=c;else if(o==="wrap"){const g=f-c;l=((l-c)%g+g)%g+c}}if(l>f){if(i==="identity")return l;if(i==="clamp")l=f;else if(i==="wrap"){const g=f-c;l=((l-c)%g+g)%g+c}}if(p===m)return p;if(l=(l-c)/(f-c),l=s(l),a==="perceptual-scale"){const g=Bm(p),w=Bm(m);l=VC(l*(w-g)+g)}else l=l*(m-p)+p;return l}function UC(e,t){let n;for(n=1;n<t.length-1&&!(t[n]>=e);++n);return n-1}var ZC=e=>e,KC=e=>e??"linear",yx=e=>e.remotionShouldExtendRight===!0,Wm=({easing:e,segmentIndex:t})=>e===void 0?ZC:typeof e=="function"?e:e[t],Vm=({input:e,inputRange:t,outputRange:n,easing:r,extrapolateLeft:o,extrapolateRight:i,output:s})=>HC(e,t,n,{easing:r,extrapolateLeft:o,extrapolateRight:e>t[1]&&i==="clamp"&&yx(r)?"extend":i,output:s}),zp=({input:e,inputRange:t,outputRange:n,options:r})=>{const o=KC(r==null?void 0:r.output);if(t.length===1)return n[0];const i=r==null?void 0:r.easing;let s="extend";(r==null?void 0:r.extrapolateLeft)!==void 0&&(s=r.extrapolateLeft);let a="extend";(r==null?void 0:r.extrapolateRight)!==void 0&&(a=r.extrapolateRight);const l=(r==null?void 0:r.posterize)===void 0?e:Math.floor(e/r.posterize)*r.posterize,c=UC(l,t),f=Wm({easing:i,segmentIndex:c});let p=Vm({input:l,inputRange:[t[c],t[c+1]],outputRange:[n[c],n[c+1]],easing:f,extrapolateLeft:s,extrapolateRight:a,output:o});for(let m=0;m<c;m++){const g=Wm({easing:i,segmentIndex:m});if(!yx(g))continue;const w=t[m+1];if(l<=w)continue;const x=Vm({input:l,inputRange:[t[m],w],outputRange:[n[m],n[m+1]],easing:g,extrapolateLeft:s,extrapolateRight:"extend",output:o});p+=x-n[m+1]}return p},YC=({input:e,inputRange:t,outputRange:n,options:r})=>{var c;const o=n.map(BC),i=(c=o[0])==null?void 0:c.kind;if(i===void 0)throw new Error("outputRange must have at least 1 element");for(const f of o)if(f.kind!==i)throw new TypeError(`Cannot interpolate ${i} values with ${f.kind} values`);const s=Math.max(...o.map(f=>f.dimensions)),a=[null,null,null];if(i!=="scale")for(let f=0;f<s;f++){for(const p of o){const m=p.units[f];if(m!==null){if(a[f]===null){a[f]=m;continue}if(a[f]!==m)throw new TypeError(`Cannot interpolate ${i} values with different units on axis ${f+1}: ${a[f]} and ${m}`)}}if(a[f]===null)throw new TypeError(`Cannot interpolate ${i} values because axis ${f+1} has no unit`)}const l=[0,0,0];for(let f=0;f<s;f++)l[f]=zp({input:e,inputRange:t,outputRange:o.map(p=>p.values[f]),options:r});return WC({kind:i,values:l,units:a,dimensions:s})},GC=e=>{var n;const t=(n=e[0])==null?void 0:n.length;if(t===void 0)throw new Error("outputRange must have at least 1 element");if(t===0)throw new TypeError("outputRange tuples must contain at least 1 number");for(const r of e){if(r.length!==t)throw new TypeError(`outputRange tuples must all have the same length, but got ${t} and ${r.length}`);for(const o of r)if(typeof o!="number"||!Number.isFinite(o))throw new TypeError(`outputRange tuples must contain only finite numbers, but got [${r.join(",")}]`)}return t},XC=({input:e,inputRange:t,outputRange:n,options:r})=>{const o=GC(n);return new Array(o).fill(!0).map((i,s)=>zp({input:e,inputRange:t,outputRange:n.map(a=>a[s]),options:r}))};function qC(e){for(let t=1;t<e.length;++t)if(!(e[t]>e[t-1]))throw new Error(`inputRange must be strictly monotonically increasing but got [${e.join(",")}]`)}function Hm(e,t){if(t.length<1)throw new Error(e+" must have at least 1 element");for(const n of t){if(typeof n!="number")throw new Error(`${e} must contain only numbers`);if(!Number.isFinite(n))throw new Error(`${e} must contain only finite numbers, but got [${t.join(",")}]`)}}function JC(e,t){if(e===void 0||typeof e=="function")return;const n=t-1;if(e.length!==n)throw new Error(`When easing is an array, it must have one entry per segment between keyframes (length inputRange.length - 1 = ${n}), but got length ${e.length}`);for(let r=0;r<e.length;r++)if(typeof e[r]!="function")throw new Error(`easing[${r}] must be a function`)}function QC(e){if(e!==void 0&&(typeof e!="number"||!Number.isFinite(e)||e<=0))throw new Error(`posterize must be a positive finite number, but got ${e}`)}function e2(e){if(!(e===void 0||e==="linear"||e==="perceptual-scale"))throw new Error(`output must be "linear" or "perceptual-scale", but got ${String(e)}`)}function Di(e,t,n,r){if(typeof e>"u")throw new Error("input can not be undefined");if(typeof t>"u")throw new Error("inputRange can not be undefined");if(typeof n>"u")throw new Error("outputRange can not be undefined");if(t.length!==n.length)throw new Error("inputRange ("+t.length+") and outputRange ("+n.length+") must have the same length");if(Hm("inputRange",t),qC(t),JC(r==null?void 0:r.easing,t.length),QC(r==null?void 0:r.posterize),e2(r==null?void 0:r.output),typeof e!="number")throw new TypeError("Cannot interpolate an input which is not a number");if(!Array.isArray(n))throw new Error("outputRange must contain only numbers");if(n.some(i=>typeof i=="string")){if(!n.every(i=>typeof i=="string"||typeof i=="number"))throw new TypeError("outputRange must contain only numbers, or supported scale, translate, and rotate strings");return YC({input:e,inputRange:t,outputRange:n,options:r})}if(n.every(i=>Array.isArray(i)))return XC({input:e,inputRange:t,outputRange:n,options:r});if(!n.every(i=>typeof i=="number"))throw new TypeError("outputRange must contain only numbers, numeric tuples, or supported scale, translate, and rotate strings");return Hm("outputRange",n),zp({input:e,inputRange:t,outputRange:n,options:r})}var t2=({allowFloats:e,durationInFrames:t,frame:n})=>{if(typeof n>"u")throw new TypeError('Argument missing for parameter "frame"');if(typeof n!="number")throw new TypeError(`Argument passed for "frame" is not a number: ${n}`);if(!Number.isFinite(n))throw new RangeError(`Frame ${n} is not finite`);if(n<0&&n<-t)throw new RangeError(`Cannot use frame ${n}: Duration of composition is ${t}, therefore the lowest frame that can be rendered is ${-t}`);if(n>t-1)throw new RangeError(`Cannot use frame ${n}: Duration of composition is ${t}, therefore the highest frame that can be rendered is ${t-1}`)},n2=e=>{if(!(typeof e>"u")){if(typeof e!="number")throw new TypeError(`A "duration" of a spring must be a "number" but is "${typeof e}"`);if(Number.isNaN(e))throw new TypeError('A "duration" of a spring is NaN, which it must not be');if(!Number.isFinite(e))throw new TypeError('A "duration" of a spring must be finite, but is '+e);if(e<=0)throw new TypeError('A "duration" of a spring must be positive, but is '+e)}},r2={damping:10,mass:1,stiffness:100,overshootClamping:!1},Nc={};function o2({animation:e,now:t,config:n}){const{toValue:r,lastTimestamp:o,current:i,velocity:s}=e,a=Math.min(t-o,64);if(n.damping<=0)throw new Error("Spring damping must be greater than 0, otherwise the spring() animation will never end, causing an infinite loop.");const l=n.damping,c=n.mass,f=n.stiffness,p=[r,o,i,s,l,c,f,t].join("-");if(Nc[p])return Nc[p];const m=-s,g=r-i,w=l/(2*Math.sqrt(f*c)),x=Math.sqrt(f/c),k=x*Math.sqrt(1-w**2),h=a/1e3,y=Math.sin(k*h),v=Math.cos(k*h),S=Math.exp(-w*x*h),b=S*(y*((m+w*x*g)/k)+g*v),E=r-b,I=w*x*b-S*(v*(m+w*x*g)-k*g*y),T=Math.exp(-x*h),j=r-T*(g+(m+x*g)*h),_=T*(m*(h*x-1)+h*g*x*x),N={toValue:r,prevPosition:i,lastTimestamp:t,current:w<1?E:j,velocity:w<1?I:_};return Nc[p]=N,N}var Lc={};function vx({frame:e,fps:t,config:n={}}){const i=[e,t,n.damping,n.mass,n.overshootClamping,n.stiffness].join("-");if(Lc[i])return Lc[i];let s={lastTimestamp:0,current:0,toValue:1,velocity:0,prevPosition:0};const a=Math.max(0,e),l=a%1;for(let c=0;c<=Math.floor(a);c++){c===Math.floor(a)&&(c+=l);const f=c/t*1e3;s=o2({animation:s,now:f,config:{...r2,...n}})}return Lc[i]=s,s}var zc=new Map;function wx({fps:e,config:t={},threshold:n=.005}){if(typeof n!="number")throw new TypeError(`threshold must be a number, got ${n} of type ${typeof n}`);if(n===0)return 1/0;if(n===1)return 0;if(isNaN(n))throw new TypeError("Threshold is NaN");if(!Number.isFinite(n))throw new TypeError("Threshold is not finite");if(n<0)throw new TypeError("Threshold is below 0");const r=[e,t.damping,t.mass,t.overshootClamping,t.stiffness,n].join("-");if(zc.has(r))return zc.get(r);ku(e,"to the measureSpring() function");let o=0,i=0;const s=()=>vx({fps:e,frame:o,config:t});let a=s();const l=()=>Math.abs(a.current-a.toValue);let c=l();for(;c>=n;)o++,a=s(),c=l();i=o;for(let f=0;f<20;f++)o++,a=s(),c=l(),c>=n&&(f=0,i=o+1);return zc.set(r,i),i}function mf({frame:e,fps:t,config:n={},from:r=0,to:o=1,durationInFrames:i,durationRestThreshold:s,delay:a=0,reverse:l=!1}){n2(i),t2({frame:e,durationInFrames:1/0,allowFloats:!0}),ku(t,"to spring()");const c=l||typeof i<"u",f=c?wx({fps:t,config:n,threshold:s}):void 0,p=c?{get:()=>f}:{get:()=>{throw new Error("did not calculate natural duration, this is an error with Remotion. Please report")}},g=(l?(i??p.get())-e:e)+(l?a:-a),w=i===void 0?g:g/(i/p.get());if(i&&g>i)return o;const x=vx({fps:t,frame:w,config:n}),k=n.overshootClamping?o>=r?Math.min(x.current,o):Math.max(x.current,o):x.current;return r===0&&o===1?k:Di(k,[0,1],[r,o])}var Um=e=>Math.min(1,Math.max(0,e)),es=30;class Yl{static step0(t){return t>0?1:0}static step1(t){return t>=1?1:0}static linear(t){return t}static ease(t){return Yl.bezier(.42,0,1,1)(t)}static quad(t){return t*t}static cubic(t){return t*t*t}static poly(t){return n=>n**t}static sin(t){return 1-Math.cos(t*Math.PI/2)}static circle(t){const n=Um(t);return 1-Math.sqrt(1-n*n)}static exp(t){return 2**(10*(t-1))}static elastic(t=1){const n=t*Math.PI;return r=>1-Math.cos(r*Math.PI/2)**3*Math.cos(r*n)}static back(t=1.70158){return n=>n*n*((t+1)*n-t)}static spring({allowTail:t=!1,durationRestThreshold:n,...r}={}){return Object.assign(i=>i<=0?0:!t&&i>=1?1:mf(t?{fps:es,frame:i*wx({fps:es,config:r,threshold:n}),config:r}:{fps:es,frame:i*es,config:r,durationInFrames:es,durationRestThreshold:n}),{remotionShouldExtendRight:t})}static bounce(t){const n=Um(t);if(n<1/2.75)return 7.5625*n*n;if(n<2/2.75){const o=n-.5454545454545454;return 7.5625*o*o+.75}if(n<2.5/2.75){const o=n-.8181818181818182;return 7.5625*o*o+.9375}const r=n-2.625/2.75;return 7.5625*r*r+.984375}static bezier(t,n,r,o){return fx(t,n,r,o)}static in(t){return t}static out(t){return n=>1-t(1-n)}static inOut(t){return n=>n<.5?t(n*2)/2:1-t((1-n)*2)/2}}var Ln="[-+]?\\d*\\.?\\d+",$a=Ln+"%";function Aa(...e){return"\\(\\s*("+e.join(")\\s*,\\s*(")+")\\s*\\)"}var Na="(?:none|[-+]?\\d*\\.?\\d+(?:%|deg|rad|grad|turn)?)";function ts(e){return new RegExp(e+"\\(\\s*("+Na+")\\s+("+Na+")\\s+("+Na+")(?:\\s*\\/\\s*("+Na+"))?\\s*\\)")}function i2(){const e={rgb:void 0,rgba:void 0,hsl:void 0,hsla:void 0,hex3:void 0,hex4:void 0,hex5:void 0,hex6:void 0,hex8:void 0,oklch:void 0,oklab:void 0,lab:void 0,lch:void 0,hwb:void 0};return e.rgb===void 0&&(e.rgb=new RegExp("rgb"+Aa(Ln,Ln,Ln)),e.rgba=new RegExp("rgba"+Aa(Ln,Ln,Ln,Ln)),e.hsl=new RegExp("hsl"+Aa(Ln,$a,$a)),e.hsla=new RegExp("hsla"+Aa(Ln,$a,$a,Ln)),e.hex3=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,e.hex4=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,e.hex6=/^#([0-9a-fA-F]{6})$/,e.hex8=/^#([0-9a-fA-F]{8})$/,e.oklch=ts("oklch"),e.oklab=ts("oklab"),e.lab=ts("lab"),e.lch=ts("lch"),e.hwb=ts("hwb")),e}function vi(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function Zm(e,t,n){const r=n<.5?n*(1+t):n+t-n*t,o=2*n-r,i=vi(o,r,e+1/3),s=vi(o,r,e),a=vi(o,r,e-1/3);return Math.round(i*255)<<24|Math.round(s*255)<<16|Math.round(a*255)<<8}function Oo(e){const t=Number.parseInt(e,10);return t<0?0:t>255?255:t}function Km(e){return(Number.parseFloat(e)%360+360)%360/360}function Ym(e){const t=Number.parseFloat(e);return t<0?0:t>1?255:Math.round(t*255)}function La(e){const t=Number.parseFloat(e);return t<0?0:t>100?1:t/100}function Sn(e,t){return e==="none"?0:e.endsWith("%")?Number.parseFloat(e)/100*t:Number.parseFloat(e)}function Dc(e){return e==="none"?0:e.endsWith("rad")?Number.parseFloat(e)*180/Math.PI:e.endsWith("grad")?Number.parseFloat(e)*.9:e.endsWith("turn")?Number.parseFloat(e)*360:Number.parseFloat(e)}function ns(e){return e===void 0||e==="none"?1:e.endsWith("%")?Math.max(0,Math.min(1,Number.parseFloat(e)/100)):Math.max(0,Math.min(1,Number.parseFloat(e)))}function wi(e){return e<=.0031308?12.92*e:1.055*e**(1/2.4)-.055}function za(e){return Math.max(0,Math.min(1,e))}function rs(e,t,n,r){const o=Math.round(za(e)*255),i=Math.round(za(t)*255),s=Math.round(za(n)*255),a=Math.round(za(r)*255);return(o<<24|i<<16|s<<8|a)>>>0}function Gm(e,t,n){const r=e+.3963377774*t+.2158037573*n,o=e-.1055613458*t-.0638541728*n,i=e-.0894841775*t-1.291485548*n,s=r*r*r,a=o*o*o,l=i*i*i,c=4.0767416621*s-3.3077115913*a+.2309699292*l,f=-1.2684380046*s+2.6097574011*a-.3413193965*l,p=-.0041960863*s-.7034186147*a+1.707614701*l;return[wi(c),wi(f),wi(p)]}function Xm(e,t,n){const r=.008856451679035631,o=24389/27,i=.95047,s=1,a=1.08883,l=(e+16)/116,c=t/500+l,f=l-n/200,p=c*c*c,m=f*f*f,g=p>r?p:(116*c-16)/o,w=e>o*r?((e+16)/116)**3:e/o,x=m>r?m:(116*f-16)/o,k=g*i,h=w*s,y=x*a,v=3.2404542*k-1.5371385*h-.4985314*y,S=-.969266*k+1.8760108*h+.041556*y,b=.0556434*k-.2040259*h+1.0572252*y;return[wi(v),wi(S),wi(b)]}function s2(e,t,n){if(t+n>=1){const c=t/(t+n);return[c,c,c]}const r=1,o=0,i=vi(o,r,e+1/3),s=vi(o,r,e),a=vi(o,r,e-1/3),l=1-t-n;return[i*l+t,s*l+t,a*l+t]}var qm={transparent:0,aliceblue:4042850303,antiquewhite:4209760255,aqua:16777215,aquamarine:2147472639,azure:4043309055,beige:4126530815,bisque:4293182719,black:255,blanchedalmond:4293643775,blue:65535,blueviolet:2318131967,brown:2771004159,burlywood:3736635391,burntsienna:3934150143,cadetblue:1604231423,chartreuse:2147418367,chocolate:3530104575,coral:4286533887,cornflowerblue:1687547391,cornsilk:4294499583,crimson:3692313855,cyan:16777215,darkblue:35839,darkcyan:9145343,darkgoldenrod:3095792639,darkgray:2846468607,darkgreen:6553855,darkgrey:2846468607,darkkhaki:3182914559,darkmagenta:2332068863,darkolivegreen:1433087999,darkorange:4287365375,darkorchid:2570243327,darkred:2332033279,darksalmon:3918953215,darkseagreen:2411499519,darkslateblue:1211993087,darkslategray:793726975,darkslategrey:793726975,darkturquoise:13554175,darkviolet:2483082239,deeppink:4279538687,deepskyblue:12582911,dimgray:1768516095,dimgrey:1768516095,dodgerblue:512819199,firebrick:2988581631,floralwhite:4294635775,forestgreen:579543807,fuchsia:4278255615,gainsboro:3705462015,ghostwhite:4177068031,gold:4292280575,goldenrod:3668254975,gray:2155905279,green:8388863,greenyellow:2919182335,grey:2155905279,honeydew:4043305215,hotpink:4285117695,indianred:3445382399,indigo:1258324735,ivory:4294963455,khaki:4041641215,lavender:3873897215,lavenderblush:4293981695,lawngreen:2096890111,lemonchiffon:4294626815,lightblue:2916673279,lightcoral:4034953471,lightcyan:3774873599,lightgoldenrodyellow:4210742015,lightgray:3553874943,lightgreen:2431553791,lightgrey:3553874943,lightpink:4290167295,lightsalmon:4288707327,lightseagreen:548580095,lightskyblue:2278488831,lightslategray:2005441023,lightslategrey:2005441023,lightsteelblue:2965692159,lightyellow:4294959359,lime:16711935,limegreen:852308735,linen:4210091775,magenta:4278255615,maroon:2147483903,mediumaquamarine:1724754687,mediumblue:52735,mediumorchid:3126187007,mediumpurple:2473647103,mediumseagreen:1018393087,mediumslateblue:2070474495,mediumspringgreen:16423679,mediumturquoise:1221709055,mediumvioletred:3340076543,midnightblue:421097727,mintcream:4127193855,mistyrose:4293190143,moccasin:4293178879,navajowhite:4292783615,navy:33023,oldlace:4260751103,olive:2155872511,olivedrab:1804477439,orange:4289003775,orangered:4282712319,orchid:3664828159,palegoldenrod:4008225535,palegreen:2566625535,paleturquoise:2951671551,palevioletred:3681588223,papayawhip:4293907967,peachpuff:4292524543,peru:3448061951,pink:4290825215,plum:3718307327,powderblue:2967529215,purple:2147516671,rebeccapurple:1714657791,red:4278190335,rosybrown:3163525119,royalblue:1097458175,saddlebrown:2336560127,salmon:4202722047,sandybrown:4104413439,seagreen:780883967,seashell:4294307583,sienna:2689740287,silver:3233857791,skyblue:2278484991,slateblue:1784335871,slategray:1887473919,slategrey:1887473919,snow:4294638335,springgreen:16744447,steelblue:1182971135,tan:3535047935,teal:8421631,thistle:3636451583,tomato:4284696575,turquoise:1088475391,violet:4001558271,wheat:4125012991,white:4294967295,whitesmoke:4126537215,yellow:4294902015,yellowgreen:2597139199};function a2(e){const t=i2();let n;if(t.hex6&&(n=t.hex6.exec(e)))return Number.parseInt(n[1]+"ff",16)>>>0;if(qm[e]!==void 0)return qm[e];if(t.rgb&&(n=t.rgb.exec(e)))return(Oo(n[1])<<24|Oo(n[2])<<16|Oo(n[3])<<8|255)>>>0;if(t.rgba&&(n=t.rgba.exec(e)))return(Oo(n[1])<<24|Oo(n[2])<<16|Oo(n[3])<<8|Ym(n[4]))>>>0;if(t.hex3&&(n=t.hex3.exec(e)))return Number.parseInt(n[1]+n[1]+n[2]+n[2]+n[3]+n[3]+"ff",16)>>>0;if(t.hex8&&(n=t.hex8.exec(e)))return Number.parseInt(n[1],16)>>>0;if(t.hex4&&(n=t.hex4.exec(e)))return Number.parseInt(n[1]+n[1]+n[2]+n[2]+n[3]+n[3]+n[4]+n[4],16)>>>0;if(t.hsl&&(n=t.hsl.exec(e)))return(Zm(Km(n[1]),La(n[2]),La(n[3]))|255)>>>0;if(t.hsla&&(n=t.hsla.exec(e)))return(Zm(Km(n[1]),La(n[2]),La(n[3]))|Ym(n[4]))>>>0;if(t.oklch&&(n=t.oklch.exec(e))){const r=Sn(n[1],1),o=Sn(n[2],.4),i=Dc(n[3]),s=ns(n[4]),a=i*Math.PI/180,[l,c,f]=Gm(r,o*Math.cos(a),o*Math.sin(a));return rs(l,c,f,s)}if(t.oklab&&(n=t.oklab.exec(e))){const r=Sn(n[1],1),o=Sn(n[2],.4),i=Sn(n[3],.4),s=ns(n[4]),[a,l,c]=Gm(r,o,i);return rs(a,l,c,s)}if(t.lab&&(n=t.lab.exec(e))){const r=Sn(n[1],100),o=Sn(n[2],125),i=Sn(n[3],125),s=ns(n[4]),[a,l,c]=Xm(r,o,i);return rs(a,l,c,s)}if(t.lch&&(n=t.lch.exec(e))){const r=Sn(n[1],100),o=Sn(n[2],150),i=Dc(n[3]),s=ns(n[4]),a=i*Math.PI/180,[l,c,f]=Xm(r,o*Math.cos(a),o*Math.sin(a));return rs(l,c,f,s)}if(t.hwb&&(n=t.hwb.exec(e))){const r=Dc(n[1]),o=Sn(n[2],1),i=Sn(n[3],1),s=ns(n[4]),[a,l,c]=s2(r/360,o,i);return rs(a,l,c,s)}throw new Error(`invalid color string ${e} provided`)}var Jm=e=>(e>>24&255)/255,l2=e=>e>>16&255,u2=e=>e>>8&255,c2=e=>e&255,d2=(e,t,n,r)=>`rgba(${e}, ${t}, ${n}, ${r})`;function f2(e){const t=a2(e);return(t<<24|t>>>8)>>>0}var p2=(e,t,n,r)=>{const[o,i,s,a]=[l2,u2,c2,Jm].map(l=>{const c=Di(e,t,n.map(f=>l(f)),{easing:r==null?void 0:r.easing,extrapolateLeft:"clamp",extrapolateRight:"clamp",posterize:r==null?void 0:r.posterize});return l===Jm?Number(c.toFixed(3)):Math.round(c)});return d2(o,i,s,a)},h2=(e,t,n,r)=>{if(typeof e>"u")throw new TypeError("input can not be undefined");if(typeof t>"u")throw new TypeError("inputRange can not be undefined");if(typeof n>"u")throw new TypeError("outputRange can not be undefined");if(t.length!==n.length)throw new TypeError("inputRange ("+t.length+" values provided) and outputRange ("+n.length+" values provided) must have the same length");const o=n.map(i=>f2(i));return p2(e,t,o,r)},Qm=({easing:e,forceSpringAllowTail:t})=>{switch(e.type){case"linear":return Yl.linear;case"spring":return Yl.spring({allowTail:t??e.allowTail??void 0,damping:e.damping,durationRestThreshold:e.durationRestThreshold??void 0,mass:e.mass,overshootClamping:e.overshootClamping,stiffness:e.stiffness});case"bezier":return fx(e.x1,e.y1,e.x2,e.y2);default:throw new TypeError(`Unsupported easing: ${JSON.stringify(e)}`)}},la=({frame:e,forceSpringAllowTail:t,status:n})=>{const{keyframes:r,easing:o,clamping:i,interpolationFunction:s}=n;if(r.length===0)return null;const a=[...r].sort((f,p)=>f.frame-p.frame),l=a.map(f=>f.frame),c=a.map(f=>f.value);if(s==="interpolateColors"){if(!c.every(f=>typeof f=="string"))return null;if(r.length===1)return c[0];try{return h2(e,l,c,{easing:o.map(f=>Qm({easing:f,forceSpringAllowTail:t})),posterize:n.posterize})}catch{return null}}if(s!=="interpolate")return null;try{return Di(e,l,c,{easing:o.map(f=>Qm({easing:f,forceSpringAllowTail:t})),extrapolateLeft:i.left,extrapolateRight:i.right,output:n.output,posterize:n.posterize})}catch{return null}},$u=({dragOverrideValue:e,frame:t})=>{if(e===void 0)return{type:"none"};if(e.type==="static")return{type:"resolved",value:e.value};if(t===null)return{type:"none"};const n=la({forceSpringAllowTail:null,frame:t,status:e.status});return n===null?{type:"none"}:{type:"resolved",value:n}},xx=({propStatus:e,dragOverrideValue:t,defaultValue:n,frame:r=null,shouldResortToDefaultValueIfUndefined:o=!1})=>{const i=$u({dragOverrideValue:t,frame:r});return i.type==="resolved"&&i.value!==void 0?i.value:e.status==="keyframed"?r!==null?la({forceSpringAllowTail:null,frame:r,status:e}):o?n:void 0:e.codeValue===void 0&&o?n:e.codeValue},Dp=d.createContext({overrideIdToNodePathMappings:{}}),m2=d.createContext({setOverrideIdToNodePath:()=>{throw new Error("OverrideIdsToNodePathsSettersContext not initialized")}}),g2=({descriptor:e,propStatusOverrides:t,dragOverrides:n,frame:r})=>{if(!t&&!n)return{params:e.params,effectKey:e.effectKey};const o={...e.params};if(t)for(const[i,s]of Object.entries(t))s!==void 0&&(o[i]=s);if(n)for(const[i,s]of Object.entries(n)){const a=$u({dragOverrideValue:s,frame:r});a.type==="resolved"&&(o[i]=a.value)}return{params:o,effectKey:e.definition.calculateKey(o)}},y2=(e,t)=>{if(!e)return null;const n={};let r=!1;for(const[o,i]of Object.entries(e)){if(i.status==="static"){n[o]=i.codeValue,r=!0;continue}if(i.status==="keyframed"){const s=la({forceSpringAllowTail:null,frame:t,status:i});s!==null&&(n[o]=s,r=!0)}}return r?n:null},ua=e=>{const t=d.useRef(null),n=e.map(i=>i.definition),r=t.current;return r!==null&&r.length===n.length&&r.every((i,s)=>i===n[s])?r:(t.current=n,n)},bx=({propStatuses:e,nodePath:t,effectIndex:n})=>{const r=e[mr(t)];if(!r)return{type:"cannot-update-sequence",reason:"not-found"};if(!r.canUpdate)return{type:"cannot-update-sequence",reason:r.reason};const o=r.effects.find(i=>i.effectIndex===n);return o?o.canUpdate?{type:"can-update-effect",props:o.props}:{type:"cannot-update-effect",reason:o.reason}:{type:"cannot-update-effect",reason:"not-found"}},Sx=(e,t)=>{const n=e[mr(t)];if(n&&n.canUpdate)return n.props},ca=({effects:e,overrideId:t})=>{const n=d.useRef(null),{propStatuses:r}=d.useContext(Pu),{getEffectDragOverrides:o}=d.useContext(_u),i=Ft(),{overrideIdToNodePathMappings:s}=d.useContext(Dp),a=n.current,l=t?s[t]??null:null,c=e.map((m,g)=>{if(l===null)return{descriptor:m,params:m.params,effectKey:m.effectKey};const w=bx({propStatuses:r,nodePath:l,effectIndex:g}),x=w.type==="can-update-effect"?y2(w.props,i):null,k=o(l,g),h=Object.keys(k).length===0?null:k,{params:y,effectKey:v}=g2({descriptor:m,propStatusOverrides:x,dragOverrides:h,frame:i});return{descriptor:m,params:y,effectKey:v}});if(a!==null&&a.length===c.length&&a.every((m,g)=>m.definition===c[g].descriptor.definition&&m.effectKey===c[g].effectKey))return a;const p=c.map(({descriptor:m,params:g,effectKey:w})=>({definition:m.definition,effectKey:w,params:g,memoized:!0}));return n.current=p,p},Op=(e,t)=>{const n={};for(const r of Object.keys(e)){const o=e[r];if(o.type!=="hidden")if(o.type==="enum"){n[r]=o;const i=t(r)??o.default,s=o.variants[i];s&&Object.assign(n,Op(s,t))}else n[r]=o}return n},Bp=e=>{const t={},n=(r,o)=>{r in t||(t[r]=o)};for(const r of Object.keys(e)){const o=e[r];if(n(r,o),o.type==="enum")for(const i of Object.values(o.variants)){const s=Bp(i);for(const a of Object.keys(s))n(a,s[a])}}return t},kx=({schema:e,key:t,value:n})=>{const r=e[t];if(!r)throw new Error("Key "+JSON.stringify(t)+" not found in schema");if(typeof n!="string")throw new Error("Value must be a string, but is "+JSON.stringify(n));if(r.type!=="enum")throw new Error("Key "+JSON.stringify(t)+" is not an enum");if(!r.variants[n])throw new Error("Value for "+JSON.stringify(t)+" must be one of "+Object.keys(r.variants).map(a=>JSON.stringify(a)).join(", ")+", got "+JSON.stringify(n));const i=Object.keys(r.variants).filter(a=>a!==n),s=new Set;for(const a of i){const l=r.variants[a],c=Object.keys(l);for(const f of c)s.add(f)}return[...s]},eg={type:"linear"},v2=({insertedKeyframeIndex:e,easingLength:t,keyframeCount:n})=>!(e>0&&e<n-1)||t===0?null:Math.min(e-1,t-1),w2=e=>({type:"static",value:e}),x2=({status:e,frame:t,value:n})=>{const r=e.keyframes.findIndex(s=>s.frame===t),o=r===-1?[...e.keyframes,{frame:t,value:n}].sort((s,a)=>s.frame-a.frame):e.keyframes.map((s,a)=>a===r?{frame:t,value:n}:s),i=[...e.easing];if(r===-1){const s=o.findIndex(c=>c.frame===t),a=v2({insertedKeyframeIndex:s,easingLength:i.length,keyframeCount:o.length}),l=a===null?eg:i[a];i.splice(s,0,l)}for(;i.length<o.length-1;)i.push(eg);return i.length>o.length-1&&(i.length=o.length-1),{type:"keyframed",status:{...e,keyframes:o,easing:i}}},b2=e=>{if((e==null?void 0:e.type)==="static")return e.value},S2=e=>e!==null&&e.status==="keyframed",Ex=(e,t)=>{if(t in e)return e[t];for(const n of Object.values(e))if(n.type==="enum")for(const r of Object.values(n.variants)){const o=Ex(r,t);if(o)return o}},Cx=({schema:e,currentValue:t,overrideValues:n,propStatus:r,frame:o})=>{var a;const i={},s=new Set;for(const l of Object.keys(t)){const c=(r==null?void 0:r[l])??null,f=Ex(e,l);if((f==null?void 0:f.type)==="hidden")continue;let p;if(c===null)p=t[l];else if(S2(c))if((f==null?void 0:f.type)==="array"||(f==null?void 0:f.keyframable)===!1)p=t[l];else{const m=$u({dragOverrideValue:n[l],frame:o});m.type==="resolved"?p=m.value:o!==null?p=la({forceSpringAllowTail:null,frame:o,status:c})??t[l]:p=t[l]}else c.status==="computed"?p=t[l]:p=xx({propStatus:c,dragOverrideValue:n[l],defaultValue:f==null?void 0:f.default,frame:o,shouldResortToDefaultValueIfUndefined:!1});(f==null?void 0:f.type)==="asset"&&typeof p=="string"&&p.startsWith(Vs)&&(p=`${window.remotion_staticBase}/${p.slice(Vs.length)}`),p===void 0&&s.add(l),i[l]=p}for(const l of Object.keys(n))if(((a=e[l])==null?void 0:a.type)==="enum"){const c=kx({schema:e,key:l,value:i[l]});for(const f of c)s.add(f)}return{merged:i,propsToDelete:s}},Ix=(e,t)=>{const n=t.split(".");let r=e;for(const o of n){if(r==null||typeof r!="object")return;r=r[o]}return r},Tx=({flatSchema:e,key:t,props:n})=>{var o;const r=Ix(n,t);if(!(((o=e[t])==null?void 0:o.type)==="text-content"&&typeof r!="string"))return r},k2=(e,t,n)=>{const r={};for(const o of t)r[o]=n?Tx({flatSchema:n,key:o,props:e}):Ix(e,o);return r},E2=(e,t)=>Object.keys(Op(e,n=>t[n])),C2=({flatSchema:e,props:t,valuesDotNotation:n,schemaKeys:r,propsToDelete:o})=>{var a;const i={...t};for(const l of r){const c=n[l];if(((a=e[l])==null?void 0:a.type)==="text-content"&&c===void 0)continue;const f=l.split(".");if(f.length===1){i[l]=c;continue}let p=i;for(let m=0;m<f.length-1;m++){const g=f[m];typeof p[g]=="object"&&p[g]!==null?p[g]={...p[g]}:p[g]={},p=p[g]}p[f[f.length-1]]=c}const s=new Set([...o].filter(l=>{var c;return!(((c=e[l])==null?void 0:c.type)==="text-content"&&n[l]===void 0)}));return TC(i,s),i},tg={},Ir=({Component:e,componentName:t,componentIdentity:n,schema:r,supportsEffects:o})=>{const i=wC(r),s=Bp(i),a=Object.keys(s),l=d.forwardRef((c,f)=>{const p=ct();if(!p.isStudio||p.isReadOnlyStudio||p.isRendering)return le.createElement(e,{...c,controls:null,ref:f});const{propStatuses:m}=d.useContext(Pu),{getDragOverrides:g}=d.useContext(_u),w=d.useContext(Dp),x=Ft();if(c.controls)return le.createElement(e,{...c,ref:f});const[k]=d.useState(()=>{const{stack:j}=c;if(!j)return String(Math.random());const _=tg[j];if(_)return _;const N=String(Math.random());return tg[j]=N,N}),h=w.overrideIdToNodePathMappings[k]??null,y=a.map(j=>Tx({flatSchema:s,key:j,props:c})),v=d.useMemo(()=>k2(c,a,s),y),S=d.useMemo(()=>({schema:i,currentRuntimeValueDotNotation:v,overrideId:k,supportsEffects:o,componentIdentity:n,componentName:t}),[v,k]),{merged:b,propsToDelete:E}=d.useMemo(()=>Cx({schema:i,currentValue:v,overrideValues:h===null?{}:g(h),propStatus:h===null?void 0:Sx(m,h),frame:x}),[v,g,h,m,x]),I=E2(i,b),T=C2({flatSchema:s,props:c,valuesDotNotation:b,schemaKeys:I,propsToDelete:E});return le.createElement(e,{...T,controls:S,ref:f})});return l.displayName=`withInteractivitySchema(${e.displayName||e.name||"Component"})`,l},Oc=[],I2=({from:e=0,trimBefore:t=0,freeze:n,durationInFrames:r=1/0,children:o,name:i,height:s,width:a,showInTimeline:l=!0,hidden:c=!1,controls:f,_remotionInternalEffects:p,_remotionInternalLoopDisplay:m,_remotionInternalStack:g,_remotionInternalDocumentationLink:w,_remotionInternalSingleChildComponent:x,_remotionInternalPremountDisplay:k,_remotionInternalPostmountDisplay:h,_remotionInternalIsMedia:y,outlineRef:v,...S},b)=>{const{layout:E="absolute-fill"}=S,[I]=d.useState(()=>String(Math.random())),T=d.useContext(xt),{rootId:j}=oo(),_=T?T.cumulatedFrom+T.relativeFrom:0,N=bu();if(E!=="absolute-fill"&&E!=="none")throw new TypeError(`The layout prop of <Sequence /> expects either "absolute-fill" or "none", but you passed: ${E}`);if(E==="none"&&typeof S.style<"u")throw new TypeError('If layout="none", you may not pass a style. Passed: '+JSON.stringify(S.style));if(typeof r!="number")throw new TypeError(`You passed to durationInFrames an argument of type ${typeof r}, but it must be a number.`);if(r<=0)throw new TypeError(`durationInFrames must be positive, but got ${r}`);if(typeof e!="number")throw new TypeError(`You passed to the "from" props of your <Sequence> an argument of type ${typeof e}, but it must be a number.`);if(!Number.isFinite(e))throw new TypeError(`The "from" prop of a sequence must be finite, but got ${e}.`);if(typeof t!="number")throw new TypeError(`You passed to the "trimBefore" prop of your <Sequence> an argument of type ${typeof t}, but it must be a number.`);if(t<0)throw new TypeError(`The "trimBefore" prop of <Sequence /> must be greater than or equal to 0, but got ${t}.`);if(Number.isNaN(t))throw new TypeError('The "trimBefore" prop of <Sequence /> must be a real number, but it is NaN.');if(!Number.isFinite(t))throw new TypeError(`The "trimBefore" prop of <Sequence /> must be finite, but it is ${t}.`);if(typeof n<"u"&&n!==null){if(typeof n!="number")throw new TypeError(`The "freeze" prop of <Sequence /> must be a number, but is of type ${typeof n}.`);if(Number.isNaN(n))throw new TypeError('The "freeze" prop of <Sequence /> must be a real number, but it is NaN.');if(!Number.isFinite(n))throw new TypeError(`The "freeze" prop of <Sequence /> must be finite, but it is ${n}.`)}const W=io(),M=ht(),$=e-t,V=((T==null?void 0:T.absoluteFrom)??0)+$,L=T?Math.min(T.durationInFrames-$,r):r,A=Math.max(0,Math.min(M.durationInFrames-e,L)),{registerSequence:R,unregisterSequence:C}=d.useContext(zi),P=d.useRef(null),z=S.layout==="none"?v??null:v??P,O=d.useMemo(()=>(T==null?void 0:T.premounting)||!!S._remotionInternalIsPremounting,[S._remotionInternalIsPremounting,T==null?void 0:T.premounting]),D=d.useMemo(()=>(T==null?void 0:T.postmounting)||!!S._remotionInternalIsPostmounting,[S._remotionInternalIsPostmounting,T==null?void 0:T.postmounting]),Z=_+$,H=T?T.cumulatedFrom+T.relativeFrom:0,G=T?H-T.cumulatedNegativeFrom:0,B=Math.max(0,G,Z),X=Z-B,ae=d.useMemo(()=>({absoluteFrom:V,cumulatedFrom:_,relativeFrom:$,cumulatedNegativeFrom:X,durationInFrames:A,parentFrom:(T==null?void 0:T.relativeFrom)??0,id:I,height:s??(T==null?void 0:T.height)??null,width:a??(T==null?void 0:T.width)??null,premounting:O,postmounting:D,premountDisplay:k??null,postmountDisplay:h??null}),[_,V,$,A,T,I,s,a,O,D,k,h,X]),oe=d.useMemo(()=>i??"",[i]),Y=w??"https://www.remotion.dev/docs/sequence",q=ct(),xe=d.useContext(Mu),Se=(S==null?void 0:S.stack)??null,de=d.useRef(null);de.current=g??Se;const K=typeof n=="number"?n:null,ee=t===0?null:t,ue=(T==null?void 0:T.cumulatedNegativeFrom)??0,se=y&&y.type!=="image"?y.data.startMediaFrom+ue-X:null,Re=y&&y.type!=="image"?y.data.startMediaFrom+ue:null,Ie=y&&y.type!=="image"&&Re!==null?K===null?null:Re+(m?K%m.durationInFrames:K)*y.data.playbackRate:null;d.useEffect(()=>{if(q.isStudio)return y?(y.type==="image"?R({type:"image",controls:f??null,effects:p??Oc,displayName:oe,documentationLink:Y,duration:A,from:e,trimBefore:ee,id:I,loopDisplay:m,nonce:N.get(),parent:(T==null?void 0:T.id)??null,postmountDisplay:h??null,premountDisplay:k??null,rootId:j,showInTimeline:l,src:y.src,getStack:()=>de.current,refForOutline:z??null,isInsideSeries:xe,frozenFrame:K,singleChildComponent:x??null}):R({type:y.type,controls:f??null,effects:p??Oc,displayName:oe,documentationLink:Y,doesVolumeChange:y.data.doesVolumeChange,duration:A,from:e,trimBefore:ee,id:I,loopDisplay:m,nonce:N.get(),parent:(T==null?void 0:T.id)??null,playbackRate:y.data.playbackRate,postmountDisplay:h??null,premountDisplay:k??null,rootId:j,showInTimeline:l,src:y.data.src,getStack:()=>de.current,startMediaFrom:se??y.data.startMediaFrom,mediaFrameAtSequenceZero:Re,volume:y.data.volumes,refForOutline:z??null,isInsideSeries:xe,frozenFrame:K,frozenMediaFrame:Ie,singleChildComponent:x??null}),()=>{C(I)}):(R({from:e,trimBefore:ee,duration:A,id:I,displayName:oe,documentationLink:Y,parent:(T==null?void 0:T.id)??null,type:"sequence",rootId:j,showInTimeline:l,nonce:N.get(),loopDisplay:m,getStack:()=>de.current,premountDisplay:k??null,postmountDisplay:h??null,controls:f??null,effects:p??Oc,refForOutline:z??null,isInsideSeries:xe,frozenFrame:K,singleChildComponent:x??null}),()=>{C(I)})},[r,I,i,R,oe,C,T==null?void 0:T.id,A,j,e,t,ee,l,N,m,k,h,q.isStudio,f,p,y,Y,z,xe,K,se,Re,Ie,x]);const De=Math.ceil(_+e+r-1),Qe=W<_+e||W>De?null:o,ke=Qe===null||typeof n>"u"||n===null?Qe:u.jsx(ia,{frame:n,children:Qe}),Ee=S.layout==="none"?void 0:S.style,je=d.useCallback(Le=>{P.current=Le,typeof b=="function"?b(Le):b&&(b.current=Le)},[b]),Me=d.useMemo(()=>({flexDirection:void 0,...a?{width:a}:{},...s?{height:s}:{},...Ee??{}}),[s,Ee,a]);if(b!==null&&E==="none")throw new TypeError('It is not supported to pass both a `ref` and `layout="none"` to <Sequence />.');return c?null:u.jsx(xt.Provider,{value:ae,children:ke===null?null:S.layout==="none"?ke:u.jsx(Hn,{ref:je,style:Me,className:S.className,children:ke})})},T2=d.forwardRef(I2),R2=(e,t)=>{if(e.layout==="none")throw new Error('`<Sequence>` with `premountFor` and `postmountFor` props does not support layout="none"');const{style:n,from:r=0,durationInFrames:o=1/0,premountFor:i=0,postmountFor:s=0,styleWhilePremounted:a,styleWhilePostmounted:l,...c}=e,{freezeFrame:f,isPremountingOrPostmounting:p,postmountingActive:m,premountingActive:g,premountingStyle:w}=aa({from:r,durationInFrames:o,premountFor:i,postmountFor:s,style:n??null,styleWhilePremounted:a??null,styleWhilePostmounted:l??null,hideWhilePremounted:"opacity"});return u.jsx(ia,{frame:f,active:p,children:u.jsx(Au,{ref:t,from:r,durationInFrames:o,style:w??void 0,_remotionInternalPremountDisplay:i,_remotionInternalPostmountDisplay:s,_remotionInternalIsPremounting:g,_remotionInternalIsPostmounting:m,...c})})},j2=d.forwardRef(R2),P2=(e,t)=>{const n=ct(),{fps:r}=ht();if(e.layout!=="none"&&!n.isRendering){const o=e.premountFor;if(o||e.postmountFor)return u.jsx(j2,{ref:t,...e,premountFor:o})}return u.jsx(T2,{...e,ref:t})},Au=d.forwardRef(P2),Rx=Au,_t=Ir({Component:Au,componentName:"<Sequence>",componentIdentity:"dev.remotion.remotion.Sequence",schema:Ri,supportsEffects:!1});Ir({Component:Au,componentName:"<Sequence>",componentIdentity:null,schema:bC,supportsEffects:!1});var jx=(e,t,n)=>{switch(e){case"fill":return[0,0,t.width,t.height,0,0,n.width,n.height];case"contain":{const r=Math.min(n.width/t.width,n.height/t.height),o=(n.width-t.width*r)/2,i=(n.height-t.height*r)/2;return[0,0,t.width,t.height,o,i,t.width*r,t.height*r]}case"cover":{const r=Math.max(n.width/t.width,n.height/t.height),o=(n.width-t.width*r)/2,i=(n.height-t.height*r)/2;return[0,0,t.width,t.height,o,i,t.width*r,t.height*r]}default:throw new Error("Unknown fit: "+e)}},F2="https://remotion.dev/docs/troubleshooting/webgl2-context",Px=(e,t)=>`Failed to acquire ${e} context for ${t}. Pass --gl=angle when using the CLI, set chromiumOptions: { gl: "angle" } when using SSR APIs, or set "OpenGL render backend" to "angle" in the Advanced section when rendering in the Studio. See ${F2}`,_2=e=>new Error(Px("WebGL",e)),Fx=e=>new Error(Px("WebGL2",e));class M2{constructor(t,n){Ae(this,"width");Ae(this,"height");Ae(this,"pairs",new Map);Ae(this,"lostContexts",new Set);this.width=t,this.height=n}getPair(t){const n=this.pairs.get(t);if(n)return n;const r=[this.allocateCanvas(t),this.allocateCanvas(t)];return this.pairs.set(t,r),r}assertContextNotLost(t){if(this.lostContexts.has(t))throw new Error("WebGL context was lost during canvas effect rendering. This typically happens in headless or memory-constrained environments (e.g. Remotion Lambda). Try reducing concurrency or increasing the Lambda function memory.")}allocateCanvas(t){const n=document.createElement("canvas");switch(n.width=this.width,n.height=this.height,t){case"2d":{if(!n.getContext("2d",{colorSpace:"srgb"}))throw new Error("Failed to acquire 2D context for canvas effect");return n}case"webgl2":{const r=n.getContext("webgl2",{premultipliedAlpha:!0,alpha:!0,preserveDrawingBuffer:!0});if(!r)throw Fx("canvas effect");return n.addEventListener("webglcontextlost",o=>{o.preventDefault(),this.lostContexts.add(n)}),n.addEventListener("webglcontextrestored",()=>{this.lostContexts.delete(n)}),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),n}case"webgpu":{if(typeof navigator>"u"||!("gpu"in navigator))throw new Error("WebGPU is not available in this environment for canvas effect");return n}default:{const r=t;throw new Error(`Unknown effect backend: ${r}`)}}}}var $2=e=>{const t=[];let n=[],r=null;for(const o of e){const{backend:i}=o.definition;r===null||i===r?(n.push(o),r=i):(t.push({backend:r,effects:n}),n=[o],r=i)}return r!==null&&n.length>0&&t.push({backend:r,effects:n}),t},Da=null,A2=()=>Da||(Da=(async()=>{if(typeof navigator>"u"||!("gpu"in navigator))throw new Error("WebGPU is not available in this environment");const{gpu:e}=navigator,t=await e.requestAdapter();if(!t)throw new Error("No WebGPU adapter available");return t.requestDevice()})(),Da),_x=(e,t)=>({pool:new M2(e,t),setupCache:new WeakMap,cleanupRegistry:[],currentRunId:0}),gf=e=>{e.currentRunId++;for(const t of e.cleanupRegistry)t.definition.cleanup(t.state)},N2=(e,t,n)=>{const r=t;let o=e.setupCache.get(r);if(o||(o=new WeakMap,e.setupCache.set(r,o)),o.has(n))return o.get(n);const i=t.setup(n);return o.set(n,i),e.cleanupRegistry.push({definition:r,state:i}),i},da=async({state:e,source:t,effects:n,output:r,width:o,height:i})=>{const s=++e.currentRunId,a=()=>e.currentRunId!==s,l=n.filter(k=>!k.params.disabled),c=$2(l);let f=t,p=null;if(c.length===0){if(t===r)return!0;const k=r.getContext("2d");if(!k)throw new Error("Failed to acquire 2D context for output canvas");return k.clearRect(0,0,o,i),k.drawImage(f,0,0,o,i),!0}let m=!1;for(const k of c)if(k.backend==="webgpu"){m=!0;break}const g=m?await A2():null;if(a())return!1;let w=!0;for(let k=0;k<c.length;k++){const h=c[k],[y,v]=e.pool.getPair(h.backend);let S=y;for(const E of h.effects){const I=E.definition,T=N2(e,I,S);I.apply({source:f,target:S,state:T,params:E.params,width:o,height:i,gpuDevice:g,flipSourceY:h.backend==="webgl2"?w:!1}),h.backend==="webgl2"&&(w=!0,e.pool.assertContextNotLost(S)),f=S,S=S===y?v:y}p=f??p;const b=c[k+1];if(b&&b.backend!==h.backend&&p)if(h.backend==="2d"&&b.backend==="webgl2")f=p,w=!0;else{const E=await createImageBitmap(p);if(a())return E.close(),!1;f=E,b.backend==="webgl2"&&(w=!1)}}if(!p)return!0;const x=r.getContext("2d");if(!x)throw new Error("Failed to acquire 2D context for output canvas");return x.clearRect(0,0,o,i),x.drawImage(p,0,0,o,i),!0},fa=()=>{const e=d.useRef(null),t=d.useRef(null);return d.useEffect(()=>()=>{e.current&&gf(e.current)},[]),d.useMemo(()=>({get:(n,r)=>((!t.current||t.current.width!==n||t.current.height!==r)&&(e.current&&gf(e.current),e.current=_x(n,r),t.current={width:n,height:r}),e.current)}),[])},L2=({width:e,height:t,fit:n,className:r,style:o,effects:i,...s},a)=>{const l=d.useRef(null),c=fa(),f=d.useMemo(()=>typeof document>"u"?null:document.createElement("canvas"),[]),p=d.useCallback(m=>{const g=l.current,w=e??m.displayWidth,x=t??m.displayHeight;if(!g)throw new Error("Canvas ref is not set");if(!f)throw new Error("Source canvas is not available");f.width=w,f.height=x;const k=f.getContext("2d");if(!k)throw new Error("Could not get 2d context for source canvas");return k.drawImage(m,...jx(n,{height:m.displayHeight,width:m.displayWidth},{width:w,height:x})),g.width=w,g.height=x,da({state:c.get(w,x),source:f,effects:i,output:g,width:w,height:x})},[c,i,n,t,f,e]);return d.useImperativeHandle(a,()=>({draw:p,getCanvas:()=>{if(!l.current)throw new Error("Canvas ref is not set");return l.current},clear:()=>{var g;const m=(g=l.current)==null?void 0:g.getContext("2d");if(!m)throw new Error("Could not get 2d context");m.clearRect(0,0,l.current.width,l.current.height)}}),[p]),u.jsx("canvas",{ref:l,className:r,style:o,...s})},z2=le.forwardRef(L2),Mx=async({resolvedSrc:e,signal:t,requestInit:n,contentType:r})=>{if(typeof ImageDecoder>"u")throw new Error("Your browser does not support the WebCodecs ImageDecoder API.");const o=await fetch(e,{...n,signal:t}),{body:i}=o;if(!i)throw new Error("Got no body");const s=new ImageDecoder({data:i,type:r??o.headers.get("Content-Type")??"image/gif"});await Promise.all([s.completed,s.tracks.ready]);const{selectedTrack:a}=s.tracks;if(!a)throw s.close(),new Error("No selected track");return{decoder:s,selectedTrack:a}},D2=5,ng=({loopBehavior:e,durationFound:t,timeInSec:n})=>e==="loop"?t?n%t:n:Math.min(n,t||1/0),O2=async({resolvedSrc:e,signal:t,requestInit:n,currentTime:r,initialLoopBehavior:o})=>{const{decoder:i,selectedTrack:s}=await Mx({resolvedSrc:e,signal:t,requestInit:n,contentType:null}),a=[];let l=null;const c=async g=>{const w=a.find(k=>k.frameIndex===g);if(w&&w.frame)return w;const x=await i.decode({frameIndex:g,completeFramesOnly:!0});return w?w.frame=x.image:a.push({frame:x.image,frameIndex:g,timeInSeconds:x.image.timestamp/1e6}),{frame:x.image,frameIndex:g,timeInSeconds:x.image.timestamp/1e6}},f=g=>{const x=a.filter(k=>k.frame).sort((k,h)=>{const y=Math.abs(k.timeInSeconds-g),v=Math.abs(h.timeInSeconds-g);return y-v});for(let k=0;k<x.length;k++){if(k<D2)continue;const h=x[k];h.frame=null}},p=async({timeInSec:g,loopBehavior:w})=>{const x=ng({durationFound:l,loopBehavior:w,timeInSec:g}),h=a.filter(v=>v.timeInSeconds<=x).map(v=>v.frameIndex).reduce((v,S)=>Math.max(v,S),0);let y=h;for(;;){const v=await c(y);if(y++,!v.frame)throw new Error("No frame found");if(!v.frame.duration||(y===s.frameCount&&l===null&&(l=(v.frame.timestamp+v.frame.duration)/1e6),v.timeInSeconds>x||y===s.frameCount))break}s.frameCount-h<3&&w==="loop"&&await c(0),f(x)};return await p({timeInSec:r,loopBehavior:o}),await p({timeInSec:r,loopBehavior:o}),{close:()=>{var g;for(const w of a)(g=w.frame)==null||g.close(),w.frame=null;i.close()},getFrame:async(g,w)=>{if(l!==null&&g>l&&w==="clear-after-finish")return null;const x=ng({loopBehavior:w,durationFound:l,timeInSec:g});await p({timeInSec:x,loopBehavior:w});const h=a.filter(y=>y.frame).reduce((y,v)=>{const S=Math.abs(y.timeInSeconds-x),b=Math.abs(v.timeInSeconds-x);return S<b?y:v});if(!h.frame)throw new Error("No frame found");return h},frameCount:s.frameCount}},B2=({frame:e,playbackRate:t,fps:n})=>e*t/n,W2=e=>{if(!e)return null;const t={...e};delete t.signal;const{headers:n,...r}=t;return JSON.stringify({...r,headers:n?Array.from(new Headers(n).entries()):null})},V2=e=>typeof window>"u"?e:new URL(e,window.origin).href,H2={src:{type:"asset",default:void 0,description:"Source",keyframable:!1},...Cr,...Li,playbackRate:{type:"number",min:0,max:10,step:.1,default:1,description:"Playback rate",hiddenFromList:!1,keyframable:!1},...ar,...ao,...so},U2=e=>{const t={},n=t;for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(r.startsWith("data-")||r.startsWith("aria-"))&&(n[r]=e[r]);return t},$x=d.forwardRef(({src:e,width:t,height:n,onError:r,loopBehavior:o="loop",playbackRate:i=1,fit:s="fill",requestInit:a,effects:l,controls:c,...f},p)=>{const m=V2(e),[g,w]=d.useState(null),{delayRender:x,continueRender:k}=Un(),[h]=d.useState(()=>x(`Rendering <AnimatedImage/> with src="${m}"`)),y=Ft(),{fps:v}=ht(),S=B2({frame:y,playbackRate:i,fps:v}),b=d.useRef(S);b.current=S;const E=W2(a),I=d.useRef(a);I.current=a;const T=d.useRef(null),j=ca({effects:l,overrideId:(c==null?void 0:c.overrideId)??null});d.useImperativeHandle(p,()=>{var W;const N=(W=T.current)==null?void 0:W.getCanvas();if(!N)throw new Error("Canvas ref is not set");return N},[]);const[_]=d.useState(()=>o);return d.useEffect(()=>{const N=new AbortController;let W=!1,M=!1;const $=()=>{M||(M=!0,k(h))};return O2({resolvedSrc:m,signal:N.signal,requestInit:I.current,currentTime:b.current,initialLoopBehavior:_}).then(V=>{if(W){V.close();return}w(V),$()}).catch(V=>{if(!W){if(V.name==="AbortError"){$();return}r?(r==null||r(V),$()):Hs(V)}}),()=>{W=!0,N.abort(),$()}},[m,h,r,E,_,k]),d.useEffect(()=>()=>{g==null||g.close()},[g]),d.useLayoutEffect(()=>{if(!g)return;const N=x(`Rendering frame at ${S} of <AnimatedImage src="${e}"/>`);let W=!1;return g.getFrame(S,o).then(async M=>{var V,L;if(W)return;if(M===null){(V=T.current)==null||V.clear(),k(N);return}await((L=T.current)==null?void 0:L.draw(M.frame))&&!W&&k(N)}).catch(M=>{W||(r?(r(M),k(N)):Hs(M))}),()=>{W=!0,k(N)}},[S,g,o,r,e,k,x,j,s,t,n]),u.jsx(z2,{ref:T,width:t,height:n,fit:s,effects:j,...f})});$x.displayName="AnimatedImageContent";var Z2=({src:e,width:t,height:n,onError:r,fit:o,playbackRate:i,loopBehavior:s,id:a,className:l,style:c,durationInFrames:f,from:p,premountFor:m,postmountFor:g,styleWhilePremounted:w,styleWhilePostmounted:x,requestInit:k,effects:h=[],controls:y,ref:v,...S})=>{const b=d.useRef(null),E=ua(h);d.useImperativeHandle(v,()=>b.current,[]);const{effectivePostmountFor:I,effectivePremountFor:T,freezeFrame:j,isPremountingOrPostmounting:_,postmountingActive:N,premountingActive:W,premountingStyle:M}=aa({from:p??0,durationInFrames:f??1/0,premountFor:m??null,postmountFor:g??null,style:c??null,styleWhilePremounted:w??null,styleWhilePostmounted:x??null,hideWhilePremounted:"display-none"}),$=U2(S),V={src:e,width:t,height:n,onError:r,fit:o,playbackRate:i,loopBehavior:s,id:a,className:l,style:M??void 0,requestInit:k,...$};return u.jsx(ia,{frame:j,active:_,children:u.jsx(_t,{layout:"none",from:p??0,durationInFrames:f??1/0,name:"<AnimatedImage>",_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/animatedimage",controls:y,_remotionInternalEffects:E,_remotionInternalPremountDisplay:T||null,_remotionInternalPostmountDisplay:I||null,_remotionInternalIsPremounting:W,_remotionInternalIsPostmounting:N,...S,outlineRef:b,children:u.jsx($x,{...V,ref:b,effects:h,controls:y})})})},Ax=Ir({Component:Z2,componentName:"<AnimatedImage>",componentIdentity:"dev.remotion.remotion.AnimatedImage",schema:H2,supportsEffects:!0});Ax.displayName="AnimatedImage";Zt(Ax);var K2={type:"boolean",default:!1,description:"Disabled"},Y2=e=>{const{calculateKey:t,validateParams:n}=e,r={...e,documentationLink:e.documentationLink??null,calculateKey:i=>{const s=i.disabled??!1;return`${t(i)}-disabled-${s}`},schema:{disabled:K2,...e.schema}};return(i={})=>(n(i),{definition:r,params:i,effectKey:r.calculateKey(i),memoized:!1})},G2=e=>{if(typeof e!="string")throw new TypeError(`The "filename" must be a string, but you passed a value of type ${typeof e}`);if(e.trim()==="")throw new Error("The `filename` must not be empty");if(!e.match(/^([0-9a-zA-Z-!_.*'()/:&$@=;+,?]+)/g))throw new Error('The `filename` must match "/^([0-9a-zA-Z-!_.*\'()/:&$@=;+,?]+)/g". Use forward slashes only, even on Windows.')},X2=e=>{if(typeof e!="string"&&!(e instanceof Uint8Array))throw new TypeError(`The "content" must be a string or Uint8Array, but you passed a value of type ${typeof e}`);if(typeof e=="string"&&e.trim()==="")throw new Error("The `content` must not be empty")},Nx=e=>{e.type==="artifact"&&(G2(e.filename),e.contentType!=="thumbnail"&&X2(e.content))},$o=d.createContext({registerRenderAsset:()=>{},unregisterRenderAsset:()=>{},renderAssets:[]}),q2=({children:e,collectAssets:t})=>{const[n,r]=d.useState([]),o=d.useRef([]),i=d.useCallback(l=>{Nx(l),o.current=[...o.current,l],r(o.current)},[]);t&&d.useImperativeHandle(t,()=>({collectAssets:()=>{const l=o.current;return o.current=[],r([]),l}}),[]);const s=d.useCallback(l=>{o.current=o.current.filter(c=>c.id!==l),r(o.current)},[]);d.useLayoutEffect(()=>{typeof window<"u"&&(window.remotion_collectAssets=()=>{const l=o.current;return o.current=[],r([]),l})},[]);const a=d.useMemo(()=>({registerRenderAsset:i,unregisterRenderAsset:s,renderAssets:n}),[n,i,s]);return u.jsx($o.Provider,{value:a,children:e})},ir=e=>typeof window>"u"||e.startsWith("http://")||e.startsWith("https://")||e.startsWith("file://")||e.startsWith("blob:")||e.startsWith("data:")?e:new URL(e,window.origin).href,Nu=({trimAfter:e,mediaDurationInFrames:t,playbackRate:n,trimBefore:r})=>{let o=t;typeof e<"u"&&(o=e),typeof r<"u"&&(o-=r);const i=o/n;return Number(i.toFixed(10))},Lx=d.createContext(null),J2=()=>le.useContext(Lx),Lu=({durationInFrames:e,times:t=1/0,children:n,name:r,showInTimeline:o,...i})=>{const s=Ft(),{durationInFrames:a}=ht();if(Su(e,{component:"of the <Loop /> component",allowFloats:!0}),typeof t!="number")throw new TypeError(`You passed to "times" an argument of type ${typeof t}, but it must be a number.`);if(t!==1/0&&t%1!==0)throw new TypeError(`The "times" prop of a loop must be an integer, but got ${t}.`);if(t<0)throw new TypeError(`The "times" prop of a loop must be at least 0, but got ${t}`);const l=Math.ceil(a/e),c=Math.min(l,t),f=i.layout==="none"?void 0:i.style,p=e*(c-1),g=Math.floor(s/e)*e,w=Math.min(g,p),x=d.useMemo(()=>({numberOfTimes:Math.min(a/e,t),startOffset:-w,durationInFrames:e}),[a,e,w,t]),k=d.useMemo(()=>({iteration:Math.floor(s/e),durationInFrames:e}),[s,e]);return u.jsx(Lx.Provider,{value:k,children:u.jsx(_t,{durationInFrames:e,from:w,name:r??"<Loop>",_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/loop",_remotionInternalLoopDisplay:x,layout:i.layout,style:f,showInTimeline:o,children:n})})};Lu.useLoop=J2;var zt=({logLevel:e,tag:t,message:n,mountTime:r})=>{const o=[r?Date.now()-r+"ms ":null,t].filter(Boolean).join(" ");kt.trace({logLevel:e,tag:null},`[${o}]`,n)},zu=d.createContext({}),rg={},Bc=[],zx=({children:e})=>{const[t,n]=d.useState(()=>rg);return d.useEffect(()=>{const r=()=>{n(rg)};return Bc.push(r),()=>{Bc=Bc.filter(o=>o!==r)}},[]),u.jsx(zu.Provider,{value:t,children:e})},Dx=e=>{const t=e.indexOf("#");return t===-1?null:t},Q2=e=>{const t=Dx(e);return t===null?e:e.slice(0,t)},Ao=e=>{const t=d.useContext(zu),n=Dx(e),r=Q2(e);return t[r]?n!==null?t[r]+e.slice(n):t[r]:e},Du=(e,t)=>{if(typeof e.volume!="number"&&typeof e.volume!="function"&&typeof e.volume<"u")throw new TypeError(`You have passed a volume of type ${typeof e.volume} to your <${t} /> component. Volume must be a number or a function with the signature '(frame: number) => number' undefined.`);if(typeof e.volume=="number"&&e.volume<0)throw new TypeError(`You have passed a volume below 0 to your <${t} /> component. Volume must be between 0 and 1`);if(typeof e.playbackRate!="number"&&typeof e.playbackRate<"u")throw new TypeError(`You have passed a playbackRate of type ${typeof e.playbackRate} to your <${t} /> component. Playback rate must a real number or undefined.`);if(typeof e.playbackRate=="number"&&(isNaN(e.playbackRate)||!Number.isFinite(e.playbackRate)||e.playbackRate<=0))throw new TypeError(`You have passed a playbackRate of ${e.playbackRate} to your <${t} /> component. Playback rate must be a real number above 0.`);if(typeof e.preservePitch!="boolean"&&typeof e.preservePitch<"u")throw new TypeError(`'preservePitch' must be a boolean or undefined but got '${typeof e.preservePitch}' instead`)},eI=(e,t)=>{if(typeof e<"u"){if(typeof e!="number")throw new TypeError(`type of startFrom prop must be a number, instead got type ${typeof e}.`);if(isNaN(e)||e===1/0)throw new TypeError("startFrom prop can not be NaN or Infinity.");if(e<0)throw new TypeError(`startFrom must be greater than equal to 0 instead got ${e}.`)}if(typeof t<"u"){if(typeof t!="number")throw new TypeError(`type of endAt prop must be a number, instead got type ${typeof t}.`);if(isNaN(t))throw new TypeError("endAt prop can not be NaN.");if(t<=0)throw new TypeError(`endAt must be a positive number, instead got ${t}.`)}if(t<e)throw new TypeError("endAt prop must be greater than startFrom prop.")},tI=(e,t)=>{if(typeof e<"u"){if(typeof e!="number")throw new TypeError(`type of trimBefore prop must be a number, instead got type ${typeof e}.`);if(isNaN(e)||e===1/0)throw new TypeError("trimBefore prop can not be NaN or Infinity.");if(e<0)throw new TypeError(`trimBefore must be greater than equal to 0 instead got ${e}.`)}if(typeof t<"u"){if(typeof t!="number")throw new TypeError(`type of trimAfter prop must be a number, instead got type ${typeof t}.`);if(isNaN(t))throw new TypeError("trimAfter prop can not be NaN.");if(t<=0)throw new TypeError(`trimAfter must be a positive number, instead got ${t}.`)}if(t<=e)throw new TypeError("trimAfter prop must be greater than trimBefore prop.")},Ou=({startFrom:e,endAt:t,trimBefore:n,trimAfter:r})=>{if(typeof e<"u"&&typeof n<"u")throw new TypeError("Cannot use both startFrom and trimBefore props. Use trimBefore instead as startFrom is deprecated.");if(typeof t<"u"&&typeof r<"u")throw new TypeError("Cannot use both endAt and trimAfter props. Use trimAfter instead as endAt is deprecated.");typeof n<"u"||typeof r<"u"?tI(n,r):(typeof e<"u"||typeof t<"u")&&eI(e,t)},Bu=({startFrom:e,endAt:t,trimBefore:n,trimAfter:r})=>({trimBeforeValue:n??e??void 0,trimAfterValue:r??t??void 0}),nI=(e,t)=>{switch(t.type){case"got-duration":{const n=ir(t.src);return e[n]===t.durationInSeconds?e:{...e,[n]:t.durationInSeconds}}default:return e}},Wp=d.createContext({durations:{},setDurations:()=>{throw new Error("context missing")}}),Ox=({children:e})=>{const[t,n]=d.useReducer(nI,{}),r=d.useMemo(()=>({durations:t,setDurations:n}),[t]);return u.jsx(Wp.Provider,{value:r,children:e})},Vp=({crossOrigin:e,requestsVideoFrame:t,isClientSideRendering:n})=>{if(e!=null)return e;if(n||t)return"anonymous"},Gl=({mediaRef:e,mediaType:t,onAutoPlayError:n,logLevel:r,mountTime:o,reason:i,isPlayer:s})=>{const{current:a}=e;if(!a)return;zt({logLevel:r,tag:"play",message:`Attempting to play ${a.src}. Reason: ${i}`,mountTime:o});const l=a.play();l.catch&&l.catch(c=>{if(a&&!c.message.includes("request was interrupted by a call to pause")&&!c.message.includes("The operation was aborted.")&&!c.message.includes("The fetching process for the media resource was aborted by the user agent")&&!c.message.includes("request was interrupted by a new load request")&&!c.message.includes("because the media was removed from the document")&&!(c.message.includes("user didn't interact with the document")&&a.muted)&&(console.log(`Could not play ${t} due to following error: `,c),!a.muted)){if(n){n();return}t==="video"&&s&&(kt.info({logLevel:r,tag:"<"+t+">"},"The video will be muted and we'll retry playing it."),kt.info({logLevel:r,tag:"<"+t+">"},"Use onAutoPlayError() to handle this error yourself."),a.muted=!0,a.play())}})},Hp=({audioContext:e,ref:t})=>{let n=null,r=!1,o=e;return{setAudioContext:i=>{o=i},attemptToConnect:()=>{if(r)throw new Error("SharedElementSourceNode has been disposed");!n&&t.current&&o&&(n=o.createMediaElementSource(t.current))},get:()=>{if(!n)throw new Error("Audio element not connected");return n},cleanup:()=>{n&&(n.disconnect(),n=null),r=!0}}},og=!1,rI=e=>{og||(og=!0,typeof window<"u"&&kt.warn({logLevel:e,tag:null},"AudioContext is not supported in this browser"))},oI=({logLevel:e,latencyHint:t,audioEnabled:n,sampleRate:r})=>{const o=ct(),i=d.useRef(r);if(r!==i.current)throw new Error(`Changing the AudioContext sample rate dynamically is not supported. The sample rate was initialized with ${i.current} Hz, but ${r} Hz was passed later.`);return d.useMemo(()=>{if(o.isRendering||!n)return null;if(typeof AudioContext>"u")return rI(e),null;const a=new AudioContext({latencyHint:t,sampleRate:r}),l=a.createGain();l.connect(a.destination),kt.trace({logLevel:e,tag:"audio"},"Creating new audio context"),a.suspend();let c=null;return{audioContext:a,gainNode:l,getState:()=>{const g=a.state;return c==="running"&&g!=="running"?"suspended-to-running":c==="suspended"&&g!=="suspended"?"running-to-suspended":g},resume:()=>{c="running";const g=a.resume();return g.finally(()=>{c==="running"&&(c=null)}),g},suspend:()=>{c="suspended";const g=a.suspend();return g.finally(()=>{c==="suspended"&&(c=null)}),g}}},[e,t,o.isRendering,n,r])},iI=(e,t)=>new Promise(n=>{const r=e.currentTime,i=e.getOutputTimestamp().performanceTime,s=performance.now(),a=()=>{var p;const{currentTime:l}=e,c=e.getOutputTimestamp(),f=performance.now()-s;if(i!==void 0&&c.performanceTime!==void 0&&c.performanceTime>i&&c.contextTime!==void 0&&c.contextTime>r){kt.verbose({logLevel:t,tag:"audio"},`waitUntilActuallyResumed: getOutputTimestamp.performanceTime advanced from ${i.toFixed(6)} to ${c.performanceTime.toFixed(6)} after ${f.toFixed(1)}ms. currentTime=${l.toFixed(6)} (advanced by ${(l-r).toFixed(6)}), getOutputTimestamp.performanceTime=${((p=c.performanceTime)==null?void 0:p.toFixed(1))??"undefined"}`),n();return}requestAnimationFrame(a)};requestAnimationFrame(a)}),Wc="data:audio/mp3;base64,/+MYxAAJcAV8AAgAABn//////+/gQ5BAMA+D4Pg+BAQBAEAwD4Pg+D4EBAEAQDAPg++hYBH///hUFQVBUFREDQNHmf///////+MYxBUGkAGIMAAAAP/29Xt6lUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV/+MYxDUAAANIAAAAAFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV",sI=(e,t)=>{const n=Object.keys(e).sort(),r=Object.keys(t).sort();if(n.length!==r.length)return!1;for(let o=0;o<n.length;o++)if(n[o]!==r[o]||e[n[o]]!==t[r[o]])return!1;return!0},aI=(e,t,n)=>e==="src"&&!n.startsWith("data:")&&!t.startsWith("data:")?new URL(n,window.origin).toString()!==new URL(t,window.origin).toString():n!==t,Oi=d.createContext(null),Wu=d.createContext(null),lI=e=>{if(e==="suspended"||e==="running-to-suspended"||e==="interrupted")return!0;if(e==="running"||e==="suspended-to-running")return!1;throw new Error(`Unexpected audio context state: ${e}`)},Bx=({children:e,audioLatencyHint:t,audioEnabled:n,previewSampleRate:r})=>{const o=sr(),i=r??48e3;d.useEffect(()=>{typeof window>"u"||(window.remotion_sampleRate=i)},[i]);const s=oI({logLevel:o,latencyHint:t,audioEnabled:n,sampleRate:i}),a=d.useRef(!1),l=d.useRef(null),c=d.useMemo(()=>({value:0}),[]),f=d.useRef([]),p=d.useMemo(()=>({dispatch:S=>{f.current.forEach(b=>b(S))},subscribe:S=>(f.current.push(S),{remove:()=>{f.current=f.current.filter(b=>b!==S)}})}),[]),m=d.useRef({scheduledEndTime:null,mediaEndTime:null}),g=d.useRef(new Map),w=d.useCallback(S=>{g.current.delete(S)},[]),x=d.useMemo(()=>({node:S,mediaTimestamp:b,sourceOffset:E,scheduledTime:I,duration:T,offset:j,originalUnloopedMediaTimestamp:_})=>{if(!s)throw new Error("Audio context not found");const N=s.getState();if(N==="closed")return{type:"not-started",reason:"audio context is closed"};const W=lI(N);T>0&&(W?g.current.set(S,{scheduledTime:I,offset:j,duration:T}):S.start(I,j,T));const M=I+T/S.playbackRate.value,$=b+j-E,V=$+T,L=s.audioContext.baseLatency+s.audioContext.outputLatency,A=I-s.audioContext.currentTime,R=m.current,C=R.scheduledEndTime!==null&&Math.abs(I-R.scheduledEndTime)>.001,P=R.mediaEndTime!==null&&Math.abs($-R.mediaEndTime)>.001;return kt.verbose({logLevel:o,tag:"audio-scheduling"},"scheduled %c%s%c %s %c%s%c %s %c%s%c %s %s %s %s %s",C?"color: red; font-weight: bold":"",I.toFixed(4),"",M.toFixed(4),P?"color: red; font-weight: bold":"",$.toFixed(4),"",V.toFixed(4),T<0||A<0?"color: red; font-weight: bold":"color: blue; font-weight: bold",T<0?"missed "+Math.abs(j).toFixed(2)+"s":Math.abs(A).toFixed(2)+(A<0?" delay":" ahead"),"","current="+s.audioContext.currentTime.toFixed(4),"offset="+j.toFixed(4),"latency="+L.toFixed(4),"state="+s.audioContext.state,_!==$?"original_ts="+_.toFixed(4):"","action="+(W?"schedule":"start"),""),R.scheduledEndTime=M,R.mediaEndTime=V,T>0?{type:"started",scheduledTime:I}:{type:"not-started",reason:"missed "+Math.abs(j).toFixed(2)+"s"}},[s,o]),k=d.useCallback(()=>{if(!s||a.current)return Promise.resolve();a.current=!0,s.gainNode.gain.cancelScheduledValues(s.audioContext.currentTime),s.gainNode.gain.setValueAtTime(0,s.audioContext.currentTime),s.gainNode.gain.linearRampToValueAtTime(1,s.audioContext.currentTime+.03),g.current.forEach((b,E)=>{E.start(b.scheduledTime,b.offset,b.duration)}),g.current.clear();const S=s.resume();return l.current=new Promise(b=>{iI(s.audioContext,o).then(b),S.catch(E=>{kt.warn({logLevel:o,tag:"audio"},"AudioContext resume rejected, continuing without audio sync",E),b()})}).finally(()=>{l.current=null}),S.catch(()=>{})},[s,o]),h=d.useCallback(()=>l.current,[]),y=d.useCallback(()=>!s||!a.current?Promise.resolve():(a.current=!1,s.suspend()),[s]),v=d.useMemo(()=>({audioContext:(s==null?void 0:s.audioContext)??null,getAudioContextState:()=>(s==null?void 0:s.getState())??null,gainNode:(s==null?void 0:s.gainNode)??null,audioSyncAnchor:c,audioSyncAnchorEmitter:p,scheduleAudioNode:x,resume:k,suspend:y,getIsResumingAudioContext:h,unscheduleAudioNode:w}),[s,c,p,x,k,y,h,w]);return u.jsx(Oi.Provider,{value:v,children:e})},Wx=({children:e,numberOfAudioTags:t})=>{const n=d.useRef([]),[r]=d.useState(t);if(t!==r)throw new Error("The number of shared audio tags has changed dynamically. Once you have set this property, you cannot change it afterwards.");const o=sr(),i=oa(),s=ct(),a=d.useContext(Oi),l=(a==null?void 0:a.audioContext)??null,c=a==null?void 0:a.resume,[f]=d.useState(()=>new Array(t).fill(!0).map(()=>{const S=d.createRef();return{id:Math.random(),ref:S,mediaElementSourceNode:Hp({audioContext:l,ref:S})}}));for(const{mediaElementSourceNode:S}of f)S==null||S.setAudioContext(l);(le.useInsertionEffect??le.useLayoutEffect)(()=>()=>{requestAnimationFrame(()=>{f.forEach(({mediaElementSourceNode:S})=>{S==null||S.cleanup()})})},[f]);const m=d.useRef(new Array(t).fill(!1)),g=d.useCallback(()=>{f.forEach(({ref:S,id:b})=>{var T;const E=(T=n.current)==null?void 0:T.find(j=>j.id===b),{current:I}=S;if(I){if(E===void 0){I.src!==Wc&&(I.src=Wc);return}if(!E)throw new TypeError("Expected audio data to be there");Object.keys(E.props).forEach(j=>{aI(j,E.props[j],I[j])&&(I[j]=E.props[j])})}})},[f]),w=d.useCallback(S=>{var L,A;const{aud:b,audioId:E,premounting:I,postmounting:T}=S,j=(L=n.current)==null?void 0:L.find(R=>R.audioId===E);if(j)return j;const _=m.current.findIndex(R=>R===!1);if(_===-1)throw new Error(`Tried to simultaneously mount ${t+1} <Html5Audio /> tags at the same time. With the current settings, the maximum amount of <Html5Audio /> tags is limited to ${t} 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.`);const{id:N,ref:W,mediaElementSourceNode:M}=f[_],$=[...m.current];$[_]=N,m.current=$;const V={props:b,id:N,el:W,audioId:E,mediaElementSourceNode:M,premounting:I,audioMounted:!!W.current,postmounting:T,cleanupOnMediaTagUnmount:()=>{}};return(A=n.current)==null||A.push(V),g(),V},[t,f,g]),x=d.useCallback(S=>{var I;const b=[...m.current],E=f.findIndex(T=>T.id===S);if(E===-1)throw new TypeError(`Unknown audio ref ${S}; refs: ${f.map(T=>T.id).join(", ")}`);b[E]=!1,m.current=b,n.current=(I=n.current)==null?void 0:I.filter(T=>T.id!==S),g()},[f,g]),k=d.useCallback(({aud:S,audioId:b,id:E,premounting:I,postmounting:T})=>{var _;let j=!1;n.current=(_=n.current)==null?void 0:_.map(N=>{const W=!!N.el.current;return N.audioMounted!==W&&(j=!0),N.id===E?sI(S,N.props)&&N.premounting===I&&N.postmounting===T?N.audioMounted===W?N:{...N,audioMounted:W}:(j=!0,{...N,props:S,premounting:I,postmounting:T,audioId:b,audioMounted:W}):N.audioMounted===W?N:{...N,audioMounted:W}}),j&&g()},[g]),h=d.useCallback(()=>{f.forEach(S=>{const b=n.current.find(E=>E.el===S.ref);b!=null&&b.premounting||Gl({mediaRef:S.ref,mediaType:"audio",onAutoPlayError:null,logLevel:o,mountTime:i,reason:"playing all audios",isPlayer:s.isPlayer})}),c==null||c()},[o,i,f,s.isPlayer,c]),y=d.useMemo(()=>({registerAudio:w,unregisterAudio:x,updateAudio:k,playAllAudios:h,numberOfAudioTags:t}),[t,h,w,x,k]),v=d.useMemo(()=>f.map(({id:S,ref:b})=>u.jsx("audio",{ref:b,preload:"metadata",src:Wc},S)),[f]);return u.jsxs(Wu.Provider,{value:y,children:[v,e]})},uI=({aud:e,audioId:t,premounting:n,postmounting:r})=>{var l;const o=d.useContext(Oi),i=d.useContext(Wu),[s]=d.useState(()=>{if(i&&i.numberOfAudioTags>0)return i.registerAudio({aud:e,audioId:t,premounting:n,postmounting:r});const c=le.createRef(),f=Hp({audioContext:(o==null?void 0:o.audioContext)??null,ref:c});return{el:c,id:Math.random(),props:e,audioId:t,mediaElementSourceNode:f,premounting:n,audioMounted:!!c.current,postmounting:r,cleanupOnMediaTagUnmount:()=>{f==null||f.cleanup()}}});(l=s.mediaElementSourceNode)==null||l.setAudioContext((o==null?void 0:o.audioContext)??null);const a=le.useInsertionEffect??le.useLayoutEffect;return typeof document<"u"&&(a(()=>{i&&i.numberOfAudioTags>0&&i.updateAudio({id:s.id,aud:e,audioId:t,premounting:n,postmounting:r})},[e,i,s.id,t,n,r]),a(()=>()=>{i&&i.numberOfAudioTags>0&&i.unregisterAudio(s.id)},[i,s.id])),s},cI=1e-5,Xl=(e,t)=>Math.abs(e-t)<cI,Vx=(e,t)=>Math.round(e/t*100)/100,yf=()=>typeof window>"u"||!/AppleWebKit/.test(window.navigator.userAgent)?!1:!window.navigator.userAgent.includes("Chrome/"),Vu=()=>typeof window>"u"?!1:/iP(ad|od|hone)/i.test(window.navigator.userAgent)&&yf(),dI=e=>Vu()&&e.startsWith("blob:"),vf=({actualFrom:e,fps:t})=>Vx(Math.max(0,-e),t),wf=({duration:e,fps:t})=>Vx(e,t),fI=({actualSrc:e,actualFrom:t,duration:n,fps:r})=>{if(dI(e)||e.startsWith("data:")||!!new URL(e,(typeof window>"u"?null:window.location.href)??"http://localhost:3000").hash||!Number.isFinite(t))return e;const i=`${e}#t=${vf({actualFrom:t,fps:r})}`;return Number.isFinite(n)?`${i},${wf({duration:n,fps:r})}`:i},pI=({prevStartFrom:e,newStartFrom:t,prevDuration:n,newDuration:r,fps:o})=>{const i=vf({actualFrom:e,fps:o}),s=vf({actualFrom:t,fps:o}),a=wf({duration:n,fps:o}),l=wf({duration:r,fps:o});return!(s<i||l>a)},hI=({actualSrc:e,actualFrom:t,duration:n,fps:r})=>{const o=d.useRef(t),i=d.useRef(n),s=d.useRef(e);return(!pI({prevStartFrom:o.current,newStartFrom:t,prevDuration:i.current,newDuration:n,fps:r})||e!==s.current)&&(o.current=t,i.current=n,s.current=e),fI({actualSrc:s.current,actualFrom:o.current,duration:i.current,fps:r})},ig=!1,mI=e=>{ig||(ig=!0,kt.warn({logLevel:e,tag:null},"In Safari, setting a volume and a playback rate at the same time is buggy."),kt.warn({logLevel:e,tag:null},"In Desktop Safari, only volumes <= 1 will be applied."),kt.warn({logLevel:e,tag:null},e,"In Mobile Safari, the volume will be ignored and set to 1 if a playbackRate is set."))},Hx=({mediaRef:e,volume:t,logLevel:n,source:r,shouldUseWebAudioApi:o})=>{var m,g,w;const i=d.useRef(null),s=d.useRef(t);s.current=t;const a=d.useContext(Oi);if(!a)throw new Error("useAmplification must be used within a SharedAudioContext");const{audioContext:l,gainNode:c}=a;if(typeof window<"u"&&d.useLayoutEffect(()=>{var k,h;if(!l||!e.current||!o)return;if(e.current.playbackRate!==1&&yf()){mI(n);return}if(!r||!c)return;const x=new GainNode(l,{gain:s.current});return r.attemptToConnect(),r.get().connect(x),x.connect(c),i.current={gainNode:x},kt.trace({logLevel:n,tag:null},`Starting to amplify ${(k=e.current)==null?void 0:k.src}. Gain = ${s.current}, playbackRate = ${(h=e.current)==null?void 0:h.playbackRate}`),()=>{i.current=null,x.disconnect(),r.get().disconnect()}},[n,e,l,r,o,c]),i.current){const x=t;Xl(i.current.gainNode.gain.value,x)||(i.current.gainNode.gain.value=x,kt.trace({logLevel:n,tag:null},`Setting gain to ${x} for ${(m=e.current)==null?void 0:m.src}`))}return(yf()&&e.current&&((g=e.current)==null?void 0:g.playbackRate)!==1||!o)&&e.current&&!Xl(t,(w=e.current)==null?void 0:w.volume)&&(e.current.volume=Math.min(t,1)),i},Io=()=>{const e=d.useContext(xt);return(e==null?void 0:e.cumulatedNegativeFrom)??0},Bi=e=>{const t=Lu.useLoop(),n=Ft(),r=Io();return e==="repeat"||t===null?n+r:n+r+t.durationInFrames*t.iteration},Ux=e=>{if(/data:|blob:/.test(e.substring(0,5)))return"Data URL";const t=e.split("/").map(n=>n.split("\\")).flat(1);return t[t.length-1]},gI=({compositionDurationInFrames:e,playbackRate:t,trimBefore:n,trimAfter:r,parentSequenceDurationInFrames:o,loop:i})=>{if(i)return e;const s=Nu({mediaDurationInFrames:e*t+(n??0),playbackRate:t,trimBefore:n,trimAfter:r});if(o!==null){const a=Math.min(o,s);return Number(a.toFixed(10))}return s},No=({frame:e,volume:t,mediaVolume:n=1})=>{if(typeof t=="number")return t*n;if(typeof t>"u")return Number(n);const r=t(e)*n;if(typeof r!="number")throw new TypeError(`You passed in a a function to the volume prop but it did not return a number but a value of type ${typeof r} for frame ${e}`);if(Number.isNaN(r))throw new TypeError(`You passed in a function to the volume prop but it returned NaN for frame ${e}.`);if(!Number.isFinite(r))throw new TypeError(`You passed in a function to the volume prop but it returned a non-finite number for frame ${e}.`);return Math.max(0,r)},sg={},yI=e=>{sg[e]||(console.warn(e),sg[e]=!0)},Zx=({volume:e,mediaVolume:t,mediaType:n,src:r,displayName:o,trimBefore:i,trimAfter:s,playbackRate:a,sequenceDurationInFrames:l,mediaStartsAt:c,loop:f})=>{if(!r)throw new Error("No src passed");const p=d.useContext(xt),[m]=d.useState(()=>e),g=gI({compositionDurationInFrames:l,playbackRate:a,trimBefore:i,trimAfter:s,parentSequenceDurationInFrames:(p==null?void 0:p.durationInFrames)??null,loop:f}),w=d.useMemo(()=>typeof e=="number"?e:new Array(Math.floor(Math.max(0,g+c))).fill(!0).map((S,b)=>No({frame:b+c,volume:e,mediaVolume:t})).join(","),[g,c,e,t]);d.useEffect(()=>{typeof e=="number"&&e!==m&&yI(`Remotion: The ${n} with src ${r} has changed it's volume. Prefer the callback syntax for setting volume to get better timeline display: https://www.remotion.dev/docs/audio/volume`)},[m,n,r,e]);const x=typeof e=="function",k=bu(),{rootId:h}=oo(),y=0-c+(i??0);return d.useMemo(()=>({volumes:w,duration:g,doesVolumeChange:x,nonce:k,rootId:h,finalDisplayName:o??Ux(r),startMediaFrom:y,src:r,playbackRate:a}),[w,g,x,k,h,o,r,y,a])},Up=({volume:e,mediaVolume:t,src:n,mediaType:r,playbackRate:o,displayName:i,id:s,getStack:a,showInTimeline:l,premountDisplay:c,postmountDisplay:f,loopDisplay:p,documentationLink:m,refForOutline:g})=>{const w=d.useContext(xt),x=Io(),{registerSequence:k,unregisterSequence:h}=d.useContext(zi),{durationInFrames:y}=ht(),v=Io(),{volumes:S,duration:b,doesVolumeChange:E,nonce:I,rootId:T,finalDisplayName:j}=Zx({volume:e,mediaVolume:t,mediaType:r,src:n,displayName:i,trimAfter:void 0,trimBefore:void 0,playbackRate:o,sequenceDurationInFrames:y,mediaStartsAt:v,loop:!1}),{isStudio:_}=ct();d.useEffect(()=>{var N,W;if(!n)throw new Error("No src passed");if(!(!_&&((W=(N=window.process)==null?void 0:N.env)==null?void 0:W.NODE_ENV)!=="test")&&l)return k({type:r,src:n,id:s,duration:b,from:0,trimBefore:null,parent:(w==null?void 0:w.id)??null,displayName:j,documentationLink:m,rootId:T,volume:S,showInTimeline:!0,nonce:I.get(),startMediaFrom:0-x,mediaFrameAtSequenceZero:null,doesVolumeChange:E,loopDisplay:p,playbackRate:o,getStack:a,premountDisplay:c,postmountDisplay:f,controls:null,effects:[],refForOutline:g,isInsideSeries:!1,frozenFrame:null,frozenMediaFrame:null}),()=>{h(s)}},[b,s,w,n,k,h,S,E,I,r,x,o,a,l,c,f,p,m,T,j,_,g])},vI=(e,t)=>{const[n,r]=d.useState([]),[o,i]=d.useState([]),[s,a]=d.useState([]),c=ct().isRendering,f=d.useRef(!1),p=d.useCallback(w=>{if(c)return{unblock:()=>{}};let x=!1;return r(k=>[...k,w]),{unblock:()=>{x||(x=!0,r(k=>{const h=k.filter(y=>y!==w);return h.length===k.length?k:h}))}}},[c]),m=d.useCallback(w=>(i(x=>[...x,w]),{remove:()=>{i(x=>x.filter(k=>k!==w))}}),[]),g=d.useCallback(w=>(a(x=>[...x,w]),{remove:()=>{a(x=>x.filter(k=>k!==w))}}),[]);return d.useEffect(()=>{c||n.length>0&&!f.current&&(f.current=!0,o.forEach(w=>w()),zt({logLevel:e,message:"Player is entering buffer state",mountTime:t,tag:"player"}))},[n]),typeof window<"u"&&d.useLayoutEffect(()=>{c||n.length===0&&f.current&&(f.current=!1,s.forEach(w=>w()),zt({logLevel:e,message:"Player is exiting buffer state",mountTime:t,tag:"player"}))},[n]),d.useMemo(()=>({addBlock:p,listenForBuffering:m,listenForResume:g,buffering:f}),[p,f,m,g])},Wi=le.createContext(null),Kx=({children:e})=>{const{logLevel:t,mountTime:n}=d.useContext(_o),r=vI(t??"info",n);return u.jsx(Wi.Provider,{value:r,children:e})},Yx=e=>{const[t,n]=d.useState(e.buffering.current);return d.useEffect(()=>{const r=()=>{n(!0)},o=()=>{n(!1)},i=e.listenForBuffering(r),s=e.listenForResume(o);return()=>{i.remove(),s.remove()}},[e]),t},Hu=()=>{const e=d.useContext(Wi),t=sr(),n=e?e.addBlock:null;return d.useMemo(()=>({delayPlayback:()=>{if(!n)throw new 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 <Composition>. 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");kt.trace({logLevel:t,tag:"[buffer-state]"},"Adding buffer handle",new Error().stack);const{unblock:r}=n({id:String(Math.random())});let o=!1;return{unblock:()=>{o||(o=!0,kt.trace({logLevel:t,tag:"[buffer-state]"},"Removing buffer handle"),r())}}}}),[n,t])},wI=()=>/^((?!chrome|android).)*safari/i.test(window.navigator.userAgent),xI=({mediaRef:e,mediaType:t,onVariableFpsVideoDetected:n,pauseWhenBuffering:r,logLevel:o,mountTime:i})=>{const s=d.useRef(!1),{delayPlayback:a}=Hu(),l=d.useCallback(c=>{var w;if(t!=="video"||!r)return;const f=e.current;if(!f)return;if(f.readyState>=f.HAVE_FUTURE_DATA&&!wI()){zt({logLevel:o,message:`Not using buffer until first frame, because readyState is ${f.readyState} and is not Safari or Desktop Chrome`,mountTime:i,tag:"buffer"});return}if(!f.requestVideoFrameCallback){zt({logLevel:o,message:"Not using buffer until first frame, because requestVideoFrameCallback is not supported",mountTime:i,tag:"buffer"});return}s.current=!0,zt({logLevel:o,message:`Buffering ${(w=e.current)==null?void 0:w.src} until the first frame is received`,mountTime:i,tag:"buffer"});const p=a(),m=()=>{p.unblock(),f.removeEventListener("ended",m,{once:!0}),f.removeEventListener("pause",m,{once:!0}),s.current=!1},g=()=>{m()};f.requestVideoFrameCallback((x,k)=>{Math.abs(k.mediaTime-c)>.5&&n(),m()}),f.addEventListener("ended",g,{once:!0}),f.addEventListener("pause",g,{once:!0}),f.addEventListener("canplay",g,{once:!0})},[a,o,e,t,i,n,r]);return d.useMemo(()=>({isBuffering:()=>s.current,bufferUntilFirstFrame:l}),[l])},bI=e=>{const{duration:t,currentTime:n,paused:r,ended:o,desiredUnclampedTime:i,mediaTagTime:s,mediaTagLastUpdate:a,rvcTime:l,rvcLastUpdate:c,isVariableFpsVideo:f,acceptableTimeShift:p,lastSeekDueToShift:m,playing:g,playbackRate:w,mediaTagBufferingOrStalled:x,playerBuffering:k,absoluteFrame:h,onlyWarnForMediaSeekingError:y,isPremounting:v,isPostmounting:S,pauseWhenBuffering:b}=e,E=!Number.isNaN(t)&&Number.isFinite(t)?Math.min(t,i):i,I=Math.abs(E-s),T=l?Math.abs(E-l):null,j=c&&l>a?T:I,_=T&&!f?j:I;if(_>p&&m!==E)return{type:"seek-due-to-shift",shouldBeTime:E,why:`because time shift is too big. shouldBeTime = ${E}, isTime = ${s}, requestVideoCallbackTime = ${l}, timeShift = ${_}${f?", isVariableFpsVideo = true":""}, isPremounting = ${v}, isPostmounting = ${S}, pauseWhenBuffering = ${b}`,bufferUntilFirstFrame:g&&w>0,playReason:g&&r?"player is playing but media tag is paused, and just seeked":null,warnAboutNonSeekable:!y};const N=g?.15:.01,W=Math.abs(n-E)>N;if(!g||k&&!x)return{type:"seek-if-not-playing",shouldBeTime:E,why:W?`not playing or something else is buffering. time offset is over seek threshold (${N})`:null};if(!g||k)return{type:"none"};const $=r&&!o;if($||h===0){const L=$?"media tag is paused":"absolute frame is 0";return{type:"play-and-seek",shouldBeTime:E,why:W?`is over timeshift threshold (threshold = ${N}) and ${L}`:null,playReason:`player is playing and ${L}`,bufferUntilFirstFrame:!f&&w>0}}return{type:"none"}},SI=e=>{var r,o;const t=le.useRef({time:((r=e.current)==null?void 0:r.currentTime)??0,lastUpdate:performance.now()}),n=((o=e.current)==null?void 0:o.currentTime)??null;return n!==null&&t.current.time!==n&&(t.current.time=n,t.current.lastUpdate=performance.now()),t},yl=({mediaRef:e,time:t,logLevel:n,why:r,mountTime:o})=>{const i=Vu()?Number(t.toFixed(1)):t;return zt({logLevel:n,tag:"seek",message:`Seeking from ${e.currentTime} to ${i}. src= ${e.src} Reason: ${r}`,mountTime:o}),e.currentTime=i,i},kI=({element:e,shouldBuffer:t,isPremounting:n,isPostmounting:r,logLevel:o,mountTime:i,src:s})=>{const a=Hu(),[l,c]=d.useState(!1);return d.useEffect(()=>{let f=[];const{current:p}=e;if(!p||!t)return;if(n||r){if((n||r)&&p.readyState<p.HAVE_FUTURE_DATA&&!navigator.userAgent.includes("Firefox/")){zt({logLevel:o,message:`Calling .load() on ${p.src} because readyState is ${p.readyState} and it is not Firefox. Element is premounted ${p.playbackRate}`,tag:"load",mountTime:i});const x=p.playbackRate;p.load(),p.playbackRate=x}return}const m=x=>{let k=!1;f.forEach(h=>{h(x),k=!0}),f=[],c(h=>(h&&(k=!0),!1)),k&&zt({logLevel:o,message:`Unmarking as buffering: ${p.src}. Reason: ${x}`,tag:"buffer",mountTime:i})},g=x=>{c(!0),zt({logLevel:o,message:`Marking as buffering: ${p.src}. Reason: ${x}`,tag:"buffer",mountTime:i});const{unblock:k}=a.delayPlayback(),h=()=>{m('"canplay" was fired'),w()},y=()=>{m('"error" event was occurred'),w()};p.addEventListener("canplay",h,{once:!0}),f.push(()=>{p.removeEventListener("canplay",h)}),p.addEventListener("error",y,{once:!0}),f.push(()=>{p.removeEventListener("error",y)}),f.push(v=>{zt({logLevel:o,message:`Unblocking ${p.src} from buffer. Reason: ${v}`,tag:"buffer",mountTime:i}),k()})},w=()=>{if(p.readyState<p.HAVE_FUTURE_DATA){if(g(`readyState is ${p.readyState}, which is less than HAVE_FUTURE_DATA`),!navigator.userAgent.includes("Firefox/")){zt({logLevel:o,message:`Calling .load() on ${s} because readyState is ${p.readyState} and it is not Firefox. ${p.playbackRate}`,tag:"load",mountTime:i});const x=p.playbackRate;p.load(),p.playbackRate=x}}else{const x=()=>{g('"waiting" event was fired')};p.addEventListener("waiting",x),f.push(()=>{p.removeEventListener("waiting",x)})}};return w(),()=>{m("element was unmounted or prop changed")}},[a,s,e,n,r,o,t,i]),l},EI=({mediaRef:e,mediaType:t,lastSeek:n,onVariableFpsVideoDetected:r})=>{const o=d.useRef(null);return d.useEffect(()=>{const{current:i}=e;if(i)o.current={time:i.currentTime,lastUpdate:performance.now()};else{o.current=null;return}if(t!=="video"){o.current=null;return}const s=i;if(!s.requestVideoFrameCallback)return;let a=()=>{};const l=()=>{if(!s)return;const c=s.requestVideoFrameCallback((f,p)=>{if(o.current!==null){const m=Math.abs(o.current.time-p.mediaTime),g=Math.abs(n.current===null?1/0:p.mediaTime-n.current);m>.5&&g>.5&&p.mediaTime>o.current.time&&r()}o.current={time:p.mediaTime,lastUpdate:performance.now()},l()});a=()=>{s.cancelVideoFrameCallback(c),a=()=>{}}};return l(),()=>{a()}},[n,e,t,r]),o},Gx=({frame:e,playbackRate:t,startFrom:n})=>Di(e,[-1,n,n+1],[-1,n,n+t]),Xx=({fps:e,frame:t,playbackRate:n,startFrom:r})=>{const o=Gx({frame:t,playbackRate:n,startFrom:r}),i=1e3/e;return o*i/1e3},ag={},CI=(e,t)=>{if(e===null||e.seekable.length===0||e.seekable.length>1||ag[e.src])return;const n={start:e.seekable.start(0),end:e.seekable.end(0)};if(n.start===0&&n.end===0){const r=[`The media ${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(`
57
+ `);console.error(r),ag[e.src]=!0}},qx=({mediaRef:e,src:t,mediaType:n,playbackRate:r,preservePitch:o=!0,onlyWarnForMediaSeekingError:i,acceptableTimeshift:s,pauseWhenBuffering:a,isPremounting:l,isPostmounting:c,onAutoPlayError:f})=>{const{playbackRate:p}=Mp(),m=Ft(),g=io(),[w]=Jw(),x=d.useContext(Wi),{fps:k}=ht(),h=Io(),y=d.useRef(null),v=d.useRef(null),S=sr(),b=oa();if(!x)throw new Error("useMediaPlayback must be used inside a <BufferingContext>");const E=d.useRef({}),I=d.useCallback(()=>{t&&(E.current[t]||(kt.verbose({logLevel:S,tag:null},`Detected ${t} as a variable FPS video. Disabling buffering while seeking.`),E.current[t]=!0))},[S,t]),T=EI({mediaRef:e,mediaType:n,lastSeek:v,onVariableFpsVideoDetected:I}),j=SI(e),_=Xx({frame:m,playbackRate:r,startFrom:-h,fps:k}),N=kI({element:e,shouldBuffer:a,isPremounting:l,isPostmounting:c,logLevel:S,mountTime:b,src:t??null}),{bufferUntilFirstFrame:W,isBuffering:M}=xI({mediaRef:e,mediaType:n,onVariableFpsVideoDetected:I,pauseWhenBuffering:a,logLevel:S,mountTime:b}),$=r*p,V=(()=>{var z;return(z=e.current)!=null&&z.duration?Math.min(e.current.duration,s??.65):s??.65})(),L=Yx(x);d.useEffect(()=>{var P,z,O,D,Z;if((P=e.current)!=null&&P.paused)return;if(!w){zt({logLevel:S,tag:"pause",message:`Pausing ${(z=e.current)==null?void 0:z.src} because ${l?"media is premounting":c?"media is postmounting":"Player is not playing"}`,mountTime:b}),(O=e.current)==null||O.pause();return}const R=N||M();x.buffering.current&&!R&&(zt({logLevel:S,tag:"pause",message:`Pausing ${(D=e.current)==null?void 0:D.src} because player is buffering but media tag is not`,mountTime:b}),(Z=e.current)==null||Z.pause())},[M,N,x,L,l,S,e,n,b,w,c]);const A=ct();d.useLayoutEffect(()=>{const R=Math.max(0,$);e.current&&e.current.playbackRate!==R&&(e.current.playbackRate=R),e.current&&e.current.preservesPitch!==o&&(e.current.preservesPitch=o)},[e,$,o]),d.useEffect(()=>{var z,O;const R=n==="audio"?"<Html5Audio>":"<Html5Video>";if(!e.current)throw new Error(`No ${n} ref found`);if(!t)throw new Error(`No 'src' attribute was passed to the ${R} element.`);const{current:C}=e,P=bI({duration:C.duration,currentTime:C.currentTime,paused:C.paused,ended:C.ended,desiredUnclampedTime:_,mediaTagTime:j.current.time,mediaTagLastUpdate:j.current.lastUpdate,rvcTime:((z=T.current)==null?void 0:z.time)??null,rvcLastUpdate:((O=T.current)==null?void 0:O.lastUpdate)??null,isVariableFpsVideo:!!E.current[t],acceptableTimeShift:V,lastSeekDueToShift:y.current,playing:w,playbackRate:$,mediaTagBufferingOrStalled:N||M(),playerBuffering:x.buffering.current,absoluteFrame:g,onlyWarnForMediaSeekingError:i,isPremounting:l,isPostmounting:c,pauseWhenBuffering:a});if(P.type!=="none"){if(P.type==="seek-due-to-shift"){v.current=yl({mediaRef:C,time:P.shouldBeTime,logLevel:S,why:P.why,mountTime:b}),y.current=v.current,P.bufferUntilFirstFrame&&W(P.shouldBeTime),P.playReason!==null&&Gl({mediaRef:e,mediaType:n,onAutoPlayError:f,logLevel:S,mountTime:b,reason:P.playReason,isPlayer:A.isPlayer}),P.warnAboutNonSeekable&&CI(C);return}if(P.type==="seek-if-not-playing"){P.why!==null&&(v.current=yl({mediaRef:C,time:P.shouldBeTime,logLevel:S,why:P.why,mountTime:b}));return}P.why!==null&&(v.current=yl({mediaRef:C,time:P.shouldBeTime,logLevel:S,why:P.why,mountTime:b})),Gl({mediaRef:e,mediaType:n,onAutoPlayError:f,logLevel:S,mountTime:b,reason:P.playReason,isPlayer:A.isPlayer}),P.bufferUntilFirstFrame&&W(P.shouldBeTime)}},[g,V,W,x.buffering,T,S,_,M,N,e,n,i,$,w,t,f,l,c,a,b,j,A.isPlayer])},Jx=({mediaRef:e,id:t,mediaType:n,onAutoPlayError:r,isPremounting:o,isPostmounting:i})=>{const{audioAndVideoTags:s,imperativePlaying:a}=oo(),l=sr(),c=oa(),f=ct();d.useEffect(()=>{const p={id:t,play:m=>{if(a.current&&!(o||i))return Gl({mediaRef:e,mediaType:n,onAutoPlayError:r,logLevel:l,mountTime:c,reason:m,isPlayer:f.isPlayer})}};return s.current.push(p),()=>{s.current=s.current.filter(m=>m.id!==t)}},[s,t,e,n,r,a,o,i,l,c,f.isPlayer])},Zp=d.createContext({playerMuted:!1,mediaVolume:1}),Kp=d.createContext({setPlayerMuted:()=>{throw new Error("default")},setMediaVolume:()=>{throw new Error("default")}}),Yp=()=>{const{mediaVolume:e}=d.useContext(Zp),{setMediaVolume:t}=d.useContext(Kp);return d.useMemo(()=>[e,t],[e,t])},Gp=()=>{const{playerMuted:e}=d.useContext(Zp),{setPlayerMuted:t}=d.useContext(Kp);return d.useMemo(()=>[e,t],[e,t])},Vi=e=>{if(e>=100)throw new Error(`Volume was set to ${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.`)},II=(e,t)=>{const[n]=d.useState(e.shouldPreMountAudioTags);if(e.shouldPreMountAudioTags!==n)throw new Error("Cannot change the behavior for pre-mounting audio tags dynamically.");const r=sr(),{volume:o,muted:i,playbackRate:s,preservePitch:a,shouldPreMountAudioTags:l,src:c,onDuration:f,acceptableTimeShiftInSeconds:p,_remotionInternalNeedsDurationCalculation:m,_remotionInternalNativeLoopPassed:g,_remotionInternalStack:w,allowAmplificationDuringRender:x,name:k,pauseWhenBuffering:h,showInTimeline:y,loopVolumeCurveBehavior:v,stack:S,crossOrigin:b,delayRenderRetries:E,delayRenderTimeoutInMilliseconds:I,toneFrequency:T,useWebAudioApi:j,onError:_,onNativeError:N,audioStreamIndex:W,...M}=e,[$]=Yp(),[V]=Gp(),L=Bi(v??"repeat");if(!c)throw new TypeError("No 'src' was passed to <Html5Audio>.");const A=Ao(c),R=d.useContext(xt),[C]=d.useState(()=>String(Math.random())),P=No({frame:L,volume:o,mediaVolume:$});Vi(P);const z=Vp({crossOrigin:b,requestsVideoFrame:!1,isClientSideRendering:!1}),O=d.useMemo(()=>({muted:i||V||P<=0,src:A,loop:g,crossOrigin:z,...M}),[g,V,i,M,A,P,z]),D=d.useMemo(()=>`audio-${Mo(c??"")}-${R==null?void 0:R.relativeFrom}-${R==null?void 0:R.cumulatedFrom}-${R==null?void 0:R.durationInFrames}-muted:${e.muted}-loop:${e.loop}`,[c,R==null?void 0:R.relativeFrom,R==null?void 0:R.cumulatedFrom,R==null?void 0:R.durationInFrames,e.muted,e.loop]),{el:Z,mediaElementSourceNode:H,cleanupOnMediaTagUnmount:G}=uI({aud:O,audioId:D,premounting:!!(R!=null&&R.premounting),postmounting:!!(R!=null&&R.postmounting)}),B=d.useCallback(()=>w??null,[w]);Up({volume:o,mediaVolume:$,src:c,mediaType:"audio",playbackRate:s??1,displayName:k??null,id:C,getStack:B,showInTimeline:y,premountDisplay:(R==null?void 0:R.premountDisplay)??null,postmountDisplay:(R==null?void 0:R.postmountDisplay)??null,loopDisplay:void 0,documentationLink:"https://www.remotion.dev/docs/html5-audio",refForOutline:null}),qx({mediaRef:Z,src:c,mediaType:"audio",playbackRate:s??1,preservePitch:a,onlyWarnForMediaSeekingError:!1,acceptableTimeshift:p??null,isPremounting:!!(R!=null&&R.premounting),isPostmounting:!!(R!=null&&R.postmounting),pauseWhenBuffering:h,onAutoPlayError:null}),Jx({id:C,isPostmounting:!!(R!=null&&R.postmounting),isPremounting:!!(R!=null&&R.premounting),mediaRef:Z,mediaType:"audio",onAutoPlayError:null}),Hx({logLevel:r,mediaRef:Z,source:H,volume:P,shouldUseWebAudioApi:j??!1}),(le.useInsertionEffect??le.useLayoutEffect)(()=>()=>{requestAnimationFrame(()=>{G()})},[G]),d.useImperativeHandle(t,()=>Z.current,[Z]);const ae=d.useRef(f);return ae.current=f,d.useEffect(()=>{var q;const{current:oe}=Z;if(!oe)return;if(oe.duration){(q=ae.current)==null||q.call(ae,oe.src,oe.duration);return}const Y=()=>{var xe;(xe=ae.current)==null||xe.call(ae,oe.src,oe.duration)};return oe.addEventListener("loadedmetadata",Y),()=>{oe.removeEventListener("loadedmetadata",Y)}},[Z,c]),n?null:u.jsx("audio",{ref:Z,preload:"metadata",crossOrigin:z,...O})},Qx=d.forwardRef(II),TI=(e,t)=>{const n=d.useRef(null),{volume:r,playbackRate:o,allowAmplificationDuringRender:i,onDuration:s,toneFrequency:a,_remotionInternalNeedsDurationCalculation:l,_remotionInternalNativeLoopPassed:c,acceptableTimeShiftInSeconds:f,name:p,onNativeError:m,delayRenderRetries:g,delayRenderTimeoutInMilliseconds:w,loopVolumeCurveBehavior:x,pauseWhenBuffering:k,audioStreamIndex:h,preservePitch:y,...v}=e,S=io(),b=Bi(x??"repeat"),E=Ft(),I=d.useContext(xt),{registerRenderAsset:T,unregisterRenderAsset:j}=d.useContext($o),{delayRender:_,continueRender:N}=Un(),W=d.useMemo(()=>`audio-${Mo(e.src??"")}-${I==null?void 0:I.relativeFrom}-${I==null?void 0:I.cumulatedFrom}-${I==null?void 0:I.durationInFrames}`,[e.src,I==null?void 0:I.relativeFrom,I==null?void 0:I.cumulatedFrom,I==null?void 0:I.durationInFrames]),M=No({volume:r,frame:b,mediaVolume:1});Vi(M),d.useImperativeHandle(t,()=>n.current,[]),d.useEffect(()=>{if(!e.src)throw new Error("No src passed");if(window.remotion_audioEnabled&&!e.muted&&!(M<=0))return T({type:"audio",src:ir(e.src),id:W,frame:S,volume:M,mediaFrame:E,playbackRate:e.playbackRate??1,toneFrequency:a??1,audioStartFrame:Math.max(0,-((I==null?void 0:I.cumulatedNegativeFrom)??0)),audioStreamIndex:h??0}),()=>j(W)},[e.muted,e.src,T,S,W,j,M,b,E,o,e.playbackRate,a,I==null?void 0:I.cumulatedNegativeFrom,h]);const{src:$}=e,V=t||l;return d.useLayoutEffect(()=>{var C,P;if(((P=(C=window.process)==null?void 0:C.env)==null?void 0:P.NODE_ENV)==="test"||!V)return;const L=_("Loading <Html5Audio> duration with src="+$,{retries:g??void 0,timeoutInMilliseconds:w??void 0}),{current:A}=n,R=()=>{A!=null&&A.duration&&s(A.src,A.duration),N(L)};return A!=null&&A.duration?(s(A.src,A.duration),N(L)):A==null||A.addEventListener("loadedmetadata",R,{once:!0}),()=>{A==null||A.removeEventListener("loadedmetadata",R),N(L)}},[$,s,V,g,w,N,_]),V?u.jsx("audio",{ref:n,...v,onError:m}):null},RI=d.forwardRef(TI),jI=(e,t)=>{const n=d.useContext(Wu),r=e,{startFrom:o,endAt:i,trimBefore:s,trimAfter:a,name:l,stack:c,pauseWhenBuffering:f,showInTimeline:p,onError:m,freeze:g,...w}=r,{loop:x,freeze:k,...h}=r,{fps:y}=ht(),v=ct(),S=sa(f);if(v.isClientSideRendering)throw new Error("<Html5Audio> is not supported in @remotion/web-renderer. Use <Audio> from @remotion/media instead. See https://remotion.dev/docs/client-side-rendering/limitations");if(typeof g<"u")throw new TypeError('The "freeze" prop is not supported on <Html5Audio />. Use <Sequence freeze={...}> to freeze media playback.');const{durations:b,setDurations:E}=d.useContext(Wp);if(typeof e.src!="string")throw new TypeError(`The \`<Html5Audio>\` tag requires a string for \`src\`, but got ${JSON.stringify(e.src)} instead.`);const I=Ao(e.src),T=d.useCallback(M=>{console.log(M.currentTarget.error);const $=`Could not play audio with src ${I}: ${M.currentTarget.error}. See https://remotion.dev/docs/media-playback-error for help.`;if(x){if(m){m(new Error($));return}Hs(new Error($))}else m==null||m(new Error($)),console.warn($)},[x,m,I]),j=d.useCallback((M,$)=>{E({type:"got-duration",durationInSeconds:$,src:M})},[E]),_=b[ir(I)]??b[ir(e.src)];Ou({startFrom:o,endAt:i,trimBefore:s,trimAfter:a});const{trimBeforeValue:N,trimAfterValue:W}=Bu({startFrom:o,endAt:i,trimBefore:s,trimAfter:a});if(x&&_!==void 0){if(!Number.isFinite(_))return u.jsx(vl,{...h,ref:t,_remotionInternalNativeLoopPassed:!0});const M=_*y;return u.jsx(Lu,{layout:"none",durationInFrames:Nu({trimAfter:W,mediaDurationInFrames:M,playbackRate:e.playbackRate??1,trimBefore:N}),children:u.jsx(vl,{...h,ref:t,_remotionInternalNativeLoopPassed:!0})})}return typeof N<"u"||typeof W<"u"?u.jsx(_t,{layout:"none",from:0-(N??0),showInTimeline:!1,durationInFrames:W,name:l,children:u.jsx(vl,{_remotionInternalNeedsDurationCalculation:!!x,pauseWhenBuffering:S,...w,ref:t})}):(Du({playbackRate:e.playbackRate,preservePitch:e.preservePitch,volume:e.volume},"Html5Audio"),v.isRendering?u.jsx(RI,{onDuration:j,...e,ref:t,onNativeError:T,_remotionInternalNeedsDurationCalculation:!!x}):u.jsx(Qx,{_remotionInternalNativeLoopPassed:e._remotionInternalNativeLoopPassed??!1,_remotionInternalStack:c??null,shouldPreMountAudioTags:n!==null&&n.numberOfAudioTags>0,...e,ref:t,onNativeError:T,onDuration:j,pauseWhenBuffering:S,_remotionInternalNeedsDurationCalculation:!!x,showInTimeline:p??!0}))},vl=d.forwardRef(jI);Zt(vl);var PI=e=>{if(e===void 0)return 1;if(typeof e!="number"||!Number.isFinite(e)||e<=0)throw new Error(`<Solid>: \`pixelDensity\` must be a positive finite number. Received: ${String(e)}.`);return e},FI={...Cr,color:{type:"color",default:"transparent",description:"Color"},width:{type:"number",min:1,step:1,default:1920,description:"Width",hiddenFromList:!1},height:{type:"number",min:1,step:1,default:1080,description:"Height",hiddenFromList:!1},pixelDensity:{type:"number",min:1,max:3,step:.1,default:1,description:"Pixel density",hiddenFromList:!1},...ar,...ao,...so},_I=({color:e,width:t,height:n,effects:r=[],className:o,style:i,pixelDensity:s,overrideId:a,reference:l})=>{const{delayRender:c,continueRender:f,cancelRender:p}=Un(),m=PI(s),g=Math.ceil(t*m),w=Math.ceil(n*m),[x,k]=d.useState(null),h=ca({effects:r,overrideId:a??null}),y=d.useMemo(()=>{if(typeof document>"u")return null;const E=document.createElement("canvas");return E.width=1,E.height=1,E},[]),v=fa(),S=d.useCallback(E=>{k(E),typeof l=="function"?l(E):l&&(l.current=E)},[l]);d.useEffect(()=>{if(!x||!y)return;const E=c("Solid effect chain");if(!v)return f(E),()=>{f(E)};const I=y.getContext("2d",{colorSpace:"srgb"});if(!I){p(new Error("Failed to acquire 2D context for <Solid> source"));return}return I.clearRect(0,0,1,1),e!==void 0&&(I.fillStyle=e,I.fillRect(0,0,1,1)),da({state:v.get(g,w),source:y,effects:h,output:x,width:g,height:w}).then(T=>{T&&f(E)}).catch(T=>{p(T)}),()=>{f(E)}},[e,x,y,v,g,w,c,f,p,h]);const b=d.useMemo(()=>({width:t,height:n,...i??{}}),[n,i,t]);return u.jsx("canvas",{ref:S,width:g,height:w,className:o,style:b})},MI=d.forwardRef(({effects:e=[],controls:t,color:n,height:r,width:o,className:i,durationInFrames:s,style:a,name:l,from:c,trimBefore:f,freeze:p,hidden:m,showInTimeline:g,pixelDensity:w,...x},k)=>{const h=ua(e),y=d.useRef(null);return d.useImperativeHandle(k,()=>y.current,[]),u.jsx(_t,{layout:"none",from:c,trimBefore:f,freeze:p,hidden:m,showInTimeline:g,controls:t,_remotionInternalEffects:h,durationInFrames:s,name:l??"<Solid>",outlineRef:y,_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/solid",...x,children:u.jsx(_I,{reference:y,overrideId:(t==null?void 0:t.overrideId)??null,color:n,height:r,width:o,className:i,style:a,effects:e,pixelDensity:w})})}),e1=Ir({Component:MI,componentName:"<Solid>",componentIdentity:"dev.remotion.remotion.Solid",schema:FI,supportsEffects:!0});e1.displayName="Solid";Zt(e1);var Oa=null,t1=()=>{if(Oa!==null)return Oa;if(typeof document>"u")return!1;const e=document.createElement("canvas"),t=e.getContext("2d");return Oa=typeof(t==null?void 0:t.drawElementImage)=="function"&&typeof e.requestPaint=="function"&&typeof e.captureElementImage=="function"&&"transferControlToOffscreen"in HTMLCanvasElement.prototype,Oa},$I="HTML in Canvas is not supported. Two common causes: Chrome is older than version 148 (update Chrome), or the HTML-in-Canvas flag is disabled at chrome://flags/#canvas-draw-element (enable it and restart Chrome).";function AI(e,t){if(typeof e!="number"||typeof t!="number")throw new Error(`HtmlInCanvas: \`width\` and \`height\` must be numbers. Received width=${String(e)}, height=${String(t)}.`);if(!Number.isInteger(e)||e<=0)throw new Error(`HtmlInCanvas: \`width\` must be a positive integer. Received: ${String(e)}.`);if(!Number.isInteger(t)||t<=0)throw new Error(`HtmlInCanvas: \`height\` must be a positive integer. Received: ${String(t)}.`)}function NI(e){if(e===void 0)return 1;if(typeof e!="number"||!Number.isFinite(e)||e<=0)throw new Error(`HtmlInCanvas: \`pixelDensity\` must be a positive finite number. Received: ${String(e)}.`);return e}var Ba=e=>e instanceof DOMException&&e.name==="InvalidStateError",lg="HtmlInCanvas: Expected the element to be inside the viewport during rendering, but Chrome had no cached paint record for it.",ug=({target:e,width:t,height:n})=>{e.width!==t&&(e.width=t),e.height!==n&&(e.height=n)},LI=({canvas:e,element:t,elementImage:n})=>{const r=e.getContext("2d");if(!r)throw new Error("Failed to acquire 2D context for <HtmlInCanvas> canvas");r.reset();const o=r.drawElementImage(n,0,0);t.style.transform=o.toString()},cg=d.createContext(null),n1=d.forwardRef(({width:e,height:t,effects:n,children:r,onPaint:o,onInit:i,pixelDensity:s,controls:a,style:l},c)=>{const f=d.useContext(cg);AI(e,t);const p=NI(s),m=Math.ceil(e*p),g=Math.ceil(t*p),{delayRender:w,continueRender:x,cancelRender:k}=Un(),{isClientSideRendering:h,isRendering:y}=ct(),v=!y||h,S=o===void 0&&i===void 0;t1()||k(new Error($I));const b=d.useRef(null),E=d.useRef(null),I=d.useRef(null),T=`${e}x${t}@${p}-${S?"direct":"offscreen"}`,j=d.useCallback(Z=>{b.current=Z,typeof c=="function"?c(Z):c&&(c.current=Z)},[c]),_=fa(),N=ca({effects:n,overrideId:(a==null?void 0:a.overrideId)??null}),W=d.useRef(N);W.current=N;const M=d.useRef(o);M.current=o;const $=d.useRef(i);$.current=i;const V=d.useRef(!1),L=d.useRef(null),A=d.useRef(!1),R=d.useRef(f);R.current=f;const C=d.useCallback(async()=>{var G;const Z=I.current;if(!Z)throw new Error("Canvas or scene element not found");const H=E.current;if(!H)throw new Error("HtmlInCanvas: paint target is not ready because the canvas is remounting");ug({target:H,width:m,height:g});try{const B=b.current;if(!B)throw new Error("Canvas not found");const X=w("onPaint");if(!V.current){const oe=$.current;if(!oe)V.current=!0;else{let Y;try{Y=B.captureElementImage(Z)}catch(q){if(Ba(q)&&v){x(X);return}throw Ba(q)?new Error(lg):q}V.current=!0;try{if(H instanceof HTMLCanvasElement)throw new Error("HtmlInCanvas: onInit requires an OffscreenCanvas paint target");const q=await oe({canvas:H,element:Z,elementImage:Y,pixelDensity:p});if(typeof q!="function")throw new Error("HtmlInCanvas: when `onInit` is provided, it must return a cleanup function, or a Promise that resolves to one.");A.current?q():L.current=q}finally{Y.close()}}}let ae;try{ae=B.captureElementImage(Z)}catch(oe){if(Ba(oe)&&v){x(X);return}throw Ba(oe)?new Error(lg):oe}try{const oe=M.current;if(oe){if(H instanceof HTMLCanvasElement)throw new Error("HtmlInCanvas: onPaint requires an OffscreenCanvas paint target");const Y=oe({canvas:H,element:Z,elementImage:ae,pixelDensity:p});Y&&await Y}else LI({canvas:H,element:Z,elementImage:ae,pixelDensity:p});await da({state:_.get(m,g),source:H,effects:W.current,output:H,width:m,height:g})}finally{ae.close()}(G=R.current)==null||G.requestParentPaint(),x(X)}catch(B){k(B)}},[g,m,_,x,k,w,p,v]);d.useLayoutEffect(()=>{const Z=b.current;if(!Z)throw new Error("Canvas not found");Z.layoutSubtree=!0;const H=S?Z:Z.transferControlToOffscreen();return E.current=H,ug({target:H,width:m,height:g}),V.current=!1,A.current=!1,Z.addEventListener("paint",C),()=>{var G;Z.removeEventListener("paint",C),E.current=null,V.current=!1,A.current=!0,(G=L.current)==null||G.call(L),L.current=null}},[C,k,m,g,S]);const P=d.useRef(!1);d.useLayoutEffect(()=>{var H;if(!P.current){P.current=!0;return}const Z=b.current;Z&&((H=Z.requestPaint)==null||H.call(Z))},[o,N]),d.useLayoutEffect(()=>{const Z=b.current;if(!Z)return;const H=w("waiting for first paint after canvas resize");return Z.addEventListener("paint",()=>{x(H)},{once:!0}),()=>{x(H)}},[e,t,x,w,T]);const z=d.useMemo(()=>({width:e,height:t}),[e,t]),O=d.useMemo(()=>({width:e,height:t,...l??{}}),[t,l,e]),D=d.useMemo(()=>({requestParentPaint:()=>{var Z,H;(H=(Z=b.current)==null?void 0:Z.requestPaint)==null||H.call(Z)}}),[]);return u.jsx(cg.Provider,{value:D,children:u.jsx("canvas",{ref:j,width:m,height:g,style:O,children:u.jsx("div",{ref:I,style:z,children:r})},T)})});n1.displayName="HtmlInCanvasContent";var r1=d.forwardRef(({width:e,height:t,effects:n=[],children:r,onPaint:o,onInit:i,pixelDensity:s,controls:a,style:l,durationInFrames:c,name:f,...p},m)=>{const g=ua(n),w=d.useRef(null),x=d.useCallback(k=>{w.current=k,typeof m=="function"?m(k):m&&(m.current=k)},[m]);return u.jsx(_t,{durationInFrames:c,name:f??"<HtmlInCanvas>",_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/remotion/html-in-canvas",controls:a,_remotionInternalEffects:g,outlineRef:w,layout:"none",...p,children:u.jsx(n1,{ref:x,width:e,height:t,effects:n,onPaint:o,onInit:i,pixelDensity:s,controls:a,style:l,children:r})})});r1.displayName="HtmlInCanvas";var zI={...Cr,pixelDensity:{type:"number",min:1,max:3,step:.1,default:1,description:"Pixel density",hiddenFromList:!1},...ar,...ao,...so},DI=Ir({Component:r1,componentName:"<HtmlInCanvas>",componentIdentity:"dev.remotion.remotion.HtmlInCanvas",schema:zI,supportsEffects:!0}),o1=Object.assign(DI,{isSupported:t1});o1.displayName="HtmlInCanvas";Zt(o1);function vr(e){return e.startsWith("data:")&&e.length>100?e.slice(0,60)+"...["+e.length+" chars total]":e}var OI={...Cr,...Li,fit:{type:"enum",default:"fill",description:"Fit",variants:{fill:{},contain:{},cover:{}}},...ar,...ao,...so},BI=()=>{if(typeof DOMException<"u")return new DOMException("Image loading was aborted","AbortError");const e=new Error("Image loading was aborted");return e.name="AbortError",e},WI=({src:e,signal:t})=>new Promise((n,r)=>{const o=new Image;let i=!1;function s(){o.onload=null,o.onerror=null}function a(c){i||(i=!0,s(),c())}function l(){a(()=>r(BI()))}if(o.onload=()=>{var c;Promise.resolve((c=o.decode)==null?void 0:c.call(o)).catch(()=>{}).then(()=>{const f=o.naturalWidth||o.width,p=o.naturalHeight||o.height;if(f<=0||p<=0){a(()=>r(new Error(`Could not determine dimensions for <CanvasImage> with src="${vr(e)}"`)));return}a(()=>n({element:o,width:f,height:p}))})},o.onerror=()=>{a(()=>r(new Error(`Could not load <CanvasImage> with src="${vr(e)}"`)))},t.addEventListener("abort",l,{once:!0}),t.aborted){l();return}o.crossOrigin="anonymous",o.src=e});function VI(e){return 1e3*2**(e-1)}var HI=({onFrame:e})=>{if(typeof requestAnimationFrame>"u")return e(),()=>{};const t=requestAnimationFrame(e);return()=>cancelAnimationFrame(t)},i1=d.forwardRef(({src:e,width:t,height:n,fit:r="fill",effects:o,controls:i,onError:s,className:a,style:l,id:c,pauseWhenLoading:f,maxRetries:p=2,delayRenderRetries:m,delayRenderTimeoutInMilliseconds:g,refForOutline:w,...x},k)=>{const{delayRender:h,continueRender:y,cancelRender:v}=Un(),{delayPlayback:S}=Hu(),[b,E]=d.useState(null),[I,T]=d.useState(null),j=Ao(e),_=fa(),N=ca({effects:o,overrideId:(i==null?void 0:i.overrideId)??null}),W=d.useContext(xt),M=d.useRef(null),[$,V]=d.useState(!1),L=!!(W!=null&&W.premounting),A=!!(W!=null&&W.postmounting),R=d.useCallback(({markAsReady:z})=>{const O=M.current;!O||O.continued||(O.continued=!0,z&&V(!1),y(O.handle),M.current=null)},[y]),C=d.useMemo(()=>typeof document>"u"?null:document.createElement("canvas"),[]),P=d.useCallback(z=>{E(z),w&&(w.current=z),typeof k=="function"?k(z):k&&(k.current=z)},[k,w]);return d.useLayoutEffect(()=>{if(!(!f||!$||L||A))return S().unblock},[S,$,A,L,f]),d.useLayoutEffect(()=>{const z=h(`Rendering <CanvasImage> with src="${vr(j)}"`,{retries:m??void 0,timeoutInMilliseconds:g??void 0}),O=new AbortController;let D=!1,Z=0,H=null;T(null),V(!0),M.current={handle:z,continued:!1};const G=()=>{WI({src:j,signal:O.signal}).then(B=>{D||T(B)}).catch(B=>{if(B.name==="AbortError"){R({markAsReady:!1});return}if(Z++,Z<=p){const X=VI(Z);console.warn(`Could not load <CanvasImage> with src="${vr(j)}", retrying in ${X}ms`),H=setTimeout(()=>{D||G()},X)}else s?(s(B),R({markAsReady:!0})):v(B)})};return G(),()=>{D=!0,H!==null&&clearTimeout(H),O.abort(),R({markAsReady:!1})}},[j,v,R,h,m,g,p,s]),d.useLayoutEffect(()=>{if(!I||!b||!C)return;const z=h(`Applying effects to <CanvasImage> with src="${vr(j)}"`);let O=!1,D=!1,Z=()=>{};const H=()=>{D||(D=!0,y(z))},G=t??I.width,B=n??I.height,X=C.getContext("2d",{colorSpace:"srgb"});return X?(C.width=G,C.height=B,b.width=G,b.height=B,X.clearRect(0,0,G,B),X.drawImage(I.element,...jx(r,{width:I.width,height:I.height},{width:G,height:B})),da({state:_.get(G,B),source:C,effects:N,output:b,width:G,height:B}).then(ae=>{ae&&!O&&(Z=HI({onFrame:()=>{O||(H(),R({markAsReady:!0}))}}))}).catch(ae=>{O||(s?(s(ae),H(),R({markAsReady:!0})):v(ae))}),()=>{O=!0,Z(),H()}):(v(new Error("Could not get 2D context for <CanvasImage> source canvas")),H(),()=>{H()})},[j,v,_,y,R,h,r,n,I,N,s,b,C,t]),u.jsx("canvas",{...x,ref:P,width:t,height:n,className:a,style:l,id:c})});i1.displayName="CanvasImageContent";var UI=d.forwardRef(({src:e,width:t,height:n,fit:r,effects:o=[],className:i,style:s,id:a,onError:l,pauseWhenLoading:c,maxRetries:f,delayRenderRetries:p,delayRenderTimeoutInMilliseconds:m,durationInFrames:g,from:w,trimBefore:x,freeze:k,premountFor:h,postmountFor:y,styleWhilePremounted:v,styleWhilePostmounted:S,hidden:b,name:E,showInTimeline:I,stack:T,controls:j,_remotionInternalDocumentationLink:_,outlineRef:N,...W},M)=>{if(!e)throw new Error('No "src" prop was passed to <CanvasImage>.');const $=ua(o),V=d.useRef(null);d.useImperativeHandle(M,()=>V.current,[]);const{effectivePostmountFor:L,effectivePremountFor:A,freezeFrame:R,isPremountingOrPostmounting:C,postmountingActive:P,premountingActive:z,premountingStyle:O}=aa({from:w??0,durationInFrames:g??1/0,premountFor:h??null,postmountFor:y??null,style:s??null,styleWhilePremounted:v??null,styleWhilePostmounted:S??null,hideWhilePremounted:"display-none"});return u.jsx(ia,{frame:R,active:C,children:u.jsx(_t,{layout:"none",from:w??0,trimBefore:x,durationInFrames:g??1/0,freeze:k,hidden:b,showInTimeline:I??!0,name:E??"<CanvasImage>",_remotionInternalDocumentationLink:_??"https://www.remotion.dev/docs/canvasimage",controls:j,_remotionInternalEffects:$,_remotionInternalIsMedia:{type:"image",src:e},_remotionInternalStack:T,_remotionInternalPremountDisplay:A||null,_remotionInternalPostmountDisplay:L||null,_remotionInternalIsPremounting:z,_remotionInternalIsPostmounting:P,outlineRef:N??V,children:u.jsx(i1,{ref:V,src:e,width:t,height:n,fit:r,effects:o,controls:j,className:i,style:O??void 0,id:a,onError:l,pauseWhenLoading:c,maxRetries:f,delayRenderRetries:p,delayRenderTimeoutInMilliseconds:m,refForOutline:N??null,...W})})})}),Xp=Ir({Component:UI,componentName:"<CanvasImage>",componentIdentity:"dev.remotion.remotion.CanvasImage",schema:OI,supportsEffects:!0});Xp.displayName="CanvasImage";Zt(Xp);var ZI=({onLoad:e,onError:t,delayRenderRetries:n,delayRenderTimeoutInMilliseconds:r,...o},i)=>{const{delayRender:s,continueRender:a}=Un(),[l]=d.useState(()=>s(`Loading <IFrame> with source ${o.src}`,{retries:n??void 0,timeoutInMilliseconds:r??void 0})),c=d.useCallback(p=>{a(l),e==null||e(p)},[l,e,a]),f=d.useCallback(p=>{a(l),t?t(p):console.error("Error loading iframe:",p,"Handle the event using the onError() prop to make this message disappear.")},[l,t,a]);return u.jsx("iframe",{referrerPolicy:"strict-origin-when-cross-origin",...o,ref:i,onError:f,onLoad:c})};d.forwardRef(ZI);function KI(e){return 1e3*2**(e-1)}var YI=({onError:e,maxRetries:t=2,src:n,pauseWhenLoading:r,delayRenderRetries:o,delayRenderTimeoutInMilliseconds:i,onImageFrame:s,crossOrigin:a,decoding:l,ref:c,refForOutline:f,...p})=>{const m=d.useRef(null),g=d.useRef({}),{delayPlayback:w}=Hu(),x=d.useContext(xt),[k,h]=d.useState(!1),y=d.useCallback($=>{m.current=$,f.current=$,typeof c=="function"?c($):c&&(c.current=$)},[c,f]),v=Ao(n),S=d.useCallback($=>{if(!m.current)return;const V=m.current.src;setTimeout(()=>{var A;if(!m.current)return;const L=(A=m.current)==null?void 0:A.src;L===V&&(m.current.removeAttribute("src"),m.current.setAttribute("src",L))},$)},[]),{delayRender:b,continueRender:E,cancelRender:I}=Un(),T=!!(x!=null&&x.premounting),j=!!(x!=null&&x.postmounting),_=d.useCallback($=>{var V,L,A,R,C,P,z;if(g.current){if(g.current[(V=m.current)==null?void 0:V.src]=(g.current[(L=m.current)==null?void 0:L.src]??0)+1,e&&(g.current[(A=m.current)==null?void 0:A.src]??0)>t){e($);return}if((g.current[(R=m.current)==null?void 0:R.src]??0)<=t){const O=KI(g.current[(C=m.current)==null?void 0:C.src]??0);console.warn(`Could not load image with source ${vr((P=m.current)==null?void 0:P.src)}, retrying again in ${O}ms`),S(O);return}try{I("Error loading image with src: "+vr((z=m.current)==null?void 0:z.src))}catch{}}},[I,t,e,S]);typeof window<"u"&&(d.useLayoutEffect(()=>{if(!(!r||!k||T||j))return w().unblock},[w,k,j,T,r]),d.useLayoutEffect(()=>{var R,C;if(((C=(R=window.process)==null?void 0:R.env)==null?void 0:C.NODE_ENV)==="test"){m.current&&(m.current.src=v);return}const{current:$}=m;if(!$)return;h(!0);const V=b("Loading <Img> with src="+vr(v),{retries:o??void 0,timeoutInMilliseconds:i??void 0});let L=!1;const A=()=>{var P,z,O;if(L){E(V);return}(g.current[(P=m.current)==null?void 0:P.src]??0)>0&&(delete g.current[(z=m.current)==null?void 0:z.src],console.info(`Retry successful - ${vr((O=m.current)==null?void 0:O.src)} is now loaded`)),$&&(s==null||s($)),h(!1),E(V)};if(!m.current){A();return}return $.src=v,$.decode().then(A).catch(P=>{console.warn(P),$.complete&&$.naturalWidth>0&&$.naturalHeight>0?A():$.addEventListener("load",A)}),()=>{L=!0,$.removeEventListener("load",A),E(V)}},[v,o,i,s,E,b]));const{isClientSideRendering:N,isRendering:W}=ct(),M=Vp({crossOrigin:a,requestsVideoFrame:!1,isClientSideRendering:N});return u.jsx("img",{...p,ref:y,crossOrigin:M,onError:_,decoding:W?"sync":l})},GI=({hidden:e,name:t,stack:n,showInTimeline:r,src:o,from:i,trimBefore:s,durationInFrames:a,freeze:l,premountFor:c,postmountFor:f,style:p,styleWhilePremounted:m,styleWhilePostmounted:g,controls:w,outlineRef:x,...k})=>{if(!o)throw new Error('No "src" prop was passed to <Img>.');const{effectivePostmountFor:h,effectivePremountFor:y,freezeFrame:v,isPremountingOrPostmounting:S,postmountingActive:b,premountingActive:E,premountingStyle:I}=aa({from:i??0,durationInFrames:a??1/0,premountFor:c??null,postmountFor:f??null,style:p??null,styleWhilePremounted:m??null,styleWhilePostmounted:g??null,hideWhilePremounted:"display-none"});return u.jsx(ia,{frame:v,active:S,children:u.jsx(_t,{layout:"none",from:i??0,trimBefore:s,durationInFrames:a??1/0,freeze:l,_remotionInternalStack:n,_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/img",_remotionInternalIsMedia:{type:"image",src:o},_remotionInternalPremountDisplay:y||null,_remotionInternalPostmountDisplay:h||null,_remotionInternalIsPremounting:E,_remotionInternalIsPostmounting:b,name:t??"<Img>",controls:w,showInTimeline:r??!0,hidden:e,outlineRef:x,children:u.jsx(YI,{src:o,refForOutline:x,style:I??void 0,...k})})})},XI=Xp,qI={src:{type:"asset",default:void 0,description:"Source",keyframable:!1},...Cr,...Li,...ar,...ao,...so},JI=new Set(["alt","crossOrigin","decoding","fetchPriority","loading","onError","onImageFrame","onLoad","sizes","srcSet","useMap"]),QI=e=>Object.keys(e).filter(t=>e[t]!==void 0&&JI.has(t)),eT=e=>e.map(t=>`"${t}"`).join(", "),tT=({props:e,ref:t,width:n,height:r})=>{if(typeof n=="string"||typeof r=="string")throw new Error('The "width" and "height" props must be numbers on <Img> when effects are passed, because <Img> renders a <CanvasImage>. Use numeric props or CSS dimensions in "style".');const o=QI(e);if(t!=null&&o.unshift("ref"),o.length!==0)throw new Error(`The ${eT(o)} prop${o.length===1?"":"s"} cannot be used on <Img> when effects are passed, because <Img> renders a <canvas> instead of a native <img>. Remove ${o.length===1?"this prop":"these props"}.`)},nT=e=>{const t=e==null?void 0:e.objectFit;if(t==="fill"||t==="contain"||t==="cover")return t},rT=({effects:e=[],ref:t,hidden:n,name:r,stack:o,showInTimeline:i,src:s,from:a,trimBefore:l,durationInFrames:c,freeze:f,premountFor:p,postmountFor:m,styleWhilePremounted:g,styleWhilePostmounted:w,controls:x,width:k,height:h,className:y,style:v,id:S,pauseWhenLoading:b,maxRetries:E,delayRenderRetries:I,delayRenderTimeoutInMilliseconds:T,...j})=>{const _=d.useRef(null),N=sa(b);if(e.length===0)return u.jsx(GI,{...j,ref:t,hidden:n,name:r,stack:o,showInTimeline:i,src:s,from:a,trimBefore:l,durationInFrames:c,freeze:f,premountFor:p,postmountFor:m,styleWhilePremounted:g,styleWhilePostmounted:w,controls:x,width:k,height:h,className:y,style:v,id:S,pauseWhenLoading:N,maxRetries:E,delayRenderRetries:I,delayRenderTimeoutInMilliseconds:T,outlineRef:_});if(!s)throw new Error('No "src" prop was passed to <Img>.');tT({props:j,ref:t,width:k,height:h});const W=typeof k=="number"?k:void 0,M=typeof h=="number"?h:void 0,$=j,V=nT(v)??"fill";return u.jsx(XI,{src:s,width:W,height:M,fit:V,effects:e,className:y,style:v,id:S,pauseWhenLoading:N,maxRetries:E,delayRenderRetries:I,delayRenderTimeoutInMilliseconds:T,from:a,trimBefore:l,durationInFrames:c,freeze:f,premountFor:p,postmountFor:m,styleWhilePremounted:g,styleWhilePostmounted:w,hidden:n,name:r??"<Img>",showInTimeline:i,stack:o,_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/img",controls:x,outlineRef:_,...$})},qp=Ir({Component:rT,componentName:"<Img>",componentIdentity:"dev.remotion.remotion.Img",schema:qI,supportsEffects:!0});Zt(qp);var oT=e=>{if(e==="remotion")return"dev.remotion.remotion";if(e.startsWith("@remotion/"))return`dev.remotion.${e.slice(10).replace(/-([a-z])/g,(n,r)=>r.toUpperCase())}`;throw new Error(`Unsupported Remotion package name: ${e}`)},s1=({packageName:e,componentName:t})=>`${oT(e)}.${t}`,Jp={...Cr,...ar},iT={...Jp,...ao},a1={...iT,...so},sT={...a1,...Ru,...Qw},aT={...Jp,...Ru,...Qw},lT=(e,t)=>{typeof e=="function"?e(t):e&&(e.current=t)},l1=e=>{const t=Ir(e);return Zt(t),t},ql=(e,t,n)=>{const r=d.forwardRef((i,s)=>{const{durationInFrames:a,from:l,trimBefore:c,freeze:f,hidden:p,name:m,showInTimeline:g,stack:w,controls:x,...k}=i,h=d.useRef(null),y=d.useCallback(v=>{h.current=v,lT(s,v)},[s]);return u.jsx(_t,{layout:"none",from:l??0,trimBefore:c,durationInFrames:a??1/0,freeze:f,hidden:p,name:m??t,showInTimeline:g??!0,controls:x,_remotionInternalStack:w,_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/interactive",outlineRef:h,children:le.createElement(e,{...k,ref:y})})});r.displayName=t;const o=l1({Component:r,componentName:t,componentIdentity:s1({packageName:"remotion",componentName:t.slice(1,-1)}),schema:n,supportsEffects:!1});return o.displayName=t,o},Be=(e,t)=>ql(e,t,sT),Bo=(e,t)=>ql(e,t,Jp),$r={baseSchema:Cr,transformSchema:ar,textSchema:Ru,backgroundSchema:ao,borderSchema:so,premountSchema:Li,sequenceSchema:Ri,withSchema:l1,_internalMakeRemotionComponentIdentity:s1,A:Be("a","<Interactive.A>"),Article:Be("article","<Interactive.Article>"),Aside:Be("aside","<Interactive.Aside>"),Button:Be("button","<Interactive.Button>"),Circle:Bo("circle","<Interactive.Circle>"),Code:Be("code","<Interactive.Code>"),Div:Be("div","<Interactive.Div>"),Ellipse:Bo("ellipse","<Interactive.Ellipse>"),Em:Be("em","<Interactive.Em>"),Footer:Be("footer","<Interactive.Footer>"),G:Bo("g","<Interactive.G>"),H1:Be("h1","<Interactive.H1>"),H2:Be("h2","<Interactive.H2>"),H3:Be("h3","<Interactive.H3>"),H4:Be("h4","<Interactive.H4>"),H5:Be("h5","<Interactive.H5>"),H6:Be("h6","<Interactive.H6>"),Header:Be("header","<Interactive.Header>"),Label:Be("label","<Interactive.Label>"),Li:Be("li","<Interactive.Li>"),Line:Bo("line","<Interactive.Line>"),Main:Be("main","<Interactive.Main>"),Nav:Be("nav","<Interactive.Nav>"),Ol:Be("ol","<Interactive.Ol>"),P:Be("p","<Interactive.P>"),Path:Bo("path","<Interactive.Path>"),Pre:Be("pre","<Interactive.Pre>"),Rect:Bo("rect","<Interactive.Rect>"),Section:Be("section","<Interactive.Section>"),Small:Be("small","<Interactive.Small>"),Span:Be("span","<Interactive.Span>"),Strong:Be("strong","<Interactive.Strong>"),Svg:ql("svg","<Interactive.Svg>",a1),Text:ql("text","<Interactive.Text>",aT),Ul:Be("ul","<Interactive.Ul>")},uT=async({resolvedSrc:e,signal:t,requestInit:n,contentType:r})=>{const{decoder:o,selectedTrack:i}=await Mx({resolvedSrc:e,signal:t,requestInit:n,contentType:r});try{const{image:s}=await o.decode({frameIndex:i.frameCount-1,completeFramesOnly:!0});try{if(s.duration===null)throw new Error("Could not determine animated image duration");return(s.timestamp+s.duration)/1e6}finally{s.close()}}finally{o.close()}},u1=le.createRef(),cT=({children:e,onlyRenderComposition:t,currentCompositionMetadata:n,initialCompositions:r,initialCanvasContent:o})=>{const[i,s]=d.useState([]),[a,l]=d.useState(o),[c,f]=d.useState(r),p=d.useRef(c),m=d.useCallback(v=>{f(S=>{const b=v(S);return p.current=b,b})},[]),g=d.useCallback(v=>{m(S=>{if(S.find(b=>b.id===v.id))throw new Error(`Multiple composition with id ${v.id} are registered.`);return[...S,v]})},[m]),w=d.useCallback(v=>{f(S=>S.filter(b=>b.id!==v))},[]),x=d.useCallback((v,S,b,E)=>{s(I=>[...I,{name:v,parent:S,nonce:b,stack:E}])},[]),k=d.useCallback((v,S)=>{s(b=>b.filter(E=>!(E.name===v&&E.parent===S)))},[]);d.useImperativeHandle(u1,()=>({getCompositions:()=>p.current}),[]);const h=d.useMemo(()=>({registerComposition:g,unregisterComposition:w,registerFolder:x,unregisterFolder:k,setCanvasContent:l,onlyRenderComposition:t}),[g,x,w,k,t]),y=d.useMemo(()=>({compositions:c,folders:i,currentCompositionMetadata:n,canvasContent:a}),[c,i,n,a]);return u.jsx(Mi.Provider,{value:y,children:u.jsx(ta.Provider,{value:h,children:e})})},c1={};Tw(c1,{makeDefaultPreviewCSS:()=>fT,injectCSS:()=>dT,OBJECTFIT_CONTAIN_CLASS_NAME:()=>Us});var Wa={},dT=e=>{if(typeof document>"u")return()=>{};if(Wa[e])return()=>{};const t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");return n.appendChild(document.createTextNode(e)),t.prepend(n),Wa[e]=n,()=>{const r=Wa[e];r&&(r.parentNode&&r.parentNode.removeChild(r),delete Wa[e])}},Us="__remotion_objectfitcontain",fT=(e,t)=>e?`
58
58
  ${e} * {
59
59
  box-sizing: border-box;
60
60
  }
@@ -76,8 +76,8 @@ Check that all your Remotion packages are on the same version. If your dependenc
76
76
  .${Us} {
77
77
  object-fit: contain;
78
78
  }
79
- `,s1="__remotion-studio-container",lT=()=>document.getElementById(s1),uT=le.createContext(null),cT=null,Oc=[],dT=()=>cT,fT=e=>(Oc.push(e),()=>{Oc=Oc.filter(t=>t!==e)}),qp=d.createContext(null),pT=()=>{const e=d.useContext(qp);return!e||e.videoEnabled===null?window.remotion_videoEnabled:e.videoEnabled},hT=()=>{const e=d.useContext(qp);return!e||e.audioEnabled===null?window.remotion_audioEnabled:e.audioEnabled},mT=({children:e,videoEnabled:t,audioEnabled:n})=>{const r=d.useMemo(()=>({videoEnabled:t,audioEnabled:n}),[t,n]);return u.jsx(qp.Provider,{value:r,children:e})},gT=({children:e,numberOfAudioTags:t,logLevel:n,audioLatencyHint:r,previewSampleRate:o,videoEnabled:i,audioEnabled:s,frameState:a})=>{const l=d.useMemo(()=>{let f=0;return{getNonce:()=>f++}},[]),c=d.useMemo(()=>({logLevel:n,mountTime:Date.now()}),[n]);return u.jsx(Fo.Provider,{value:c,children:u.jsx(na.Provider,{value:l,children:u.jsx(fC,{frameState:a,children:u.jsx(mT,{videoEnabled:i,audioEnabled:s,children:u.jsx(jw,{children:u.jsx(Mx,{children:u.jsx(vC,{children:u.jsx(Ax,{children:u.jsx(Wx,{children:u.jsx(Nx,{audioLatencyHint:r,audioEnabled:s,previewSampleRate:o,children:u.jsx(Lx,{numberOfAudioTags:t,children:e})})})})})})})})})})})},lg=["h264","h265","vp8","vp9","av1","mp3","aac","wav","prores","h264-mkv","h264-ts","gif"];function yT(e,t,n){if(!(typeof e>"u")){if(typeof e!="string")throw new TypeError(`The "${n}" prop ${t} must be a string, but you passed a value of type ${typeof e}.`);if(!lg.includes(e))throw new Error(`The "${n}" prop ${t} must be one of ${lg.join(", ")}, but you passed ${e}.`)}}var vT=({calculated:e,compositionId:t,compositionFps:n,compositionHeight:r,compositionWidth:o,compositionDurationInFrames:i})=>{const s=`calculated by calculateMetadata() for the composition "${t}"`,a=`of the "<Composition />" component with the id "${t}"`,l=(e==null?void 0:e.width)??o??void 0;Hl(l,"width",e!=null&&e.width?s:a);const c=(e==null?void 0:e.height)??r??void 0;Hl(c,"height",e!=null&&e.height?s:a);const f=(e==null?void 0:e.fps)??n??null;Su(f,e!=null&&e.fps?s:a);const p=(e==null?void 0:e.durationInFrames)??i??null;bu(p,{allowFloats:!1,component:`of the "<Composition />" component with the id "${t}"`});const m=e==null?void 0:e.defaultCodec;yT(m,s,"defaultCodec");const g=e==null?void 0:e.defaultOutName,w=e==null?void 0:e.defaultVideoImageFormat,x=e==null?void 0:e.defaultPixelFormat,k=e==null?void 0:e.defaultProResProfile,h=e==null?void 0:e.defaultSampleRate;return{width:l,height:c,fps:f,durationInFrames:p,defaultCodec:m,defaultOutName:g,defaultVideoImageFormat:w,defaultPixelFormat:x,defaultProResProfile:k,defaultSampleRate:h}},ug=({calculated:e,compositionDurationInFrames:t,compositionFps:n,compositionHeight:r,compositionId:o,compositionWidth:i,defaultProps:s,originalProps:a})=>{const l=vT({calculated:e,compositionDurationInFrames:t,compositionFps:n,compositionHeight:r,compositionWidth:i,compositionId:o});return{metadataSource:{durationInFrames:(e==null?void 0:e.durationInFrames)===void 0?"composition":"calculate-metadata",fps:(e==null?void 0:e.fps)===void 0?"composition":"calculate-metadata",height:(e==null?void 0:e.height)===void 0?"composition":"calculate-metadata",width:(e==null?void 0:e.width)===void 0?"composition":"calculate-metadata"},videoConfig:{...l,id:o,defaultProps:uf(s??{}),props:uf((e==null?void 0:e.props)??a),defaultCodec:l.defaultCodec??null,defaultOutName:l.defaultOutName??null,defaultVideoImageFormat:l.defaultVideoImageFormat??null,defaultPixelFormat:l.defaultPixelFormat??null,defaultProResProfile:l.defaultProResProfile??null,defaultSampleRate:l.defaultSampleRate??null}}},a1=({calculateMetadata:e,signal:t,defaultProps:n,inputProps:r,compositionId:o,compositionDurationInFrames:i,compositionFps:s,compositionHeight:a,compositionWidth:l})=>{const c=e?e({defaultProps:n,props:r,abortSignal:t,compositionId:o,isRendering:Rn().isRendering}):null;return c!==null&&typeof c=="object"&&"then"in c?c.then(f=>ug({calculated:f,compositionDurationInFrames:i,compositionFps:s,compositionHeight:a,compositionWidth:l,compositionId:o,defaultProps:n,originalProps:r})):ug({calculated:c,compositionDurationInFrames:i,compositionFps:s,compositionHeight:a,compositionWidth:l,compositionId:o,defaultProps:n,originalProps:r})},l1=e=>{const t=a1(e);return typeof t=="object"&&"then"in t?t.then(({videoConfig:n})=>n):t.videoConfig},wT=e=>{try{return{type:"success",result:a1(e)}}catch(t){return{type:"error",error:t}}},xT=e=>{try{return{type:"success",result:l1(e)}}catch(t){return{type:"error",error:t}}},bT=le.createContext(()=>{}),ST=()=>{if(Rn().isRendering){const e=window.remotion_envVariables;return e?{...JSON.parse(e),NODE_ENV:"production"}:{}}return{NODE_ENV:"production"}},kT=()=>{const e=ST();window.process||(window.process={}),window.process.env||(window.process.env={}),Object.keys(e).forEach(t=>{window.process.env[t]=e[t]})},ET=le.createContext(null),CT=d.createContext({setSize:()=>{},size:{size:"auto",translation:{x:0,y:0}}}),IT=({canvasSize:e,compositionHeight:t,compositionWidth:n,previewSize:r})=>{const o=e.height/t,i=e.width/n,s=Math.min(o,i);return r==="auto"?s===0?1:s:Number(r)},TT=le.createContext(null),RT=({src:e,transparent:t,currentTime:n,toneMapped:r})=>`http://localhost:${window.remotion_proxyPort}/proxy?src=${encodeURIComponent(ir(e))}&time=${encodeURIComponent(Math.max(0,n))}&transparent=${String(t)}&toneMapped=${String(r)}`,jT=({onError:e,volume:t,playbackRate:n,src:r,muted:o,allowAmplificationDuringRender:i,transparent:s,toneMapped:a,toneFrequency:l,name:c,loopVolumeCurveBehavior:f,delayRenderRetries:p,delayRenderTimeoutInMilliseconds:m,onVideoFrame:g,crossOrigin:w,audioStreamIndex:x,preservePitch:k,...h})=>{const y=io(),v=Ft(),S=Bi(f),b=Iu(),E=d.useContext(xt),I=Co(),{registerRenderAsset:T,unregisterRenderAsset:R}=d.useContext(Mo);if(!r)throw new TypeError("No `src` was passed to <OffthreadVideo>.");const F=d.useMemo(()=>`offthreadvideo-${_o(r)}-${E==null?void 0:E.cumulatedFrom}-${E==null?void 0:E.relativeFrom}-${E==null?void 0:E.durationInFrames}`,[r,E==null?void 0:E.cumulatedFrom,E==null?void 0:E.relativeFrom,E==null?void 0:E.durationInFrames]);if(!b)throw new Error("No video config found");const A=Ao({volume:t,frame:S,mediaVolume:1});Vi(A),d.useEffect(()=>{if(!r)throw new Error("No src passed");if(window.remotion_audioEnabled&&!o&&!(A<=0))return T({type:"video",src:ir(r),id:F,frame:y,volume:A,mediaFrame:v,playbackRate:n,toneFrequency:l,audioStartFrame:Math.max(0,-((E==null?void 0:E.cumulatedNegativeFrom)??0)),audioStreamIndex:x}),()=>R(F)},[o,r,T,F,R,A,v,y,n,l,E==null?void 0:E.cumulatedNegativeFrom,x]);const W=d.useMemo(()=>Hx({frame:v,playbackRate:n||1,startFrom:-I})/b.fps,[v,I,n,b.fps]),M=d.useMemo(()=>RT({src:r,currentTime:W,transparent:s,toneMapped:a}),[a,W,r,s]),[$,V]=d.useState(null),{delayRender:D,continueRender:L}=Un();d.useLayoutEffect(()=>{if(!window.remotion_videoEnabled)return;const N=[];V(null);const O=new AbortController,z=D(`Fetching ${M} from server`,{retries:p??void 0,timeoutInMilliseconds:m??void 0});return(async()=>{try{const H=await fetch(M,{signal:O.signal,cache:"no-store"});if(H.status!==200){if(H.status===500){const X=await H.json();if(X.error){const ae=X.error.replace(/^Error: /,"");throw new Error(ae)}}throw new Error(`Server returned status ${H.status} while fetching ${M}`)}const G=await H.blob(),B=URL.createObjectURL(G);N.push(()=>URL.revokeObjectURL(B)),V({src:B,handle:z})}catch(H){if(H.message.includes("aborted")){L(z);return}if(O.signal.aborted){L(z);return}H.message.includes("Failed to fetch")&&(H=new Error(`Failed to fetch ${M}. This could be caused by Chrome rejecting the request because the disk space is low. Consider increasing the disk size of your environment.`,{cause:H})),e?e(H):Hs(H)}})(),N.push(()=>{O.signal.aborted||O.abort()}),()=>{N.forEach(H=>H())}},[M,p,m,e,L,D]);const j=d.useCallback(()=>{e?e==null||e(new Error("Failed to load image with src "+$)):Hs("Failed to load image with src "+$)},[$,e]),C=d.useMemo(()=>[Us,h.className].filter($i).join(" "),[h.className]),P=d.useCallback(N=>{g&&g(N)},[g]);return!$||!window.remotion_videoEnabled?null:(L($.handle),u.jsx(Gp,{src:$.src,delayRenderRetries:p,delayRenderTimeoutInMilliseconds:m,onImageFrame:P,...h,onError:j,className:C}))},u1=({ref:e,onVideoFrame:t})=>{d.useEffect(()=>{const{current:n}=e;if(!n||!t)return;let r=0;const o=(i,s)=>{e.current&&(t(e.current,i,s),r=e.current.requestVideoFrameCallback(o))};if(t(n),!!n.requestVideoFrameCallback)return r=n.requestVideoFrameCallback(o),()=>{r&&n.cancelVideoFrameCallback(r)}},[t,e])};class ui extends Error{constructor({message:n,src:r}){super(n);Ae(this,"src");this.name="MediaPlaybackError",this.src=r}}var PT=(e,t)=>{const n=d.useContext(Oi);if(!n)throw new Error("SharedAudioContext not found");const r=d.useRef(null),o=d.useMemo(()=>n.audioContext?Wp({audioContext:n.audioContext,ref:r}):null,[n.audioContext]);(le.useInsertionEffect??le.useLayoutEffect)(()=>()=>{requestAnimationFrame(()=>{o==null||o.cleanup()})},[o]);const{volume:s,muted:a,playbackRate:l,preservePitch:c,onlyWarnForMediaSeekingError:f,src:p,onDuration:m,acceptableTimeShift:g,acceptableTimeShiftInSeconds:w,toneFrequency:x,name:k,_remotionInternalNativeLoopPassed:h,_remotionInternalStack:y,style:v,pauseWhenBuffering:S,showInTimeline:b,loopVolumeCurveBehavior:E,onError:I,onAutoPlayError:T,onVideoFrame:R,crossOrigin:F,delayRenderRetries:A,delayRenderTimeoutInMilliseconds:W,allowAmplificationDuringRender:M,useWebAudioApi:$,audioStreamIndex:V,...D}=e,L=Bi(E??"repeat"),{fps:j,durationInFrames:C}=ht(),P=d.useContext(xt),N=sr(),O=oa(),[z]=d.useState(()=>String(Math.random()));if(typeof g<"u")throw new Error("acceptableTimeShift has been removed. Use acceptableTimeShiftInSeconds instead.");const[Z]=Zp(),[H]=Kp(),G=Ao({frame:L,volume:s,mediaVolume:Z});Vi(G);const B=d.useCallback(()=>y??null,[y]);Vp({volume:s,mediaVolume:Z,mediaType:"video",src:p,playbackRate:e.playbackRate??1,displayName:k??null,id:z,getStack:B,showInTimeline:b,premountDisplay:(P==null?void 0:P.premountDisplay)??null,postmountDisplay:(P==null?void 0:P.postmountDisplay)??null,loopDisplay:void 0,documentationLink:f?"https://www.remotion.dev/docs/offthreadvideo":"https://www.remotion.dev/docs/html5-video",refForOutline:r}),Zx({mediaRef:r,src:p,mediaType:"video",playbackRate:e.playbackRate??1,preservePitch:c,onlyWarnForMediaSeekingError:f,acceptableTimeshift:w??null,isPremounting:!!(P!=null&&P.premounting),isPostmounting:!!(P!=null&&P.postmounting),pauseWhenBuffering:S,onAutoPlayError:T??null}),Kx({id:z,isPostmounting:!!(P!=null&&P.postmounting),isPremounting:!!(P!=null&&P.premounting),mediaRef:r,mediaType:"video",onAutoPlayError:T??null}),Dx({logLevel:N,mediaRef:r,volume:G,source:o,shouldUseWebAudioApi:$??!1});const X=P?P.relativeFrom:0,ae=P?Math.min(P.durationInFrames,C):C,oe=$o(p),Y=uI({actualSrc:oe,actualFrom:X,duration:ae,fps:j});d.useImperativeHandle(t,()=>r.current,[]),d.useState(()=>zt({logLevel:N,message:`Mounting video with source = ${Y}, v=${fs}, user agent=${typeof navigator>"u"?"server":navigator.userAgent}`,tag:"video",mountTime:O})),d.useEffect(()=>{const{current:de}=r;if(!de)return;const K=()=>{var ee;if(de.error){if(console.error("Error occurred in video",de==null?void 0:de.error),I){const ue=new ui({message:`Code ${de.error.code}: ${de.error.message}`,src:p});I(ue);return}throw new ui({message:`The browser threw an error while playing the video ${p}: Code ${de.error.code} - ${(ee=de==null?void 0:de.error)==null?void 0:ee.message}. See https://remotion.dev/docs/media-playback-error for help. Pass an onError() prop to handle the error.`,src:p})}else{if(I){const ue=new ui({message:`The browser threw an error while playing the video ${p}`,src:p});I(ue);return}throw new ui({message:"The browser threw an error while playing the video",src:p})}};return de.addEventListener("error",K,{once:!0}),()=>{de.removeEventListener("error",K)}},[I,p]);const q=d.useRef(m);q.current=m,u1({ref:r,onVideoFrame:R}),d.useEffect(()=>{var ee;const{current:de}=r;if(!de)return;if(de.duration){(ee=q.current)==null||ee.call(q,p,de.duration);return}const K=()=>{var ue;(ue=q.current)==null||ue.call(q,p,de.duration)};return de.addEventListener("loadedmetadata",K),()=>{de.removeEventListener("loadedmetadata",K)}},[p]),d.useEffect(()=>{const{current:de}=r;de&&(Wu()?de.preload="metadata":de.preload="auto")},[]);const xe=d.useMemo(()=>({...v}),[v]),Se=Bp({crossOrigin:F,requestsVideoFrame:!!R,isClientSideRendering:!1});return u.jsx("video",{...D,ref:r,muted:a||H||G<=0,playsInline:!0,src:Y,loop:h,style:xe,disableRemotePlayback:!0,crossOrigin:Se,controls:!1})},Jp=d.forwardRef(PT),Qp=e=>{const{startFrom:t,endAt:n,trimBefore:r,trimAfter:o,name:i,pauseWhenBuffering:s,stack:a,showInTimeline:l,...c}=e,f=ct(),p=sa(s);if(f.isClientSideRendering)throw new Error("<OffthreadVideo> is not supported in @remotion/web-renderer. Use <Video> from @remotion/media instead. See https://remotion.dev/docs/client-side-rendering/limitations");const m=d.useCallback(()=>{},[]);if(typeof e.src!="string")throw new TypeError(`The \`<OffthreadVideo>\` tag requires a string for \`src\`, but got ${JSON.stringify(e.src)} instead.`);Du({startFrom:t,endAt:n,trimBefore:r,trimAfter:o});const{trimBeforeValue:g,trimAfterValue:w}=Ou({startFrom:t,endAt:n,trimBefore:r,trimAfter:o});if(typeof g<"u"||typeof w<"u")return u.jsx(_t,{layout:"none",from:0-(g??0),showInTimeline:!1,durationInFrames:w,name:i,children:u.jsx(Qp,{pauseWhenBuffering:p,...c,trimAfter:void 0,name:void 0,showInTimeline:l,trimBefore:void 0,stack:void 0,startFrom:void 0,endAt:void 0})});if(zu(e,"Video"),f.isRendering)return u.jsx(jT,{pauseWhenBuffering:p,...c,trimAfter:void 0,name:void 0,showInTimeline:l,trimBefore:void 0,stack:void 0,startFrom:void 0,endAt:void 0});const{transparent:x,toneMapped:k,onAutoPlayError:h,onVideoFrame:y,crossOrigin:v,delayRenderRetries:S,delayRenderTimeoutInMilliseconds:b,...E}=c;return u.jsx(Jp,{_remotionInternalStack:a??null,onDuration:m,onlyWarnForMediaSeekingError:!0,pauseWhenBuffering:p,showInTimeline:l??!0,onAutoPlayError:h??void 0,onVideoFrame:y??null,crossOrigin:v,...E,_remotionInternalNativeLoopPassed:!1})},c1=({src:e,acceptableTimeShiftInSeconds:t,allowAmplificationDuringRender:n,audioStreamIndex:r,crossOrigin:o,delayRenderRetries:i,delayRenderTimeoutInMilliseconds:s,loopVolumeCurveBehavior:a,muted:l,name:c,onAutoPlayError:f,onError:p,onVideoFrame:m,pauseWhenBuffering:g,playbackRate:w,preservePitch:x,showInTimeline:k,style:h,toneFrequency:y,toneMapped:v,transparent:S,trimAfter:b,trimBefore:E,useWebAudioApi:I,volume:T,_remotionInternalNativeLoopPassed:R,endAt:F,stack:A,startFrom:W,imageFormat:M,...$})=>{if(M)throw new TypeError("The `<OffthreadVideo>` tag does no longer accept `imageFormat`. Use the `transparent` prop if you want to render a transparent video.");return u.jsx(Qp,{acceptableTimeShiftInSeconds:t,allowAmplificationDuringRender:n??!0,audioStreamIndex:r??0,crossOrigin:o,delayRenderRetries:i,delayRenderTimeoutInMilliseconds:s,loopVolumeCurveBehavior:a??"repeat",muted:l??!1,name:c,onAutoPlayError:f??null,onError:p,onVideoFrame:m,pauseWhenBuffering:sa(g),playbackRate:w??1,preservePitch:x,toneFrequency:y??1,showInTimeline:k??!0,src:e,stack:A,startFrom:W,_remotionInternalNativeLoopPassed:R??!1,endAt:F,style:h,toneMapped:v??!0,transparent:S??!1,trimAfter:b,trimBefore:E,useWebAudioApi:I??!1,volume:T,...$})};Zt(c1);var FT="remotion_staticFilesChanged";function _T(){const e=le.useContext(Mi),t=le.useContext(Ni),n=le.useContext(Ai),r=le.useContext(xt),o=le.useContext(na),i=le.useContext(Po),s=le.useContext(Lu),a=le.useContext(ku),l=le.useContext(Mo),c=le.useContext(zi),f=le.useContext(Ru),p=le.useContext(Pu),m=le.useContext(Wi),g=le.useContext(Fo);return d.useMemo(()=>({compositionManagerCtx:e,timelineContext:t,setTimelineContext:n,sequenceContext:r,nonceContext:o,canUseRemotionHooksContext:i,preloadContext:s,resolveCompositionContext:a,renderAssetManagerContext:l,sequenceManagerContext:c,sequenceManagerRefContext:f,visualModePropStatusesRefContext:p,bufferManagerContext:m,logLevelContext:g}),[e,o,r,n,t,i,s,a,l,c,f,p,m,g])}var MT=e=>{const{children:t,contexts:n}=e;return u.jsx(Fo.Provider,{value:n.logLevelContext,children:u.jsx(Po.Provider,{value:n.canUseRemotionHooksContext,children:u.jsx(na.Provider,{value:n.nonceContext,children:u.jsx(Lu.Provider,{value:n.preloadContext,children:u.jsx(Mi.Provider,{value:n.compositionManagerCtx,children:u.jsx(Ru.Provider,{value:n.sequenceManagerRefContext,children:u.jsx(zi.Provider,{value:n.sequenceManagerContext,children:u.jsx(Pu.Provider,{value:n.visualModePropStatusesRefContext,children:u.jsx(Mo.Provider,{value:n.renderAssetManagerContext,children:u.jsx(ku.Provider,{value:n.resolveCompositionContext,children:u.jsx(Ni.Provider,{value:n.timelineContext,children:u.jsx(Ai.Provider,{value:n.setTimelineContext,children:u.jsx(xt.Provider,{value:n.sequenceContext,children:u.jsx(Wi.Provider,{value:n.bufferManagerContext,children:t})})})})})})})})})})})})})})},$T=d.createRef(),me={MaxMediaCacheSizeContext:uT,useUnsafeVideoConfig:Iu,useFrameForVolumeProp:Bi,useTimelinePosition:io,useAbsoluteTimelinePosition:Uw,evaluateVolume:Ao,getAbsoluteSrc:ir,getAnimatedImageDurationInSeconds:oT,getAssetDisplayName:Ox,Timeline:ff,validateMediaTrimProps:Du,validateMediaProps:zu,resolveTrimProps:Ou,VideoForPreview:Jp,CompositionManager:Mi,CompositionSetters:ta,VisualModePropStatusesContext:ju,VisualModePropStatusesRefContext:Pu,VisualModeDragOverridesContext:Fu,VisualModeSettersContext:ex,SequenceManager:zi,SequenceManagerRefContext:Ru,SequenceStackTracesUpdateContext:bT,baseSchema:Cr,sequenceSchema:Ri,SequenceWithoutSchema:kx,sequenceStyleSchema:Xw,sequenceVisualStyleSchema:pC,sequencePremountSchema:Gw,textSchema:Tu,transformSchema:ar,premountSchema:Li,flattenActiveSchema:zp,getFlatSchemaWithAllKeys:Dp,RemotionRootContexts:gT,CompositionManagerProvider:iT,useVideo:Cu,getRoot:dT,useMediaVolumeState:Zp,usePlayerMutedState:Kp,useMediaInTimeline:Vp,useLazyComponent:Aw,truthy:$i,SequenceContext:xt,PremountContext:nx,usePremounting:aa,useRemotionContexts:_T,RemotionContextProvider:MT,CSSUtils:i1,setupEnvVariables:kT,MediaVolumeContext:Hp,SetMediaVolumeContext:Up,getRemotionEnvironment:Rn,SharedAudioContext:Oi,SharedAudioContextProvider:Nx,SharedAudioTagsContext:Bu,SharedAudioTagsContextProvider:Lx,invalidCompositionErrorMessage:nC,invalidFolderNameErrorMessage:CE,calculateMediaDuration:Au,isCompositionIdValid:Lw,isFolderNameValid:Cw,getPreviewDomElement:lT,compositionsRef:o1,portalNode:cf,waitForRoot:fT,SetTimelineContext:Ai,CanUseRemotionHooksProvider:sf,CanUseRemotionHooks:Po,PrefetchProvider:Mx,DurationsContextProvider:Ax,IsPlayerContextProvider:jE,useIsPlayer:Ep,EditorPropsProvider:jw,EditorPropsContext:Cp,usePreload:$o,NonceContext:na,resolveVideoConfig:l1,resolveVideoConfigOrCatch:xT,resolveVideoConfigWithMetadataOrCatch:wT,ResolveCompositionContext:ku,useResolvedVideoConfig:Ip,resolveCompositionsRef:DE,REMOTION_STUDIO_CONTAINER_ELEMENT:s1,RenderAssetManager:Mo,persistCurrentFrame:Ow,usePlaybackRate:Fp,useTimelineContext:oo,useTimelineSetFrame:Zw,isIosSafari:Wu,WATCH_REMOTION_STATIC_FILES:FT,addSequenceStackTraces:Zt,useMediaStartsAt:Co,BufferingProvider:Wx,BufferingContextReact:Wi,getComponentsToAddStacksTo:sC,getSequenceComponent:lC,getSingleChildComponent:uC,CurrentScaleContext:ET,PixelDensityContext:TT,PreviewSizeContext:CT,calculateScale:IT,validateRenderAsset:Fx,Log:kt,LogLevelContext:Fo,useLogLevel:sr,playbackLogging:zt,timeValueRef:zE,compositionSelectorRef:$T,RemotionEnvironmentContext:Pw,warnAboutTooHighVolume:Vi,AudioForPreview:Yx,OBJECTFIT_CONTAIN_CLASS_NAME:Us,InnerOffthreadVideo:Qp,useBasicMediaInTimeline:Bx,getInputPropsOverride:Rw,setInputPropsOverride:AE,useVideoEnabled:pT,useAudioEnabled:hT,useIsPlayerBuffering:Vx,TimelinePosition:ff,DelayRenderContextType:$w,TimelineContext:Ni,PlaybackRateContext:Rp,AbsoluteTimeContext:jp,RenderAssetManagerProvider:Z2,getEffectiveVisualModeValue:mx,CompositionRenderErrorContext:kw,useEffectChainState:fa,createEffectChainState:Tx,cleanupEffectChainState:hf,runEffectChain:da,useMemoizedEffects:ca,useMemoizedEffectDefinitions:ua,createEffect:V2,createWebGLContextError:T2,createWebGL2ContextError:Ix,computeEffectiveSchemaValuesDotNotation:xx,interpolateKeyframedStatus:la,makeStaticDragOverride:h2,makeKeyframedDragOverride:m2,resolveDragOverrideValue:Mu,getStaticDragOverrideValue:g2,OverrideIdsToNodePathsGettersContext:Lp,OverrideIdsToNodePathsSettersContext:c2,findPropsToDelete:vx,makeSequencePropsSubscriptionKey:mr,getPropStatusesCtx:yx,getEffectPropStatusesCtx:gx,hiddenField:_p,durationInFramesField:$p,freezeField:Ap,fromField:Jw},d1=e=>le.Children.toArray(e).reduce((n,r)=>r.type===le.Fragment?n.concat(d1(r.props.children)):(n.push(r),n),[]),AT={durationInFrames:$r.baseSchema.durationInFrames,name:$r.sequenceSchema.name,hidden:$r.sequenceSchema.hidden,showInTimeline:$r.sequenceSchema.showInTimeline,freeze:$r.baseSchema.freeze,trimBefore:$r.sequenceSchema.trimBefore,layout:$r.sequenceSchema.layout},NT=d.forwardRef(({offset:e=0,className:t="",stack:n=null,_remotionInternalRender:r=null,...o},i)=>(xC(),r?r({...o,offset:e,className:t||void 0,stack:n},i):u.jsx(tx,{children:o.children}))),f1=$r.withSchema({Component:NT,componentName:"<Series.Sequence>",componentIdentity:"dev.remotion.remotion.Series.Sequence",schema:AT,supportsEffects:!1}),LT=kx,cg=({durationInFrames:e,offset:t,index:n,childrenLength:r})=>{const o=`index = ${n}, duration = ${e}`;(n!==r-1||e!==1/0)&&bu(e,{component:"of a <Series.Sequence /> component",allowFloats:!0});const i=t??0;if(Number.isNaN(i))throw new TypeError(`The "offset" property of a <Series.Sequence /> must not be NaN, but got NaN (${o}).`);if(!Number.isFinite(i))throw new TypeError(`The "offset" property of a <Series.Sequence /> must be finite, but got ${i} (${o}).`);if(i%1!==0)throw new TypeError(`The "offset" property of a <Series.Sequence /> must be finite, but got ${i} (${o}).`);return i},zT=e=>{const t=d.useMemo(()=>{const n=d1(e.children),r=(o,i)=>{if(o===n.length)return null;const a=n[o];if(typeof a=="string"){if(a.trim()==="")return r(o+1,i);throw new TypeError(`The <Series /> component only accepts a list of <Series.Sequence /> components as its children, but you passed a string "${a}"`)}if(a.type!==f1)throw new TypeError(`The <Series /> component only accepts a list of <Series.Sequence /> components as its children, but got ${a} instead`);const l=a;return cg({durationInFrames:l.props.durationInFrames,offset:l.props.offset,index:o,childrenLength:n.length}),le.cloneElement(l,{_remotionInternalRender:(c,f)=>{const p=c.durationInFrames,{durationInFrames:m,children:g,offset:w,controls:x,stack:k,from:h,name:y,...v}=c,S=cg({durationInFrames:p,offset:w,index:o,childrenLength:n.length}),b=i+S,E=i+p+S;return u.jsxs(u.Fragment,{children:[u.jsx(LT,{ref:f,name:y||"<Series.Sequence>",_remotionInternalDocumentationLink:y?void 0:"https://www.remotion.dev/docs/series",_remotionInternalStack:k??void 0,controls:x??void 0,from:b,durationInFrames:p,...v,children:u.jsx(tx,{children:g})}),r(o+1,E)]})}})};return r(0,0)},[e.children]);return u.jsx(wC,{children:u.jsx(_t,{layout:"none",name:"<Series>",_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/series",...e,children:t})})},DT=Object.assign(Ir({Component:zT,componentName:"<Series>",componentIdentity:"dev.remotion.remotion.Series",schema:yC,supportsEffects:!1}),{Sequence:f1});Zt(DT);var OT={"%3A":":","%2F":"/","%3F":"?","%23":"#","%5B":"[","%5D":"]","%40":"@","%21":"!","%24":"$","%26":"&","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";"},dg={},BT=e=>{dg[e]||(console.warn(e),dg[e]=!0)},WT=e=>{for(const t of Object.keys(OT))if(e.includes(t))return{containsHex:!0,hexCode:t};return{containsHex:!1}},vf=e=>e.startsWith("/")?vf(e.substring(1)):e,VT=e=>{if(typeof window<"u"&&window.remotion_staticBase){if(e.startsWith(window.remotion_staticBase))throw new Error(`The value "${e}" is already prefixed with the static base ${window.remotion_staticBase}. You don't need to call staticFile() on it.`);return`${window.remotion_staticBase}/${vf(e)}`}return`/${vf(e)}`},HT=e=>e.split("/").map(o=>encodeURIComponent(o)).join("/"),eh=e=>{if(e===null)throw new TypeError("null was passed to staticFile()");if(typeof e>"u")throw new TypeError("undefined was passed to staticFile()");if(e.startsWith("http://")||e.startsWith("https://"))throw new TypeError(`staticFile() does not support remote URLs - got "${e}". Instead, pass the URL without wrapping it in staticFile(). See: https://remotion.dev/docs/staticfile-remote-urls`);if(e.startsWith("..")||e.startsWith("./"))throw new TypeError(`staticFile() does not support relative paths - got "${e}". Instead, pass the name of a file that is inside the public/ folder. See: https://remotion.dev/docs/staticfile-relative-paths`);if(e.startsWith("/Users")||e.startsWith("/home")||e.startsWith("/tmp")||e.startsWith("/etc")||e.startsWith("/opt")||e.startsWith("/var")||e.startsWith("C:")||e.startsWith("D:")||e.startsWith("E:"))throw new TypeError(`staticFile() does not support absolute paths - got "${e}". Instead, pass the name of a file that is inside the public/ folder. See: https://remotion.dev/docs/staticfile-relative-paths`);if(e.startsWith("public/"))throw new TypeError(`Do not include the public/ prefix when using staticFile() - got "${e}". See: https://remotion.dev/docs/staticfile-relative-paths`);const t=WT(e);t.containsHex&&BT(`WARNING: You seem to pass an already encoded path (path contains ${t.hexCode}). Since Remotion 4.0, the encoding is done by staticFile() itself. You may want to remove a encodeURIComponent() wrapping.`);const n=HT(e),r=VT(n);return r.startsWith("/")?r:`/${r}`},UT=e=>{const t={...e,durationInFrames:1,fps:1};return le.createElement(Ul,t)};Zt(UT);var fg=e=>Math.round(e*1e5)/1e5,Bc=({element:e,desiredTime:t,logLevel:n,mountTime:r})=>{if(Gl(e.currentTime,t))return{wait:Promise.resolve(t),cancel:()=>{}};gl({logLevel:n,mediaRef:e,time:t,why:"Seeking during rendering",mountTime:r});let o,i=null;const s=new Promise(l=>{o=e.requestVideoFrameCallback((c,f)=>{const p=f.expectedDisplayTime-c;if(p<=0){l(f.mediaTime);return}setTimeout(()=>{l(f.mediaTime)},p+150)})}),a=new Promise(l=>{const c=()=>{l()};e.addEventListener("seeked",c,{once:!0}),i=()=>{e.removeEventListener("seeked",c)}});return{wait:Promise.all([s,a]).then(([l])=>l),cancel:()=>{i==null||i(),e.cancelVideoFrameCallback(o)}}},ZT=({element:e,desiredTime:t,fps:n,logLevel:r,mountTime:o})=>{const i=1/n/2;let s=()=>{};return Number.isFinite(e.duration)&&e.currentTime>=e.duration&&t>=e.duration?{prom:Promise.resolve(),cancel:()=>{}}:{prom:new Promise((l,c)=>{const f=Bc({element:e,desiredTime:t+i,logLevel:r,mountTime:o});f.wait.then(p=>{if(Math.abs(t-p)<=i)return l();const g=t>p?1:-1,w=Bc({element:e,desiredTime:p+i*g,logLevel:r,mountTime:o});s=w.cancel,w.wait.then(x=>{const k=Math.abs(t-x);if(fg(k)<=fg(i))return l();const h=Bc({element:e,desiredTime:t+i,logLevel:r,mountTime:o});return s=h.cancel,h.wait.then(()=>{l()}).catch(y=>{c(y)})}).catch(x=>{c(x)})}),s=f.cancel}),cancel:()=>{s()}}},KT=({onError:e,volume:t,allowAmplificationDuringRender:n,playbackRate:r,onDuration:o,toneFrequency:i,name:s,acceptableTimeShiftInSeconds:a,delayRenderRetries:l,delayRenderTimeoutInMilliseconds:c,loopVolumeCurveBehavior:f,audioStreamIndex:p,onVideoFrame:m,preservePitch:g,...w},x)=>{const k=io(),h=Ft(),y=Bi(f??"repeat"),v=Iu(),S=d.useRef(null),b=d.useContext(xt),E=Co(),I=ct(),T=sr(),R=oa(),{delayRender:F,continueRender:A}=Un(),{registerRenderAsset:W,unregisterRenderAsset:M}=d.useContext(Mo),$=d.useMemo(()=>`video-${_o(w.src??"")}-${b==null?void 0:b.cumulatedFrom}-${b==null?void 0:b.relativeFrom}-${b==null?void 0:b.durationInFrames}`,[w.src,b==null?void 0:b.cumulatedFrom,b==null?void 0:b.relativeFrom,b==null?void 0:b.durationInFrames]);if(!v)throw new Error("No video config found");const V=Ao({volume:t,frame:y,mediaVolume:1});Vi(V),d.useEffect(()=>{if(!w.src)throw new Error("No src passed");if(!w.muted&&!(V<=0)&&window.remotion_audioEnabled)return W({type:"video",src:ir(w.src),id:$,frame:k,volume:V,mediaFrame:h,playbackRate:r??1,toneFrequency:i??1,audioStartFrame:Math.max(0,-((b==null?void 0:b.cumulatedNegativeFrom)??0)),audioStreamIndex:p??0}),()=>M($)},[w.muted,w.src,W,$,M,V,h,k,r,i,b==null?void 0:b.cumulatedNegativeFrom,p]),d.useImperativeHandle(x,()=>S.current,[]),u1({ref:S,onVideoFrame:m}),d.useEffect(()=>{var z,Z;if(!window.remotion_videoEnabled)return;const{current:L}=S;if(!L)return;const j=Ux({frame:h,playbackRate:r||1,startFrom:-E,fps:v.fps}),C=F(`Rendering <Html5Video /> with src="${w.src}" at time ${j}`,{retries:l??void 0,timeoutInMilliseconds:c??void 0});if(((Z=(z=window.process)==null?void 0:z.env)==null?void 0:Z.NODE_ENV)==="test"){A(C);return}if(Gl(L.currentTime,j)){if(L.readyState>=2){A(C);return}const H=()=>{A(C)};return L.addEventListener("loadeddata",H,{once:!0}),()=>{L.removeEventListener("loadeddata",H)}}const P=()=>{A(C)},N=ZT({element:L,desiredTime:j,fps:v.fps,logLevel:T,mountTime:R});N.prom.then(()=>{A(C)}),L.addEventListener("ended",P,{once:!0});const O=()=>{var H;if(L!=null&&L.error){if(console.error("Error occurred in video",L==null?void 0:L.error),e)return;throw new ui({message:`The browser threw an error while playing the video ${w.src}: Code ${L.error.code} - ${(H=L==null?void 0:L.error)==null?void 0:H.message}. See https://remotion.dev/docs/media-playback-error for help. Pass an onError() prop to handle the error.`,src:w.src})}else throw new ui({message:"The browser threw an error",src:w.src})};return L.addEventListener("error",O,{once:!0}),()=>{N.cancel(),L.removeEventListener("ended",P),L.removeEventListener("error",O),A(C)}},[y,w.src,r,v.fps,h,E,e,l,c,T,R,A,F]);const{src:D}=w;return I.isRendering&&d.useLayoutEffect(()=>{var P,N;if(((N=(P=window.process)==null?void 0:P.env)==null?void 0:N.NODE_ENV)==="test")return;const L=F("Loading <Html5Video> duration with src="+D,{retries:l??void 0,timeoutInMilliseconds:c??void 0}),{current:j}=S,C=()=>{j!=null&&j.duration&&o(D,j.duration),A(L)};return j!=null&&j.duration?(o(D,j.duration),A(L)):j==null||j.addEventListener("loadedmetadata",C,{once:!0}),()=>{j==null||j.removeEventListener("loadedmetadata",C),A(L)}},[D,o,l,c,A,F]),u.jsx("video",{ref:S,disableRemotePlayback:!0,...w})},YT=d.forwardRef(KT),GT=(e,t)=>{const{startFrom:n,endAt:r,trimBefore:o,trimAfter:i,name:s,pauseWhenBuffering:a,stack:l,_remotionInternalNativeLoopPassed:c,showInTimeline:f,onAutoPlayError:p,onVideoFrame:m,...g}=e,{loop:w,...x}=e,{fps:k}=ht(),h=ct(),y=sa(a);if(h.isClientSideRendering)throw new Error("<Html5Video> is not supported in @remotion/web-renderer. Use <Video> from @remotion/media instead. See https://remotion.dev/docs/client-side-rendering/limitations");const{durations:v,setDurations:S}=d.useContext(Op);if(typeof t=="string")throw new Error("string refs are not supported");if(typeof e.src!="string")throw new TypeError(`The \`<Html5Video>\` tag requires a string for \`src\`, but got ${JSON.stringify(e.src)} instead.`);const b=$o(e.src),E=d.useCallback((F,A)=>{S({type:"got-duration",durationInSeconds:A,src:F})},[S]),I=v[ir(b)]??v[ir(e.src)];Du({startFrom:n,endAt:r,trimBefore:o,trimAfter:i});const{trimBeforeValue:T,trimAfterValue:R}=Ou({startFrom:n,endAt:r,trimBefore:o,trimAfter:i});if(w&&I!==void 0){if(!Number.isFinite(I))return u.jsx(vl,{...x,ref:t,stack:l,_remotionInternalNativeLoopPassed:!0});const F=I*k;return u.jsx(Nu,{durationInFrames:Au({trimAfter:R,mediaDurationInFrames:F,playbackRate:e.playbackRate??1,trimBefore:T}),layout:"none",name:s,showInTimeline:!1,children:u.jsx(vl,{...x,ref:t,stack:l,_remotionInternalNativeLoopPassed:!0})})}return typeof T<"u"||typeof R<"u"?u.jsx(_t,{layout:"none",from:0-(T??0),showInTimeline:!1,durationInFrames:R===void 0?void 0:R/(e.playbackRate??1),name:s,children:u.jsx(vl,{pauseWhenBuffering:y,onVideoFrame:m,...g,ref:t,stack:l})}):(zu({playbackRate:e.playbackRate,preservePitch:e.preservePitch,volume:e.volume},"Html5Video"),h.isRendering?u.jsx(YT,{onDuration:E,onVideoFrame:m??null,...g,ref:t}):u.jsx(Jp,{onlyWarnForMediaSeekingError:!1,...g,ref:t,onVideoFrame:m??null,pauseWhenBuffering:y,onDuration:E,_remotionInternalStack:l??null,_remotionInternalNativeLoopPassed:c??!1,showInTimeline:f??!0,onAutoPlayError:p??void 0}))},vl=d.forwardRef(GT);Zt(vl);cC();var XT={},qT=new Proxy(XT,{get(e,t){return t==="Bundling"||t==="Rendering"||t==="Log"||t==="Puppeteer"||t==="Output"?qT:()=>{console.warn("⚠️ The CLI configuration has been extracted from Remotion Core."),console.warn("Update the import from the config file:"),console.warn(),console.warn("- Delete:"),console.warn('import {Config} from "remotion";'),console.warn("+ Replace:"),console.warn('import {Config} from "@remotion/cli/config";'),console.warn(),console.warn("For more information, see https://www.remotion.dev/docs/4-0-migration."),process.exit(1)}}});_t.displayName="Sequence";Zt(_t);aC(_t);Zt(Ul);Zt(IE);typeof window<"u"&&(window.remotion_renderReady=!1,window.remotion_delayRenderTimeouts||(window.remotion_delayRenderTimeouts={}),window.remotion_delayRenderHandles=[]);var JT={"style.transformOrigin":{type:"transform-origin",step:1,default:"50% 50%",description:"Transform origin"},"style.translate":{type:"translate",step:1,default:"0px 0px",description:"Offset"},"style.scale":{type:"scale",max:100,step:.01,default:1,description:"Scale",defaultKeyframeOutput:"perceptual-scale"},"style.rotate":{type:"rotation-css",step:1,default:"0deg",description:"Rotation"},"style.opacity":{type:"number",min:0,max:1,step:.01,default:1,description:"Opacity",hiddenFromList:!1}},QT={"style.borderWidth":{type:"number",default:void 0,min:0,step:1,description:"Border width",hiddenFromList:!1},"style.borderStyle":{type:"enum",default:"none",description:"Border style",variants:{none:{},hidden:{},solid:{},dashed:{},dotted:{},double:{},groove:{},ridge:{},inset:{},outset:{}}},"style.borderColor":{type:"color",default:void 0,description:"Border color"}},eR={"style.backgroundColor":{type:"color",default:"transparent",description:"Color"}},tR={premountFor:{type:"number",default:0,description:"Premount For",min:0,step:1,hiddenFromList:!1,keyframable:!1},postmountFor:{type:"number",default:0,min:0,step:1,hiddenFromList:!0,keyframable:!1}},nR={...tR},rR={...JT,...eR,...QT,...nR},oR={layout:{type:"enum",default:"absolute-fill",description:"Layout",variants:{"absolute-fill":rR,none:{}}}};({...oR.layout});var iR=(e,t,n)=>{if(e){if(typeof e!="object")throw new Error(`"${t}" must be an object, but you passed a value of type ${typeof e}`);if(Array.isArray(e))throw new Error(`"${t}" must be an object, an array was passed ${n?`for composition "${n}"`:""}`)}};function sR(e,t,n){if(typeof e!="number")throw new Error(`The "${t}" prop ${n} must be a number, but you passed a value of type ${typeof e}`);if(isNaN(e))throw new TypeError(`The "${t}" prop ${n} must not be NaN, but is NaN.`);if(!Number.isFinite(e))throw new TypeError(`The "${t}" prop ${n} must be finite, but is ${e}.`);if(e%1!==0)throw new TypeError(`The "${t}" prop ${n} must be an integer, but is ${e}.`);if(e<=0)throw new TypeError(`The "${t}" prop ${n} must be positive, but got ${e}.`)}function aR(e,t){const{allowFloats:n,component:r}=t;if(typeof e>"u")throw new Error(`The "durationInFrames" prop ${r} is missing.`);if(typeof e!="number")throw new Error(`The "durationInFrames" prop ${r} must be a number, but you passed a value of type ${typeof e}`);if(e<=0)throw new TypeError(`The "durationInFrames" prop ${r} must be positive, but got ${e}.`);if(!n&&e%1!==0)throw new TypeError(`The "durationInFrames" prop ${r} must be an integer, but got ${e}.`);if(!Number.isFinite(e))throw new TypeError(`The "durationInFrames" prop ${r} must be finite, but got ${e}.`)}function lR(e,t,n){if(typeof e!="number")throw new Error(`"fps" must be a number, but you passed a value of type ${typeof e} ${t}`);if(!Number.isFinite(e))throw new Error(`"fps" must be a finite, but you passed ${e} ${t}`);if(isNaN(e))throw new Error(`"fps" must not be NaN, but got ${e} ${t}`);if(e<=0)throw new TypeError(`"fps" must be positive, but got ${e} ${t}`);if(n&&e>50)throw new 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 Hu={validateFps:lR,validateDimension:sR,validateDurationInFrames:aR,validateDefaultAndInputProps:iR};if(typeof d.createContext!="function"){const e=['Remotion requires React.createContext, but it is "undefined".','If you are in a React Server Component, turn it into a client component by adding "use client" at the top of the file.',"","Before:",' import {Player} from "@remotion/player";',"","After:",' "use client";',' import {Player} from "@remotion/player";'];throw new Error(e.join(`
80
- `))}var jt=25,wf=16,uR=()=>u.jsx("svg",{width:jt,height:jt,viewBox:"0 0 25 25",fill:"none",children:u.jsx("path",{d:"M8 6.375C7.40904 8.17576 7.06921 10.2486 7.01438 12.3871C6.95955 14.5255 7.19163 16.6547 7.6875 18.5625C9.95364 18.2995 12.116 17.6164 14.009 16.5655C15.902 15.5147 17.4755 14.124 18.6088 12.5C17.5158 10.8949 15.9949 9.51103 14.1585 8.45082C12.3222 7.3906 10.2174 6.68116 8 6.375Z",fill:"white",stroke:"white",strokeWidth:"6.25",strokeLinejoin:"round"})}),cR=()=>u.jsxs("svg",{viewBox:"0 0 100 100",width:jt,height:jt,children:[u.jsx("rect",{x:"25",y:"20",width:"20",height:"60",fill:"#fff",ry:"5",rx:"5"}),u.jsx("rect",{x:"55",y:"20",width:"20",height:"60",fill:"#fff",ry:"5",rx:"5"})]}),dR=({isFullscreen:e})=>{const r=e?0:3,o=e?6*1.6:6/2,i=e?6*1.6:6*2;return u.jsxs("svg",{viewBox:"0 0 32 32",height:wf,width:wf,children:[u.jsx("path",{d:`
79
+ `,d1="__remotion-studio-container",pT=()=>document.getElementById(d1),hT=le.createContext(null),mT=null,Vc=[],gT=()=>mT,yT=e=>(Vc.push(e),()=>{Vc=Vc.filter(t=>t!==e)}),Qp=d.createContext(null),vT=()=>{const e=d.useContext(Qp);return!e||e.videoEnabled===null?window.remotion_videoEnabled:e.videoEnabled},wT=()=>{const e=d.useContext(Qp);return!e||e.audioEnabled===null?window.remotion_audioEnabled:e.audioEnabled},xT=({children:e,videoEnabled:t,audioEnabled:n})=>{const r=d.useMemo(()=>({videoEnabled:t,audioEnabled:n}),[t,n]);return u.jsx(Qp.Provider,{value:r,children:e})},bT=({children:e,numberOfAudioTags:t,logLevel:n,audioLatencyHint:r,previewSampleRate:o,videoEnabled:i,audioEnabled:s,frameState:a})=>{const l=d.useMemo(()=>{let f=0;return{getNonce:()=>f++}},[]),c=d.useMemo(()=>({logLevel:n,mountTime:Date.now()}),[n]);return u.jsx(_o.Provider,{value:c,children:u.jsx(na.Provider,{value:l,children:u.jsx(yC,{frameState:a,children:u.jsx(xT,{videoEnabled:i,audioEnabled:s,children:u.jsx($w,{children:u.jsx(zx,{children:u.jsx(kC,{children:u.jsx(Ox,{children:u.jsx(Kx,{children:u.jsx(Bx,{audioLatencyHint:r,audioEnabled:s,previewSampleRate:o,children:u.jsx(Wx,{numberOfAudioTags:t,children:e})})})})})})})})})})})},dg=["h264","h265","vp8","vp9","av1","mp3","aac","wav","prores","h264-mkv","h264-ts","gif"];function ST(e,t,n){if(!(typeof e>"u")){if(typeof e!="string")throw new TypeError(`The "${n}" prop ${t} must be a string, but you passed a value of type ${typeof e}.`);if(!dg.includes(e))throw new Error(`The "${n}" prop ${t} must be one of ${dg.join(", ")}, but you passed ${e}.`)}}var kT=({calculated:e,compositionId:t,compositionFps:n,compositionHeight:r,compositionWidth:o,compositionDurationInFrames:i})=>{const s=`calculated by calculateMetadata() for the composition "${t}"`,a=`of the "<Composition />" component with the id "${t}"`,l=(e==null?void 0:e.width)??o??void 0;Ul(l,"width",e!=null&&e.width?s:a);const c=(e==null?void 0:e.height)??r??void 0;Ul(c,"height",e!=null&&e.height?s:a);const f=(e==null?void 0:e.fps)??n??null;ku(f,e!=null&&e.fps?s:a);const p=(e==null?void 0:e.durationInFrames)??i??null;Su(p,{allowFloats:!1,component:`of the "<Composition />" component with the id "${t}"`});const m=e==null?void 0:e.defaultCodec;ST(m,s,"defaultCodec");const g=e==null?void 0:e.defaultOutName,w=e==null?void 0:e.defaultVideoImageFormat,x=e==null?void 0:e.defaultPixelFormat,k=e==null?void 0:e.defaultProResProfile,h=e==null?void 0:e.defaultSampleRate;return{width:l,height:c,fps:f,durationInFrames:p,defaultCodec:m,defaultOutName:g,defaultVideoImageFormat:w,defaultPixelFormat:x,defaultProResProfile:k,defaultSampleRate:h}},fg=({calculated:e,compositionDurationInFrames:t,compositionFps:n,compositionHeight:r,compositionId:o,compositionWidth:i,defaultProps:s,originalProps:a})=>{const l=kT({calculated:e,compositionDurationInFrames:t,compositionFps:n,compositionHeight:r,compositionWidth:i,compositionId:o});return{metadataSource:{durationInFrames:(e==null?void 0:e.durationInFrames)===void 0?"composition":"calculate-metadata",fps:(e==null?void 0:e.fps)===void 0?"composition":"calculate-metadata",height:(e==null?void 0:e.height)===void 0?"composition":"calculate-metadata",width:(e==null?void 0:e.width)===void 0?"composition":"calculate-metadata"},videoConfig:{...l,id:o,defaultProps:df(s??{}),props:df((e==null?void 0:e.props)??a),defaultCodec:l.defaultCodec??null,defaultOutName:l.defaultOutName??null,defaultVideoImageFormat:l.defaultVideoImageFormat??null,defaultPixelFormat:l.defaultPixelFormat??null,defaultProResProfile:l.defaultProResProfile??null,defaultSampleRate:l.defaultSampleRate??null}}},f1=({calculateMetadata:e,signal:t,defaultProps:n,inputProps:r,compositionId:o,compositionDurationInFrames:i,compositionFps:s,compositionHeight:a,compositionWidth:l})=>{const c=e?e({defaultProps:n,props:r,abortSignal:t,compositionId:o,isRendering:Rn().isRendering}):null;return c!==null&&typeof c=="object"&&"then"in c?c.then(f=>fg({calculated:f,compositionDurationInFrames:i,compositionFps:s,compositionHeight:a,compositionWidth:l,compositionId:o,defaultProps:n,originalProps:r})):fg({calculated:c,compositionDurationInFrames:i,compositionFps:s,compositionHeight:a,compositionWidth:l,compositionId:o,defaultProps:n,originalProps:r})},p1=e=>{const t=f1(e);return typeof t=="object"&&"then"in t?t.then(({videoConfig:n})=>n):t.videoConfig},ET=e=>{try{return{type:"success",result:f1(e)}}catch(t){return{type:"error",error:t}}},CT=e=>{try{return{type:"success",result:p1(e)}}catch(t){return{type:"error",error:t}}},IT=le.createContext(()=>{}),TT=()=>{if(Rn().isRendering){const e=window.remotion_envVariables;return e?{...JSON.parse(e),NODE_ENV:"production"}:{}}return{NODE_ENV:"production"}},RT=()=>{const e=TT();window.process||(window.process={}),window.process.env||(window.process.env={}),Object.keys(e).forEach(t=>{window.process.env[t]=e[t]})},jT=le.createContext(null),PT=d.createContext({setSize:()=>{},size:{size:"auto",translation:{x:0,y:0}}}),FT=({canvasSize:e,compositionHeight:t,compositionWidth:n,previewSize:r})=>{const o=e.height/t,i=e.width/n,s=Math.min(o,i);return r==="auto"?s===0?1:s:Number(r)},_T=le.createContext(null),MT=({src:e,transparent:t,currentTime:n,toneMapped:r})=>`http://localhost:${window.remotion_proxyPort}/proxy?src=${encodeURIComponent(ir(e))}&time=${encodeURIComponent(Math.max(0,n))}&transparent=${String(t)}&toneMapped=${String(r)}`,$T=({onError:e,volume:t,playbackRate:n,src:r,muted:o,allowAmplificationDuringRender:i,transparent:s,toneMapped:a,toneFrequency:l,name:c,loopVolumeCurveBehavior:f,delayRenderRetries:p,delayRenderTimeoutInMilliseconds:m,onVideoFrame:g,crossOrigin:w,audioStreamIndex:x,preservePitch:k,...h})=>{const y=io(),v=Ft(),S=Bi(f),b=Tu(),E=d.useContext(xt),I=Io(),{registerRenderAsset:T,unregisterRenderAsset:j}=d.useContext($o);if(!r)throw new TypeError("No `src` was passed to <OffthreadVideo>.");const _=d.useMemo(()=>`offthreadvideo-${Mo(r)}-${E==null?void 0:E.cumulatedFrom}-${E==null?void 0:E.relativeFrom}-${E==null?void 0:E.durationInFrames}`,[r,E==null?void 0:E.cumulatedFrom,E==null?void 0:E.relativeFrom,E==null?void 0:E.durationInFrames]);if(!b)throw new Error("No video config found");const N=No({volume:t,frame:S,mediaVolume:1});Vi(N),d.useEffect(()=>{if(!r)throw new Error("No src passed");if(window.remotion_audioEnabled&&!o&&!(N<=0))return T({type:"video",src:ir(r),id:_,frame:y,volume:N,mediaFrame:v,playbackRate:n,toneFrequency:l,audioStartFrame:Math.max(0,-((E==null?void 0:E.cumulatedNegativeFrom)??0)),audioStreamIndex:x}),()=>j(_)},[o,r,T,_,j,N,v,y,n,l,E==null?void 0:E.cumulatedNegativeFrom,x]);const W=d.useMemo(()=>Gx({frame:v,playbackRate:n||1,startFrom:-I})/b.fps,[v,I,n,b.fps]),M=d.useMemo(()=>MT({src:r,currentTime:W,transparent:s,toneMapped:a}),[a,W,r,s]),[$,V]=d.useState(null),{delayRender:L,continueRender:A}=Un();d.useLayoutEffect(()=>{if(!window.remotion_videoEnabled)return;const z=[];V(null);const O=new AbortController,D=L(`Fetching ${M} from server`,{retries:p??void 0,timeoutInMilliseconds:m??void 0});return(async()=>{try{const H=await fetch(M,{signal:O.signal,cache:"no-store"});if(H.status!==200){if(H.status===500){const X=await H.json();if(X.error){const ae=X.error.replace(/^Error: /,"");throw new Error(ae)}}throw new Error(`Server returned status ${H.status} while fetching ${M}`)}const G=await H.blob(),B=URL.createObjectURL(G);z.push(()=>URL.revokeObjectURL(B)),V({src:B,handle:D})}catch(H){if(H.message.includes("aborted")){A(D);return}if(O.signal.aborted){A(D);return}H.message.includes("Failed to fetch")&&(H=new Error(`Failed to fetch ${M}. This could be caused by Chrome rejecting the request because the disk space is low. Consider increasing the disk size of your environment.`,{cause:H})),e?e(H):Hs(H)}})(),z.push(()=>{O.signal.aborted||O.abort()}),()=>{z.forEach(H=>H())}},[M,p,m,e,A,L]);const R=d.useCallback(()=>{e?e==null||e(new Error("Failed to load image with src "+$)):Hs("Failed to load image with src "+$)},[$,e]),C=d.useMemo(()=>[Us,h.className].filter($i).join(" "),[h.className]),P=d.useCallback(z=>{g&&g(z)},[g]);return!$||!window.remotion_videoEnabled?null:(A($.handle),u.jsx(qp,{src:$.src,delayRenderRetries:p,delayRenderTimeoutInMilliseconds:m,onImageFrame:P,...h,onError:R,className:C}))},h1=({ref:e,onVideoFrame:t})=>{d.useEffect(()=>{const{current:n}=e;if(!n||!t)return;let r=0;const o=(i,s)=>{e.current&&(t(e.current,i,s),r=e.current.requestVideoFrameCallback(o))};if(t(n),!!n.requestVideoFrameCallback)return r=n.requestVideoFrameCallback(o),()=>{r&&n.cancelVideoFrameCallback(r)}},[t,e])};class ui extends Error{constructor({message:n,src:r}){super(n);Ae(this,"src");this.name="MediaPlaybackError",this.src=r}}var AT=(e,t)=>{const n=d.useContext(Oi);if(!n)throw new Error("SharedAudioContext not found");const r=d.useRef(null),o=d.useMemo(()=>n.audioContext?Hp({audioContext:n.audioContext,ref:r}):null,[n.audioContext]);(le.useInsertionEffect??le.useLayoutEffect)(()=>()=>{requestAnimationFrame(()=>{o==null||o.cleanup()})},[o]);const{volume:s,muted:a,playbackRate:l,preservePitch:c,onlyWarnForMediaSeekingError:f,src:p,onDuration:m,acceptableTimeShift:g,acceptableTimeShiftInSeconds:w,toneFrequency:x,name:k,_remotionInternalNativeLoopPassed:h,_remotionInternalStack:y,style:v,pauseWhenBuffering:S,showInTimeline:b,loopVolumeCurveBehavior:E,onError:I,onAutoPlayError:T,onVideoFrame:j,crossOrigin:_,delayRenderRetries:N,delayRenderTimeoutInMilliseconds:W,allowAmplificationDuringRender:M,useWebAudioApi:$,audioStreamIndex:V,...L}=e,A=Bi(E??"repeat"),{fps:R,durationInFrames:C}=ht(),P=d.useContext(xt),z=sr(),O=oa(),[D]=d.useState(()=>String(Math.random()));if(typeof g<"u")throw new Error("acceptableTimeShift has been removed. Use acceptableTimeShiftInSeconds instead.");const[Z]=Yp(),[H]=Gp(),G=No({frame:A,volume:s,mediaVolume:Z});Vi(G);const B=d.useCallback(()=>y??null,[y]);Up({volume:s,mediaVolume:Z,mediaType:"video",src:p,playbackRate:e.playbackRate??1,displayName:k??null,id:D,getStack:B,showInTimeline:b,premountDisplay:(P==null?void 0:P.premountDisplay)??null,postmountDisplay:(P==null?void 0:P.postmountDisplay)??null,loopDisplay:void 0,documentationLink:f?"https://www.remotion.dev/docs/offthreadvideo":"https://www.remotion.dev/docs/html5-video",refForOutline:r}),qx({mediaRef:r,src:p,mediaType:"video",playbackRate:e.playbackRate??1,preservePitch:c,onlyWarnForMediaSeekingError:f,acceptableTimeshift:w??null,isPremounting:!!(P!=null&&P.premounting),isPostmounting:!!(P!=null&&P.postmounting),pauseWhenBuffering:S,onAutoPlayError:T??null}),Jx({id:D,isPostmounting:!!(P!=null&&P.postmounting),isPremounting:!!(P!=null&&P.premounting),mediaRef:r,mediaType:"video",onAutoPlayError:T??null}),Hx({logLevel:z,mediaRef:r,volume:G,source:o,shouldUseWebAudioApi:$??!1});const X=P?P.relativeFrom:0,ae=P?Math.min(P.durationInFrames,C):C,oe=Ao(p),Y=hI({actualSrc:oe,actualFrom:X,duration:ae,fps:R});d.useImperativeHandle(t,()=>r.current,[]),d.useState(()=>zt({logLevel:z,message:`Mounting video with source = ${Y}, v=${fs}, user agent=${typeof navigator>"u"?"server":navigator.userAgent}`,tag:"video",mountTime:O})),d.useEffect(()=>{const{current:de}=r;if(!de)return;const K=()=>{var ee;if(de.error){if(console.error("Error occurred in video",de==null?void 0:de.error),I){const ue=new ui({message:`Code ${de.error.code}: ${de.error.message}`,src:p});I(ue);return}throw new ui({message:`The browser threw an error while playing the video ${p}: Code ${de.error.code} - ${(ee=de==null?void 0:de.error)==null?void 0:ee.message}. See https://remotion.dev/docs/media-playback-error for help. Pass an onError() prop to handle the error.`,src:p})}else{if(I){const ue=new ui({message:`The browser threw an error while playing the video ${p}`,src:p});I(ue);return}throw new ui({message:"The browser threw an error while playing the video",src:p})}};return de.addEventListener("error",K,{once:!0}),()=>{de.removeEventListener("error",K)}},[I,p]);const q=d.useRef(m);q.current=m,h1({ref:r,onVideoFrame:j}),d.useEffect(()=>{var ee;const{current:de}=r;if(!de)return;if(de.duration){(ee=q.current)==null||ee.call(q,p,de.duration);return}const K=()=>{var ue;(ue=q.current)==null||ue.call(q,p,de.duration)};return de.addEventListener("loadedmetadata",K),()=>{de.removeEventListener("loadedmetadata",K)}},[p]),d.useEffect(()=>{const{current:de}=r;de&&(Vu()?de.preload="metadata":de.preload="auto")},[]);const xe=d.useMemo(()=>({...v}),[v]),Se=Vp({crossOrigin:_,requestsVideoFrame:!!j,isClientSideRendering:!1});return u.jsx("video",{...L,ref:r,muted:a||H||G<=0,playsInline:!0,src:Y,loop:h,style:xe,disableRemotePlayback:!0,crossOrigin:Se,controls:!1})},eh=d.forwardRef(AT),th=e=>{const{startFrom:t,endAt:n,trimBefore:r,trimAfter:o,name:i,pauseWhenBuffering:s,stack:a,showInTimeline:l,...c}=e,f=ct(),p=sa(s);if(f.isClientSideRendering)throw new Error("<OffthreadVideo> is not supported in @remotion/web-renderer. Use <Video> from @remotion/media instead. See https://remotion.dev/docs/client-side-rendering/limitations");const m=d.useCallback(()=>{},[]);if(typeof e.src!="string")throw new TypeError(`The \`<OffthreadVideo>\` tag requires a string for \`src\`, but got ${JSON.stringify(e.src)} instead.`);Ou({startFrom:t,endAt:n,trimBefore:r,trimAfter:o});const{trimBeforeValue:g,trimAfterValue:w}=Bu({startFrom:t,endAt:n,trimBefore:r,trimAfter:o});if(typeof g<"u"||typeof w<"u")return u.jsx(_t,{layout:"none",from:0-(g??0),showInTimeline:!1,durationInFrames:w,name:i,children:u.jsx(th,{pauseWhenBuffering:p,...c,trimAfter:void 0,name:void 0,showInTimeline:l,trimBefore:void 0,stack:void 0,startFrom:void 0,endAt:void 0})});if(Du(e,"Video"),f.isRendering)return u.jsx($T,{pauseWhenBuffering:p,...c,trimAfter:void 0,name:void 0,showInTimeline:l,trimBefore:void 0,stack:void 0,startFrom:void 0,endAt:void 0});const{transparent:x,toneMapped:k,onAutoPlayError:h,onVideoFrame:y,crossOrigin:v,delayRenderRetries:S,delayRenderTimeoutInMilliseconds:b,...E}=c;return u.jsx(eh,{_remotionInternalStack:a??null,onDuration:m,onlyWarnForMediaSeekingError:!0,pauseWhenBuffering:p,showInTimeline:l??!0,onAutoPlayError:h??void 0,onVideoFrame:y??null,crossOrigin:v,...E,_remotionInternalNativeLoopPassed:!1})},m1=({src:e,acceptableTimeShiftInSeconds:t,allowAmplificationDuringRender:n,audioStreamIndex:r,crossOrigin:o,delayRenderRetries:i,delayRenderTimeoutInMilliseconds:s,loopVolumeCurveBehavior:a,muted:l,name:c,onAutoPlayError:f,onError:p,onVideoFrame:m,pauseWhenBuffering:g,playbackRate:w,preservePitch:x,showInTimeline:k,style:h,toneFrequency:y,toneMapped:v,transparent:S,trimAfter:b,trimBefore:E,useWebAudioApi:I,volume:T,_remotionInternalNativeLoopPassed:j,endAt:_,stack:N,startFrom:W,imageFormat:M,...$})=>{if(M)throw new TypeError("The `<OffthreadVideo>` tag does no longer accept `imageFormat`. Use the `transparent` prop if you want to render a transparent video.");return u.jsx(th,{acceptableTimeShiftInSeconds:t,allowAmplificationDuringRender:n??!0,audioStreamIndex:r??0,crossOrigin:o,delayRenderRetries:i,delayRenderTimeoutInMilliseconds:s,loopVolumeCurveBehavior:a??"repeat",muted:l??!1,name:c,onAutoPlayError:f??null,onError:p,onVideoFrame:m,pauseWhenBuffering:sa(g),playbackRate:w??1,preservePitch:x,toneFrequency:y??1,showInTimeline:k??!0,src:e,stack:N,startFrom:W,_remotionInternalNativeLoopPassed:j??!1,endAt:_,style:h,toneMapped:v??!0,transparent:S??!1,trimAfter:b,trimBefore:E,useWebAudioApi:I??!1,volume:T,...$})};Zt(m1);var NT="remotion_staticFilesChanged";function LT(){const e=le.useContext(Mi),t=le.useContext(Ni),n=le.useContext(Ai),r=le.useContext(xt),o=le.useContext(na),i=le.useContext(Fo),s=le.useContext(zu),a=le.useContext(Eu),l=le.useContext($o),c=le.useContext(zi),f=le.useContext(ju),p=le.useContext(Fu),m=le.useContext(Wi),g=le.useContext(_o);return d.useMemo(()=>({compositionManagerCtx:e,timelineContext:t,setTimelineContext:n,sequenceContext:r,nonceContext:o,canUseRemotionHooksContext:i,preloadContext:s,resolveCompositionContext:a,renderAssetManagerContext:l,sequenceManagerContext:c,sequenceManagerRefContext:f,visualModePropStatusesRefContext:p,bufferManagerContext:m,logLevelContext:g}),[e,o,r,n,t,i,s,a,l,c,f,p,m,g])}var zT=e=>{const{children:t,contexts:n}=e;return u.jsx(_o.Provider,{value:n.logLevelContext,children:u.jsx(Fo.Provider,{value:n.canUseRemotionHooksContext,children:u.jsx(na.Provider,{value:n.nonceContext,children:u.jsx(zu.Provider,{value:n.preloadContext,children:u.jsx(Mi.Provider,{value:n.compositionManagerCtx,children:u.jsx(ju.Provider,{value:n.sequenceManagerRefContext,children:u.jsx(zi.Provider,{value:n.sequenceManagerContext,children:u.jsx(Fu.Provider,{value:n.visualModePropStatusesRefContext,children:u.jsx($o.Provider,{value:n.renderAssetManagerContext,children:u.jsx(Eu.Provider,{value:n.resolveCompositionContext,children:u.jsx(Ni.Provider,{value:n.timelineContext,children:u.jsx(Ai.Provider,{value:n.setTimelineContext,children:u.jsx(xt.Provider,{value:n.sequenceContext,children:u.jsx(Wi.Provider,{value:n.bufferManagerContext,children:t})})})})})})})})})})})})})})},DT=d.createRef(),me={MaxMediaCacheSizeContext:hT,useUnsafeVideoConfig:Tu,useFrameForVolumeProp:Bi,useTimelinePosition:io,useAbsoluteTimelinePosition:Xw,evaluateVolume:No,getAbsoluteSrc:ir,getAnimatedImageDurationInSeconds:uT,getAssetDisplayName:Ux,Timeline:hf,validateMediaTrimProps:Ou,validateMediaProps:Du,resolveTrimProps:Bu,VideoForPreview:eh,CompositionManager:Mi,CompositionSetters:ta,VisualModePropStatusesContext:Pu,VisualModePropStatusesRefContext:Fu,VisualModeDragOverridesContext:_u,VisualModeSettersContext:ix,SequenceManager:zi,SequenceManagerRefContext:ju,SequenceStackTracesUpdateContext:IT,baseSchema:Cr,sequenceSchema:Ri,SequenceWithoutSchema:Rx,sequenceStyleSchema:tx,sequenceVisualStyleSchema:vC,sequencePremountSchema:ex,textSchema:Ru,transformSchema:ar,premountSchema:Li,flattenActiveSchema:Op,getFlatSchemaWithAllKeys:Bp,RemotionRootContexts:bT,CompositionManagerProvider:cT,useVideo:Iu,getRoot:gT,useMediaVolumeState:Yp,usePlayerMutedState:Gp,useMediaInTimeline:Up,useLazyComponent:Ow,truthy:$i,SequenceContext:xt,PremountContext:ax,usePremounting:aa,useRemotionContexts:LT,RemotionContextProvider:zT,CSSUtils:c1,setupEnvVariables:RT,MediaVolumeContext:Zp,SetMediaVolumeContext:Kp,getRemotionEnvironment:Rn,SharedAudioContext:Oi,SharedAudioContextProvider:Bx,SharedAudioTagsContext:Wu,SharedAudioTagsContextProvider:Wx,invalidCompositionErrorMessage:aC,invalidFolderNameErrorMessage:PE,calculateMediaDuration:Nu,isCompositionIdValid:Ww,isFolderNameValid:Pw,getPreviewDomElement:pT,compositionsRef:u1,portalNode:ff,waitForRoot:yT,SetTimelineContext:Ai,CanUseRemotionHooksProvider:lf,CanUseRemotionHooks:Fo,PrefetchProvider:zx,DurationsContextProvider:Ox,IsPlayerContextProvider:$E,useIsPlayer:Ip,EditorPropsProvider:$w,EditorPropsContext:Tp,usePreload:Ao,NonceContext:na,resolveVideoConfig:p1,resolveVideoConfigOrCatch:CT,resolveVideoConfigWithMetadataOrCatch:ET,ResolveCompositionContext:Eu,useResolvedVideoConfig:Rp,resolveCompositionsRef:HE,REMOTION_STUDIO_CONTAINER_ELEMENT:d1,RenderAssetManager:$o,persistCurrentFrame:Uw,usePlaybackRate:Mp,useTimelineContext:oo,useTimelineSetFrame:qw,isIosSafari:Vu,WATCH_REMOTION_STATIC_FILES:NT,addSequenceStackTraces:Zt,useMediaStartsAt:Io,BufferingProvider:Kx,BufferingContextReact:Wi,getComponentsToAddStacksTo:dC,getSequenceComponent:pC,getSingleChildComponent:hC,CurrentScaleContext:jT,PixelDensityContext:_T,PreviewSizeContext:PT,calculateScale:FT,validateRenderAsset:Nx,Log:kt,LogLevelContext:_o,useLogLevel:sr,playbackLogging:zt,timeValueRef:VE,compositionSelectorRef:DT,RemotionEnvironmentContext:Aw,warnAboutTooHighVolume:Vi,AudioForPreview:Qx,OBJECTFIT_CONTAIN_CLASS_NAME:Us,InnerOffthreadVideo:th,useBasicMediaInTimeline:Zx,getInputPropsOverride:Mw,setInputPropsOverride:OE,useVideoEnabled:vT,useAudioEnabled:wT,useIsPlayerBuffering:Yx,TimelinePosition:hf,DelayRenderContextType:Dw,TimelineContext:Ni,PlaybackRateContext:Pp,AbsoluteTimeContext:Fp,RenderAssetManagerProvider:q2,getEffectiveVisualModeValue:xx,CompositionRenderErrorContext:Rw,useEffectChainState:fa,createEffectChainState:_x,cleanupEffectChainState:gf,runEffectChain:da,useMemoizedEffects:ca,useMemoizedEffectDefinitions:ua,createEffect:Y2,createWebGLContextError:_2,createWebGL2ContextError:Fx,computeEffectiveSchemaValuesDotNotation:Cx,interpolateKeyframedStatus:la,makeStaticDragOverride:w2,makeKeyframedDragOverride:x2,resolveDragOverrideValue:$u,getStaticDragOverrideValue:b2,OverrideIdsToNodePathsGettersContext:Dp,OverrideIdsToNodePathsSettersContext:m2,findPropsToDelete:kx,makeSequencePropsSubscriptionKey:mr,getPropStatusesCtx:Sx,getEffectPropStatusesCtx:bx,hiddenField:$p,durationInFramesField:Np,freezeField:Lp,fromField:rx},g1=e=>le.Children.toArray(e).reduce((n,r)=>r.type===le.Fragment?n.concat(g1(r.props.children)):(n.push(r),n),[]),OT={durationInFrames:$r.baseSchema.durationInFrames,name:$r.sequenceSchema.name,hidden:$r.sequenceSchema.hidden,showInTimeline:$r.sequenceSchema.showInTimeline,freeze:$r.baseSchema.freeze,trimBefore:$r.sequenceSchema.trimBefore,layout:$r.sequenceSchema.layout},BT=d.forwardRef(({offset:e=0,className:t="",stack:n=null,_remotionInternalRender:r=null,...o},i)=>(CC(),r?r({...o,offset:e,className:t||void 0,stack:n},i):u.jsx(sx,{children:o.children}))),y1=$r.withSchema({Component:BT,componentName:"<Series.Sequence>",componentIdentity:"dev.remotion.remotion.Series.Sequence",schema:OT,supportsEffects:!1}),WT=Rx,pg=({durationInFrames:e,offset:t,index:n,childrenLength:r})=>{const o=`index = ${n}, duration = ${e}`;(n!==r-1||e!==1/0)&&Su(e,{component:"of a <Series.Sequence /> component",allowFloats:!0});const i=t??0;if(Number.isNaN(i))throw new TypeError(`The "offset" property of a <Series.Sequence /> must not be NaN, but got NaN (${o}).`);if(!Number.isFinite(i))throw new TypeError(`The "offset" property of a <Series.Sequence /> must be finite, but got ${i} (${o}).`);if(i%1!==0)throw new TypeError(`The "offset" property of a <Series.Sequence /> must be finite, but got ${i} (${o}).`);return i},VT=e=>{const t=d.useMemo(()=>{const n=g1(e.children),r=(o,i)=>{if(o===n.length)return null;const a=n[o];if(typeof a=="string"){if(a.trim()==="")return r(o+1,i);throw new TypeError(`The <Series /> component only accepts a list of <Series.Sequence /> components as its children, but you passed a string "${a}"`)}if(a.type!==y1)throw new TypeError(`The <Series /> component only accepts a list of <Series.Sequence /> components as its children, but got ${a} instead`);const l=a;return pg({durationInFrames:l.props.durationInFrames,offset:l.props.offset,index:o,childrenLength:n.length}),le.cloneElement(l,{_remotionInternalRender:(c,f)=>{const p=c.durationInFrames,{durationInFrames:m,children:g,offset:w,controls:x,stack:k,from:h,name:y,...v}=c,S=pg({durationInFrames:p,offset:w,index:o,childrenLength:n.length}),b=i+S,E=i+p+S;return u.jsxs(u.Fragment,{children:[u.jsx(WT,{ref:f,name:y||"<Series.Sequence>",_remotionInternalDocumentationLink:y?void 0:"https://www.remotion.dev/docs/series",_remotionInternalStack:k??void 0,controls:x??void 0,from:b,durationInFrames:p,...v,children:u.jsx(sx,{children:g})}),r(o+1,E)]})}})};return r(0,0)},[e.children]);return u.jsx(EC,{children:u.jsx(_t,{layout:"none",name:"<Series>",_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/series",...e,children:t})})},HT=Object.assign(Ir({Component:VT,componentName:"<Series>",componentIdentity:"dev.remotion.remotion.Series",schema:SC,supportsEffects:!1}),{Sequence:y1});Zt(HT);var UT={"%3A":":","%2F":"/","%3F":"?","%23":"#","%5B":"[","%5D":"]","%40":"@","%21":"!","%24":"$","%26":"&","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";"},hg={},ZT=e=>{hg[e]||(console.warn(e),hg[e]=!0)},KT=e=>{for(const t of Object.keys(UT))if(e.includes(t))return{containsHex:!0,hexCode:t};return{containsHex:!1}},xf=e=>e.startsWith("/")?xf(e.substring(1)):e,YT=e=>{if(typeof window<"u"&&window.remotion_staticBase){if(e.startsWith(window.remotion_staticBase))throw new Error(`The value "${e}" is already prefixed with the static base ${window.remotion_staticBase}. You don't need to call staticFile() on it.`);return`${window.remotion_staticBase}/${xf(e)}`}return`/${xf(e)}`},GT=e=>e.split("/").map(o=>encodeURIComponent(o)).join("/"),nh=e=>{if(e===null)throw new TypeError("null was passed to staticFile()");if(typeof e>"u")throw new TypeError("undefined was passed to staticFile()");if(e.startsWith("http://")||e.startsWith("https://"))throw new TypeError(`staticFile() does not support remote URLs - got "${e}". Instead, pass the URL without wrapping it in staticFile(). See: https://remotion.dev/docs/staticfile-remote-urls`);if(e.startsWith("..")||e.startsWith("./"))throw new TypeError(`staticFile() does not support relative paths - got "${e}". Instead, pass the name of a file that is inside the public/ folder. See: https://remotion.dev/docs/staticfile-relative-paths`);if(e.startsWith("/Users")||e.startsWith("/home")||e.startsWith("/tmp")||e.startsWith("/etc")||e.startsWith("/opt")||e.startsWith("/var")||e.startsWith("C:")||e.startsWith("D:")||e.startsWith("E:"))throw new TypeError(`staticFile() does not support absolute paths - got "${e}". Instead, pass the name of a file that is inside the public/ folder. See: https://remotion.dev/docs/staticfile-relative-paths`);if(e.startsWith("public/"))throw new TypeError(`Do not include the public/ prefix when using staticFile() - got "${e}". See: https://remotion.dev/docs/staticfile-relative-paths`);const t=KT(e);t.containsHex&&ZT(`WARNING: You seem to pass an already encoded path (path contains ${t.hexCode}). Since Remotion 4.0, the encoding is done by staticFile() itself. You may want to remove a encodeURIComponent() wrapping.`);const n=GT(e),r=YT(n);return r.startsWith("/")?r:`/${r}`},XT=e=>{const t={...e,durationInFrames:1,fps:1};return le.createElement(Zl,t)};Zt(XT);var mg=e=>Math.round(e*1e5)/1e5,Hc=({element:e,desiredTime:t,logLevel:n,mountTime:r})=>{if(Xl(e.currentTime,t))return{wait:Promise.resolve(t),cancel:()=>{}};yl({logLevel:n,mediaRef:e,time:t,why:"Seeking during rendering",mountTime:r});let o,i=null;const s=new Promise(l=>{o=e.requestVideoFrameCallback((c,f)=>{const p=f.expectedDisplayTime-c;if(p<=0){l(f.mediaTime);return}setTimeout(()=>{l(f.mediaTime)},p+150)})}),a=new Promise(l=>{const c=()=>{l()};e.addEventListener("seeked",c,{once:!0}),i=()=>{e.removeEventListener("seeked",c)}});return{wait:Promise.all([s,a]).then(([l])=>l),cancel:()=>{i==null||i(),e.cancelVideoFrameCallback(o)}}},qT=({element:e,desiredTime:t,fps:n,logLevel:r,mountTime:o})=>{const i=1/n/2;let s=()=>{};return Number.isFinite(e.duration)&&e.currentTime>=e.duration&&t>=e.duration?{prom:Promise.resolve(),cancel:()=>{}}:{prom:new Promise((l,c)=>{const f=Hc({element:e,desiredTime:t+i,logLevel:r,mountTime:o});f.wait.then(p=>{if(Math.abs(t-p)<=i)return l();const g=t>p?1:-1,w=Hc({element:e,desiredTime:p+i*g,logLevel:r,mountTime:o});s=w.cancel,w.wait.then(x=>{const k=Math.abs(t-x);if(mg(k)<=mg(i))return l();const h=Hc({element:e,desiredTime:t+i,logLevel:r,mountTime:o});return s=h.cancel,h.wait.then(()=>{l()}).catch(y=>{c(y)})}).catch(x=>{c(x)})}),s=f.cancel}),cancel:()=>{s()}}},JT=({onError:e,volume:t,allowAmplificationDuringRender:n,playbackRate:r,onDuration:o,toneFrequency:i,name:s,acceptableTimeShiftInSeconds:a,delayRenderRetries:l,delayRenderTimeoutInMilliseconds:c,loopVolumeCurveBehavior:f,audioStreamIndex:p,onVideoFrame:m,preservePitch:g,...w},x)=>{const k=io(),h=Ft(),y=Bi(f??"repeat"),v=Tu(),S=d.useRef(null),b=d.useContext(xt),E=Io(),I=ct(),T=sr(),j=oa(),{delayRender:_,continueRender:N}=Un(),{registerRenderAsset:W,unregisterRenderAsset:M}=d.useContext($o),$=d.useMemo(()=>`video-${Mo(w.src??"")}-${b==null?void 0:b.cumulatedFrom}-${b==null?void 0:b.relativeFrom}-${b==null?void 0:b.durationInFrames}`,[w.src,b==null?void 0:b.cumulatedFrom,b==null?void 0:b.relativeFrom,b==null?void 0:b.durationInFrames]);if(!v)throw new Error("No video config found");const V=No({volume:t,frame:y,mediaVolume:1});Vi(V),d.useEffect(()=>{if(!w.src)throw new Error("No src passed");if(!w.muted&&!(V<=0)&&window.remotion_audioEnabled)return W({type:"video",src:ir(w.src),id:$,frame:k,volume:V,mediaFrame:h,playbackRate:r??1,toneFrequency:i??1,audioStartFrame:Math.max(0,-((b==null?void 0:b.cumulatedNegativeFrom)??0)),audioStreamIndex:p??0}),()=>M($)},[w.muted,w.src,W,$,M,V,h,k,r,i,b==null?void 0:b.cumulatedNegativeFrom,p]),d.useImperativeHandle(x,()=>S.current,[]),h1({ref:S,onVideoFrame:m}),d.useEffect(()=>{var D,Z;if(!window.remotion_videoEnabled)return;const{current:A}=S;if(!A)return;const R=Xx({frame:h,playbackRate:r||1,startFrom:-E,fps:v.fps}),C=_(`Rendering <Html5Video /> with src="${w.src}" at time ${R}`,{retries:l??void 0,timeoutInMilliseconds:c??void 0});if(((Z=(D=window.process)==null?void 0:D.env)==null?void 0:Z.NODE_ENV)==="test"){N(C);return}if(Xl(A.currentTime,R)){if(A.readyState>=2){N(C);return}const H=()=>{N(C)};return A.addEventListener("loadeddata",H,{once:!0}),()=>{A.removeEventListener("loadeddata",H)}}const P=()=>{N(C)},z=qT({element:A,desiredTime:R,fps:v.fps,logLevel:T,mountTime:j});z.prom.then(()=>{N(C)}),A.addEventListener("ended",P,{once:!0});const O=()=>{var H;if(A!=null&&A.error){if(console.error("Error occurred in video",A==null?void 0:A.error),e)return;throw new ui({message:`The browser threw an error while playing the video ${w.src}: Code ${A.error.code} - ${(H=A==null?void 0:A.error)==null?void 0:H.message}. See https://remotion.dev/docs/media-playback-error for help. Pass an onError() prop to handle the error.`,src:w.src})}else throw new ui({message:"The browser threw an error",src:w.src})};return A.addEventListener("error",O,{once:!0}),()=>{z.cancel(),A.removeEventListener("ended",P),A.removeEventListener("error",O),N(C)}},[y,w.src,r,v.fps,h,E,e,l,c,T,j,N,_]);const{src:L}=w;return I.isRendering&&d.useLayoutEffect(()=>{var P,z;if(((z=(P=window.process)==null?void 0:P.env)==null?void 0:z.NODE_ENV)==="test")return;const A=_("Loading <Html5Video> duration with src="+L,{retries:l??void 0,timeoutInMilliseconds:c??void 0}),{current:R}=S,C=()=>{R!=null&&R.duration&&o(L,R.duration),N(A)};return R!=null&&R.duration?(o(L,R.duration),N(A)):R==null||R.addEventListener("loadedmetadata",C,{once:!0}),()=>{R==null||R.removeEventListener("loadedmetadata",C),N(A)}},[L,o,l,c,N,_]),u.jsx("video",{ref:S,disableRemotePlayback:!0,...w})},QT=d.forwardRef(JT),eR=(e,t)=>{const{startFrom:n,endAt:r,trimBefore:o,trimAfter:i,name:s,pauseWhenBuffering:a,stack:l,_remotionInternalNativeLoopPassed:c,showInTimeline:f,onAutoPlayError:p,onVideoFrame:m,...g}=e,{loop:w,...x}=e,{fps:k}=ht(),h=ct(),y=sa(a);if(h.isClientSideRendering)throw new Error("<Html5Video> is not supported in @remotion/web-renderer. Use <Video> from @remotion/media instead. See https://remotion.dev/docs/client-side-rendering/limitations");const{durations:v,setDurations:S}=d.useContext(Wp);if(typeof t=="string")throw new Error("string refs are not supported");if(typeof e.src!="string")throw new TypeError(`The \`<Html5Video>\` tag requires a string for \`src\`, but got ${JSON.stringify(e.src)} instead.`);const b=Ao(e.src),E=d.useCallback((_,N)=>{S({type:"got-duration",durationInSeconds:N,src:_})},[S]),I=v[ir(b)]??v[ir(e.src)];Ou({startFrom:n,endAt:r,trimBefore:o,trimAfter:i});const{trimBeforeValue:T,trimAfterValue:j}=Bu({startFrom:n,endAt:r,trimBefore:o,trimAfter:i});if(w&&I!==void 0){if(!Number.isFinite(I))return u.jsx(wl,{...x,ref:t,stack:l,_remotionInternalNativeLoopPassed:!0});const _=I*k;return u.jsx(Lu,{durationInFrames:Nu({trimAfter:j,mediaDurationInFrames:_,playbackRate:e.playbackRate??1,trimBefore:T}),layout:"none",name:s,showInTimeline:!1,children:u.jsx(wl,{...x,ref:t,stack:l,_remotionInternalNativeLoopPassed:!0})})}return typeof T<"u"||typeof j<"u"?u.jsx(_t,{layout:"none",from:0-(T??0),showInTimeline:!1,durationInFrames:j===void 0?void 0:j/(e.playbackRate??1),name:s,children:u.jsx(wl,{pauseWhenBuffering:y,onVideoFrame:m,...g,ref:t,stack:l})}):(Du({playbackRate:e.playbackRate,preservePitch:e.preservePitch,volume:e.volume},"Html5Video"),h.isRendering?u.jsx(QT,{onDuration:E,onVideoFrame:m??null,...g,ref:t}):u.jsx(eh,{onlyWarnForMediaSeekingError:!1,...g,ref:t,onVideoFrame:m??null,pauseWhenBuffering:y,onDuration:E,_remotionInternalStack:l??null,_remotionInternalNativeLoopPassed:c??!1,showInTimeline:f??!0,onAutoPlayError:p??void 0}))},wl=d.forwardRef(eR);Zt(wl);mC();var tR={},nR=new Proxy(tR,{get(e,t){return t==="Bundling"||t==="Rendering"||t==="Log"||t==="Puppeteer"||t==="Output"?nR:()=>{console.warn("⚠️ The CLI configuration has been extracted from Remotion Core."),console.warn("Update the import from the config file:"),console.warn(),console.warn("- Delete:"),console.warn('import {Config} from "remotion";'),console.warn("+ Replace:"),console.warn('import {Config} from "@remotion/cli/config";'),console.warn(),console.warn("For more information, see https://www.remotion.dev/docs/4-0-migration."),process.exit(1)}}});_t.displayName="Sequence";Zt(_t);fC(_t);Zt(Zl);Zt(FE);typeof window<"u"&&(window.remotion_renderReady=!1,window.remotion_delayRenderTimeouts||(window.remotion_delayRenderTimeouts={}),window.remotion_delayRenderHandles=[]);var rR={"style.transformOrigin":{type:"transform-origin",step:1,default:"50% 50%",description:"Transform origin"},"style.translate":{type:"translate",step:1,default:"0px 0px",description:"Offset"},"style.scale":{type:"scale",max:100,step:.01,default:1,description:"Scale",defaultKeyframeOutput:"perceptual-scale"},"style.rotate":{type:"rotation-css",step:1,default:"0deg",description:"Rotation"},"style.opacity":{type:"number",min:0,max:1,step:.01,default:1,description:"Opacity",hiddenFromList:!1}},oR={"style.borderWidth":{type:"number",default:void 0,min:0,step:1,description:"Border width",hiddenFromList:!1},"style.borderStyle":{type:"enum",default:"none",description:"Border style",variants:{none:{},hidden:{},solid:{},dashed:{},dotted:{},double:{},groove:{},ridge:{},inset:{},outset:{}}},"style.borderColor":{type:"color",default:void 0,description:"Border color"}},iR={"style.backgroundColor":{type:"color",default:"transparent",description:"Color"}},sR={premountFor:{type:"number",default:0,description:"Premount For",min:0,step:1,hiddenFromList:!1,keyframable:!1},postmountFor:{type:"number",default:0,min:0,step:1,hiddenFromList:!0,keyframable:!1}},aR={...sR},lR={...rR,...iR,...oR,...aR},uR={layout:{type:"enum",default:"absolute-fill",description:"Layout",variants:{"absolute-fill":lR,none:{}}}};({...uR.layout});var cR=(e,t,n)=>{if(e){if(typeof e!="object")throw new Error(`"${t}" must be an object, but you passed a value of type ${typeof e}`);if(Array.isArray(e))throw new Error(`"${t}" must be an object, an array was passed ${n?`for composition "${n}"`:""}`)}};function dR(e,t,n){if(typeof e!="number")throw new Error(`The "${t}" prop ${n} must be a number, but you passed a value of type ${typeof e}`);if(isNaN(e))throw new TypeError(`The "${t}" prop ${n} must not be NaN, but is NaN.`);if(!Number.isFinite(e))throw new TypeError(`The "${t}" prop ${n} must be finite, but is ${e}.`);if(e%1!==0)throw new TypeError(`The "${t}" prop ${n} must be an integer, but is ${e}.`);if(e<=0)throw new TypeError(`The "${t}" prop ${n} must be positive, but got ${e}.`)}function fR(e,t){const{allowFloats:n,component:r}=t;if(typeof e>"u")throw new Error(`The "durationInFrames" prop ${r} is missing.`);if(typeof e!="number")throw new Error(`The "durationInFrames" prop ${r} must be a number, but you passed a value of type ${typeof e}`);if(e<=0)throw new TypeError(`The "durationInFrames" prop ${r} must be positive, but got ${e}.`);if(!n&&e%1!==0)throw new TypeError(`The "durationInFrames" prop ${r} must be an integer, but got ${e}.`);if(!Number.isFinite(e))throw new TypeError(`The "durationInFrames" prop ${r} must be finite, but got ${e}.`)}function pR(e,t,n){if(typeof e!="number")throw new Error(`"fps" must be a number, but you passed a value of type ${typeof e} ${t}`);if(!Number.isFinite(e))throw new Error(`"fps" must be a finite, but you passed ${e} ${t}`);if(isNaN(e))throw new Error(`"fps" must not be NaN, but got ${e} ${t}`);if(e<=0)throw new TypeError(`"fps" must be positive, but got ${e} ${t}`);if(n&&e>50)throw new 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 Uu={validateFps:pR,validateDimension:dR,validateDurationInFrames:fR,validateDefaultAndInputProps:cR};if(typeof d.createContext!="function"){const e=['Remotion requires React.createContext, but it is "undefined".','If you are in a React Server Component, turn it into a client component by adding "use client" at the top of the file.',"","Before:",' import {Player} from "@remotion/player";',"","After:",' "use client";',' import {Player} from "@remotion/player";'];throw new Error(e.join(`
80
+ `))}var jt=25,bf=16,hR=()=>u.jsx("svg",{width:jt,height:jt,viewBox:"0 0 25 25",fill:"none",children:u.jsx("path",{d:"M8 6.375C7.40904 8.17576 7.06921 10.2486 7.01438 12.3871C6.95955 14.5255 7.19163 16.6547 7.6875 18.5625C9.95364 18.2995 12.116 17.6164 14.009 16.5655C15.902 15.5147 17.4755 14.124 18.6088 12.5C17.5158 10.8949 15.9949 9.51103 14.1585 8.45082C12.3222 7.3906 10.2174 6.68116 8 6.375Z",fill:"white",stroke:"white",strokeWidth:"6.25",strokeLinejoin:"round"})}),mR=()=>u.jsxs("svg",{viewBox:"0 0 100 100",width:jt,height:jt,children:[u.jsx("rect",{x:"25",y:"20",width:"20",height:"60",fill:"#fff",ry:"5",rx:"5"}),u.jsx("rect",{x:"55",y:"20",width:"20",height:"60",fill:"#fff",ry:"5",rx:"5"})]}),gR=({isFullscreen:e})=>{const r=e?0:3,o=e?6*1.6:6/2,i=e?6*1.6:6*2;return u.jsxs("svg",{viewBox:"0 0 32 32",height:bf,width:bf,children:[u.jsx("path",{d:`
81
81
  M ${r} ${i}
82
82
  L ${o} ${o}
83
83
  L ${i} ${r}
@@ -93,8 +93,8 @@ Check that all your Remotion packages are on the same version. If your dependenc
93
93
  M ${32-r} ${32-i}
94
94
  L ${32-o} ${32-o}
95
95
  L ${32-i} ${32-r}
96
- `,stroke:"#fff",strokeWidth:6,fill:"none"})]})},fR=()=>u.jsx("svg",{width:jt,height:jt,viewBox:"0 0 24 24",children:u.jsx("path",{d:"M3.63 3.63a.996.996 0 000 1.41L7.29 8.7 7 9H4c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1h3l3.29 3.29c.63.63 1.71.18 1.71-.71v-4.17l4.18 4.18c-.49.37-1.02.68-1.6.91-.36.15-.58.53-.58.92 0 .72.73 1.18 1.39.91.8-.33 1.55-.77 2.22-1.31l1.34 1.34a.996.996 0 101.41-1.41L5.05 3.63c-.39-.39-1.02-.39-1.42 0zM19 12c0 .82-.15 1.61-.41 2.34l1.53 1.53c.56-1.17.88-2.48.88-3.87 0-3.83-2.4-7.11-5.78-8.4-.59-.23-1.22.23-1.22.86v.19c0 .38.25.71.61.85C17.18 6.54 19 9.06 19 12zm-8.71-6.29l-.17.17L12 7.76V6.41c0-.89-1.08-1.33-1.71-.7zM16.5 12A4.5 4.5 0 0014 7.97v1.79l2.48 2.48c.01-.08.02-.16.02-.24z",fill:"#fff"})}),pR=()=>u.jsx("svg",{width:jt,height:jt,viewBox:"0 0 24 24",children:u.jsx("path",{d:"M3 10v4c0 .55.45 1 1 1h3l3.29 3.29c.63.63 1.71.18 1.71-.71V6.41c0-.89-1.08-1.34-1.71-.71L7 9H4c-.55 0-1 .45-1 1zm13.5 2A4.5 4.5 0 0014 7.97v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 4.45v.2c0 .38.25.71.6.85C17.18 6.53 19 9.06 19 12s-1.82 5.47-4.4 6.5c-.36.14-.6.47-.6.85v.2c0 .63.63 1.07 1.21.85C18.6 19.11 21 15.84 21 12s-2.4-7.11-5.79-8.4c-.58-.23-1.21.22-1.21.85z",fill:"#fff"})}),pg="__remotion_buffering_indicator",hg="__remotion_buffering_animation",hR={width:jt,height:jt,overflow:"hidden",lineHeight:"normal",fontSize:"inherit"},mR={width:14,height:14,overflow:"hidden",lineHeight:"normal",fontSize:"inherit"},gR=({type:e})=>{const t=e==="player"?hR:mR;return u.jsxs(u.Fragment,{children:[u.jsx("style",{type:"text/css",children:`
97
- @keyframes ${hg} {
96
+ `,stroke:"#fff",strokeWidth:6,fill:"none"})]})},yR=()=>u.jsx("svg",{width:jt,height:jt,viewBox:"0 0 24 24",children:u.jsx("path",{d:"M3.63 3.63a.996.996 0 000 1.41L7.29 8.7 7 9H4c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1h3l3.29 3.29c.63.63 1.71.18 1.71-.71v-4.17l4.18 4.18c-.49.37-1.02.68-1.6.91-.36.15-.58.53-.58.92 0 .72.73 1.18 1.39.91.8-.33 1.55-.77 2.22-1.31l1.34 1.34a.996.996 0 101.41-1.41L5.05 3.63c-.39-.39-1.02-.39-1.42 0zM19 12c0 .82-.15 1.61-.41 2.34l1.53 1.53c.56-1.17.88-2.48.88-3.87 0-3.83-2.4-7.11-5.78-8.4-.59-.23-1.22.23-1.22.86v.19c0 .38.25.71.61.85C17.18 6.54 19 9.06 19 12zm-8.71-6.29l-.17.17L12 7.76V6.41c0-.89-1.08-1.33-1.71-.7zM16.5 12A4.5 4.5 0 0014 7.97v1.79l2.48 2.48c.01-.08.02-.16.02-.24z",fill:"#fff"})}),vR=()=>u.jsx("svg",{width:jt,height:jt,viewBox:"0 0 24 24",children:u.jsx("path",{d:"M3 10v4c0 .55.45 1 1 1h3l3.29 3.29c.63.63 1.71.18 1.71-.71V6.41c0-.89-1.08-1.34-1.71-.71L7 9H4c-.55 0-1 .45-1 1zm13.5 2A4.5 4.5 0 0014 7.97v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 4.45v.2c0 .38.25.71.6.85C17.18 6.53 19 9.06 19 12s-1.82 5.47-4.4 6.5c-.36.14-.6.47-.6.85v.2c0 .63.63 1.07 1.21.85C18.6 19.11 21 15.84 21 12s-2.4-7.11-5.79-8.4c-.58-.23-1.21.22-1.21.85z",fill:"#fff"})}),gg="__remotion_buffering_indicator",yg="__remotion_buffering_animation",wR={width:jt,height:jt,overflow:"hidden",lineHeight:"normal",fontSize:"inherit"},xR={width:14,height:14,overflow:"hidden",lineHeight:"normal",fontSize:"inherit"},bR=({type:e})=>{const t=e==="player"?wR:xR;return u.jsxs(u.Fragment,{children:[u.jsx("style",{type:"text/css",children:`
97
+ @keyframes ${yg} {
98
98
  0% {
99
99
  rotate: 0deg;
100
100
  }
@@ -103,37 +103,37 @@ Check that all your Remotion packages are on the same version. If your dependenc
103
103
  }
104
104
  }
105
105
 
106
- .${pg} {
107
- animation: ${hg} 1s linear infinite;
106
+ .${gg} {
107
+ animation: ${yg} 1s linear infinite;
108
108
  }
109
- `}),u.jsx("div",{style:t,children:u.jsx("svg",{viewBox:e==="player"?"0 0 22 22":"0 0 18 18",style:t,className:pg,children:u.jsx("path",{d:e==="player"?"M 11 4 A 7 7 0 0 1 15.1145 16.66312":"M 9 2 A 7 7 0 0 1 13.1145 14.66312",stroke:"white",strokeLinecap:"round",fill:"none",strokeWidth:3})})})]})},yR=({currentSize:e,width:t,height:n,compositionWidth:r,compositionHeight:o})=>t!==void 0&&n===void 0?{aspectRatio:[r,o].join("/")}:n!==void 0&&t===void 0?{aspectRatio:[r,o].join("/")}:e?{width:r,height:o}:{width:r,height:o},p1=({previewSize:e,compositionWidth:t,compositionHeight:n,canvasSize:r})=>{const o=me.calculateScale({canvasSize:r,compositionHeight:n,compositionWidth:t,previewSize:e}),i=0-(1-o)/2,s=i*t,a=i*n,l=t*o,c=n*o,f=r.width/2-l/2,p=r.height/2-c/2;return{centerX:f,centerY:p,xCorrection:s,yCorrection:a,scale:o}},h1=({config:e,style:t,canvasSize:n,overflowVisible:r,layout:o})=>e?{position:"relative",overflow:r?"visible":"hidden",...yR({compositionHeight:e.height,compositionWidth:e.width,currentSize:n,height:t==null?void 0:t.height,width:t==null?void 0:t.width}),opacity:o?1:0,...t}:{},m1=({config:e,layout:t,scale:n,overflowVisible:r})=>e?t?{position:"absolute",width:e.width,height:e.height,display:"flex",transform:`scale(${n})`,marginLeft:t.xCorrection,marginTop:t.yCorrection,overflow:r?"visible":"hidden"}:{position:"absolute",width:e.width,height:e.height,display:"flex",transform:`scale(${n})`,overflow:r?"visible":"hidden"}:{},g1=({layout:e,scale:t,config:n,overflowVisible:r})=>{if(!n)return{};if(!e)return{width:n.width*t,height:n.height*t,display:"flex",flexDirection:"column",position:"absolute",overflow:r?"visible":"hidden"};const{centerX:o,centerY:i}=e;return{width:n.width*t,height:n.height*t,display:"flex",flexDirection:"column",position:"absolute",left:o,top:i,overflow:r?"visible":"hidden"}},y1=le.createContext(void 0),v1=le.createContext(void 0);class vR{constructor(){Ae(this,"listeners",{ended:[],error:[],pause:[],play:[],ratechange:[],scalechange:[],seeked:[],timeupdate:[],frameupdate:[],fullscreenchange:[],volumechange:[],mutechange:[],waiting:[],resume:[]});Ae(this,"dispatchSeek",t=>{this.dispatchEvent("seeked",{frame:t})});Ae(this,"dispatchVolumeChange",t=>{this.dispatchEvent("volumechange",{volume:t})});Ae(this,"dispatchPause",()=>{this.dispatchEvent("pause",void 0)});Ae(this,"dispatchPlay",()=>{this.dispatchEvent("play",void 0)});Ae(this,"dispatchEnded",()=>{this.dispatchEvent("ended",void 0)});Ae(this,"dispatchRateChange",t=>{this.dispatchEvent("ratechange",{playbackRate:t})});Ae(this,"dispatchScaleChange",t=>{this.dispatchEvent("scalechange",{scale:t})});Ae(this,"dispatchError",t=>{this.dispatchEvent("error",{error:t})});Ae(this,"dispatchTimeUpdate",t=>{this.dispatchEvent("timeupdate",t)});Ae(this,"dispatchFrameUpdate",t=>{this.dispatchEvent("frameupdate",t)});Ae(this,"dispatchFullscreenChange",t=>{this.dispatchEvent("fullscreenchange",t)});Ae(this,"dispatchMuteChange",t=>{this.dispatchEvent("mutechange",t)});Ae(this,"dispatchWaiting",t=>{this.dispatchEvent("waiting",t)});Ae(this,"dispatchResume",t=>{this.dispatchEvent("resume",t)})}addEventListener(t,n){this.listeners[t].push(n)}removeEventListener(t,n){this.listeners[t]=this.listeners[t].filter(r=>r!==n)}dispatchEvent(t,n){this.listeners[t].forEach(r=>{r({detail:n})})}}class wR{constructor(){Ae(this,"listeners",{error:[],waiting:[],resume:[]});Ae(this,"dispatchError",t=>{this.dispatchEvent("error",{error:t})});Ae(this,"dispatchWaiting",t=>{this.dispatchEvent("waiting",t)});Ae(this,"dispatchResume",t=>{this.dispatchEvent("resume",t)})}addEventListener(t,n){this.listeners[t].push(n)}removeEventListener(t,n){this.listeners[t]=this.listeners[t].filter(r=>r!==n)}dispatchEvent(t,n){this.listeners[t].forEach(r=>{r({detail:n})})}}var w1=e=>{const t=d.useContext(me.BufferingContextReact);if(!t)throw new Error("BufferingContextReact not found");d.useLayoutEffect(()=>{const n=t.listenForBuffering(()=>{t.buffering.current=!0,e.dispatchWaiting({})}),r=t.listenForResume(()=>{t.buffering.current=!1,e.dispatchResume({})});return()=>{n.remove(),r.remove()}},[t,e])},xR=({children:e,currentPlaybackRate:t})=>{const[n]=d.useState(()=>new vR);if(!d.useContext(me.BufferingContextReact))throw new Error("BufferingContextReact not found");return d.useEffect(()=>{t&&n.dispatchRateChange(t)},[n,t]),w1(n),u.jsx(y1.Provider,{value:n,children:e})},th=(e,t)=>{const[n,r]=d.useState(!1);return d.useEffect(()=>{const{current:o}=e;if(!o)return;let i;const s=()=>{t&&(clearTimeout(i),i=setTimeout(()=>{r(!1)},t===!0?3e3:t))},a=()=>{r(!0),s()},l=()=>{r(!1),clearTimeout(i)},c=()=>{r(!0),s()};return o.addEventListener("mouseenter",a),o.addEventListener("mouseleave",l),o.addEventListener("mousemove",c),()=>{o.removeEventListener("mouseenter",a),o.removeEventListener("mouseleave",l),o.removeEventListener("mousemove",c),clearTimeout(i)}},[t,e]),n},Uu=()=>{const[e,t,n]=me.Timeline.usePlayingState(),[r,o]=d.useState(!1),i=me.Timeline.useTimelinePosition(),s=d.useRef(i),a=me.Timeline.useTimelineSetFrame(),l=me.Timeline.useTimelineSetFrame(),c=d.useContext(me.SharedAudioContext),f=d.useContext(me.SharedAudioTagsContext),{audioAndVideoTags:p}=me.useTimelineContext(),m=d.useRef(i);m.current=i;const g=me.useVideo(),w=me.useUnsafeVideoConfig(),x=d.useContext(y1),k=((w==null?void 0:w.durationInFrames)??1)-1,h=i===k,y=i===0;if(!x)throw new TypeError("Expected Player event emitter context");const v=d.useContext(me.BufferingContextReact);if(!v)throw new Error("Missing the buffering context. Most likely you have a Remotion version mismatch.");const{buffering:S}=v,b=d.useCallback(L=>{const j=w?me.TimelinePosition.clampFrameToCompositionRange(L,w.durationInFrames):Math.max(0,L);g!=null&&g.id&&l(C=>({...C,[g.id]:j})),m.current=j,x.dispatchSeek(j)},[w,x,l,g==null?void 0:g.id]),E=d.useCallback(L=>{n.current||(o(!0),h&&b(0),c==null||c.resume(),f&&f.numberOfAudioTags>0&&L&&f.playAllAudios(),p.current.forEach(j=>j.play("player play() was called and playing audio from a click")),n.current=!0,t(!0),s.current=m.current,x.dispatchPlay())},[n,h,c,f,t,x,b,p]),I=d.useCallback(()=>{n.current&&(n.current=!1,t(!1),x.dispatchPause(),c==null||c.suspend())},[x,n,t,c]),T=d.useCallback(()=>{n.current&&(n.current=!1,m.current=s.current,w&&(l(L=>({...L,[w.id]:s.current})),t(!1),x.dispatchPause()))},[w,x,n,t,l]),R=g==null?void 0:g.id,F=d.useCallback(L=>{if(!R)return null;n.current||a(j=>{const C=j[R]??window.remotion_initialFrame??0,P=Math.max(0,C-L);return C===P?j:{...j,[R]:P}})},[n,a,R]),A=d.useCallback(L=>{if(!R)return null;n.current||a(j=>{const C=j[R]??window.remotion_initialFrame??0,P=Math.min(k,C+L);return C===P?j:{...j,[R]:P}})},[R,n,k,a]),W=d.useCallback(L=>{n.current?I():E(L)},[n,I,E]),M=d.useCallback(()=>n.current,[n]),$=d.useCallback(()=>m.current,[m]),V=d.useCallback(()=>S.current,[S]);return d.useMemo(()=>({frameBack:F,frameForward:A,isLastFrame:h,emitter:x,playing:e,play:E,pause:I,seek:b,isFirstFrame:y,getCurrentFrame:$,isPlaying:M,isBuffering:V,pauseAndReturnToPlayStart:T,hasPlayed:r,toggle:W}),[x,F,A,r,y,h,$,I,T,E,e,b,W,M,V])},bR=({browserMediaControlsBehavior:e,videoConfig:t,playbackRate:n})=>{const{playing:r,pause:o,play:i,emitter:s,getCurrentFrame:a,seek:l}=Uu(),c=d.useRef(!1);d.useEffect(()=>{r&&(c.current=!0)},[r]),d.useEffect(()=>{navigator.mediaSession&&e.mode!=="do-nothing"&&(r?navigator.mediaSession.playbackState="playing":c.current&&(navigator.mediaSession.playbackState="paused"))},[e.mode,r]),d.useEffect(()=>{if(!navigator.mediaSession||e.mode==="do-nothing")return;const f=()=>{t&&navigator.mediaSession&&navigator.mediaSession.setPositionState({duration:t.durationInFrames/t.fps,playbackRate:n,position:a()/t.fps})};return s.addEventListener("timeupdate",f),()=>{s.removeEventListener("timeupdate",f)}},[e.mode,s,a,n,t]),d.useEffect(()=>{if(navigator.mediaSession&&e.mode!=="do-nothing")return navigator.mediaSession.setActionHandler("play",()=>{e.mode==="register-media-session"&&i()}),navigator.mediaSession.setActionHandler("pause",()=>{e.mode==="register-media-session"&&o()}),navigator.mediaSession.setActionHandler("seekto",f=>{e.mode==="register-media-session"&&f.seekTime!==void 0&&t&&l(Math.round(f.seekTime*t.fps))}),navigator.mediaSession.setActionHandler("seekbackward",()=>{e.mode==="register-media-session"&&t&&l(Math.max(0,Math.round((a()-10)*t.fps)))}),navigator.mediaSession.setActionHandler("seekforward",()=>{e.mode==="register-media-session"&&t&&l(Math.max(t.durationInFrames-1,Math.round((a()+10)*t.fps)))}),navigator.mediaSession.setActionHandler("previoustrack",()=>{e.mode==="register-media-session"&&l(0)}),()=>{navigator.mediaSession.metadata=null,navigator.mediaSession.setActionHandler("play",null),navigator.mediaSession.setActionHandler("pause",null),navigator.mediaSession.setActionHandler("seekto",null),navigator.mediaSession.setActionHandler("seekbackward",null),navigator.mediaSession.setActionHandler("seekforward",null),navigator.mediaSession.setActionHandler("previoustrack",null)}},[e.mode,a,o,i,l,t])},SR=({time:e,currentFrame:t,playbackSpeed:n,fps:r,actualLastFrame:o,actualFirstFrame:i,framesAdvanced:s,shouldLoop:a})=>{const c=(n<0?Math.ceil:Math.floor)(e*n/(1e3/r))-s,f=c+t,p=t>o||t<i,m=f>o||f<i,g=!a&&m&&!p;return n>0?m?{nextFrame:i,framesToAdvance:c,hasEnded:g}:{nextFrame:f,framesToAdvance:c,hasEnded:g}:m?{nextFrame:o,framesToAdvance:c,hasEnded:g}:{nextFrame:f,framesToAdvance:c,hasEnded:g}},mg=()=>typeof document>"u"?!1:document.visibilityState==="hidden",kR=()=>{const e=d.useRef(mg());return d.useEffect(()=>{const t=()=>{e.current=mg()};return document.addEventListener("visibilitychange",t),()=>{document.removeEventListener("visibilitychange",t)}},[]),e},ER=.1,gg=({audioContext:e,audioSyncAnchor:t,absoluteTimeInSeconds:n,globalPlaybackRate:r,logLevel:o,force:i})=>{const s=e.currentTime-n/r,a=s-t.value,{outputLatency:l}=e,c=l===0?.3:l,f=e.baseLatency+c;return Math.abs(a)<ER+f&&!i||Math.abs(a)<Number.EPSILON?!1:(me.Log.verbose({logLevel:o,tag:"audio-scheduling"},"Anchor "+(i?"forcibly ":"")+"changed from %s to %s with shift %s",t.value,s,a),t.value=s,!0)},CR=e=>{if(e==="suspended"||e==="running-to-suspended")return!0;if(e==="closed"||e==="interrupted"||e==="running"||e==="suspended-to-running")return!1;throw new Error(`Unexpected audio context state: ${e}`)},IR=({loop:e,playbackRate:t,moveToBeginningWhenEnded:n,inFrame:r,outFrame:o,browserMediaControlsBehavior:i,getCurrentFrame:s,muted:a})=>{const l=me.useUnsafeVideoConfig(),c=me.Timeline.useTimelinePosition(),{playing:f,pause:p,emitter:m,isPlaying:g}=Uu(),w=me.Timeline.useTimelineSetFrame(),x=d.useContext(me.SharedAudioContext),k=me.useLogLevel(),h=kR(),y=d.useRef(0),v=d.useContext(me.BufferingContextReact);if(!v)throw new Error("Missing the buffering context. Most likely you have a Remotion version mismatch.");bR({browserMediaControlsBehavior:i,playbackRate:t,videoConfig:l}),d.useLayoutEffect(()=>{if(!x||!x.audioContext||!l||a)return;gg({audioContext:x.audioContext,audioSyncAnchor:x.audioSyncAnchor,absoluteTimeInSeconds:c/l.fps,globalPlaybackRate:t,logLevel:k,force:!1})&&x.audioSyncAnchorEmitter.dispatch("changed")},[l,c,k,t,x,a]),d.useLayoutEffect(()=>{const S=x==null?void 0:x.audioContext;if(!S||!l||a)return;const b=()=>{const E=x==null?void 0:x.getAudioContextState();E&&CR(E)&&gg({audioContext:S,audioSyncAnchor:x.audioSyncAnchor,absoluteTimeInSeconds:s()/l.fps,globalPlaybackRate:t,logLevel:k,force:!0})};return S==null||S.addEventListener("statechange",b),()=>{S==null||S.removeEventListener("statechange",b)}},[l,s,k,a,t,x]),d.useEffect(()=>{var M;if(!l)return;if(!f){(M=x==null?void 0:x.suspend)==null||M.call(x);return}let S=!1,b=null,E=performance.now(),I=0;const T=()=>{b!==null&&(b.type==="raf"?cancelAnimationFrame(b.id):clearTimeout(b.id))},R=()=>{S=!0,T()},F=()=>{var N,O;if(S)return;if(!g()){(N=x==null?void 0:x.suspend)==null||N.call(x);return}!a&&!v.buffering.current&&((O=x==null?void 0:x.resume)==null||O.call(x));const $=performance.now()-E,V=o??l.durationInFrames-1,D=r??0,L=s(),{nextFrame:j,framesToAdvance:C,hasEnded:P}=SR({time:$,currentFrame:L,playbackSpeed:t,fps:l.fps,actualFirstFrame:D,actualLastFrame:V,framesAdvanced:I,shouldLoop:e});if(I+=C,j!==s()&&(!P||n)&&!v.buffering.current&&w(z=>({...z,[l.id]:j})),P){R(),p(),m.dispatchEnded();return}A()},A=()=>{var V,D;const $=((V=x==null?void 0:x.getIsResumingAudioContext)==null?void 0:V.call(x))??null;if($!==null&&!a){$.then(()=>{E=performance.now(),I=0,A()});return}if(v.buffering.current){a||(D=x==null?void 0:x.suspend)==null||D.call(x);const L=v.listenForResume(()=>{L.remove(),E=performance.now(),I=0,A()});return}if(h.current){b={type:"timeout",id:setTimeout(F,1e3/l.fps)};return}b={type:"raf",id:requestAnimationFrame(F)}};A();const W=()=>{document.visibilityState!=="visible"&&(T(),F())};return window.addEventListener("visibilitychange",W),()=>{window.removeEventListener("visibilitychange",W),R()}},[l,e,p,f,w,m,t,r,o,n,h,s,v,g,x,k,a]),d.useEffect(()=>{const S=performance.now(),b=S-y.current;if(b>=250){m.dispatchTimeUpdate({frame:c}),y.current=S;return}const E=setTimeout(()=>{m.dispatchTimeUpdate({frame:c}),y.current=performance.now()},250-b);return()=>clearTimeout(E)},[m,c]),d.useEffect(()=>{m.dispatchFrameUpdate({frame:c})},[m,c])},Wc=[],Vc=e=>e?"current"in e?e.current:e:null,nh=(e,t)=>{const[n,r]=d.useState(()=>{const s=Vc(e);if(!s)return null;const a=s.getClientRects();return a[0]?{width:a[0].width,height:a[0].height,left:a[0].x,top:a[0].y,windowSize:{height:window.innerHeight,width:window.innerWidth}}:null}),o=d.useMemo(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(s=>{const{contentRect:a,target:l}=s[0],c=l.getClientRects();if(!(c!=null&&c[0])){r(null);return}const f=a.width===0?1:c[0].width/a.width,p=a.height===0?1:c[0].height/a.height,m=t.shouldApplyCssTransforms||f===0?c[0].width:c[0].width*(1/f),g=t.shouldApplyCssTransforms||p===0?c[0].height:c[0].height*(1/p);r(w=>w&&w.width===m&&w.height===g&&w.left===c[0].x&&w.top===c[0].y&&w.windowSize.height===window.innerHeight&&w.windowSize.width===window.innerWidth?w:{width:m,height:g,left:c[0].x,top:c[0].y,windowSize:{height:window.innerHeight,width:window.innerWidth}})}),[t.shouldApplyCssTransforms]),i=d.useCallback(()=>{const s=Vc(e);if(!s)return;const a=s.getClientRects();if(!a[0]){r(null);return}r(l=>l&&l.width===a[0].width&&l.height===a[0].height&&l.left===a[0].x&&l.top===a[0].y&&l.windowSize.height===window.innerHeight&&l.windowSize.width===window.innerWidth?l:{width:a[0].width,height:a[0].height,left:a[0].x,top:a[0].y,windowSize:{height:window.innerHeight,width:window.innerWidth}})},[e]);return d.useEffect(()=>{i()},[i]),d.useEffect(()=>{if(!o)return;const s=Vc(e);return s&&o.observe(s),()=>{s&&o.unobserve(s)}},[o,e]),d.useEffect(()=>{if(t.triggerOnWindowResize)return window.addEventListener("resize",i),()=>{window.removeEventListener("resize",i)}},[t.triggerOnWindowResize,i]),d.useEffect(()=>(Wc.push(i),()=>{Wc=Wc.filter(s=>s!==i)}),[i]),d.useMemo(()=>n?{...n,refresh:i}:null,[n,i])},rh=e=>e??"__remotion-player",TR={display:"flex",justifyContent:"center",alignItems:"center",flex:1,height:"100%",width:"100%"};class x1 extends le.Component{constructor(){super(...arguments);Ae(this,"state",{hasError:null})}static getDerivedStateFromError(n){return{hasError:n}}componentDidCatch(n){this.props.onError(n)}render(){return this.state.hasError?u.jsx("div",{style:TR,children:this.props.errorFallback({error:this.state.hasError})}):this.props.children}}var RR=async()=>{if(typeof window>"u"||typeof window.crypto>"u"||typeof window.crypto.subtle>"u")return null;try{const e=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(window.location.hostname));return Array.from(new Uint8Array(e)).map(t=>t.toString(16).padStart(2,"0")).join("")}catch{return null}},Hc={backgroundColor:"red",position:"absolute",padding:12,fontFamily:"Arial"},jR=["28d262b44cc61fa750f1686b16ad0604dabfe193fbc263eec05c89b7ad4c2cd6","4db1b0a94be33165dfefcb3ba03d04c7a2666dd27c496d3dc9fa41858e94925e","fbc48530bbf245da790f63675e84e06bab38c3b114fab07eb350025119922bdc","7baf10a8932757b1b3a22b3fce10a048747ac2f8eaf638603487e3705b07eb83","8a6c21a598d8c667272b5207c051b85997bf5b45d5fb712378be3f27cd72c6a6","a2f7aaac9c50a9255e7fc376110c4e0bfe153722dc66ed3c5d3bf2a135f65518"],yg=!1,PR=()=>{const[e,t]=le.useState(!1);return d.useEffect(()=>{yg||(yg=!0,RR().then(n=>{n&&jR.includes(n)&&t(!0)}).catch(()=>{}))},[]),d.useEffect(()=>{if(!e)return;const n=()=>{if(!document.querySelector(".warning-banner")){const i=document.createElement("div");i.className="warning-banner",Object.assign(i.style,Hc,{zIndex:"9999",cssText:`${Hc.cssText} !important;`}),i.innerHTML=`
109
+ `}),u.jsx("div",{style:t,children:u.jsx("svg",{viewBox:e==="player"?"0 0 22 22":"0 0 18 18",style:t,className:gg,children:u.jsx("path",{d:e==="player"?"M 11 4 A 7 7 0 0 1 15.1145 16.66312":"M 9 2 A 7 7 0 0 1 13.1145 14.66312",stroke:"white",strokeLinecap:"round",fill:"none",strokeWidth:3})})})]})},SR=({currentSize:e,width:t,height:n,compositionWidth:r,compositionHeight:o})=>t!==void 0&&n===void 0?{aspectRatio:[r,o].join("/")}:n!==void 0&&t===void 0?{aspectRatio:[r,o].join("/")}:e?{width:r,height:o}:{width:r,height:o},v1=({previewSize:e,compositionWidth:t,compositionHeight:n,canvasSize:r})=>{const o=me.calculateScale({canvasSize:r,compositionHeight:n,compositionWidth:t,previewSize:e}),i=0-(1-o)/2,s=i*t,a=i*n,l=t*o,c=n*o,f=r.width/2-l/2,p=r.height/2-c/2;return{centerX:f,centerY:p,xCorrection:s,yCorrection:a,scale:o}},w1=({config:e,style:t,canvasSize:n,overflowVisible:r,layout:o})=>e?{position:"relative",overflow:r?"visible":"hidden",...SR({compositionHeight:e.height,compositionWidth:e.width,currentSize:n,height:t==null?void 0:t.height,width:t==null?void 0:t.width}),opacity:o?1:0,...t}:{},x1=({config:e,layout:t,scale:n,overflowVisible:r})=>e?t?{position:"absolute",width:e.width,height:e.height,display:"flex",transform:`scale(${n})`,marginLeft:t.xCorrection,marginTop:t.yCorrection,overflow:r?"visible":"hidden"}:{position:"absolute",width:e.width,height:e.height,display:"flex",transform:`scale(${n})`,overflow:r?"visible":"hidden"}:{},b1=({layout:e,scale:t,config:n,overflowVisible:r})=>{if(!n)return{};if(!e)return{width:n.width*t,height:n.height*t,display:"flex",flexDirection:"column",position:"absolute",overflow:r?"visible":"hidden"};const{centerX:o,centerY:i}=e;return{width:n.width*t,height:n.height*t,display:"flex",flexDirection:"column",position:"absolute",left:o,top:i,overflow:r?"visible":"hidden"}},S1=le.createContext(void 0),k1=le.createContext(void 0);class kR{constructor(){Ae(this,"listeners",{ended:[],error:[],pause:[],play:[],ratechange:[],scalechange:[],seeked:[],timeupdate:[],frameupdate:[],fullscreenchange:[],volumechange:[],mutechange:[],waiting:[],resume:[]});Ae(this,"dispatchSeek",t=>{this.dispatchEvent("seeked",{frame:t})});Ae(this,"dispatchVolumeChange",t=>{this.dispatchEvent("volumechange",{volume:t})});Ae(this,"dispatchPause",()=>{this.dispatchEvent("pause",void 0)});Ae(this,"dispatchPlay",()=>{this.dispatchEvent("play",void 0)});Ae(this,"dispatchEnded",()=>{this.dispatchEvent("ended",void 0)});Ae(this,"dispatchRateChange",t=>{this.dispatchEvent("ratechange",{playbackRate:t})});Ae(this,"dispatchScaleChange",t=>{this.dispatchEvent("scalechange",{scale:t})});Ae(this,"dispatchError",t=>{this.dispatchEvent("error",{error:t})});Ae(this,"dispatchTimeUpdate",t=>{this.dispatchEvent("timeupdate",t)});Ae(this,"dispatchFrameUpdate",t=>{this.dispatchEvent("frameupdate",t)});Ae(this,"dispatchFullscreenChange",t=>{this.dispatchEvent("fullscreenchange",t)});Ae(this,"dispatchMuteChange",t=>{this.dispatchEvent("mutechange",t)});Ae(this,"dispatchWaiting",t=>{this.dispatchEvent("waiting",t)});Ae(this,"dispatchResume",t=>{this.dispatchEvent("resume",t)})}addEventListener(t,n){this.listeners[t].push(n)}removeEventListener(t,n){this.listeners[t]=this.listeners[t].filter(r=>r!==n)}dispatchEvent(t,n){this.listeners[t].forEach(r=>{r({detail:n})})}}class ER{constructor(){Ae(this,"listeners",{error:[],waiting:[],resume:[]});Ae(this,"dispatchError",t=>{this.dispatchEvent("error",{error:t})});Ae(this,"dispatchWaiting",t=>{this.dispatchEvent("waiting",t)});Ae(this,"dispatchResume",t=>{this.dispatchEvent("resume",t)})}addEventListener(t,n){this.listeners[t].push(n)}removeEventListener(t,n){this.listeners[t]=this.listeners[t].filter(r=>r!==n)}dispatchEvent(t,n){this.listeners[t].forEach(r=>{r({detail:n})})}}var E1=e=>{const t=d.useContext(me.BufferingContextReact);if(!t)throw new Error("BufferingContextReact not found");d.useLayoutEffect(()=>{const n=t.listenForBuffering(()=>{t.buffering.current=!0,e.dispatchWaiting({})}),r=t.listenForResume(()=>{t.buffering.current=!1,e.dispatchResume({})});return()=>{n.remove(),r.remove()}},[t,e])},CR=({children:e,currentPlaybackRate:t})=>{const[n]=d.useState(()=>new kR);if(!d.useContext(me.BufferingContextReact))throw new Error("BufferingContextReact not found");return d.useEffect(()=>{t&&n.dispatchRateChange(t)},[n,t]),E1(n),u.jsx(S1.Provider,{value:n,children:e})},rh=(e,t)=>{const[n,r]=d.useState(!1);return d.useEffect(()=>{const{current:o}=e;if(!o)return;let i;const s=()=>{t&&(clearTimeout(i),i=setTimeout(()=>{r(!1)},t===!0?3e3:t))},a=()=>{r(!0),s()},l=()=>{r(!1),clearTimeout(i)},c=()=>{r(!0),s()};return o.addEventListener("mouseenter",a),o.addEventListener("mouseleave",l),o.addEventListener("mousemove",c),()=>{o.removeEventListener("mouseenter",a),o.removeEventListener("mouseleave",l),o.removeEventListener("mousemove",c),clearTimeout(i)}},[t,e]),n},Zu=()=>{const[e,t,n]=me.Timeline.usePlayingState(),[r,o]=d.useState(!1),i=me.Timeline.useTimelinePosition(),s=d.useRef(i),a=me.Timeline.useTimelineSetFrame(),l=me.Timeline.useTimelineSetFrame(),c=d.useContext(me.SharedAudioContext),f=d.useContext(me.SharedAudioTagsContext),{audioAndVideoTags:p}=me.useTimelineContext(),m=d.useRef(i);m.current=i;const g=me.useVideo(),w=me.useUnsafeVideoConfig(),x=d.useContext(S1),k=((w==null?void 0:w.durationInFrames)??1)-1,h=i===k,y=i===0;if(!x)throw new TypeError("Expected Player event emitter context");const v=d.useContext(me.BufferingContextReact);if(!v)throw new Error("Missing the buffering context. Most likely you have a Remotion version mismatch.");const{buffering:S}=v,b=d.useCallback(A=>{const R=w?me.TimelinePosition.clampFrameToCompositionRange(A,w.durationInFrames):Math.max(0,A);g!=null&&g.id&&l(C=>({...C,[g.id]:R})),m.current=R,x.dispatchSeek(R)},[w,x,l,g==null?void 0:g.id]),E=d.useCallback(A=>{n.current||(o(!0),h&&b(0),c==null||c.resume(),f&&f.numberOfAudioTags>0&&A&&f.playAllAudios(),p.current.forEach(R=>R.play("player play() was called and playing audio from a click")),n.current=!0,t(!0),s.current=m.current,x.dispatchPlay())},[n,h,c,f,t,x,b,p]),I=d.useCallback(()=>{n.current&&(n.current=!1,t(!1),x.dispatchPause(),c==null||c.suspend())},[x,n,t,c]),T=d.useCallback(()=>{n.current&&(n.current=!1,m.current=s.current,w&&(l(A=>({...A,[w.id]:s.current})),t(!1),x.dispatchPause()))},[w,x,n,t,l]),j=g==null?void 0:g.id,_=d.useCallback(A=>{if(!j)return null;n.current||a(R=>{const C=R[j]??window.remotion_initialFrame??0,P=Math.max(0,C-A);return C===P?R:{...R,[j]:P}})},[n,a,j]),N=d.useCallback(A=>{if(!j)return null;n.current||a(R=>{const C=R[j]??window.remotion_initialFrame??0,P=Math.min(k,C+A);return C===P?R:{...R,[j]:P}})},[j,n,k,a]),W=d.useCallback(A=>{n.current?I():E(A)},[n,I,E]),M=d.useCallback(()=>n.current,[n]),$=d.useCallback(()=>m.current,[m]),V=d.useCallback(()=>S.current,[S]);return d.useMemo(()=>({frameBack:_,frameForward:N,isLastFrame:h,emitter:x,playing:e,play:E,pause:I,seek:b,isFirstFrame:y,getCurrentFrame:$,isPlaying:M,isBuffering:V,pauseAndReturnToPlayStart:T,hasPlayed:r,toggle:W}),[x,_,N,r,y,h,$,I,T,E,e,b,W,M,V])},IR=({browserMediaControlsBehavior:e,videoConfig:t,playbackRate:n})=>{const{playing:r,pause:o,play:i,emitter:s,getCurrentFrame:a,seek:l}=Zu(),c=d.useRef(!1);d.useEffect(()=>{r&&(c.current=!0)},[r]),d.useEffect(()=>{navigator.mediaSession&&e.mode!=="do-nothing"&&(r?navigator.mediaSession.playbackState="playing":c.current&&(navigator.mediaSession.playbackState="paused"))},[e.mode,r]),d.useEffect(()=>{if(!navigator.mediaSession||e.mode==="do-nothing")return;const f=()=>{t&&navigator.mediaSession&&navigator.mediaSession.setPositionState({duration:t.durationInFrames/t.fps,playbackRate:n,position:a()/t.fps})};return s.addEventListener("timeupdate",f),()=>{s.removeEventListener("timeupdate",f)}},[e.mode,s,a,n,t]),d.useEffect(()=>{if(navigator.mediaSession&&e.mode!=="do-nothing")return navigator.mediaSession.setActionHandler("play",()=>{e.mode==="register-media-session"&&i()}),navigator.mediaSession.setActionHandler("pause",()=>{e.mode==="register-media-session"&&o()}),navigator.mediaSession.setActionHandler("seekto",f=>{e.mode==="register-media-session"&&f.seekTime!==void 0&&t&&l(Math.round(f.seekTime*t.fps))}),navigator.mediaSession.setActionHandler("seekbackward",()=>{e.mode==="register-media-session"&&t&&l(Math.max(0,Math.round((a()-10)*t.fps)))}),navigator.mediaSession.setActionHandler("seekforward",()=>{e.mode==="register-media-session"&&t&&l(Math.max(t.durationInFrames-1,Math.round((a()+10)*t.fps)))}),navigator.mediaSession.setActionHandler("previoustrack",()=>{e.mode==="register-media-session"&&l(0)}),()=>{navigator.mediaSession.metadata=null,navigator.mediaSession.setActionHandler("play",null),navigator.mediaSession.setActionHandler("pause",null),navigator.mediaSession.setActionHandler("seekto",null),navigator.mediaSession.setActionHandler("seekbackward",null),navigator.mediaSession.setActionHandler("seekforward",null),navigator.mediaSession.setActionHandler("previoustrack",null)}},[e.mode,a,o,i,l,t])},TR=({time:e,currentFrame:t,playbackSpeed:n,fps:r,actualLastFrame:o,actualFirstFrame:i,framesAdvanced:s,shouldLoop:a})=>{const c=(n<0?Math.ceil:Math.floor)(e*n/(1e3/r))-s,f=c+t,p=t>o||t<i,m=f>o||f<i,g=!a&&m&&!p;return n>0?m?{nextFrame:i,framesToAdvance:c,hasEnded:g}:{nextFrame:f,framesToAdvance:c,hasEnded:g}:m?{nextFrame:o,framesToAdvance:c,hasEnded:g}:{nextFrame:f,framesToAdvance:c,hasEnded:g}},vg=()=>typeof document>"u"?!1:document.visibilityState==="hidden",RR=()=>{const e=d.useRef(vg());return d.useEffect(()=>{const t=()=>{e.current=vg()};return document.addEventListener("visibilitychange",t),()=>{document.removeEventListener("visibilitychange",t)}},[]),e},jR=.1,wg=({audioContext:e,audioSyncAnchor:t,absoluteTimeInSeconds:n,globalPlaybackRate:r,logLevel:o,force:i})=>{const s=e.currentTime-n/r,a=s-t.value,{outputLatency:l}=e,c=l===0?.3:l,f=e.baseLatency+c;return Math.abs(a)<jR+f&&!i||Math.abs(a)<Number.EPSILON?!1:(me.Log.verbose({logLevel:o,tag:"audio-scheduling"},"Anchor "+(i?"forcibly ":"")+"changed from %s to %s with shift %s",t.value,s,a),t.value=s,!0)},PR=e=>{if(e==="suspended"||e==="running-to-suspended")return!0;if(e==="closed"||e==="interrupted"||e==="running"||e==="suspended-to-running")return!1;throw new Error(`Unexpected audio context state: ${e}`)},FR=({loop:e,playbackRate:t,moveToBeginningWhenEnded:n,inFrame:r,outFrame:o,browserMediaControlsBehavior:i,getCurrentFrame:s,muted:a})=>{const l=me.useUnsafeVideoConfig(),c=me.Timeline.useTimelinePosition(),{playing:f,pause:p,emitter:m,isPlaying:g}=Zu(),w=me.Timeline.useTimelineSetFrame(),x=d.useContext(me.SharedAudioContext),k=me.useLogLevel(),h=RR(),y=d.useRef(0),v=d.useContext(me.BufferingContextReact);if(!v)throw new Error("Missing the buffering context. Most likely you have a Remotion version mismatch.");IR({browserMediaControlsBehavior:i,playbackRate:t,videoConfig:l}),d.useLayoutEffect(()=>{if(!x||!x.audioContext||!l||a)return;wg({audioContext:x.audioContext,audioSyncAnchor:x.audioSyncAnchor,absoluteTimeInSeconds:c/l.fps,globalPlaybackRate:t,logLevel:k,force:!1})&&x.audioSyncAnchorEmitter.dispatch("changed")},[l,c,k,t,x,a]),d.useLayoutEffect(()=>{const S=x==null?void 0:x.audioContext;if(!S||!l||a)return;const b=()=>{const E=x==null?void 0:x.getAudioContextState();E&&PR(E)&&wg({audioContext:S,audioSyncAnchor:x.audioSyncAnchor,absoluteTimeInSeconds:s()/l.fps,globalPlaybackRate:t,logLevel:k,force:!0})};return S==null||S.addEventListener("statechange",b),()=>{S==null||S.removeEventListener("statechange",b)}},[l,s,k,a,t,x]),d.useEffect(()=>{var M;if(!l)return;if(!f){(M=x==null?void 0:x.suspend)==null||M.call(x);return}let S=!1,b=null,E=performance.now(),I=0;const T=()=>{b!==null&&(b.type==="raf"?cancelAnimationFrame(b.id):clearTimeout(b.id))},j=()=>{S=!0,T()},_=()=>{var z,O;if(S)return;if(!g()){(z=x==null?void 0:x.suspend)==null||z.call(x);return}!a&&!v.buffering.current&&((O=x==null?void 0:x.resume)==null||O.call(x));const $=performance.now()-E,V=o??l.durationInFrames-1,L=r??0,A=s(),{nextFrame:R,framesToAdvance:C,hasEnded:P}=TR({time:$,currentFrame:A,playbackSpeed:t,fps:l.fps,actualFirstFrame:L,actualLastFrame:V,framesAdvanced:I,shouldLoop:e});if(I+=C,R!==s()&&(!P||n)&&!v.buffering.current&&w(D=>({...D,[l.id]:R})),P){j(),p(),m.dispatchEnded();return}N()},N=()=>{var V,L;const $=((V=x==null?void 0:x.getIsResumingAudioContext)==null?void 0:V.call(x))??null;if($!==null&&!a){$.then(()=>{E=performance.now(),I=0,N()});return}if(v.buffering.current){a||(L=x==null?void 0:x.suspend)==null||L.call(x);const A=v.listenForResume(()=>{A.remove(),E=performance.now(),I=0,N()});return}if(h.current){b={type:"timeout",id:setTimeout(_,1e3/l.fps)};return}b={type:"raf",id:requestAnimationFrame(_)}};N();const W=()=>{document.visibilityState!=="visible"&&(T(),_())};return window.addEventListener("visibilitychange",W),()=>{window.removeEventListener("visibilitychange",W),j()}},[l,e,p,f,w,m,t,r,o,n,h,s,v,g,x,k,a]),d.useEffect(()=>{const S=performance.now(),b=S-y.current;if(b>=250){m.dispatchTimeUpdate({frame:c}),y.current=S;return}const E=setTimeout(()=>{m.dispatchTimeUpdate({frame:c}),y.current=performance.now()},250-b);return()=>clearTimeout(E)},[m,c]),d.useEffect(()=>{m.dispatchFrameUpdate({frame:c})},[m,c])},Uc=[],Zc=e=>e?"current"in e?e.current:e:null,oh=(e,t)=>{const[n,r]=d.useState(()=>{const s=Zc(e);if(!s)return null;const a=s.getClientRects();return a[0]?{width:a[0].width,height:a[0].height,left:a[0].x,top:a[0].y,windowSize:{height:window.innerHeight,width:window.innerWidth}}:null}),o=d.useMemo(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(s=>{const{contentRect:a,target:l}=s[0],c=l.getClientRects();if(!(c!=null&&c[0])){r(null);return}const f=a.width===0?1:c[0].width/a.width,p=a.height===0?1:c[0].height/a.height,m=t.shouldApplyCssTransforms||f===0?c[0].width:c[0].width*(1/f),g=t.shouldApplyCssTransforms||p===0?c[0].height:c[0].height*(1/p);r(w=>w&&w.width===m&&w.height===g&&w.left===c[0].x&&w.top===c[0].y&&w.windowSize.height===window.innerHeight&&w.windowSize.width===window.innerWidth?w:{width:m,height:g,left:c[0].x,top:c[0].y,windowSize:{height:window.innerHeight,width:window.innerWidth}})}),[t.shouldApplyCssTransforms]),i=d.useCallback(()=>{const s=Zc(e);if(!s)return;const a=s.getClientRects();if(!a[0]){r(null);return}r(l=>l&&l.width===a[0].width&&l.height===a[0].height&&l.left===a[0].x&&l.top===a[0].y&&l.windowSize.height===window.innerHeight&&l.windowSize.width===window.innerWidth?l:{width:a[0].width,height:a[0].height,left:a[0].x,top:a[0].y,windowSize:{height:window.innerHeight,width:window.innerWidth}})},[e]);return d.useEffect(()=>{i()},[i]),d.useEffect(()=>{if(!o)return;const s=Zc(e);return s&&o.observe(s),()=>{s&&o.unobserve(s)}},[o,e]),d.useEffect(()=>{if(t.triggerOnWindowResize)return window.addEventListener("resize",i),()=>{window.removeEventListener("resize",i)}},[t.triggerOnWindowResize,i]),d.useEffect(()=>(Uc.push(i),()=>{Uc=Uc.filter(s=>s!==i)}),[i]),d.useMemo(()=>n?{...n,refresh:i}:null,[n,i])},ih=e=>e??"__remotion-player",_R={display:"flex",justifyContent:"center",alignItems:"center",flex:1,height:"100%",width:"100%"};class C1 extends le.Component{constructor(){super(...arguments);Ae(this,"state",{hasError:null})}static getDerivedStateFromError(n){return{hasError:n}}componentDidCatch(n){this.props.onError(n)}render(){return this.state.hasError?u.jsx("div",{style:_R,children:this.props.errorFallback({error:this.state.hasError})}):this.props.children}}var MR=async()=>{if(typeof window>"u"||typeof window.crypto>"u"||typeof window.crypto.subtle>"u")return null;try{const e=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(window.location.hostname));return Array.from(new Uint8Array(e)).map(t=>t.toString(16).padStart(2,"0")).join("")}catch{return null}},Kc={backgroundColor:"red",position:"absolute",padding:12,fontFamily:"Arial"},$R=["28d262b44cc61fa750f1686b16ad0604dabfe193fbc263eec05c89b7ad4c2cd6","4db1b0a94be33165dfefcb3ba03d04c7a2666dd27c496d3dc9fa41858e94925e","fbc48530bbf245da790f63675e84e06bab38c3b114fab07eb350025119922bdc","7baf10a8932757b1b3a22b3fce10a048747ac2f8eaf638603487e3705b07eb83","8a6c21a598d8c667272b5207c051b85997bf5b45d5fb712378be3f27cd72c6a6","a2f7aaac9c50a9255e7fc376110c4e0bfe153722dc66ed3c5d3bf2a135f65518"],xg=!1,AR=()=>{const[e,t]=le.useState(!1);return d.useEffect(()=>{xg||(xg=!0,MR().then(n=>{n&&$R.includes(n)&&t(!0)}).catch(()=>{}))},[]),d.useEffect(()=>{if(!e)return;const n=()=>{if(!document.querySelector(".warning-banner")){const i=document.createElement("div");i.className="warning-banner",Object.assign(i.style,Kc,{zIndex:"9999",cssText:`${Kc.cssText} !important;`}),i.innerHTML=`
110
110
  <a href="https://github.com/remotion-dev/remotion/pull/4589" style="color: white;">
111
111
  Remotion Unlicensed – Contact hi@remotion.dev
112
112
  </a>
113
- `,document.body.appendChild(i)}},r=new MutationObserver(()=>n());return r.observe(document.body,{childList:!0,subtree:!0}),()=>{r.disconnect()}},[e]),e?u.jsx("div",{style:Hc,className:"warning-banner",children:u.jsx("a",{style:{color:"white"},href:"https://github.com/remotion-dev/remotion/pull/4589",children:"Remotion Unlicensed – Contact hi@remotion.dev"})}):null},vg=({playing:e,buffering:t})=>e&&t?u.jsx(gR,{type:"player"}):e?u.jsx(cR,{}):u.jsx(uR,{}),Bo=12,wg=5,FR=({volume:e,isVertical:t,onBlur:n,inputRef:r,setVolume:o})=>{const i=d.useMemo(()=>{const m={paddingLeft:5,height:jt,width:go,display:"inline-flex",alignItems:"center"};return t?{...m,position:"absolute",transform:`rotate(-90deg) translateX(${go/2+jt/2}px)`}:{...m}},[t]),s=typeof le.useId>"u"?"volume-slider":le.useId(),[a]=d.useState(()=>`__remotion-volume-slider-${_o(s)}`.replace(".","")),l=d.useCallback(p=>{o(parseFloat(p.target.value))},[o]),c=d.useMemo(()=>{const p={WebkitAppearance:"none",backgroundColor:"rgba(255, 255, 255, 0.5)",borderRadius:wg/2,cursor:"pointer",height:wg,width:go,backgroundImage:`linear-gradient(
113
+ `,document.body.appendChild(i)}},r=new MutationObserver(()=>n());return r.observe(document.body,{childList:!0,subtree:!0}),()=>{r.disconnect()}},[e]),e?u.jsx("div",{style:Kc,className:"warning-banner",children:u.jsx("a",{style:{color:"white"},href:"https://github.com/remotion-dev/remotion/pull/4589",children:"Remotion Unlicensed – Contact hi@remotion.dev"})}):null},bg=({playing:e,buffering:t})=>e&&t?u.jsx(bR,{type:"player"}):e?u.jsx(mR,{}):u.jsx(hR,{}),Wo=12,Sg=5,NR=({volume:e,isVertical:t,onBlur:n,inputRef:r,setVolume:o})=>{const i=d.useMemo(()=>{const m={paddingLeft:5,height:jt,width:yo,display:"inline-flex",alignItems:"center"};return t?{...m,position:"absolute",transform:`rotate(-90deg) translateX(${yo/2+jt/2}px)`}:{...m}},[t]),s=typeof le.useId>"u"?"volume-slider":le.useId(),[a]=d.useState(()=>`__remotion-volume-slider-${Mo(s)}`.replace(".","")),l=d.useCallback(p=>{o(parseFloat(p.target.value))},[o]),c=d.useMemo(()=>{const p={WebkitAppearance:"none",backgroundColor:"rgba(255, 255, 255, 0.5)",borderRadius:Sg/2,cursor:"pointer",height:Sg,width:yo,backgroundImage:`linear-gradient(
114
114
  to right,
115
115
  white ${e*100}%, rgba(255, 255, 255, 0) ${e*100}%
116
- )`};return t?{...p,bottom:jt+go/2}:p},[t,e]),f=`
116
+ )`};return t?{...p,bottom:jt+yo/2}:p},[t,e]),f=`
117
117
  .${a}::-webkit-slider-thumb {
118
118
  -webkit-appearance: none;
119
119
  background-color: white;
120
- border-radius: ${Bo/2}px;
120
+ border-radius: ${Wo/2}px;
121
121
  box-shadow: 0 0 2px black;
122
- height: ${Bo}px;
123
- width: ${Bo}px;
122
+ height: ${Wo}px;
123
+ width: ${Wo}px;
124
124
  }
125
125
 
126
126
  .${a}::-moz-range-thumb {
127
127
  -webkit-appearance: none;
128
128
  background-color: white;
129
- border-radius: ${Bo/2}px;
129
+ border-radius: ${Wo/2}px;
130
130
  box-shadow: 0 0 2px black;
131
- height: ${Bo}px;
132
- width: ${Bo}px;
131
+ height: ${Wo}px;
132
+ width: ${Wo}px;
133
133
  }
134
- `;return u.jsxs("div",{style:i,children:[u.jsx("style",{dangerouslySetInnerHTML:{__html:f}}),u.jsx("input",{ref:r,"aria-label":"Change volume",className:a,max:1,min:0,onBlur:n,onChange:l,step:.01,type:"range",value:e,style:c})]})},_R=e=>u.jsx(FR,{...e}),go=100,MR=({displayVerticalVolumeSlider:e,renderMuteButton:t,renderVolumeSlider:n})=>{const[r,o]=me.usePlayerMutedState(),[i,s]=me.useMediaVolumeState(),[a,l]=d.useState(!1),c=d.useRef(null),f=d.useRef(null),p=th(c,!1),m=d.useCallback(()=>{setTimeout(()=>{f.current&&document.activeElement!==f.current&&l(!1)},10)},[]),g=i===0,w=d.useCallback(()=>{if(g){s(1),o(!1);return}o(S=>!S)},[g,o,s]),x=d.useMemo(()=>({display:"inline-flex",background:"none",border:"none",justifyContent:"center",alignItems:"center",touchAction:"none",...e&&{position:"relative"}}),[e]),k=d.useMemo(()=>({display:"inline",width:jt,height:jt,cursor:"pointer",appearance:"none",background:"none",border:"none",padding:0}),[]),h=d.useCallback(({muted:S,volume:b})=>{const E=S||b===0;return u.jsx("button",{"aria-label":E?"Unmute sound":"Mute sound",title:E?"Unmute sound":"Mute sound",onClick:w,onBlur:m,onFocus:()=>l(!0),style:k,type:"button",children:E?u.jsx(fR,{}):u.jsx(pR,{})})},[m,w,k]),y=d.useMemo(()=>t?t({muted:r,volume:i}):h({muted:r,volume:i}),[r,i,h,t]),v=d.useMemo(()=>(a||p)&&!r&&!me.isIosSafari()?(n??_R)({isVertical:e,volume:i,onBlur:()=>l(!1),inputRef:f,setVolume:s}):null,[e,a,p,r,i,n,s]);return u.jsxs("div",{ref:c,style:x,children:[y,v]})};function $R(e){const[t,n]=d.useState(e),r=d.useRef(null);return d.useEffect(()=>{const o=i=>{r.current&&!r.current.contains(i.target)&&n(!1)};return document.addEventListener("pointerup",o,!0),()=>{document.removeEventListener("pointerup",o,!0)}},[]),{ref:r,isComponentVisible:t,setIsComponentVisible:n}}var AR=35,NR=70,LR={height:30,paddingRight:15,paddingLeft:12,display:"flex",flexDirection:"row",alignItems:"center"},zR={width:22,display:"flex",alignItems:"center"},DR={width:14,height:14,color:"black"},OR=()=>u.jsx("svg",{viewBox:"0 0 512 512",style:DR,children:u.jsx("path",{fill:"currentColor",d:"M435.848 83.466L172.804 346.51l-96.652-96.652c-4.686-4.686-12.284-4.686-16.971 0l-28.284 28.284c-4.686 4.686-4.686 12.284 0 16.971l133.421 133.421c4.686 4.686 12.284 4.686 16.971 0l299.813-299.813c4.686-4.686 4.686-12.284 0-16.971l-28.284-28.284c-4.686-4.686-12.284-4.686-16.97 0z"})}),BR=e=>{const t=e.toString();return t.includes(".")?t:t+".0"},WR=({rate:e,onSelect:t,selectedRate:n,keyboardSelectedRate:r})=>{const o=d.useCallback(p=>{p.stopPropagation(),p.preventDefault(),t(e)},[t,e]),[i,s]=d.useState(!1),a=d.useCallback(()=>{s(!0)},[]),l=d.useCallback(()=>{s(!1)},[]),c=r===e,f=d.useMemo(()=>({...LR,backgroundColor:i||c?"#eee":"transparent"}),[i,c]);return u.jsxs("div",{onPointerEnter:a,onPointerLeave:l,tabIndex:0,style:f,onClick:o,children:[u.jsx("div",{style:zR,children:e===n?u.jsx(OR,{}):null}),BR(e),"x"]},e)},VR=({setIsComponentVisible:e,playbackRates:t,canvasSize:n})=>{const{setPlaybackRate:r,playbackRate:o}=me.usePlaybackRate(),[i,s]=d.useState(o);d.useEffect(()=>{const c=f=>{if(f.preventDefault(),f.key==="ArrowUp"){const p=t.findIndex(m=>m===i);if(p===0)return;s(p===-1?t[0]:t[p-1])}else if(f.key==="ArrowDown"){const p=t.findIndex(m=>m===i);if(p===t.length-1)return;s(p===-1?t[t.length-1]:t[p+1])}else f.key==="Enter"&&(r(i),e(!1))};return window.addEventListener("keydown",c),()=>{window.removeEventListener("keydown",c)}},[t,i,r,e]);const a=d.useCallback(c=>{r(c),e(!1)},[e,r]),l=d.useMemo(()=>({position:"absolute",right:0,width:125,maxHeight:n.height-NR-AR,bottom:35,background:"#fff",borderRadius:4,overflow:"auto",color:"black",textAlign:"left"}),[n.height]);return u.jsx("div",{style:l,children:t.map(c=>u.jsx(WR,{selectedRate:o,onSelect:a,rate:c,keyboardSelectedRate:i},c))})},HR={fontSize:13,fontWeight:"bold",color:"white",border:"2px solid white",borderRadius:20,paddingLeft:8,paddingRight:8,paddingTop:2,paddingBottom:2},xf={appearance:"none",backgroundColor:"transparent",border:"none",cursor:"pointer",paddingLeft:0,paddingRight:0,paddingTop:6,paddingBottom:6,height:37,display:"inline-flex",marginBottom:0,marginTop:0,alignItems:"center"},UR={...xf,position:"relative"},ZR=({playbackRates:e,canvasSize:t})=>{const{ref:n,isComponentVisible:r,setIsComponentVisible:o}=$R(!1),{playbackRate:i}=me.usePlaybackRate(),s=d.useCallback(a=>{a.stopPropagation(),a.preventDefault(),o(l=>!l)},[o]);return u.jsx("div",{ref:n,children:u.jsxs("button",{type:"button","aria-label":"Change playback rate",style:UR,onClick:s,children:[u.jsxs("div",{style:HR,children:[i,"x"]}),r&&u.jsx(VR,{canvasSize:t,playbackRates:e,setIsComponentVisible:o})]})})},xg=(e,t,n)=>Math.round(Di(e,[0,n],[0,t-1],{extrapolateLeft:"clamp",extrapolateRight:"clamp"})),ci=5,os=12,bf=4,KR={userSelect:"none",WebkitUserSelect:"none",paddingTop:bf,paddingBottom:bf,boxSizing:"border-box",cursor:"pointer",position:"relative",touchAction:"none"},YR={height:ci,backgroundColor:"rgba(255, 255, 255, 0.25)",width:"100%",borderRadius:ci/2},GR=e=>{let t=e;for(;t.parentElement;)t=t.parentElement;return t},XR=({durationInFrames:e,onSeekEnd:t,onSeekStart:n,inFrame:r,outFrame:o})=>{const i=d.useRef(null),s=th(i,!1),a=nh(i,{triggerOnWindowResize:!0,shouldApplyCssTransforms:!0}),{seek:l,play:c,pause:f,playing:p}=Uu(),m=me.Timeline.useTimelinePosition(),[g,w]=d.useState({dragging:!1}),x=(a==null?void 0:a.width)??0,k=d.useCallback(E=>{var R;if(E.button!==0)return;const I=(R=i.current)==null?void 0:R.getBoundingClientRect().left,T=xg(E.clientX-I,e,x);f(),l(T),w({dragging:!0,wasPlaying:p}),n()},[e,x,f,l,p,n]),h=d.useCallback(E=>{var R;if(!a)throw new Error("Player has no size");if(!g.dragging)return;const I=(R=i.current)==null?void 0:R.getBoundingClientRect().left,T=xg(E.clientX-I,e,a.width);l(T)},[g.dragging,e,l,a]),y=d.useCallback(()=>{w({dragging:!1}),g.dragging&&(g.wasPlaying?c():f(),t())},[g,t,f,c]);d.useEffect(()=>{if(!g.dragging)return;const E=GR(i.current);return E.addEventListener("pointermove",h),E.addEventListener("pointerup",y),()=>{E.removeEventListener("pointermove",h),E.removeEventListener("pointerup",y)}},[g.dragging,h,y]);const v=d.useMemo(()=>({height:os,width:os,borderRadius:os/2,position:"absolute",top:bf-os/2+5/2,backgroundColor:"white",left:Math.max(0,m/Math.max(1,e-1)*x-os/2),boxShadow:"0 0 2px black",opacity:Number(s||g.dragging)}),[s,g.dragging,e,m,x]),S=d.useMemo(()=>({height:ci,backgroundColor:"rgba(255, 255, 255, 1)",width:(m-(r??0))/(e-1)*x,marginLeft:(r??0)/(e-1)*x,borderRadius:ci/2}),[e,m,r,x]),b=d.useMemo(()=>({height:ci,backgroundColor:"rgba(255, 255, 255, 0.25)",width:((o??e-1)-(r??0))/(e-1)*100+"%",marginLeft:(r??0)/(e-1)*100+"%",borderRadius:ci/2,position:"absolute"}),[e,r,o]);return u.jsxs("div",{ref:i,onPointerDown:k,style:KR,children:[u.jsxs("div",{style:YR,children:[u.jsx("div",{style:b}),u.jsx("div",{style:S})]}),u.jsx("div",{style:v})]})},bg=e=>{const t=Math.floor(e/60),n=Math.floor(e-t*60);return`${String(t)}:${String(n).padStart(2,"0")}`},qR=({durationInFrames:e,maxTimeLabelWidth:t,fps:n})=>{const r=me.Timeline.useTimelinePosition(),o=d.useMemo(()=>({color:"white",fontFamily:"sans-serif",fontSize:14,maxWidth:t===null?void 0:t,overflow:"hidden",textOverflow:"ellipsis"}),[t]),s=r===e-1?r+1:r;return u.jsxs("div",{style:o,children:[bg(s/n)," / ",bg(e/n)]})},JR=10,Sf=12,QR=({allowFullscreen:e,playerWidth:t})=>d.useMemo(()=>{const r=jt,o=jt,i=e?wf:0,s=o+r+i+Sf*2+JR*2,a=t-s,l=Math.max(a,0),c=l-go,p=(c<go?l:c)+s+go,m=t<p;return{maxTimeLabelWidth:l===0?null:l,displayVerticalVolumeSlider:m}},[e,t]),ej=[0,.013,.049,.104,.175,.259,.352,.45,.55,.648,.741,.825,.896,.951,.987],tj=[0,8.1,15.5,22.5,29,35.3,41.2,47.1,52.9,58.8,64.7,71,77.5,84.5,91.9],nj=1/.7,rj={boxSizing:"border-box",position:"absolute",bottom:0,width:"100%",paddingTop:40,paddingBottom:10,backgroundImage:`linear-gradient(to bottom,${ej.map((e,t)=>`hsla(0, 0%, 0%, ${e}) ${tj[t]*nj}%`).join(", ")}, hsl(0, 0%, 0%) 100%)`,backgroundSize:"auto 145px",display:"flex",paddingRight:Sf,paddingLeft:Sf,flexDirection:"column",transition:"opacity 0.3s"},oj={display:"flex",flexDirection:"row",width:"100%",alignItems:"center",justifyContent:"center",userSelect:"none",WebkitUserSelect:"none"},ij={display:"flex",flexDirection:"row",userSelect:"none",WebkitUserSelect:"none",alignItems:"center"},is={width:12},sj={height:8},aj={flex:1},lj={},uj=({durationInFrames:e,isFullscreen:t,fps:n,showVolumeControls:r,onFullscreenButtonClick:o,allowFullscreen:i,onExitFullscreenButtonClick:s,spaceKeyToPlayOrPause:a,onSeekEnd:l,onSeekStart:c,inFrame:f,outFrame:p,initiallyShowControls:m,canvasSize:g,renderPlayPauseButton:w,renderFullscreenButton:x,alwaysShowControls:k,showPlaybackRateControl:h,containerRef:y,buffering:v,hideControlsWhenPointerDoesntMove:S,onPointerDown:b,onDoubleClick:E,renderMuteButton:I,renderVolumeSlider:T,playing:R,toggle:F,renderCustomControls:A})=>{const W=d.useRef(null),[M,$]=d.useState(!1),V=th(y,S),{maxTimeLabelWidth:D,displayVerticalVolumeSlider:L}=QR({allowFullscreen:i,playerWidth:(g==null?void 0:g.width)??0}),[j,C]=d.useState(()=>{if(typeof m=="boolean")return m;if(typeof m=="number"){if(m%1!==0)throw new Error("initiallyShowControls must be an integer or a boolean");if(Number.isNaN(m))throw new Error("initiallyShowControls must not be NaN");if(!Number.isFinite(m))throw new Error("initiallyShowControls must be finite");if(m<=0)throw new Error("initiallyShowControls must be a positive integer");return m}throw new TypeError("initiallyShowControls must be a number or a boolean")}),P=d.useMemo(()=>({...rj,opacity:Number(V||!R||j||k)}),[V,j,R,k]);d.useEffect(()=>{W.current&&a&&W.current.focus({preventScroll:!0})},[R,a]),d.useEffect(()=>{$((typeof document<"u"&&(document.fullscreenEnabled||document.webkitFullscreenEnabled))??!1)},[]),d.useEffect(()=>{if(j===!1)return;const X=setTimeout(()=>{C(!1)},j===!0?2e3:j);return()=>{clearInterval(X)}},[j]);const N=d.useMemo(()=>{if(h===!0)return[.5,.8,1,1.2,1.5,1.8,2,2.5,3];if(Array.isArray(h)){for(const B of h){if(typeof B!="number")throw new Error("Every item in showPlaybackRateControl must be a number");if(B<=0)throw new Error("Every item in showPlaybackRateControl must be positive")}return h}return null},[h]),O=A?A():null,z=d.useRef(null),Z=d.useRef(null),H=d.useCallback(B=>{(B.target===z.current||B.target===Z.current)&&(b==null||b(B))},[b]),G=d.useCallback(B=>{(B.target===z.current||B.target===Z.current)&&(E==null||E(B))},[E]);return u.jsxs("div",{ref:z,style:P,onPointerDown:H,onDoubleClick:G,children:[u.jsxs("div",{ref:Z,style:oj,children:[u.jsxs("div",{style:ij,children:[u.jsx("button",{ref:W,type:"button",style:xf,onClick:F,"aria-label":R?"Pause video":"Play video",title:R?"Pause video":"Play video",children:w===null?u.jsx(vg,{buffering:v,playing:R}):w({playing:R,isBuffering:v})??u.jsx(vg,{buffering:v,playing:R})}),r?u.jsxs(u.Fragment,{children:[u.jsx("div",{style:is}),u.jsx(MR,{renderMuteButton:I,renderVolumeSlider:T,displayVerticalVolumeSlider:L})]}):null,u.jsx("div",{style:is}),u.jsx(qR,{durationInFrames:e,fps:n,maxTimeLabelWidth:D}),u.jsx("div",{style:is})]}),u.jsx("div",{style:aj}),O,O&&N&&g?u.jsx("div",{style:is}):null,N&&g&&u.jsx(ZR,{canvasSize:g,playbackRates:N}),N&&M&&i?u.jsx("div",{style:is}):null,u.jsx("div",{style:lj,children:M&&i?u.jsx("button",{type:"button","aria-label":t?"Exit fullscreen":"Enter Fullscreen",title:t?"Exit fullscreen":"Enter Fullscreen",style:xf,onClick:t?s:o,children:x===null?u.jsx(dR,{isFullscreen:t}):x({isFullscreen:t})}):null})]}),u.jsx("div",{style:sj}),u.jsx(XR,{onSeekEnd:l,onSeekStart:c,durationInFrames:e,inFrame:f,outFrame:p})]})},b1=typeof document>"u",cj=e=>{let t=!1;return{promise:new Promise((r,o)=>{e.then(i=>{if(t){o({isCanceled:t,value:i});return}r(i)}).catch(i=>{o({isCanceled:t,error:i})})}),cancel:()=>{t=!0}}},dj=e=>new Promise(t=>setTimeout(t,e)),fj=()=>{const e=d.useRef([]),t=d.useCallback(i=>{e.current=[...e.current,i]},[]),n=d.useCallback(i=>{e.current=e.current.filter(s=>s!==i)},[]),r=d.useCallback(()=>e.current.map(i=>i.cancel()),[]);return d.useMemo(()=>({appendPendingPromise:t,removePendingPromise:n,clearPendingPromises:r}),[t,r,n])},pj=(e,t,n)=>{const r=fj(),o=d.useCallback(async l=>{if(l instanceof PointerEvent?l.pointerType==="touch":l.nativeEvent.pointerType==="touch"){e(l);return}r.clearPendingPromises();const c=cj(dj(200));r.appendPendingPromise(c);try{await c.promise,r.removePendingPromise(c),e(l)}catch(f){const p=f;if(r.removePendingPromise(c),!p.isCanceled)throw p.error}},[r,e]),i=d.useCallback(()=>{document.addEventListener("pointerup",l=>{o(l)},{once:!0})},[o]),s=d.useCallback(()=>{r.clearPendingPromises(),t()},[r,t]);return d.useMemo(()=>n?{handlePointerDown:i,handleDoubleClick:s}:{handlePointerDown:e,handleDoubleClick:()=>{}},[n,s,i,e])},kf=le.version.split(".")[0];if(kf==="0")throw new Error(`Version ${kf} of "react" is not supported by Remotion`);var hj=parseInt(kf,10)>=18,mj=({controls:e,style:t,loop:n,autoPlay:r,allowFullscreen:o,inputProps:i,clickToPlay:s,showVolumeControls:a,doubleClickToFullscreen:l,spaceKeyToPlayOrPause:c,errorFallback:f,playbackRate:p,renderLoading:m,renderPoster:g,className:w,moveToBeginningWhenEnded:x,showPosterWhenUnplayed:k,showPosterWhenEnded:h,showPosterWhenPaused:y,showPosterWhenBuffering:v,showPosterWhenBufferingAndPaused:S,inFrame:b,outFrame:E,initiallyShowControls:I,renderFullscreen:T,renderPlayPauseButton:R,renderMuteButton:F,renderVolumeSlider:A,renderCustomControls:W,alwaysShowControls:M,showPlaybackRateControl:$,posterFillMode:V,bufferStateDelayInMilliseconds:D,hideControlsWhenPointerDoesntMove:L,overflowVisible:j,browserMediaControlsBehavior:C,overrideInternalClassName:P,noSuspense:N},O)=>{const z=me.useUnsafeVideoConfig(),Z=me.useVideo(),H=d.useRef(null),G=nh(H,{triggerOnWindowResize:!1,shouldApplyCssTransforms:!1}),[B,X]=d.useState(!1),[ae,oe]=d.useState(r),[Y,q]=d.useState(()=>!1),[xe,Se]=d.useState(!1),de=d.useMemo(()=>typeof document>"u"?!1:!!(document.fullscreenEnabled||document.webkitFullscreenEnabled),[]),K=Uu(),ee=K.toggle,{playerMuted:ue,mediaVolume:se}=d.useContext(me.MediaVolumeContext);d.useEffect(()=>{K.emitter.dispatchVolumeChange(se)},[K.emitter,se]);const Re=ue||se===0;d.useEffect(()=>{K.emitter.dispatchMuteChange({isMuted:Re})},[K.emitter,Re]),IR({loop:n,playbackRate:p,moveToBeginningWhenEnded:x,inFrame:b,outFrame:E,getCurrentFrame:K.getCurrentFrame,browserMediaControlsBehavior:C,muted:Re}),d.useEffect(()=>{B&&!K.playing&&(X(!1),K.play())},[B,K]),d.useEffect(()=>{const{current:ge}=H;if(!ge)return;const Ce=()=>{const Ct=document.fullscreenElement===ge||document.webkitFullscreenElement===ge;q(Ct)};return document.addEventListener("fullscreenchange",Ce),document.addEventListener("webkitfullscreenchange",Ce),()=>{document.removeEventListener("fullscreenchange",Ce),document.removeEventListener("webkitfullscreenchange",Ce)}},[]);const Ie=d.useCallback(ge=>{ee(ge)},[ee]),De=d.useCallback(()=>{if(!o)throw new Error("allowFullscreen is false");if(!de)throw new Error("Browser doesnt support fullscreen");if(!H.current)throw new Error("No player ref found");H.current.webkitRequestFullScreen?H.current.webkitRequestFullScreen():H.current.requestFullscreen()},[o,de]),Qe=d.useCallback(()=>{document.webkitExitFullscreen?document.webkitExitFullscreen():document.exitFullscreen()},[]);d.useEffect(()=>{const{current:ge}=H;if(!ge)return;const Ce=()=>{const Ct=document.webkitFullscreenElement??document.fullscreenElement;Ct&&Ct===H.current?K.emitter.dispatchFullscreenChange({isFullscreen:!0}):K.emitter.dispatchFullscreenChange({isFullscreen:!1})};return ge.addEventListener("webkitfullscreenchange",Ce),ge.addEventListener("fullscreenchange",Ce),()=>{ge.removeEventListener("webkitfullscreenchange",Ce),ge.removeEventListener("fullscreenchange",Ce)}},[K.emitter]);const ke=(z==null?void 0:z.durationInFrames)??1,Ee=d.useMemo(()=>!z||!G?null:p1({canvasSize:G,compositionHeight:z.height,compositionWidth:z.width,previewSize:"auto"}),[G,z]),je=(Ee==null?void 0:Ee.scale)??1,_e=d.useRef(!1);d.useEffect(()=>{if(!_e.current){_e.current=!0;return}K.emitter.dispatchScaleChange(je)},[K.emitter,je]);const{setMediaVolume:Le,setPlayerMuted:dt}=d.useContext(me.SetMediaVolumeContext),[Kt,gn]=d.useState(!1);d.useEffect(()=>{let ge=null,Ce=!1;const Ct=()=>{Ce=!1,requestAnimationFrame(()=>{D===0?gn(!0):ge=setTimeout(()=>{Ce||gn(!0)},D)})},$n=()=>{requestAnimationFrame(()=>{Ce=!0,gn(!1),ge&&clearTimeout(ge)})};return K.emitter.addEventListener("waiting",Ct),K.emitter.addEventListener("resume",$n),()=>{K.emitter.removeEventListener("waiting",Ct),K.emitter.removeEventListener("resume",$n),gn(!1),ge&&clearTimeout(ge),Ce=!0}},[D,K.emitter]),d.useImperativeHandle(O,()=>{const ge={play:K.play,pause:()=>{X(!1),K.pause()},toggle:Ie,getContainerNode:()=>H.current,getCurrentFrame:K.getCurrentFrame,isPlaying:K.isPlaying,seekTo:Ce=>{const Ct=ke-1,$n=Math.max(0,Math.min(Ct,Ce));K.isPlaying()&&(X($n!==Ct||n),K.pause()),$n===Ct&&!n&&K.emitter.dispatchEnded(),K.seek($n)},isFullscreen:()=>{const{current:Ce}=H;return Ce?document.fullscreenElement===Ce||document.webkitFullscreenElement===Ce:!1},requestFullscreen:De,exitFullscreen:Qe,getVolume:()=>ue?0:se,setVolume:Ce=>{if(typeof Ce!="number")throw new TypeError(`setVolume() takes a number, got value of type ${typeof Ce}`);if(isNaN(Ce))throw new TypeError("setVolume() got a number that is NaN. Volume must be between 0 and 1.");if(Ce<0||Ce>1)throw new TypeError(`setVolume() got a number that is out of range. Must be between 0 and 1, got ${Ce}`);Le(Ce)},isMuted:()=>Re,mute:()=>{dt(!0)},unmute:()=>{dt(!1)},getScale:()=>je,pauseAndReturnToPlayStart:()=>{K.pauseAndReturnToPlayStart()}};return Object.assign(K.emitter,ge)},[ke,Qe,n,ue,Re,se,K,De,dt,Le,Ie,je]);const Zn=Z?Z.component:null,Mt=d.useMemo(()=>h1({canvasSize:G,config:z,style:t,overflowVisible:j,layout:Ee}),[G,z,Ee,j,t]),Kn=d.useMemo(()=>g1({config:z,layout:Ee,scale:je,overflowVisible:j}),[z,Ee,j,je]),Yt=d.useMemo(()=>m1({config:z,layout:Ee,scale:je,overflowVisible:j}),[z,Ee,j,je]),yn=K.pause,Gt=K.emitter.dispatchError,ft=d.useCallback(ge=>{yn(),Gt(ge)},[Gt,yn]),vn=d.useCallback(ge=>{ge.stopPropagation(),De()},[De]),Ot=d.useCallback(ge=>{ge.stopPropagation(),Qe()},[Qe]),_n=d.useCallback(ge=>{(ge instanceof MouseEvent?ge.button===2:ge.nativeEvent.button)||Ie(ge)},[Ie]),Yn=d.useCallback(()=>{Se(!0)},[]),Mn=d.useCallback(()=>{Se(!1)},[]),Tr=d.useCallback(()=>{Y?Qe():De()},[Qe,Y,De]),{handlePointerDown:ur,handleDoubleClick:cr}=pj(_n,Tr,l&&o&&de);d.useEffect(()=>{ae&&(K.play(),oe(!1))},[ae,K]);const _=d.useMemo(()=>m?m({height:Mt.height,width:Mt.width,isBuffering:Kt}):null,[Mt.height,Mt.width,m,Kt]),U=d.useMemo(()=>({type:"scale",scale:je}),[je]);if(!z)return null;const re=g?g({height:V==="player-size"?Mt.height:z.height,width:V==="player-size"?Mt.width:z.width,isBuffering:Kt}):null;if(re===void 0)throw new TypeError("renderPoster() must return a React element, but undefined was returned");const fe=re&&[y&&!K.isPlaying()&&!xe,h&&K.isLastFrame&&!K.isPlaying(),k&&!K.hasPlayed&&!K.isPlaying(),v&&Kt&&K.isPlaying(),S&&Kt&&!K.isPlaying()].some(Boolean),{left:we,top:be,width:Pe,height:Me,...He}=Kn,ze=u.jsxs(u.Fragment,{children:[u.jsxs("div",{style:Kn,onPointerDown:s?ur:void 0,onDoubleClick:l?cr:void 0,children:[u.jsxs("div",{style:Yt,className:rh(P),children:[Zn?u.jsx(x1,{onError:ft,errorFallback:f,children:u.jsx(me.CurrentScaleContext.Provider,{value:U,children:u.jsx(Zn,{...(Z==null?void 0:Z.props)??{},...i??{}})})}):null,fe&&V==="composition-size"?u.jsx("div",{style:{...He,width:z.width,height:z.height},onPointerDown:s?ur:void 0,onDoubleClick:l?cr:void 0,children:re}):null]}),u.jsx(PR,{})]}),fe&&V==="player-size"?u.jsx("div",{style:Kn,onPointerDown:s?ur:void 0,onDoubleClick:l?cr:void 0,children:re}):null,e?u.jsx(uj,{fps:z.fps,playing:K.playing,toggle:K.toggle,durationInFrames:z.durationInFrames,containerRef:H,onFullscreenButtonClick:vn,isFullscreen:Y,allowFullscreen:o,showVolumeControls:a,onExitFullscreenButtonClick:Ot,spaceKeyToPlayOrPause:c,onSeekEnd:Mn,onSeekStart:Yn,inFrame:b,outFrame:E,initiallyShowControls:I,canvasSize:G,renderFullscreenButton:T,renderPlayPauseButton:R,alwaysShowControls:M,showPlaybackRateControl:$,buffering:Kt,hideControlsWhenPointerDoesntMove:L,onDoubleClick:l?cr:void 0,onPointerDown:s?ur:void 0,renderMuteButton:F,renderVolumeSlider:A,renderCustomControls:W}):null]});return N||b1&&!hj?u.jsx("div",{ref:H,style:Mt,className:w,children:ze}):u.jsx("div",{ref:H,style:Mt,className:w,children:u.jsx(d.Suspense,{fallback:_,children:ze})})},gj=d.forwardRef(mj),S1="remotion.volumePreference",yj=(e,t,n)=>{if(!(typeof window>"u"))try{window.localStorage.setItem(n??S1,String(e))}catch(r){me.Log.error({logLevel:t,tag:null},"Could not persist volume",r)}},vj=e=>{if(typeof window>"u")return 1;try{const t=window.localStorage.getItem(e??S1);return t?Number(t):1}catch{return 1}},oh="player-comp",k1=({children:e,timelineContext:t,playbackRateContext:n,fps:r,compositionHeight:o,compositionWidth:i,durationInFrames:s,component:a,numberOfSharedAudioTags:l,initiallyMuted:c,logLevel:f,audioLatencyHint:p,sampleRate:m,volumePersistenceKey:g,initialVolume:w,inputProps:x,audioEnabled:k})=>{const h=w===void 0,y=d.useMemo(()=>({compositions:[{component:a,durationInFrames:s,height:o,width:i,fps:r,id:oh,nonce:[[0,777]],folderName:null,parentFolderName:null,schema:null,calculateMetadata:null,stack:null}],folders:[],currentCompositionMetadata:{defaultCodec:null,defaultOutName:null,defaultPixelFormat:null,defaultProResProfile:null,defaultSampleRate:null,defaultVideoImageFormat:null,durationInFrames:s,fps:r,height:o,width:i,props:x},canvasContent:{type:"composition",compositionId:"player-comp"}}),[a,s,o,i,r,x]),[v,S]=d.useState(()=>c),[b,E]=d.useState(()=>h?vj(g??null):w),I=d.useMemo(()=>({playerMuted:v,mediaVolume:b}),[v,b]),T=d.useRef(!1),R=T.current||k&&!v&&b>0;T.current=R;const F=d.useCallback($=>{E($),h&&yj($,f,g??null)},[h,f,g]),A=d.useMemo(()=>({setPlayerMuted:S,setMediaVolume:F}),[F]),W=d.useMemo(()=>({logLevel:f,mountTime:Date.now()}),[f]),M=d.useMemo(()=>({isPlayer:!0,isRendering:!1,isStudio:!1,isClientSideRendering:!1,isReadOnlyStudio:!1}),[]);return u.jsx(me.RemotionEnvironmentContext.Provider,{value:M,children:u.jsx(me.LogLevelContext.Provider,{value:W,children:u.jsx(me.CanUseRemotionHooksProvider,{children:u.jsx(me.AbsoluteTimeContext.Provider,{value:t,children:u.jsx(me.PlaybackRateContext.Provider,{value:n,children:u.jsx(me.TimelineContext.Provider,{value:t,children:u.jsx(me.CompositionManager.Provider,{value:y,children:u.jsx(me.PrefetchProvider,{children:u.jsx(me.DurationsContextProvider,{children:u.jsx(me.MediaVolumeContext.Provider,{value:I,children:u.jsx(me.SetMediaVolumeContext.Provider,{value:A,children:u.jsx(me.BufferingProvider,{children:u.jsx(me.SharedAudioContextProvider,{audioLatencyHint:p,audioEnabled:R,previewSampleRate:m,children:u.jsx(me.SharedAudioTagsContextProvider,{numberOfAudioTags:l,children:e})})})})})})})})})})})})})})},Sg=!1,wj=(e,t)=>{e||Sg||(Sg=!0,me.Log.warn({logLevel:t,tag:null},"Note: Some companies are required to obtain a license to use Remotion. See: https://remotion.dev/license\nPass the `acknowledgeRemotionLicense` prop to `<Player />` function to make this message disappear."))},kg=(e,t)=>{if(typeof e>"u"||e===null)return e??null;if(typeof e!="number")throw new TypeError(`"${t}" must be a number, but is ${JSON.stringify(e)}`);if(Number.isNaN(e))throw new TypeError(`"${t}" must not be NaN, but is ${JSON.stringify(e)}`);if(!Number.isFinite(e))throw new TypeError(`"${t}" must be finite, but is ${JSON.stringify(e)}`);if(e%1!==0)throw new TypeError(`"${t}" must be an integer, but is ${JSON.stringify(e)}`);return e},xj=({inFrame:e,durationInFrames:t,outFrame:n})=>{const r=kg(e,"inFrame"),o=kg(n,"outFrame");if(!(r===null&&o===null)){if(r!==null&&r>t-1)throw new Error("inFrame must be less than (durationInFrames - 1), but is "+r);if(o!==null&&o>t-1)throw new Error("outFrame must be less than (durationInFrames - 1), but is "+o);if(r!==null&&r<0)throw new Error("inFrame must be greater than 0, but is "+r);if(o!==null&&o<=0)throw new Error(`outFrame must be greater than 0, but is ${o}. If you want to render a single frame, use <Thumbnail /> instead.`);if(o!==null&&r!==null&&o<=r)throw new Error("outFrame must be greater than inFrame, but is "+o+" <= "+r)}},bj=({initialFrame:e,durationInFrames:t})=>{if(typeof t!="number")throw new Error(`\`durationInFrames\` must be a number, but is ${JSON.stringify(t)}`);if(!(typeof e>"u")){if(typeof e!="number")throw new Error(`\`initialFrame\` must be a number, but is ${JSON.stringify(e)}`);if(Number.isNaN(e))throw new Error("`initialFrame` must be a number, but is NaN");if(!Number.isFinite(e))throw new Error("`initialFrame` must be a number, but is Infinity");if(e%1!==0)throw new Error(`\`initialFrame\` must be an integer, but is ${JSON.stringify(e)}`);if(e>t-1)throw new Error(`\`initialFrame\` must be less or equal than \`durationInFrames - 1\`, but is ${JSON.stringify(e)}`)}},Sj=e=>{if(e!==void 0){if(e>10)throw new Error(`The highest possible playback rate is 10. You passed: ${e}`);if(e<-10)throw new Error(`The lowest possible playback rate is -10. You passed: ${e}`);if(e===0)throw new Error("A playback rate of 0 is not supported.")}},kj=Hu.validateFps,Eg=Hu.validateDimension,Ej=Hu.validateDurationInFrames,Cj=Hu.validateDefaultAndInputProps,Ij=e=>"component"in e?e.component:null,Tj=({durationInFrames:e,compositionHeight:t,compositionWidth:n,fps:r,inputProps:o,style:i,controls:s=!1,loop:a=!1,autoPlay:l=!1,showVolumeControls:c=!0,allowFullscreen:f=!0,clickToPlay:p,doubleClickToFullscreen:m=!1,spaceKeyToPlayOrPause:g=!0,moveToBeginningWhenEnded:w=!0,numberOfSharedAudioTags:x=5,errorFallback:k=()=>"⚠️",playbackRate:h=1,renderLoading:y,className:v,showPosterWhenUnplayed:S,showPosterWhenEnded:b,showPosterWhenPaused:E,showPosterWhenBuffering:I,showPosterWhenBufferingAndPaused:T,initialFrame:R,renderPoster:F,inFrame:A,outFrame:W,initiallyShowControls:M,renderFullscreenButton:$,renderPlayPauseButton:V,renderVolumeSlider:D,renderCustomControls:L,alwaysShowControls:j=!1,initiallyMuted:C=!1,showPlaybackRateControl:P=!1,posterFillMode:N="player-size",bufferStateDelayInMilliseconds:O,hideControlsWhenPointerDoesntMove:z=!0,overflowVisible:Z=!1,renderMuteButton:H,browserMediaControlsBehavior:G,overrideInternalClassName:B,logLevel:X="info",noSuspense:ae,acknowledgeRemotionLicense:oe,audioLatencyHint:Y="playback",sampleRate:q=48e3,volumePersistenceKey:xe,initialVolume:Se,...de},K)=>{if(typeof window<"u"&&(window.remotion_isPlayer=!0),de.defaultProps!==void 0)throw new Error("The <Player /> component does not accept `defaultProps`, but some were passed. Use `inputProps` instead.");const ee=Ij(de);if((ee==null?void 0:ee.type)===Ul)throw new TypeError("'component' should not be an instance of <Composition/>. Pass the React component directly, and set the duration, fps and dimensions as separate props. See https://www.remotion.dev/docs/player/examples for an example.");if(ee===Ul)throw new TypeError("'component' must not be the 'Composition' component. Pass your own React component directly, and set the duration, fps and dimensions as separate props. See https://www.remotion.dev/docs/player/examples for an example.");d.useState(()=>wj(!!oe,X));const ue=me.useLazyComponent({compProps:de,componentName:"Player",noSuspense:!!ae});bj({initialFrame:R,durationInFrames:e});const[se,Re]=d.useState(()=>({[oh]:R??0})),[Ie,De]=d.useState(!1),[Qe]=d.useState("player-comp"),ke=d.useRef(null),Ee=d.useRef([]),je=d.useRef(!1),[_e,Le]=d.useState(h);if(typeof t!="number")throw new TypeError(`'compositionHeight' must be a number but got '${typeof t}' instead`);if(typeof n!="number")throw new TypeError(`'compositionWidth' must be a number but got '${typeof n}' instead`);if(Eg(t,"compositionHeight","of the <Player /> component"),Eg(n,"compositionWidth","of the <Player /> component"),Ej(e,{component:"of the <Player/> component",allowFloats:!1}),kj(r,"as a prop of the <Player/> component",!1),Cj(o,"inputProps",null),xj({durationInFrames:e,inFrame:A,outFrame:W}),typeof s!="boolean"&&typeof s<"u")throw new TypeError(`'controls' must be a boolean or undefined but got '${typeof s}' instead`);if(typeof l!="boolean"&&typeof l<"u")throw new TypeError(`'autoPlay' must be a boolean or undefined but got '${typeof l}' instead`);if(typeof a!="boolean"&&typeof a<"u")throw new TypeError(`'loop' must be a boolean or undefined but got '${typeof a}' instead`);if(typeof m!="boolean"&&typeof m<"u")throw new TypeError(`'doubleClickToFullscreen' must be a boolean or undefined but got '${typeof m}' instead`);if(typeof c!="boolean"&&typeof c<"u")throw new TypeError(`'showVolumeControls' must be a boolean or undefined but got '${typeof c}' instead`);if(typeof f!="boolean"&&typeof f<"u")throw new TypeError(`'allowFullscreen' must be a boolean or undefined but got '${typeof f}' instead`);if(typeof p!="boolean"&&typeof p<"u")throw new TypeError(`'clickToPlay' must be a boolean or undefined but got '${typeof p}' instead`);if(typeof g!="boolean"&&typeof g<"u")throw new TypeError(`'spaceKeyToPlayOrPause' must be a boolean or undefined but got '${typeof g}' instead`);if(typeof q!="number"||!Number.isFinite(q)||Number.isNaN(q)||q<=0||q%1!==0)throw new TypeError(`'sampleRate' must be a positive integer but got '${q}' instead`);if(typeof Se<"u"&&typeof Se!="number")throw new TypeError(`'initialVolume' must be a number or undefined but got '${typeof Se}' instead`);if(typeof Se=="number"&&(!Number.isFinite(Se)||Number.isNaN(Se)||Se<0||Se>1))throw new TypeError(`'initialVolume' must be between 0 and 1 but got '${Se}' instead`);if(typeof x!="number"||x%1!==0||!Number.isFinite(x)||Number.isNaN(x)||x<0)throw new TypeError(`'numberOfSharedAudioTags' must be an integer but got '${x}' instead`);Sj(_e),d.useEffect(()=>{Le(h)},[h]),d.useImperativeHandle(K,()=>ke.current,[]),d.useState(()=>{me.playbackLogging({logLevel:X,message:`[player] Mounting <Player>. User agent = ${typeof navigator>"u"?"server":navigator.userAgent}`,tag:"player",mountTime:Date.now()})});const dt=d.useMemo(()=>({frame:se,playing:Ie,rootId:Qe,imperativePlaying:je,audioAndVideoTags:Ee}),[se,Ie,Qe]),Kt=d.useMemo(()=>({playbackRate:_e,setPlaybackRate:Le}),[_e]),gn=d.useMemo(()=>({setFrame:Re,setPlaying:De}),[Re]);typeof window<"u"&&d.useLayoutEffect(()=>{me.CSSUtils.injectCSS(me.CSSUtils.makeDefaultPreviewCSS(`.${rh(B)}`,"#fff"))},[B]);const Zn=d.useMemo(()=>o??{},[o]),Mt=d.useMemo(()=>G??{mode:"prevent-media-session"},[G]);return u.jsx(me.IsPlayerContextProvider,{children:u.jsx(k1,{timelineContext:dt,playbackRateContext:Kt,component:ue,compositionHeight:t,compositionWidth:n,durationInFrames:e,fps:r,numberOfSharedAudioTags:x,initiallyMuted:C,logLevel:X,audioLatencyHint:Y,sampleRate:q,volumePersistenceKey:xe,initialVolume:Se,inputProps:Zn,audioEnabled:!0,children:u.jsx(me.SetTimelineContext.Provider,{value:gn,children:u.jsx(xR,{currentPlaybackRate:_e,children:u.jsx(gj,{ref:ke,posterFillMode:N,renderLoading:y,autoPlay:!!l,loop:!!a,controls:!!s,errorFallback:k,style:i,inputProps:Zn,allowFullscreen:!!f,moveToBeginningWhenEnded:!!w,clickToPlay:typeof p=="boolean"?p:!!s,showVolumeControls:!!c,doubleClickToFullscreen:!!m,spaceKeyToPlayOrPause:!!g,playbackRate:_e,className:v??void 0,showPosterWhenUnplayed:!!S,showPosterWhenEnded:!!b,showPosterWhenPaused:!!E,showPosterWhenBuffering:!!I,showPosterWhenBufferingAndPaused:!!T,renderPoster:F,inFrame:A??null,outFrame:W??null,initiallyShowControls:M??!0,renderFullscreen:$??null,renderPlayPauseButton:V??null,renderMuteButton:H??null,renderVolumeSlider:D??null,renderCustomControls:L??null,alwaysShowControls:j,showPlaybackRateControl:P,bufferStateDelayInMilliseconds:O??300,hideControlsWhenPointerDoesntMove:z,overflowVisible:Z,browserMediaControlsBehavior:Mt,overrideInternalClassName:B??void 0,noSuspense:!!ae})})})})})},Rj=d.forwardRef,jj=Rj(Tj),Pj=()=>{const e=d.useContext(v1);if(!e)throw new TypeError("Expected Player event emitter context");return d.useMemo(()=>({emitter:e}),[e])},Ef=le.version.split(".")[0];if(Ef==="0")throw new Error(`Version ${Ef} of "react" is not supported by Remotion`);var Fj=parseInt(Ef,10)>=18,_j=({style:e,inputProps:t,errorFallback:n,renderLoading:r,className:o,overflowVisible:i,noSuspense:s,overrideInternalClassName:a},l)=>{const c=me.useUnsafeVideoConfig(),f=me.useVideo(),p=d.useRef(null),m=nh(p,{triggerOnWindowResize:!1,shouldApplyCssTransforms:!1}),g=d.useMemo(()=>!c||!m?null:p1({canvasSize:m,compositionHeight:c.height,compositionWidth:c.width,previewSize:"auto"}),[m,c]),w=(g==null?void 0:g.scale)??1,x=Pj();w1(x.emitter),d.useImperativeHandle(l,()=>{const T={getContainerNode:()=>p.current,getScale:()=>w};return Object.assign(x.emitter,T)},[w,x.emitter]);const k=f?f.component:null,h=d.useMemo(()=>h1({config:c,style:e,canvasSize:m,overflowVisible:i,layout:g}),[m,c,g,i,e]),y=d.useMemo(()=>g1({config:c,layout:g,scale:w,overflowVisible:i}),[c,g,i,w]),v=d.useMemo(()=>m1({config:c,layout:g,scale:w,overflowVisible:i}),[c,g,i,w]),S=d.useCallback(T=>{x.emitter.dispatchError(T)},[x.emitter]),b=d.useMemo(()=>r?r({height:h.height,width:h.width,isBuffering:!1}):null,[h.height,h.width,r]),E=d.useMemo(()=>({type:"scale",scale:w}),[w]);if(!c)return null;const I=u.jsx("div",{style:y,children:u.jsx("div",{style:v,className:rh(a),children:k?u.jsx(x1,{onError:S,errorFallback:n,children:u.jsx(me.CurrentScaleContext.Provider,{value:E,children:u.jsx(k,{...(f==null?void 0:f.props)??{},...t??{}})})}):null})});return s||b1&&!Fj?u.jsx("div",{ref:p,style:h,className:o,children:I}):u.jsx("div",{ref:p,style:h,className:o,children:u.jsx(d.Suspense,{fallback:b,children:I})})},Mj=d.forwardRef(_j),$j=({frameToDisplay:e,style:t,inputProps:n,compositionHeight:r,compositionWidth:o,durationInFrames:i,fps:s,className:a,errorFallback:l=()=>"⚠️",renderLoading:c,overflowVisible:f=!1,overrideInternalClassName:p,logLevel:m="info",noSuspense:g,...w},x)=>{typeof window<"u"&&d.useLayoutEffect(()=>{window.remotion_isPlayer=!0},[]);const[k]=d.useState(()=>String(_o(null))),h=d.useRef(null),y=d.useMemo(()=>({playing:!1,frame:{[oh]:e},rootId:k,imperativePlaying:{current:!1},audioAndVideoTags:{current:[]}}),[e,k]),v=d.useMemo(()=>({playbackRate:1,setPlaybackRate:()=>{throw new Error("thumbnail")}}),[]);d.useImperativeHandle(x,()=>h.current,[]);const S=me.useLazyComponent({compProps:w,componentName:"Thumbnail",noSuspense:!!g}),[b]=d.useState(()=>new wR),E=d.useMemo(()=>n??{},[n]);return u.jsx(me.IsPlayerContextProvider,{children:u.jsx(k1,{timelineContext:y,playbackRateContext:v,component:S,compositionHeight:r,compositionWidth:o,durationInFrames:i,fps:s,numberOfSharedAudioTags:0,initiallyMuted:!0,logLevel:m,audioLatencyHint:"playback",sampleRate:48e3,inputProps:E,audioEnabled:!1,children:u.jsx(v1.Provider,{value:b,children:u.jsx(Mj,{ref:h,className:a,errorFallback:l,inputProps:E,renderLoading:c,style:t,overflowVisible:f,overrideInternalClassName:p,noSuspense:!!g})})})})},Aj=d.forwardRef;Aj($j);const xi=[1,1.5,2,4];function Cg(e){return xi.find(t=>t>e+1e-9)??xi[xi.length-1]}function Nj(e,t){switch(t){case"L":return e.playing&&e.rate>0?{rate:Cg(e.rate),playing:!0}:{rate:xi[0],playing:!0};case"J":return e.playing&&e.rate<0?{rate:-Cg(-e.rate),playing:!0}:{rate:-xi[0],playing:!0};case"K":return{rate:xi[0],playing:!e.playing}}}function ih(e,t,n){const r=Math.round(e*n),o=Math.round(t*n);return{from:r,durationInFrames:Math.max(1,o-r)}}function Lj(e){if(typeof e!="object"||e===null)return null;const t=e;return typeof t.scale!="number"||!Number.isFinite(t.scale)||t.scale<=0||!Array.isArray(t.allowed)||t.allowed.some(n=>typeof n!="boolean")?null:{scale:t.scale,allowed:t.allowed}}function zj(e,t,n,r){const o=t?t.scale:n,i=[];let s=!1;for(let a=0;a<e.length;a++){const l=e[a-1],c=l?e[a].srcIn-l.srcOut:0;a>0&&c>=r&&(s=!s);const f=t?t.allowed[a]!==!1:!0;i.push(s&&f?o:1)}return i}const Dj=({src:e,spans:t,punchInScale:n=1.07,punch:r=null,punchThresholdSec:o=.15,audioFadeSec:i=.01,background:s="black"})=>{const{fps:a}=ht(),l=d.useMemo(()=>zj(t,r,n,o),[t,r,n,o]),c=Math.max(1,Math.round(i*a));return u.jsx(Hn,{style:{backgroundColor:s},children:t.map((f,p)=>{const{from:m,durationInFrames:g}=ih(f.outIn,f.outOut,a);return u.jsx(_t,{from:m,durationInFrames:g,premountFor:a,children:u.jsx(Hn,{style:{transform:`scale(${l[p]})`},children:u.jsx(c1,{src:e,trimBefore:Math.round(f.srcIn*a),trimAfter:Math.round(f.srcOut*a),style:{width:"100%",height:"100%",objectFit:"cover",objectPosition:"var(--ossclip-obj-x, 50%) var(--ossclip-obj-y, 50%)"},volume:w=>Math.max(0,Math.min(1,(w+1)/c,(g-w)/c))})})},p)})})};function Q(e,t,n){function r(a,l){var c;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(c=a._zod).traits??(c.traits=new Set),a._zod.traits.add(e),t(a,l);for(const f in s.prototype)f in a||Object.defineProperty(a,f,{value:s.prototype[f].bind(a)});a._zod.constr=s,a._zod.def=l}const o=(n==null?void 0:n.Parent)??Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function s(a){var l;const c=n!=null&&n.Parent?new i:this;r(c,a),(l=c._zod).deferred??(l.deferred=[]);for(const f of c._zod.deferred)f();return c}return Object.defineProperty(s,"init",{value:r}),Object.defineProperty(s,Symbol.hasInstance,{value:a=>{var l,c;return n!=null&&n.Parent&&a instanceof n.Parent?!0:(c=(l=a==null?void 0:a._zod)==null?void 0:l.traits)==null?void 0:c.has(e)}}),Object.defineProperty(s,"name",{value:e}),s}class Zs extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const E1={};function Qr(e){return E1}function C1(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function Oj(e,t){return typeof t=="bigint"?t.toString():t}function I1(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function sh(e){return e==null}function ah(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function Bj(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,o=n>r?n:r,i=Number.parseInt(e.toFixed(o).replace(".","")),s=Number.parseInt(t.toFixed(o).replace(".",""));return i%s/10**o}function Xe(e,t,n){Object.defineProperty(e,t,{get(){{const r=n();return e[t]=r,r}},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function lh(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function ss(e){return JSON.stringify(e)}const T1=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function Cf(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Wj=I1(()=>{var e;if(typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function ql(e){if(Cf(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(Cf(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}const Vj=new Set(["string","number","symbol"]);function pa(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function No(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n!=null&&n.parent)&&(r._zod.parent=e),r}function ye(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Hj(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Uj={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Zj(e,t){const n={},r=e._zod.def;for(const o in t){if(!(o in r.shape))throw new Error(`Unrecognized key: "${o}"`);t[o]&&(n[o]=r.shape[o])}return No(e,{...e._zod.def,shape:n,checks:[]})}function Kj(e,t){const n={...e._zod.def.shape},r=e._zod.def;for(const o in t){if(!(o in r.shape))throw new Error(`Unrecognized key: "${o}"`);t[o]&&delete n[o]}return No(e,{...e._zod.def,shape:n,checks:[]})}function Yj(e,t){if(!ql(t))throw new Error("Invalid input to extend: expected a plain object");const n={...e._zod.def,get shape(){const r={...e._zod.def.shape,...t};return lh(this,"shape",r),r},checks:[]};return No(e,n)}function Gj(e,t){return No(e,{...e._zod.def,get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return lh(this,"shape",n),n},catchall:t._zod.def.catchall,checks:[]})}function Xj(e,t,n){const r=t._zod.def.shape,o={...r};if(n)for(const i in n){if(!(i in r))throw new Error(`Unrecognized key: "${i}"`);n[i]&&(o[i]=e?new e({type:"optional",innerType:r[i]}):r[i])}else for(const i in r)o[i]=e?new e({type:"optional",innerType:r[i]}):r[i];return No(t,{...t._zod.def,shape:o,checks:[]})}function qj(e,t,n){const r=t._zod.def.shape,o={...r};if(n)for(const i in n){if(!(i in o))throw new Error(`Unrecognized key: "${i}"`);n[i]&&(o[i]=new e({type:"nonoptional",innerType:r[i]}))}else for(const i in r)o[i]=new e({type:"nonoptional",innerType:r[i]});return No(t,{...t._zod.def,shape:o,checks:[]})}function Es(e,t=0){var n;for(let r=t;r<e.issues.length;r++)if(((n=e.issues[r])==null?void 0:n.continue)!==!0)return!0;return!1}function yo(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Va(e){return typeof e=="string"?e:e==null?void 0:e.message}function eo(e,t,n){var o,i,s,a,l,c;const r={...e,path:e.path??[]};if(!e.message){const f=Va((s=(i=(o=e.inst)==null?void 0:o._zod.def)==null?void 0:i.error)==null?void 0:s.call(i,e))??Va((a=t==null?void 0:t.error)==null?void 0:a.call(t,e))??Va((l=n.customError)==null?void 0:l.call(n,e))??Va((c=n.localeError)==null?void 0:c.call(n,e))??"Invalid input";r.message=f}return delete r.inst,delete r.continue,t!=null&&t.reportInput||delete r.input,r}function uh(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Ks(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const R1=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get(){return JSON.stringify(t,Oj,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},j1=Q("$ZodError",R1),P1=Q("$ZodError",R1,{Parent:Error});function Jj(e,t=n=>n.message){const n={},r=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}function Qj(e,t){const n=t||function(i){return i.message},r={_errors:[]},o=i=>{for(const s of i.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>o({issues:a}));else if(s.code==="invalid_key")o({issues:s.issues});else if(s.code==="invalid_element")o({issues:s.issues});else if(s.path.length===0)r._errors.push(n(s));else{let a=r,l=0;for(;l<s.path.length;){const c=s.path[l];l===s.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(s))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return o(e),r}const eP=e=>(t,n,r,o)=>{const i=r?Object.assign(r,{async:!1}):{async:!1},s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw new Zs;if(s.issues.length){const a=new((o==null?void 0:o.Err)??e)(s.issues.map(l=>eo(l,i,Qr())));throw T1(a,o==null?void 0:o.callee),a}return s.value},tP=e=>async(t,n,r,o)=>{const i=r?Object.assign(r,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise&&(s=await s),s.issues.length){const a=new((o==null?void 0:o.Err)??e)(s.issues.map(l=>eo(l,i,Qr())));throw T1(a,o==null?void 0:o.callee),a}return s.value},F1=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new Zs;return i.issues.length?{success:!1,error:new(e??j1)(i.issues.map(s=>eo(s,o,Qr())))}:{success:!0,data:i.value}},nP=F1(P1),_1=e=>async(t,n,r)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(s=>eo(s,o,Qr())))}:{success:!0,data:i.value}},rP=_1(P1),oP=/^[cC][^\s-]{8,}$/,iP=/^[0-9a-z]+$/,sP=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,aP=/^[0-9a-vA-V]{20}$/,lP=/^[A-Za-z0-9]{27}$/,uP=/^[a-zA-Z0-9_-]{21}$/,cP=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,dP=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Ig=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/,fP=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,pP="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function hP(){return new RegExp(pP,"u")}const mP=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,gP=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,yP=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,vP=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,wP=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,M1=/^[A-Za-z0-9_-]*$/,xP=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,bP=/^\+(?:[0-9]){6,14}[0-9]$/,$1="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",SP=new RegExp(`^${$1}$`);function A1(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function kP(e){return new RegExp(`^${A1(e)}$`)}function EP(e){const t=A1({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-]\\d{2}:\\d{2})");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${$1}T(?:${r})$`)}const CP=e=>{const t=e?`[\\s\\S]{${(e==null?void 0:e.minimum)??0},${(e==null?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},IP=/^\d+$/,TP=/^-?\d+(?:\.\d+)?/i,RP=/true|false/i,jP=/^[^A-Z]*$/,PP=/^[^a-z]*$/,nn=Q("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),N1={number:"number",bigint:"bigint",object:"date"},L1=Q("$ZodCheckLessThan",(e,t)=>{nn.init(e,t);const n=N1[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,i=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),z1=Q("$ZodCheckGreaterThan",(e,t)=>{nn.init(e,t);const n=N1[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,i=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),FP=Q("$ZodCheckMultipleOf",(e,t)=>{nn.init(e,t),e._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):Bj(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),_P=Q("$ZodCheckNumberFormat",(e,t)=>{var s;nn.init(e,t),t.format=t.format||"float64";const n=(s=t.format)==null?void 0:s.includes("int"),r=n?"int":"number",[o,i]=Uj[t.format];e._zod.onattach.push(a=>{const l=a._zod.bag;l.format=t.format,l.minimum=o,l.maximum=i,n&&(l.pattern=IP)}),e._zod.check=a=>{const l=a.value;if(n){if(!Number.isInteger(l)){a.issues.push({expected:r,format:t.format,code:"invalid_type",input:l,inst:e});return}if(!Number.isSafeInteger(l)){l>0?a.issues.push({input:l,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,continue:!t.abort}):a.issues.push({input:l,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,continue:!t.abort});return}}l<o&&a.issues.push({origin:"number",input:l,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),l>i&&a.issues.push({origin:"number",input:l,code:"too_big",maximum:i,inst:e})}}),MP=Q("$ZodCheckMaxLength",(e,t)=>{var n;nn.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!sh(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const o=r.value;if(o.length<=t.maximum)return;const s=uh(o);r.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),$P=Q("$ZodCheckMinLength",(e,t)=>{var n;nn.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!sh(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const o=r.value;if(o.length>=t.minimum)return;const s=uh(o);r.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),AP=Q("$ZodCheckLengthEquals",(e,t)=>{var n;nn.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!sh(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=r=>{const o=r.value,i=o.length;if(i===t.length)return;const s=uh(o),a=i>t.length;r.issues.push({origin:s,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Zu=Q("$ZodCheckStringFormat",(e,t)=>{var n,r;nn.init(e,t),e._zod.onattach.push(o=>{const i=o._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),NP=Q("$ZodCheckRegex",(e,t)=>{Zu.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),LP=Q("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=jP),Zu.init(e,t)}),zP=Q("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=PP),Zu.init(e,t)}),DP=Q("$ZodCheckIncludes",(e,t)=>{nn.init(e,t);const n=pa(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(o=>{const i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),OP=Q("$ZodCheckStartsWith",(e,t)=>{nn.init(e,t);const n=new RegExp(`^${pa(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),BP=Q("$ZodCheckEndsWith",(e,t)=>{nn.init(e,t);const n=new RegExp(`.*${pa(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),WP=Q("$ZodCheckOverwrite",(e,t)=>{nn.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class VP{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
134
+ `;return u.jsxs("div",{style:i,children:[u.jsx("style",{dangerouslySetInnerHTML:{__html:f}}),u.jsx("input",{ref:r,"aria-label":"Change volume",className:a,max:1,min:0,onBlur:n,onChange:l,step:.01,type:"range",value:e,style:c})]})},LR=e=>u.jsx(NR,{...e}),yo=100,zR=({displayVerticalVolumeSlider:e,renderMuteButton:t,renderVolumeSlider:n})=>{const[r,o]=me.usePlayerMutedState(),[i,s]=me.useMediaVolumeState(),[a,l]=d.useState(!1),c=d.useRef(null),f=d.useRef(null),p=rh(c,!1),m=d.useCallback(()=>{setTimeout(()=>{f.current&&document.activeElement!==f.current&&l(!1)},10)},[]),g=i===0,w=d.useCallback(()=>{if(g){s(1),o(!1);return}o(S=>!S)},[g,o,s]),x=d.useMemo(()=>({display:"inline-flex",background:"none",border:"none",justifyContent:"center",alignItems:"center",touchAction:"none",...e&&{position:"relative"}}),[e]),k=d.useMemo(()=>({display:"inline",width:jt,height:jt,cursor:"pointer",appearance:"none",background:"none",border:"none",padding:0}),[]),h=d.useCallback(({muted:S,volume:b})=>{const E=S||b===0;return u.jsx("button",{"aria-label":E?"Unmute sound":"Mute sound",title:E?"Unmute sound":"Mute sound",onClick:w,onBlur:m,onFocus:()=>l(!0),style:k,type:"button",children:E?u.jsx(yR,{}):u.jsx(vR,{})})},[m,w,k]),y=d.useMemo(()=>t?t({muted:r,volume:i}):h({muted:r,volume:i}),[r,i,h,t]),v=d.useMemo(()=>(a||p)&&!r&&!me.isIosSafari()?(n??LR)({isVertical:e,volume:i,onBlur:()=>l(!1),inputRef:f,setVolume:s}):null,[e,a,p,r,i,n,s]);return u.jsxs("div",{ref:c,style:x,children:[y,v]})};function DR(e){const[t,n]=d.useState(e),r=d.useRef(null);return d.useEffect(()=>{const o=i=>{r.current&&!r.current.contains(i.target)&&n(!1)};return document.addEventListener("pointerup",o,!0),()=>{document.removeEventListener("pointerup",o,!0)}},[]),{ref:r,isComponentVisible:t,setIsComponentVisible:n}}var OR=35,BR=70,WR={height:30,paddingRight:15,paddingLeft:12,display:"flex",flexDirection:"row",alignItems:"center"},VR={width:22,display:"flex",alignItems:"center"},HR={width:14,height:14,color:"black"},UR=()=>u.jsx("svg",{viewBox:"0 0 512 512",style:HR,children:u.jsx("path",{fill:"currentColor",d:"M435.848 83.466L172.804 346.51l-96.652-96.652c-4.686-4.686-12.284-4.686-16.971 0l-28.284 28.284c-4.686 4.686-4.686 12.284 0 16.971l133.421 133.421c4.686 4.686 12.284 4.686 16.971 0l299.813-299.813c4.686-4.686 4.686-12.284 0-16.971l-28.284-28.284c-4.686-4.686-12.284-4.686-16.97 0z"})}),ZR=e=>{const t=e.toString();return t.includes(".")?t:t+".0"},KR=({rate:e,onSelect:t,selectedRate:n,keyboardSelectedRate:r})=>{const o=d.useCallback(p=>{p.stopPropagation(),p.preventDefault(),t(e)},[t,e]),[i,s]=d.useState(!1),a=d.useCallback(()=>{s(!0)},[]),l=d.useCallback(()=>{s(!1)},[]),c=r===e,f=d.useMemo(()=>({...WR,backgroundColor:i||c?"#eee":"transparent"}),[i,c]);return u.jsxs("div",{onPointerEnter:a,onPointerLeave:l,tabIndex:0,style:f,onClick:o,children:[u.jsx("div",{style:VR,children:e===n?u.jsx(UR,{}):null}),ZR(e),"x"]},e)},YR=({setIsComponentVisible:e,playbackRates:t,canvasSize:n})=>{const{setPlaybackRate:r,playbackRate:o}=me.usePlaybackRate(),[i,s]=d.useState(o);d.useEffect(()=>{const c=f=>{if(f.preventDefault(),f.key==="ArrowUp"){const p=t.findIndex(m=>m===i);if(p===0)return;s(p===-1?t[0]:t[p-1])}else if(f.key==="ArrowDown"){const p=t.findIndex(m=>m===i);if(p===t.length-1)return;s(p===-1?t[t.length-1]:t[p+1])}else f.key==="Enter"&&(r(i),e(!1))};return window.addEventListener("keydown",c),()=>{window.removeEventListener("keydown",c)}},[t,i,r,e]);const a=d.useCallback(c=>{r(c),e(!1)},[e,r]),l=d.useMemo(()=>({position:"absolute",right:0,width:125,maxHeight:n.height-BR-OR,bottom:35,background:"#fff",borderRadius:4,overflow:"auto",color:"black",textAlign:"left"}),[n.height]);return u.jsx("div",{style:l,children:t.map(c=>u.jsx(KR,{selectedRate:o,onSelect:a,rate:c,keyboardSelectedRate:i},c))})},GR={fontSize:13,fontWeight:"bold",color:"white",border:"2px solid white",borderRadius:20,paddingLeft:8,paddingRight:8,paddingTop:2,paddingBottom:2},Sf={appearance:"none",backgroundColor:"transparent",border:"none",cursor:"pointer",paddingLeft:0,paddingRight:0,paddingTop:6,paddingBottom:6,height:37,display:"inline-flex",marginBottom:0,marginTop:0,alignItems:"center"},XR={...Sf,position:"relative"},qR=({playbackRates:e,canvasSize:t})=>{const{ref:n,isComponentVisible:r,setIsComponentVisible:o}=DR(!1),{playbackRate:i}=me.usePlaybackRate(),s=d.useCallback(a=>{a.stopPropagation(),a.preventDefault(),o(l=>!l)},[o]);return u.jsx("div",{ref:n,children:u.jsxs("button",{type:"button","aria-label":"Change playback rate",style:XR,onClick:s,children:[u.jsxs("div",{style:GR,children:[i,"x"]}),r&&u.jsx(YR,{canvasSize:t,playbackRates:e,setIsComponentVisible:o})]})})},kg=(e,t,n)=>Math.round(Di(e,[0,n],[0,t-1],{extrapolateLeft:"clamp",extrapolateRight:"clamp"})),ci=5,os=12,kf=4,JR={userSelect:"none",WebkitUserSelect:"none",paddingTop:kf,paddingBottom:kf,boxSizing:"border-box",cursor:"pointer",position:"relative",touchAction:"none"},QR={height:ci,backgroundColor:"rgba(255, 255, 255, 0.25)",width:"100%",borderRadius:ci/2},ej=e=>{let t=e;for(;t.parentElement;)t=t.parentElement;return t},tj=({durationInFrames:e,onSeekEnd:t,onSeekStart:n,inFrame:r,outFrame:o})=>{const i=d.useRef(null),s=rh(i,!1),a=oh(i,{triggerOnWindowResize:!0,shouldApplyCssTransforms:!0}),{seek:l,play:c,pause:f,playing:p}=Zu(),m=me.Timeline.useTimelinePosition(),[g,w]=d.useState({dragging:!1}),x=(a==null?void 0:a.width)??0,k=d.useCallback(E=>{var j;if(E.button!==0)return;const I=(j=i.current)==null?void 0:j.getBoundingClientRect().left,T=kg(E.clientX-I,e,x);f(),l(T),w({dragging:!0,wasPlaying:p}),n()},[e,x,f,l,p,n]),h=d.useCallback(E=>{var j;if(!a)throw new Error("Player has no size");if(!g.dragging)return;const I=(j=i.current)==null?void 0:j.getBoundingClientRect().left,T=kg(E.clientX-I,e,a.width);l(T)},[g.dragging,e,l,a]),y=d.useCallback(()=>{w({dragging:!1}),g.dragging&&(g.wasPlaying?c():f(),t())},[g,t,f,c]);d.useEffect(()=>{if(!g.dragging)return;const E=ej(i.current);return E.addEventListener("pointermove",h),E.addEventListener("pointerup",y),()=>{E.removeEventListener("pointermove",h),E.removeEventListener("pointerup",y)}},[g.dragging,h,y]);const v=d.useMemo(()=>({height:os,width:os,borderRadius:os/2,position:"absolute",top:kf-os/2+5/2,backgroundColor:"white",left:Math.max(0,m/Math.max(1,e-1)*x-os/2),boxShadow:"0 0 2px black",opacity:Number(s||g.dragging)}),[s,g.dragging,e,m,x]),S=d.useMemo(()=>({height:ci,backgroundColor:"rgba(255, 255, 255, 1)",width:(m-(r??0))/(e-1)*x,marginLeft:(r??0)/(e-1)*x,borderRadius:ci/2}),[e,m,r,x]),b=d.useMemo(()=>({height:ci,backgroundColor:"rgba(255, 255, 255, 0.25)",width:((o??e-1)-(r??0))/(e-1)*100+"%",marginLeft:(r??0)/(e-1)*100+"%",borderRadius:ci/2,position:"absolute"}),[e,r,o]);return u.jsxs("div",{ref:i,onPointerDown:k,style:JR,children:[u.jsxs("div",{style:QR,children:[u.jsx("div",{style:b}),u.jsx("div",{style:S})]}),u.jsx("div",{style:v})]})},Eg=e=>{const t=Math.floor(e/60),n=Math.floor(e-t*60);return`${String(t)}:${String(n).padStart(2,"0")}`},nj=({durationInFrames:e,maxTimeLabelWidth:t,fps:n})=>{const r=me.Timeline.useTimelinePosition(),o=d.useMemo(()=>({color:"white",fontFamily:"sans-serif",fontSize:14,maxWidth:t===null?void 0:t,overflow:"hidden",textOverflow:"ellipsis"}),[t]),s=r===e-1?r+1:r;return u.jsxs("div",{style:o,children:[Eg(s/n)," / ",Eg(e/n)]})},rj=10,Ef=12,oj=({allowFullscreen:e,playerWidth:t})=>d.useMemo(()=>{const r=jt,o=jt,i=e?bf:0,s=o+r+i+Ef*2+rj*2,a=t-s,l=Math.max(a,0),c=l-yo,p=(c<yo?l:c)+s+yo,m=t<p;return{maxTimeLabelWidth:l===0?null:l,displayVerticalVolumeSlider:m}},[e,t]),ij=[0,.013,.049,.104,.175,.259,.352,.45,.55,.648,.741,.825,.896,.951,.987],sj=[0,8.1,15.5,22.5,29,35.3,41.2,47.1,52.9,58.8,64.7,71,77.5,84.5,91.9],aj=1/.7,lj={boxSizing:"border-box",position:"absolute",bottom:0,width:"100%",paddingTop:40,paddingBottom:10,backgroundImage:`linear-gradient(to bottom,${ij.map((e,t)=>`hsla(0, 0%, 0%, ${e}) ${sj[t]*aj}%`).join(", ")}, hsl(0, 0%, 0%) 100%)`,backgroundSize:"auto 145px",display:"flex",paddingRight:Ef,paddingLeft:Ef,flexDirection:"column",transition:"opacity 0.3s"},uj={display:"flex",flexDirection:"row",width:"100%",alignItems:"center",justifyContent:"center",userSelect:"none",WebkitUserSelect:"none"},cj={display:"flex",flexDirection:"row",userSelect:"none",WebkitUserSelect:"none",alignItems:"center"},is={width:12},dj={height:8},fj={flex:1},pj={},hj=({durationInFrames:e,isFullscreen:t,fps:n,showVolumeControls:r,onFullscreenButtonClick:o,allowFullscreen:i,onExitFullscreenButtonClick:s,spaceKeyToPlayOrPause:a,onSeekEnd:l,onSeekStart:c,inFrame:f,outFrame:p,initiallyShowControls:m,canvasSize:g,renderPlayPauseButton:w,renderFullscreenButton:x,alwaysShowControls:k,showPlaybackRateControl:h,containerRef:y,buffering:v,hideControlsWhenPointerDoesntMove:S,onPointerDown:b,onDoubleClick:E,renderMuteButton:I,renderVolumeSlider:T,playing:j,toggle:_,renderCustomControls:N})=>{const W=d.useRef(null),[M,$]=d.useState(!1),V=rh(y,S),{maxTimeLabelWidth:L,displayVerticalVolumeSlider:A}=oj({allowFullscreen:i,playerWidth:(g==null?void 0:g.width)??0}),[R,C]=d.useState(()=>{if(typeof m=="boolean")return m;if(typeof m=="number"){if(m%1!==0)throw new Error("initiallyShowControls must be an integer or a boolean");if(Number.isNaN(m))throw new Error("initiallyShowControls must not be NaN");if(!Number.isFinite(m))throw new Error("initiallyShowControls must be finite");if(m<=0)throw new Error("initiallyShowControls must be a positive integer");return m}throw new TypeError("initiallyShowControls must be a number or a boolean")}),P=d.useMemo(()=>({...lj,opacity:Number(V||!j||R||k)}),[V,R,j,k]);d.useEffect(()=>{W.current&&a&&W.current.focus({preventScroll:!0})},[j,a]),d.useEffect(()=>{$((typeof document<"u"&&(document.fullscreenEnabled||document.webkitFullscreenEnabled))??!1)},[]),d.useEffect(()=>{if(R===!1)return;const X=setTimeout(()=>{C(!1)},R===!0?2e3:R);return()=>{clearInterval(X)}},[R]);const z=d.useMemo(()=>{if(h===!0)return[.5,.8,1,1.2,1.5,1.8,2,2.5,3];if(Array.isArray(h)){for(const B of h){if(typeof B!="number")throw new Error("Every item in showPlaybackRateControl must be a number");if(B<=0)throw new Error("Every item in showPlaybackRateControl must be positive")}return h}return null},[h]),O=N?N():null,D=d.useRef(null),Z=d.useRef(null),H=d.useCallback(B=>{(B.target===D.current||B.target===Z.current)&&(b==null||b(B))},[b]),G=d.useCallback(B=>{(B.target===D.current||B.target===Z.current)&&(E==null||E(B))},[E]);return u.jsxs("div",{ref:D,style:P,onPointerDown:H,onDoubleClick:G,children:[u.jsxs("div",{ref:Z,style:uj,children:[u.jsxs("div",{style:cj,children:[u.jsx("button",{ref:W,type:"button",style:Sf,onClick:_,"aria-label":j?"Pause video":"Play video",title:j?"Pause video":"Play video",children:w===null?u.jsx(bg,{buffering:v,playing:j}):w({playing:j,isBuffering:v})??u.jsx(bg,{buffering:v,playing:j})}),r?u.jsxs(u.Fragment,{children:[u.jsx("div",{style:is}),u.jsx(zR,{renderMuteButton:I,renderVolumeSlider:T,displayVerticalVolumeSlider:A})]}):null,u.jsx("div",{style:is}),u.jsx(nj,{durationInFrames:e,fps:n,maxTimeLabelWidth:L}),u.jsx("div",{style:is})]}),u.jsx("div",{style:fj}),O,O&&z&&g?u.jsx("div",{style:is}):null,z&&g&&u.jsx(qR,{canvasSize:g,playbackRates:z}),z&&M&&i?u.jsx("div",{style:is}):null,u.jsx("div",{style:pj,children:M&&i?u.jsx("button",{type:"button","aria-label":t?"Exit fullscreen":"Enter Fullscreen",title:t?"Exit fullscreen":"Enter Fullscreen",style:Sf,onClick:t?s:o,children:x===null?u.jsx(gR,{isFullscreen:t}):x({isFullscreen:t})}):null})]}),u.jsx("div",{style:dj}),u.jsx(tj,{onSeekEnd:l,onSeekStart:c,durationInFrames:e,inFrame:f,outFrame:p})]})},I1=typeof document>"u",mj=e=>{let t=!1;return{promise:new Promise((r,o)=>{e.then(i=>{if(t){o({isCanceled:t,value:i});return}r(i)}).catch(i=>{o({isCanceled:t,error:i})})}),cancel:()=>{t=!0}}},gj=e=>new Promise(t=>setTimeout(t,e)),yj=()=>{const e=d.useRef([]),t=d.useCallback(i=>{e.current=[...e.current,i]},[]),n=d.useCallback(i=>{e.current=e.current.filter(s=>s!==i)},[]),r=d.useCallback(()=>e.current.map(i=>i.cancel()),[]);return d.useMemo(()=>({appendPendingPromise:t,removePendingPromise:n,clearPendingPromises:r}),[t,r,n])},vj=(e,t,n)=>{const r=yj(),o=d.useCallback(async l=>{if(l instanceof PointerEvent?l.pointerType==="touch":l.nativeEvent.pointerType==="touch"){e(l);return}r.clearPendingPromises();const c=mj(gj(200));r.appendPendingPromise(c);try{await c.promise,r.removePendingPromise(c),e(l)}catch(f){const p=f;if(r.removePendingPromise(c),!p.isCanceled)throw p.error}},[r,e]),i=d.useCallback(()=>{document.addEventListener("pointerup",l=>{o(l)},{once:!0})},[o]),s=d.useCallback(()=>{r.clearPendingPromises(),t()},[r,t]);return d.useMemo(()=>n?{handlePointerDown:i,handleDoubleClick:s}:{handlePointerDown:e,handleDoubleClick:()=>{}},[n,s,i,e])},Cf=le.version.split(".")[0];if(Cf==="0")throw new Error(`Version ${Cf} of "react" is not supported by Remotion`);var wj=parseInt(Cf,10)>=18,xj=({controls:e,style:t,loop:n,autoPlay:r,allowFullscreen:o,inputProps:i,clickToPlay:s,showVolumeControls:a,doubleClickToFullscreen:l,spaceKeyToPlayOrPause:c,errorFallback:f,playbackRate:p,renderLoading:m,renderPoster:g,className:w,moveToBeginningWhenEnded:x,showPosterWhenUnplayed:k,showPosterWhenEnded:h,showPosterWhenPaused:y,showPosterWhenBuffering:v,showPosterWhenBufferingAndPaused:S,inFrame:b,outFrame:E,initiallyShowControls:I,renderFullscreen:T,renderPlayPauseButton:j,renderMuteButton:_,renderVolumeSlider:N,renderCustomControls:W,alwaysShowControls:M,showPlaybackRateControl:$,posterFillMode:V,bufferStateDelayInMilliseconds:L,hideControlsWhenPointerDoesntMove:A,overflowVisible:R,browserMediaControlsBehavior:C,overrideInternalClassName:P,noSuspense:z},O)=>{const D=me.useUnsafeVideoConfig(),Z=me.useVideo(),H=d.useRef(null),G=oh(H,{triggerOnWindowResize:!1,shouldApplyCssTransforms:!1}),[B,X]=d.useState(!1),[ae,oe]=d.useState(r),[Y,q]=d.useState(()=>!1),[xe,Se]=d.useState(!1),de=d.useMemo(()=>typeof document>"u"?!1:!!(document.fullscreenEnabled||document.webkitFullscreenEnabled),[]),K=Zu(),ee=K.toggle,{playerMuted:ue,mediaVolume:se}=d.useContext(me.MediaVolumeContext);d.useEffect(()=>{K.emitter.dispatchVolumeChange(se)},[K.emitter,se]);const Re=ue||se===0;d.useEffect(()=>{K.emitter.dispatchMuteChange({isMuted:Re})},[K.emitter,Re]),FR({loop:n,playbackRate:p,moveToBeginningWhenEnded:x,inFrame:b,outFrame:E,getCurrentFrame:K.getCurrentFrame,browserMediaControlsBehavior:C,muted:Re}),d.useEffect(()=>{B&&!K.playing&&(X(!1),K.play())},[B,K]),d.useEffect(()=>{const{current:ge}=H;if(!ge)return;const Ce=()=>{const Ct=document.fullscreenElement===ge||document.webkitFullscreenElement===ge;q(Ct)};return document.addEventListener("fullscreenchange",Ce),document.addEventListener("webkitfullscreenchange",Ce),()=>{document.removeEventListener("fullscreenchange",Ce),document.removeEventListener("webkitfullscreenchange",Ce)}},[]);const Ie=d.useCallback(ge=>{ee(ge)},[ee]),De=d.useCallback(()=>{if(!o)throw new Error("allowFullscreen is false");if(!de)throw new Error("Browser doesnt support fullscreen");if(!H.current)throw new Error("No player ref found");H.current.webkitRequestFullScreen?H.current.webkitRequestFullScreen():H.current.requestFullscreen()},[o,de]),Qe=d.useCallback(()=>{document.webkitExitFullscreen?document.webkitExitFullscreen():document.exitFullscreen()},[]);d.useEffect(()=>{const{current:ge}=H;if(!ge)return;const Ce=()=>{const Ct=document.webkitFullscreenElement??document.fullscreenElement;Ct&&Ct===H.current?K.emitter.dispatchFullscreenChange({isFullscreen:!0}):K.emitter.dispatchFullscreenChange({isFullscreen:!1})};return ge.addEventListener("webkitfullscreenchange",Ce),ge.addEventListener("fullscreenchange",Ce),()=>{ge.removeEventListener("webkitfullscreenchange",Ce),ge.removeEventListener("fullscreenchange",Ce)}},[K.emitter]);const ke=(D==null?void 0:D.durationInFrames)??1,Ee=d.useMemo(()=>!D||!G?null:v1({canvasSize:G,compositionHeight:D.height,compositionWidth:D.width,previewSize:"auto"}),[G,D]),je=(Ee==null?void 0:Ee.scale)??1,Me=d.useRef(!1);d.useEffect(()=>{if(!Me.current){Me.current=!0;return}K.emitter.dispatchScaleChange(je)},[K.emitter,je]);const{setMediaVolume:Le,setPlayerMuted:dt}=d.useContext(me.SetMediaVolumeContext),[Kt,gn]=d.useState(!1);d.useEffect(()=>{let ge=null,Ce=!1;const Ct=()=>{Ce=!1,requestAnimationFrame(()=>{L===0?gn(!0):ge=setTimeout(()=>{Ce||gn(!0)},L)})},$n=()=>{requestAnimationFrame(()=>{Ce=!0,gn(!1),ge&&clearTimeout(ge)})};return K.emitter.addEventListener("waiting",Ct),K.emitter.addEventListener("resume",$n),()=>{K.emitter.removeEventListener("waiting",Ct),K.emitter.removeEventListener("resume",$n),gn(!1),ge&&clearTimeout(ge),Ce=!0}},[L,K.emitter]),d.useImperativeHandle(O,()=>{const ge={play:K.play,pause:()=>{X(!1),K.pause()},toggle:Ie,getContainerNode:()=>H.current,getCurrentFrame:K.getCurrentFrame,isPlaying:K.isPlaying,seekTo:Ce=>{const Ct=ke-1,$n=Math.max(0,Math.min(Ct,Ce));K.isPlaying()&&(X($n!==Ct||n),K.pause()),$n===Ct&&!n&&K.emitter.dispatchEnded(),K.seek($n)},isFullscreen:()=>{const{current:Ce}=H;return Ce?document.fullscreenElement===Ce||document.webkitFullscreenElement===Ce:!1},requestFullscreen:De,exitFullscreen:Qe,getVolume:()=>ue?0:se,setVolume:Ce=>{if(typeof Ce!="number")throw new TypeError(`setVolume() takes a number, got value of type ${typeof Ce}`);if(isNaN(Ce))throw new TypeError("setVolume() got a number that is NaN. Volume must be between 0 and 1.");if(Ce<0||Ce>1)throw new TypeError(`setVolume() got a number that is out of range. Must be between 0 and 1, got ${Ce}`);Le(Ce)},isMuted:()=>Re,mute:()=>{dt(!0)},unmute:()=>{dt(!1)},getScale:()=>je,pauseAndReturnToPlayStart:()=>{K.pauseAndReturnToPlayStart()}};return Object.assign(K.emitter,ge)},[ke,Qe,n,ue,Re,se,K,De,dt,Le,Ie,je]);const Zn=Z?Z.component:null,Mt=d.useMemo(()=>w1({canvasSize:G,config:D,style:t,overflowVisible:R,layout:Ee}),[G,D,Ee,R,t]),Kn=d.useMemo(()=>b1({config:D,layout:Ee,scale:je,overflowVisible:R}),[D,Ee,R,je]),Yt=d.useMemo(()=>x1({config:D,layout:Ee,scale:je,overflowVisible:R}),[D,Ee,R,je]),yn=K.pause,Gt=K.emitter.dispatchError,ft=d.useCallback(ge=>{yn(),Gt(ge)},[Gt,yn]),vn=d.useCallback(ge=>{ge.stopPropagation(),De()},[De]),Ot=d.useCallback(ge=>{ge.stopPropagation(),Qe()},[Qe]),_n=d.useCallback(ge=>{(ge instanceof MouseEvent?ge.button===2:ge.nativeEvent.button)||Ie(ge)},[Ie]),Yn=d.useCallback(()=>{Se(!0)},[]),Mn=d.useCallback(()=>{Se(!1)},[]),Tr=d.useCallback(()=>{Y?Qe():De()},[Qe,Y,De]),{handlePointerDown:ur,handleDoubleClick:cr}=vj(_n,Tr,l&&o&&de);d.useEffect(()=>{ae&&(K.play(),oe(!1))},[ae,K]);const F=d.useMemo(()=>m?m({height:Mt.height,width:Mt.width,isBuffering:Kt}):null,[Mt.height,Mt.width,m,Kt]),U=d.useMemo(()=>({type:"scale",scale:je}),[je]);if(!D)return null;const re=g?g({height:V==="player-size"?Mt.height:D.height,width:V==="player-size"?Mt.width:D.width,isBuffering:Kt}):null;if(re===void 0)throw new TypeError("renderPoster() must return a React element, but undefined was returned");const fe=re&&[y&&!K.isPlaying()&&!xe,h&&K.isLastFrame&&!K.isPlaying(),k&&!K.hasPlayed&&!K.isPlaying(),v&&Kt&&K.isPlaying(),S&&Kt&&!K.isPlaying()].some(Boolean),{left:we,top:be,width:Pe,height:$e,...He}=Kn,ze=u.jsxs(u.Fragment,{children:[u.jsxs("div",{style:Kn,onPointerDown:s?ur:void 0,onDoubleClick:l?cr:void 0,children:[u.jsxs("div",{style:Yt,className:ih(P),children:[Zn?u.jsx(C1,{onError:ft,errorFallback:f,children:u.jsx(me.CurrentScaleContext.Provider,{value:U,children:u.jsx(Zn,{...(Z==null?void 0:Z.props)??{},...i??{}})})}):null,fe&&V==="composition-size"?u.jsx("div",{style:{...He,width:D.width,height:D.height},onPointerDown:s?ur:void 0,onDoubleClick:l?cr:void 0,children:re}):null]}),u.jsx(AR,{})]}),fe&&V==="player-size"?u.jsx("div",{style:Kn,onPointerDown:s?ur:void 0,onDoubleClick:l?cr:void 0,children:re}):null,e?u.jsx(hj,{fps:D.fps,playing:K.playing,toggle:K.toggle,durationInFrames:D.durationInFrames,containerRef:H,onFullscreenButtonClick:vn,isFullscreen:Y,allowFullscreen:o,showVolumeControls:a,onExitFullscreenButtonClick:Ot,spaceKeyToPlayOrPause:c,onSeekEnd:Mn,onSeekStart:Yn,inFrame:b,outFrame:E,initiallyShowControls:I,canvasSize:G,renderFullscreenButton:T,renderPlayPauseButton:j,alwaysShowControls:M,showPlaybackRateControl:$,buffering:Kt,hideControlsWhenPointerDoesntMove:A,onDoubleClick:l?cr:void 0,onPointerDown:s?ur:void 0,renderMuteButton:_,renderVolumeSlider:N,renderCustomControls:W}):null]});return z||I1&&!wj?u.jsx("div",{ref:H,style:Mt,className:w,children:ze}):u.jsx("div",{ref:H,style:Mt,className:w,children:u.jsx(d.Suspense,{fallback:F,children:ze})})},bj=d.forwardRef(xj),T1="remotion.volumePreference",Sj=(e,t,n)=>{if(!(typeof window>"u"))try{window.localStorage.setItem(n??T1,String(e))}catch(r){me.Log.error({logLevel:t,tag:null},"Could not persist volume",r)}},kj=e=>{if(typeof window>"u")return 1;try{const t=window.localStorage.getItem(e??T1);return t?Number(t):1}catch{return 1}},sh="player-comp",R1=({children:e,timelineContext:t,playbackRateContext:n,fps:r,compositionHeight:o,compositionWidth:i,durationInFrames:s,component:a,numberOfSharedAudioTags:l,initiallyMuted:c,logLevel:f,audioLatencyHint:p,sampleRate:m,volumePersistenceKey:g,initialVolume:w,inputProps:x,audioEnabled:k})=>{const h=w===void 0,y=d.useMemo(()=>({compositions:[{component:a,durationInFrames:s,height:o,width:i,fps:r,id:sh,nonce:[[0,777]],folderName:null,parentFolderName:null,schema:null,calculateMetadata:null,stack:null}],folders:[],currentCompositionMetadata:{defaultCodec:null,defaultOutName:null,defaultPixelFormat:null,defaultProResProfile:null,defaultSampleRate:null,defaultVideoImageFormat:null,durationInFrames:s,fps:r,height:o,width:i,props:x},canvasContent:{type:"composition",compositionId:"player-comp"}}),[a,s,o,i,r,x]),[v,S]=d.useState(()=>c),[b,E]=d.useState(()=>h?kj(g??null):w),I=d.useMemo(()=>({playerMuted:v,mediaVolume:b}),[v,b]),T=d.useRef(!1),j=T.current||k&&!v&&b>0;T.current=j;const _=d.useCallback($=>{E($),h&&Sj($,f,g??null)},[h,f,g]),N=d.useMemo(()=>({setPlayerMuted:S,setMediaVolume:_}),[_]),W=d.useMemo(()=>({logLevel:f,mountTime:Date.now()}),[f]),M=d.useMemo(()=>({isPlayer:!0,isRendering:!1,isStudio:!1,isClientSideRendering:!1,isReadOnlyStudio:!1}),[]);return u.jsx(me.RemotionEnvironmentContext.Provider,{value:M,children:u.jsx(me.LogLevelContext.Provider,{value:W,children:u.jsx(me.CanUseRemotionHooksProvider,{children:u.jsx(me.AbsoluteTimeContext.Provider,{value:t,children:u.jsx(me.PlaybackRateContext.Provider,{value:n,children:u.jsx(me.TimelineContext.Provider,{value:t,children:u.jsx(me.CompositionManager.Provider,{value:y,children:u.jsx(me.PrefetchProvider,{children:u.jsx(me.DurationsContextProvider,{children:u.jsx(me.MediaVolumeContext.Provider,{value:I,children:u.jsx(me.SetMediaVolumeContext.Provider,{value:N,children:u.jsx(me.BufferingProvider,{children:u.jsx(me.SharedAudioContextProvider,{audioLatencyHint:p,audioEnabled:j,previewSampleRate:m,children:u.jsx(me.SharedAudioTagsContextProvider,{numberOfAudioTags:l,children:e})})})})})})})})})})})})})})},Cg=!1,Ej=(e,t)=>{e||Cg||(Cg=!0,me.Log.warn({logLevel:t,tag:null},"Note: Some companies are required to obtain a license to use Remotion. See: https://remotion.dev/license\nPass the `acknowledgeRemotionLicense` prop to `<Player />` function to make this message disappear."))},Ig=(e,t)=>{if(typeof e>"u"||e===null)return e??null;if(typeof e!="number")throw new TypeError(`"${t}" must be a number, but is ${JSON.stringify(e)}`);if(Number.isNaN(e))throw new TypeError(`"${t}" must not be NaN, but is ${JSON.stringify(e)}`);if(!Number.isFinite(e))throw new TypeError(`"${t}" must be finite, but is ${JSON.stringify(e)}`);if(e%1!==0)throw new TypeError(`"${t}" must be an integer, but is ${JSON.stringify(e)}`);return e},Cj=({inFrame:e,durationInFrames:t,outFrame:n})=>{const r=Ig(e,"inFrame"),o=Ig(n,"outFrame");if(!(r===null&&o===null)){if(r!==null&&r>t-1)throw new Error("inFrame must be less than (durationInFrames - 1), but is "+r);if(o!==null&&o>t-1)throw new Error("outFrame must be less than (durationInFrames - 1), but is "+o);if(r!==null&&r<0)throw new Error("inFrame must be greater than 0, but is "+r);if(o!==null&&o<=0)throw new Error(`outFrame must be greater than 0, but is ${o}. If you want to render a single frame, use <Thumbnail /> instead.`);if(o!==null&&r!==null&&o<=r)throw new Error("outFrame must be greater than inFrame, but is "+o+" <= "+r)}},Ij=({initialFrame:e,durationInFrames:t})=>{if(typeof t!="number")throw new Error(`\`durationInFrames\` must be a number, but is ${JSON.stringify(t)}`);if(!(typeof e>"u")){if(typeof e!="number")throw new Error(`\`initialFrame\` must be a number, but is ${JSON.stringify(e)}`);if(Number.isNaN(e))throw new Error("`initialFrame` must be a number, but is NaN");if(!Number.isFinite(e))throw new Error("`initialFrame` must be a number, but is Infinity");if(e%1!==0)throw new Error(`\`initialFrame\` must be an integer, but is ${JSON.stringify(e)}`);if(e>t-1)throw new Error(`\`initialFrame\` must be less or equal than \`durationInFrames - 1\`, but is ${JSON.stringify(e)}`)}},Tj=e=>{if(e!==void 0){if(e>10)throw new Error(`The highest possible playback rate is 10. You passed: ${e}`);if(e<-10)throw new Error(`The lowest possible playback rate is -10. You passed: ${e}`);if(e===0)throw new Error("A playback rate of 0 is not supported.")}},Rj=Uu.validateFps,Tg=Uu.validateDimension,jj=Uu.validateDurationInFrames,Pj=Uu.validateDefaultAndInputProps,Fj=e=>"component"in e?e.component:null,_j=({durationInFrames:e,compositionHeight:t,compositionWidth:n,fps:r,inputProps:o,style:i,controls:s=!1,loop:a=!1,autoPlay:l=!1,showVolumeControls:c=!0,allowFullscreen:f=!0,clickToPlay:p,doubleClickToFullscreen:m=!1,spaceKeyToPlayOrPause:g=!0,moveToBeginningWhenEnded:w=!0,numberOfSharedAudioTags:x=5,errorFallback:k=()=>"⚠️",playbackRate:h=1,renderLoading:y,className:v,showPosterWhenUnplayed:S,showPosterWhenEnded:b,showPosterWhenPaused:E,showPosterWhenBuffering:I,showPosterWhenBufferingAndPaused:T,initialFrame:j,renderPoster:_,inFrame:N,outFrame:W,initiallyShowControls:M,renderFullscreenButton:$,renderPlayPauseButton:V,renderVolumeSlider:L,renderCustomControls:A,alwaysShowControls:R=!1,initiallyMuted:C=!1,showPlaybackRateControl:P=!1,posterFillMode:z="player-size",bufferStateDelayInMilliseconds:O,hideControlsWhenPointerDoesntMove:D=!0,overflowVisible:Z=!1,renderMuteButton:H,browserMediaControlsBehavior:G,overrideInternalClassName:B,logLevel:X="info",noSuspense:ae,acknowledgeRemotionLicense:oe,audioLatencyHint:Y="playback",sampleRate:q=48e3,volumePersistenceKey:xe,initialVolume:Se,...de},K)=>{if(typeof window<"u"&&(window.remotion_isPlayer=!0),de.defaultProps!==void 0)throw new Error("The <Player /> component does not accept `defaultProps`, but some were passed. Use `inputProps` instead.");const ee=Fj(de);if((ee==null?void 0:ee.type)===Zl)throw new TypeError("'component' should not be an instance of <Composition/>. Pass the React component directly, and set the duration, fps and dimensions as separate props. See https://www.remotion.dev/docs/player/examples for an example.");if(ee===Zl)throw new TypeError("'component' must not be the 'Composition' component. Pass your own React component directly, and set the duration, fps and dimensions as separate props. See https://www.remotion.dev/docs/player/examples for an example.");d.useState(()=>Ej(!!oe,X));const ue=me.useLazyComponent({compProps:de,componentName:"Player",noSuspense:!!ae});Ij({initialFrame:j,durationInFrames:e});const[se,Re]=d.useState(()=>({[sh]:j??0})),[Ie,De]=d.useState(!1),[Qe]=d.useState("player-comp"),ke=d.useRef(null),Ee=d.useRef([]),je=d.useRef(!1),[Me,Le]=d.useState(h);if(typeof t!="number")throw new TypeError(`'compositionHeight' must be a number but got '${typeof t}' instead`);if(typeof n!="number")throw new TypeError(`'compositionWidth' must be a number but got '${typeof n}' instead`);if(Tg(t,"compositionHeight","of the <Player /> component"),Tg(n,"compositionWidth","of the <Player /> component"),jj(e,{component:"of the <Player/> component",allowFloats:!1}),Rj(r,"as a prop of the <Player/> component",!1),Pj(o,"inputProps",null),Cj({durationInFrames:e,inFrame:N,outFrame:W}),typeof s!="boolean"&&typeof s<"u")throw new TypeError(`'controls' must be a boolean or undefined but got '${typeof s}' instead`);if(typeof l!="boolean"&&typeof l<"u")throw new TypeError(`'autoPlay' must be a boolean or undefined but got '${typeof l}' instead`);if(typeof a!="boolean"&&typeof a<"u")throw new TypeError(`'loop' must be a boolean or undefined but got '${typeof a}' instead`);if(typeof m!="boolean"&&typeof m<"u")throw new TypeError(`'doubleClickToFullscreen' must be a boolean or undefined but got '${typeof m}' instead`);if(typeof c!="boolean"&&typeof c<"u")throw new TypeError(`'showVolumeControls' must be a boolean or undefined but got '${typeof c}' instead`);if(typeof f!="boolean"&&typeof f<"u")throw new TypeError(`'allowFullscreen' must be a boolean or undefined but got '${typeof f}' instead`);if(typeof p!="boolean"&&typeof p<"u")throw new TypeError(`'clickToPlay' must be a boolean or undefined but got '${typeof p}' instead`);if(typeof g!="boolean"&&typeof g<"u")throw new TypeError(`'spaceKeyToPlayOrPause' must be a boolean or undefined but got '${typeof g}' instead`);if(typeof q!="number"||!Number.isFinite(q)||Number.isNaN(q)||q<=0||q%1!==0)throw new TypeError(`'sampleRate' must be a positive integer but got '${q}' instead`);if(typeof Se<"u"&&typeof Se!="number")throw new TypeError(`'initialVolume' must be a number or undefined but got '${typeof Se}' instead`);if(typeof Se=="number"&&(!Number.isFinite(Se)||Number.isNaN(Se)||Se<0||Se>1))throw new TypeError(`'initialVolume' must be between 0 and 1 but got '${Se}' instead`);if(typeof x!="number"||x%1!==0||!Number.isFinite(x)||Number.isNaN(x)||x<0)throw new TypeError(`'numberOfSharedAudioTags' must be an integer but got '${x}' instead`);Tj(Me),d.useEffect(()=>{Le(h)},[h]),d.useImperativeHandle(K,()=>ke.current,[]),d.useState(()=>{me.playbackLogging({logLevel:X,message:`[player] Mounting <Player>. User agent = ${typeof navigator>"u"?"server":navigator.userAgent}`,tag:"player",mountTime:Date.now()})});const dt=d.useMemo(()=>({frame:se,playing:Ie,rootId:Qe,imperativePlaying:je,audioAndVideoTags:Ee}),[se,Ie,Qe]),Kt=d.useMemo(()=>({playbackRate:Me,setPlaybackRate:Le}),[Me]),gn=d.useMemo(()=>({setFrame:Re,setPlaying:De}),[Re]);typeof window<"u"&&d.useLayoutEffect(()=>{me.CSSUtils.injectCSS(me.CSSUtils.makeDefaultPreviewCSS(`.${ih(B)}`,"#fff"))},[B]);const Zn=d.useMemo(()=>o??{},[o]),Mt=d.useMemo(()=>G??{mode:"prevent-media-session"},[G]);return u.jsx(me.IsPlayerContextProvider,{children:u.jsx(R1,{timelineContext:dt,playbackRateContext:Kt,component:ue,compositionHeight:t,compositionWidth:n,durationInFrames:e,fps:r,numberOfSharedAudioTags:x,initiallyMuted:C,logLevel:X,audioLatencyHint:Y,sampleRate:q,volumePersistenceKey:xe,initialVolume:Se,inputProps:Zn,audioEnabled:!0,children:u.jsx(me.SetTimelineContext.Provider,{value:gn,children:u.jsx(CR,{currentPlaybackRate:Me,children:u.jsx(bj,{ref:ke,posterFillMode:z,renderLoading:y,autoPlay:!!l,loop:!!a,controls:!!s,errorFallback:k,style:i,inputProps:Zn,allowFullscreen:!!f,moveToBeginningWhenEnded:!!w,clickToPlay:typeof p=="boolean"?p:!!s,showVolumeControls:!!c,doubleClickToFullscreen:!!m,spaceKeyToPlayOrPause:!!g,playbackRate:Me,className:v??void 0,showPosterWhenUnplayed:!!S,showPosterWhenEnded:!!b,showPosterWhenPaused:!!E,showPosterWhenBuffering:!!I,showPosterWhenBufferingAndPaused:!!T,renderPoster:_,inFrame:N??null,outFrame:W??null,initiallyShowControls:M??!0,renderFullscreen:$??null,renderPlayPauseButton:V??null,renderMuteButton:H??null,renderVolumeSlider:L??null,renderCustomControls:A??null,alwaysShowControls:R,showPlaybackRateControl:P,bufferStateDelayInMilliseconds:O??300,hideControlsWhenPointerDoesntMove:D,overflowVisible:Z,browserMediaControlsBehavior:Mt,overrideInternalClassName:B??void 0,noSuspense:!!ae})})})})})},Mj=d.forwardRef,$j=Mj(_j),Aj=()=>{const e=d.useContext(k1);if(!e)throw new TypeError("Expected Player event emitter context");return d.useMemo(()=>({emitter:e}),[e])},If=le.version.split(".")[0];if(If==="0")throw new Error(`Version ${If} of "react" is not supported by Remotion`);var Nj=parseInt(If,10)>=18,Lj=({style:e,inputProps:t,errorFallback:n,renderLoading:r,className:o,overflowVisible:i,noSuspense:s,overrideInternalClassName:a},l)=>{const c=me.useUnsafeVideoConfig(),f=me.useVideo(),p=d.useRef(null),m=oh(p,{triggerOnWindowResize:!1,shouldApplyCssTransforms:!1}),g=d.useMemo(()=>!c||!m?null:v1({canvasSize:m,compositionHeight:c.height,compositionWidth:c.width,previewSize:"auto"}),[m,c]),w=(g==null?void 0:g.scale)??1,x=Aj();E1(x.emitter),d.useImperativeHandle(l,()=>{const T={getContainerNode:()=>p.current,getScale:()=>w};return Object.assign(x.emitter,T)},[w,x.emitter]);const k=f?f.component:null,h=d.useMemo(()=>w1({config:c,style:e,canvasSize:m,overflowVisible:i,layout:g}),[m,c,g,i,e]),y=d.useMemo(()=>b1({config:c,layout:g,scale:w,overflowVisible:i}),[c,g,i,w]),v=d.useMemo(()=>x1({config:c,layout:g,scale:w,overflowVisible:i}),[c,g,i,w]),S=d.useCallback(T=>{x.emitter.dispatchError(T)},[x.emitter]),b=d.useMemo(()=>r?r({height:h.height,width:h.width,isBuffering:!1}):null,[h.height,h.width,r]),E=d.useMemo(()=>({type:"scale",scale:w}),[w]);if(!c)return null;const I=u.jsx("div",{style:y,children:u.jsx("div",{style:v,className:ih(a),children:k?u.jsx(C1,{onError:S,errorFallback:n,children:u.jsx(me.CurrentScaleContext.Provider,{value:E,children:u.jsx(k,{...(f==null?void 0:f.props)??{},...t??{}})})}):null})});return s||I1&&!Nj?u.jsx("div",{ref:p,style:h,className:o,children:I}):u.jsx("div",{ref:p,style:h,className:o,children:u.jsx(d.Suspense,{fallback:b,children:I})})},zj=d.forwardRef(Lj),Dj=({frameToDisplay:e,style:t,inputProps:n,compositionHeight:r,compositionWidth:o,durationInFrames:i,fps:s,className:a,errorFallback:l=()=>"⚠️",renderLoading:c,overflowVisible:f=!1,overrideInternalClassName:p,logLevel:m="info",noSuspense:g,...w},x)=>{typeof window<"u"&&d.useLayoutEffect(()=>{window.remotion_isPlayer=!0},[]);const[k]=d.useState(()=>String(Mo(null))),h=d.useRef(null),y=d.useMemo(()=>({playing:!1,frame:{[sh]:e},rootId:k,imperativePlaying:{current:!1},audioAndVideoTags:{current:[]}}),[e,k]),v=d.useMemo(()=>({playbackRate:1,setPlaybackRate:()=>{throw new Error("thumbnail")}}),[]);d.useImperativeHandle(x,()=>h.current,[]);const S=me.useLazyComponent({compProps:w,componentName:"Thumbnail",noSuspense:!!g}),[b]=d.useState(()=>new ER),E=d.useMemo(()=>n??{},[n]);return u.jsx(me.IsPlayerContextProvider,{children:u.jsx(R1,{timelineContext:y,playbackRateContext:v,component:S,compositionHeight:r,compositionWidth:o,durationInFrames:i,fps:s,numberOfSharedAudioTags:0,initiallyMuted:!0,logLevel:m,audioLatencyHint:"playback",sampleRate:48e3,inputProps:E,audioEnabled:!1,children:u.jsx(k1.Provider,{value:b,children:u.jsx(zj,{ref:h,className:a,errorFallback:l,inputProps:E,renderLoading:c,style:t,overflowVisible:f,overrideInternalClassName:p,noSuspense:!!g})})})})},Oj=d.forwardRef;Oj(Dj);const xi=[1,1.5,2,4];function Rg(e){return xi.find(t=>t>e+1e-9)??xi[xi.length-1]}function Bj(e,t){switch(t){case"L":return e.playing&&e.rate>0?{rate:Rg(e.rate),playing:!0}:{rate:xi[0],playing:!0};case"J":return e.playing&&e.rate<0?{rate:-Rg(-e.rate),playing:!0}:{rate:-xi[0],playing:!0};case"K":return{rate:xi[0],playing:!e.playing}}}function ah(e,t,n){const r=Math.round(e*n),o=Math.round(t*n);return{from:r,durationInFrames:Math.max(1,o-r)}}function Wj(e){if(typeof e!="object"||e===null)return null;const t=e;return typeof t.scale!="number"||!Number.isFinite(t.scale)||t.scale<=0||!Array.isArray(t.allowed)||t.allowed.some(n=>typeof n!="boolean")?null:{scale:t.scale,allowed:t.allowed}}function Vj(e,t,n,r){const o=t?t.scale:n,i=[];let s=!1;for(let a=0;a<e.length;a++){const l=e[a-1],c=l?e[a].srcIn-l.srcOut:0;a>0&&c>=r&&(s=!s);const f=t?t.allowed[a]!==!1:!0;i.push(s&&f?o:1)}return i}const Hj=({src:e,spans:t,punchInScale:n=1.07,punch:r=null,punchThresholdSec:o=.15,audioFadeSec:i=.01,background:s="black"})=>{const{fps:a}=ht(),l=d.useMemo(()=>Vj(t,r,n,o),[t,r,n,o]),c=Math.max(1,Math.round(i*a));return u.jsx(Hn,{style:{backgroundColor:s},children:t.map((f,p)=>{const{from:m,durationInFrames:g}=ah(f.outIn,f.outOut,a);return u.jsx(_t,{from:m,durationInFrames:g,premountFor:a,children:u.jsx(Hn,{style:{transform:`scale(${l[p]})`},children:u.jsx(m1,{src:e,trimBefore:Math.round(f.srcIn*a),trimAfter:Math.round(f.srcOut*a),style:{width:"100%",height:"100%",objectFit:"cover",objectPosition:"var(--ossclip-obj-x, 50%) var(--ossclip-obj-y, 50%)"},volume:w=>Math.max(0,Math.min(1,(w+1)/c,(g-w)/c))})})},p)})})};function Q(e,t,n){function r(a,l){var c;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(c=a._zod).traits??(c.traits=new Set),a._zod.traits.add(e),t(a,l);for(const f in s.prototype)f in a||Object.defineProperty(a,f,{value:s.prototype[f].bind(a)});a._zod.constr=s,a._zod.def=l}const o=(n==null?void 0:n.Parent)??Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function s(a){var l;const c=n!=null&&n.Parent?new i:this;r(c,a),(l=c._zod).deferred??(l.deferred=[]);for(const f of c._zod.deferred)f();return c}return Object.defineProperty(s,"init",{value:r}),Object.defineProperty(s,Symbol.hasInstance,{value:a=>{var l,c;return n!=null&&n.Parent&&a instanceof n.Parent?!0:(c=(l=a==null?void 0:a._zod)==null?void 0:l.traits)==null?void 0:c.has(e)}}),Object.defineProperty(s,"name",{value:e}),s}class Zs extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const j1={};function Qr(e){return j1}function P1(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function Uj(e,t){return typeof t=="bigint"?t.toString():t}function F1(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function lh(e){return e==null}function uh(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function Zj(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,o=n>r?n:r,i=Number.parseInt(e.toFixed(o).replace(".","")),s=Number.parseInt(t.toFixed(o).replace(".",""));return i%s/10**o}function Xe(e,t,n){Object.defineProperty(e,t,{get(){{const r=n();return e[t]=r,r}},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function ch(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function ss(e){return JSON.stringify(e)}const _1=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function Tf(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Kj=F1(()=>{var e;if(typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function Jl(e){if(Tf(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(Tf(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}const Yj=new Set(["string","number","symbol"]);function pa(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Lo(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n!=null&&n.parent)&&(r._zod.parent=e),r}function ye(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Gj(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Xj={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function qj(e,t){const n={},r=e._zod.def;for(const o in t){if(!(o in r.shape))throw new Error(`Unrecognized key: "${o}"`);t[o]&&(n[o]=r.shape[o])}return Lo(e,{...e._zod.def,shape:n,checks:[]})}function Jj(e,t){const n={...e._zod.def.shape},r=e._zod.def;for(const o in t){if(!(o in r.shape))throw new Error(`Unrecognized key: "${o}"`);t[o]&&delete n[o]}return Lo(e,{...e._zod.def,shape:n,checks:[]})}function Qj(e,t){if(!Jl(t))throw new Error("Invalid input to extend: expected a plain object");const n={...e._zod.def,get shape(){const r={...e._zod.def.shape,...t};return ch(this,"shape",r),r},checks:[]};return Lo(e,n)}function eP(e,t){return Lo(e,{...e._zod.def,get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return ch(this,"shape",n),n},catchall:t._zod.def.catchall,checks:[]})}function tP(e,t,n){const r=t._zod.def.shape,o={...r};if(n)for(const i in n){if(!(i in r))throw new Error(`Unrecognized key: "${i}"`);n[i]&&(o[i]=e?new e({type:"optional",innerType:r[i]}):r[i])}else for(const i in r)o[i]=e?new e({type:"optional",innerType:r[i]}):r[i];return Lo(t,{...t._zod.def,shape:o,checks:[]})}function nP(e,t,n){const r=t._zod.def.shape,o={...r};if(n)for(const i in n){if(!(i in o))throw new Error(`Unrecognized key: "${i}"`);n[i]&&(o[i]=new e({type:"nonoptional",innerType:r[i]}))}else for(const i in r)o[i]=new e({type:"nonoptional",innerType:r[i]});return Lo(t,{...t._zod.def,shape:o,checks:[]})}function Es(e,t=0){var n;for(let r=t;r<e.issues.length;r++)if(((n=e.issues[r])==null?void 0:n.continue)!==!0)return!0;return!1}function vo(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Va(e){return typeof e=="string"?e:e==null?void 0:e.message}function eo(e,t,n){var o,i,s,a,l,c;const r={...e,path:e.path??[]};if(!e.message){const f=Va((s=(i=(o=e.inst)==null?void 0:o._zod.def)==null?void 0:i.error)==null?void 0:s.call(i,e))??Va((a=t==null?void 0:t.error)==null?void 0:a.call(t,e))??Va((l=n.customError)==null?void 0:l.call(n,e))??Va((c=n.localeError)==null?void 0:c.call(n,e))??"Invalid input";r.message=f}return delete r.inst,delete r.continue,t!=null&&t.reportInput||delete r.input,r}function dh(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Ks(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const M1=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get(){return JSON.stringify(t,Uj,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},$1=Q("$ZodError",M1),A1=Q("$ZodError",M1,{Parent:Error});function rP(e,t=n=>n.message){const n={},r=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}function oP(e,t){const n=t||function(i){return i.message},r={_errors:[]},o=i=>{for(const s of i.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>o({issues:a}));else if(s.code==="invalid_key")o({issues:s.issues});else if(s.code==="invalid_element")o({issues:s.issues});else if(s.path.length===0)r._errors.push(n(s));else{let a=r,l=0;for(;l<s.path.length;){const c=s.path[l];l===s.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(s))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return o(e),r}const iP=e=>(t,n,r,o)=>{const i=r?Object.assign(r,{async:!1}):{async:!1},s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw new Zs;if(s.issues.length){const a=new((o==null?void 0:o.Err)??e)(s.issues.map(l=>eo(l,i,Qr())));throw _1(a,o==null?void 0:o.callee),a}return s.value},sP=e=>async(t,n,r,o)=>{const i=r?Object.assign(r,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},i);if(s instanceof Promise&&(s=await s),s.issues.length){const a=new((o==null?void 0:o.Err)??e)(s.issues.map(l=>eo(l,i,Qr())));throw _1(a,o==null?void 0:o.callee),a}return s.value},N1=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new Zs;return i.issues.length?{success:!1,error:new(e??$1)(i.issues.map(s=>eo(s,o,Qr())))}:{success:!0,data:i.value}},aP=N1(A1),L1=e=>async(t,n,r)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(s=>eo(s,o,Qr())))}:{success:!0,data:i.value}},lP=L1(A1),uP=/^[cC][^\s-]{8,}$/,cP=/^[0-9a-z]+$/,dP=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,fP=/^[0-9a-vA-V]{20}$/,pP=/^[A-Za-z0-9]{27}$/,hP=/^[a-zA-Z0-9_-]{21}$/,mP=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,gP=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,jg=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/,yP=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,vP="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function wP(){return new RegExp(vP,"u")}const xP=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,bP=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,SP=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,kP=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,EP=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,z1=/^[A-Za-z0-9_-]*$/,CP=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,IP=/^\+(?:[0-9]){6,14}[0-9]$/,D1="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",TP=new RegExp(`^${D1}$`);function O1(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function RP(e){return new RegExp(`^${O1(e)}$`)}function jP(e){const t=O1({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-]\\d{2}:\\d{2})");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${D1}T(?:${r})$`)}const PP=e=>{const t=e?`[\\s\\S]{${(e==null?void 0:e.minimum)??0},${(e==null?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},FP=/^\d+$/,_P=/^-?\d+(?:\.\d+)?/i,MP=/true|false/i,$P=/^[^A-Z]*$/,AP=/^[^a-z]*$/,nn=Q("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),B1={number:"number",bigint:"bigint",object:"date"},W1=Q("$ZodCheckLessThan",(e,t)=>{nn.init(e,t);const n=B1[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,i=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<i&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),V1=Q("$ZodCheckGreaterThan",(e,t)=>{nn.init(e,t);const n=B1[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,i=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),NP=Q("$ZodCheckMultipleOf",(e,t)=>{nn.init(e,t),e._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):Zj(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),LP=Q("$ZodCheckNumberFormat",(e,t)=>{var s;nn.init(e,t),t.format=t.format||"float64";const n=(s=t.format)==null?void 0:s.includes("int"),r=n?"int":"number",[o,i]=Xj[t.format];e._zod.onattach.push(a=>{const l=a._zod.bag;l.format=t.format,l.minimum=o,l.maximum=i,n&&(l.pattern=FP)}),e._zod.check=a=>{const l=a.value;if(n){if(!Number.isInteger(l)){a.issues.push({expected:r,format:t.format,code:"invalid_type",input:l,inst:e});return}if(!Number.isSafeInteger(l)){l>0?a.issues.push({input:l,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,continue:!t.abort}):a.issues.push({input:l,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,continue:!t.abort});return}}l<o&&a.issues.push({origin:"number",input:l,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),l>i&&a.issues.push({origin:"number",input:l,code:"too_big",maximum:i,inst:e})}}),zP=Q("$ZodCheckMaxLength",(e,t)=>{var n;nn.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!lh(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const o=r.value;if(o.length<=t.maximum)return;const s=dh(o);r.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),DP=Q("$ZodCheckMinLength",(e,t)=>{var n;nn.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!lh(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const o=r.value;if(o.length>=t.minimum)return;const s=dh(o);r.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),OP=Q("$ZodCheckLengthEquals",(e,t)=>{var n;nn.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!lh(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=r=>{const o=r.value,i=o.length;if(i===t.length)return;const s=dh(o),a=i>t.length;r.issues.push({origin:s,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Ku=Q("$ZodCheckStringFormat",(e,t)=>{var n,r;nn.init(e,t),e._zod.onattach.push(o=>{const i=o._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),BP=Q("$ZodCheckRegex",(e,t)=>{Ku.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),WP=Q("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=$P),Ku.init(e,t)}),VP=Q("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=AP),Ku.init(e,t)}),HP=Q("$ZodCheckIncludes",(e,t)=>{nn.init(e,t);const n=pa(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(o=>{const i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),UP=Q("$ZodCheckStartsWith",(e,t)=>{nn.init(e,t);const n=new RegExp(`^${pa(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),ZP=Q("$ZodCheckEndsWith",(e,t)=>{nn.init(e,t);const n=new RegExp(`.*${pa(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),KP=Q("$ZodCheckOverwrite",(e,t)=>{nn.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class YP{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
135
135
  `).filter(s=>s),o=Math.min(...r.map(s=>s.length-s.trimStart().length)),i=r.map(s=>s.slice(o)).map(s=>" ".repeat(this.indent*2)+s);for(const s of i)this.content.push(s)}compile(){const t=Function,n=this==null?void 0:this.args,o=[...((this==null?void 0:this.content)??[""]).map(i=>` ${i}`)];return new t(...n,o.join(`
136
- `))}}const HP={major:4,minor:0,patch:0},qe=Q("$ZodType",(e,t)=>{var o;var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=HP;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const i of r)for(const s of i._zod.onattach)s(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),(o=e._zod.deferred)==null||o.push(()=>{e._zod.run=e._zod.parse});else{const i=(s,a,l)=>{let c=Es(s),f;for(const p of a){if(p._zod.def.when){if(!p._zod.def.when(s))continue}else if(c)continue;const m=s.issues.length,g=p._zod.check(s);if(g instanceof Promise&&(l==null?void 0:l.async)===!1)throw new Zs;if(f||g instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await g,s.issues.length!==m&&(c||(c=Es(s,m)))});else{if(s.issues.length===m)continue;c||(c=Es(s,m))}}return f?f.then(()=>s):s};e._zod.run=(s,a)=>{const l=e._zod.parse(s,a);if(l instanceof Promise){if(a.async===!1)throw new Zs;return l.then(c=>i(c,r,a))}return i(l,r,a)}}e["~standard"]={validate:i=>{var s;try{const a=nP(e,i);return a.success?{value:a.data}:{issues:(s=a.error)==null?void 0:s.issues}}catch{return rP(e,i).then(l=>{var c;return l.success?{value:l.data}:{issues:(c=l.error)==null?void 0:c.issues}})}},vendor:"zod",version:1}}),ch=Q("$ZodString",(e,t)=>{var n;qe.init(e,t),e._zod.pattern=[...((n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)??[]].pop()??CP(e._zod.bag),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),Je=Q("$ZodStringFormat",(e,t)=>{Zu.init(e,t),ch.init(e,t)}),UP=Q("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=dP),Je.init(e,t)}),ZP=Q("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Ig(r))}else t.pattern??(t.pattern=Ig());Je.init(e,t)}),KP=Q("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=fP),Je.init(e,t)}),YP=Q("$ZodURL",(e,t)=>{Je.init(e,t),e._zod.check=n=>{try{const r=n.value,o=new URL(r),i=o.href;t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:xP.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),!r.endsWith("/")&&i.endsWith("/")?n.value=i.slice(0,-1):n.value=i;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),GP=Q("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=hP()),Je.init(e,t)}),XP=Q("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=uP),Je.init(e,t)}),qP=Q("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=oP),Je.init(e,t)}),JP=Q("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=iP),Je.init(e,t)}),QP=Q("$ZodULID",(e,t)=>{t.pattern??(t.pattern=sP),Je.init(e,t)}),eF=Q("$ZodXID",(e,t)=>{t.pattern??(t.pattern=aP),Je.init(e,t)}),tF=Q("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=lP),Je.init(e,t)}),nF=Q("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=EP(t)),Je.init(e,t)}),rF=Q("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=SP),Je.init(e,t)}),oF=Q("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=kP(t)),Je.init(e,t)}),iF=Q("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=cP),Je.init(e,t)}),sF=Q("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=mP),Je.init(e,t),e._zod.onattach.push(n=>{const r=n._zod.bag;r.format="ipv4"})}),aF=Q("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=gP),Je.init(e,t),e._zod.onattach.push(n=>{const r=n._zod.bag;r.format="ipv6"}),e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),lF=Q("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=yP),Je.init(e,t)}),uF=Q("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=vP),Je.init(e,t),e._zod.check=n=>{const[r,o]=n.value.split("/");try{if(!o)throw new Error;const i=Number(o);if(`${i}`!==o)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${r}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function D1(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const cF=Q("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=wP),Je.init(e,t),e._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64"}),e._zod.check=n=>{D1(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function dF(e){if(!M1.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return D1(n)}const fF=Q("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=M1),Je.init(e,t),e._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64url"}),e._zod.check=n=>{dF(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),pF=Q("$ZodE164",(e,t)=>{t.pattern??(t.pattern=bP),Je.init(e,t)});function hF(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const o=JSON.parse(atob(r));return!("typ"in o&&(o==null?void 0:o.typ)!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const mF=Q("$ZodJWT",(e,t)=>{Je.init(e,t),e._zod.check=n=>{hF(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),O1=Q("$ZodNumber",(e,t)=>{qe.init(e,t),e._zod.pattern=e._zod.bag.pattern??TP,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const o=n.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;const i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),n}}),gF=Q("$ZodNumber",(e,t)=>{_P.init(e,t),O1.init(e,t)}),yF=Q("$ZodBoolean",(e,t)=>{qe.init(e,t),e._zod.pattern=RP,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}const o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),vF=Q("$ZodUnknown",(e,t)=>{qe.init(e,t),e._zod.parse=n=>n}),wF=Q("$ZodNever",(e,t)=>{qe.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Tg(e,t,n){e.issues.length&&t.issues.push(...yo(n,e.issues)),t.value[n]=e.value}const xF=Q("$ZodArray",(e,t)=>{qe.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const i=[];for(let s=0;s<o.length;s++){const a=o[s],l=t.element._zod.run({value:a,issues:[]},r);l instanceof Promise?i.push(l.then(c=>Tg(c,n,s))):Tg(l,n,s)}return i.length?Promise.all(i).then(()=>n):n}});function Ha(e,t,n){e.issues.length&&t.issues.push(...yo(n,e.issues)),t.value[n]=e.value}function Rg(e,t,n,r){e.issues.length?r[n]===void 0?n in r?t.value[n]=void 0:t.value[n]=e.value:t.issues.push(...yo(n,e.issues)):e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}const bF=Q("$ZodObject",(e,t)=>{qe.init(e,t);const n=I1(()=>{const p=Object.keys(t.shape);for(const g of p)if(!(t.shape[g]instanceof qe))throw new Error(`Invalid element at key "${g}": expected a Zod schema`);const m=Hj(t.shape);return{shape:t.shape,keys:p,keySet:new Set(p),numKeys:p.length,optionalKeys:new Set(m)}});Xe(e._zod,"propValues",()=>{const p=t.shape,m={};for(const g in p){const w=p[g]._zod;if(w.values){m[g]??(m[g]=new Set);for(const x of w.values)m[g].add(x)}}return m});const r=p=>{const m=new VP(["shape","payload","ctx"]),g=n.value,w=y=>{const v=ss(y);return`shape[${v}]._zod.run({ value: input[${v}], issues: [] }, ctx)`};m.write("const input = payload.value;");const x=Object.create(null);let k=0;for(const y of g.keys)x[y]=`key_${k++}`;m.write("const newResult = {}");for(const y of g.keys)if(g.optionalKeys.has(y)){const v=x[y];m.write(`const ${v} = ${w(y)};`);const S=ss(y);m.write(`
136
+ `))}}const GP={major:4,minor:0,patch:0},qe=Q("$ZodType",(e,t)=>{var o;var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=GP;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const i of r)for(const s of i._zod.onattach)s(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),(o=e._zod.deferred)==null||o.push(()=>{e._zod.run=e._zod.parse});else{const i=(s,a,l)=>{let c=Es(s),f;for(const p of a){if(p._zod.def.when){if(!p._zod.def.when(s))continue}else if(c)continue;const m=s.issues.length,g=p._zod.check(s);if(g instanceof Promise&&(l==null?void 0:l.async)===!1)throw new Zs;if(f||g instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await g,s.issues.length!==m&&(c||(c=Es(s,m)))});else{if(s.issues.length===m)continue;c||(c=Es(s,m))}}return f?f.then(()=>s):s};e._zod.run=(s,a)=>{const l=e._zod.parse(s,a);if(l instanceof Promise){if(a.async===!1)throw new Zs;return l.then(c=>i(c,r,a))}return i(l,r,a)}}e["~standard"]={validate:i=>{var s;try{const a=aP(e,i);return a.success?{value:a.data}:{issues:(s=a.error)==null?void 0:s.issues}}catch{return lP(e,i).then(l=>{var c;return l.success?{value:l.data}:{issues:(c=l.error)==null?void 0:c.issues}})}},vendor:"zod",version:1}}),fh=Q("$ZodString",(e,t)=>{var n;qe.init(e,t),e._zod.pattern=[...((n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)??[]].pop()??PP(e._zod.bag),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),Je=Q("$ZodStringFormat",(e,t)=>{Ku.init(e,t),fh.init(e,t)}),XP=Q("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=gP),Je.init(e,t)}),qP=Q("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=jg(r))}else t.pattern??(t.pattern=jg());Je.init(e,t)}),JP=Q("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=yP),Je.init(e,t)}),QP=Q("$ZodURL",(e,t)=>{Je.init(e,t),e._zod.check=n=>{try{const r=n.value,o=new URL(r),i=o.href;t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:CP.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),!r.endsWith("/")&&i.endsWith("/")?n.value=i.slice(0,-1):n.value=i;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),eF=Q("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=wP()),Je.init(e,t)}),tF=Q("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=hP),Je.init(e,t)}),nF=Q("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=uP),Je.init(e,t)}),rF=Q("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=cP),Je.init(e,t)}),oF=Q("$ZodULID",(e,t)=>{t.pattern??(t.pattern=dP),Je.init(e,t)}),iF=Q("$ZodXID",(e,t)=>{t.pattern??(t.pattern=fP),Je.init(e,t)}),sF=Q("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=pP),Je.init(e,t)}),aF=Q("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=jP(t)),Je.init(e,t)}),lF=Q("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=TP),Je.init(e,t)}),uF=Q("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=RP(t)),Je.init(e,t)}),cF=Q("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=mP),Je.init(e,t)}),dF=Q("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=xP),Je.init(e,t),e._zod.onattach.push(n=>{const r=n._zod.bag;r.format="ipv4"})}),fF=Q("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=bP),Je.init(e,t),e._zod.onattach.push(n=>{const r=n._zod.bag;r.format="ipv6"}),e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),pF=Q("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=SP),Je.init(e,t)}),hF=Q("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=kP),Je.init(e,t),e._zod.check=n=>{const[r,o]=n.value.split("/");try{if(!o)throw new Error;const i=Number(o);if(`${i}`!==o)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${r}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function H1(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const mF=Q("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=EP),Je.init(e,t),e._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64"}),e._zod.check=n=>{H1(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function gF(e){if(!z1.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return H1(n)}const yF=Q("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=z1),Je.init(e,t),e._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64url"}),e._zod.check=n=>{gF(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),vF=Q("$ZodE164",(e,t)=>{t.pattern??(t.pattern=IP),Je.init(e,t)});function wF(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const o=JSON.parse(atob(r));return!("typ"in o&&(o==null?void 0:o.typ)!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const xF=Q("$ZodJWT",(e,t)=>{Je.init(e,t),e._zod.check=n=>{wF(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),U1=Q("$ZodNumber",(e,t)=>{qe.init(e,t),e._zod.pattern=e._zod.bag.pattern??_P,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const o=n.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;const i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),n}}),bF=Q("$ZodNumber",(e,t)=>{LP.init(e,t),U1.init(e,t)}),SF=Q("$ZodBoolean",(e,t)=>{qe.init(e,t),e._zod.pattern=MP,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}const o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),kF=Q("$ZodUnknown",(e,t)=>{qe.init(e,t),e._zod.parse=n=>n}),EF=Q("$ZodNever",(e,t)=>{qe.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Pg(e,t,n){e.issues.length&&t.issues.push(...vo(n,e.issues)),t.value[n]=e.value}const CF=Q("$ZodArray",(e,t)=>{qe.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const i=[];for(let s=0;s<o.length;s++){const a=o[s],l=t.element._zod.run({value:a,issues:[]},r);l instanceof Promise?i.push(l.then(c=>Pg(c,n,s))):Pg(l,n,s)}return i.length?Promise.all(i).then(()=>n):n}});function Ha(e,t,n){e.issues.length&&t.issues.push(...vo(n,e.issues)),t.value[n]=e.value}function Fg(e,t,n,r){e.issues.length?r[n]===void 0?n in r?t.value[n]=void 0:t.value[n]=e.value:t.issues.push(...vo(n,e.issues)):e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}const IF=Q("$ZodObject",(e,t)=>{qe.init(e,t);const n=F1(()=>{const p=Object.keys(t.shape);for(const g of p)if(!(t.shape[g]instanceof qe))throw new Error(`Invalid element at key "${g}": expected a Zod schema`);const m=Gj(t.shape);return{shape:t.shape,keys:p,keySet:new Set(p),numKeys:p.length,optionalKeys:new Set(m)}});Xe(e._zod,"propValues",()=>{const p=t.shape,m={};for(const g in p){const w=p[g]._zod;if(w.values){m[g]??(m[g]=new Set);for(const x of w.values)m[g].add(x)}}return m});const r=p=>{const m=new YP(["shape","payload","ctx"]),g=n.value,w=y=>{const v=ss(y);return`shape[${v}]._zod.run({ value: input[${v}], issues: [] }, ctx)`};m.write("const input = payload.value;");const x=Object.create(null);let k=0;for(const y of g.keys)x[y]=`key_${k++}`;m.write("const newResult = {}");for(const y of g.keys)if(g.optionalKeys.has(y)){const v=x[y];m.write(`const ${v} = ${w(y)};`);const S=ss(y);m.write(`
137
137
  if (${v}.issues.length) {
138
138
  if (input[${S}] === undefined) {
139
139
  if (${S} in input) {
@@ -156,11 +156,11 @@ Check that all your Remotion packages are on the same version. If your dependenc
156
156
  if (${v}.issues.length) payload.issues = payload.issues.concat(${v}.issues.map(iss => ({
157
157
  ...iss,
158
158
  path: iss.path ? [${ss(y)}, ...iss.path] : [${ss(y)}]
159
- })));`),m.write(`newResult[${ss(y)}] = ${v}.value`)}m.write("payload.value = newResult;"),m.write("return payload;");const h=m.compile();return(y,v)=>h(p,y,v)};let o;const i=Cf,s=!E1.jitless,l=s&&Wj.value,c=t.catchall;let f;e._zod.parse=(p,m)=>{f??(f=n.value);const g=p.value;if(!i(g))return p.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),p;const w=[];if(s&&l&&(m==null?void 0:m.async)===!1&&m.jitless!==!0)o||(o=r(t.shape)),p=o(p,m);else{p.value={};const v=f.shape;for(const S of f.keys){const b=v[S],E=b._zod.run({value:g[S],issues:[]},m),I=b._zod.optin==="optional"&&b._zod.optout==="optional";E instanceof Promise?w.push(E.then(T=>I?Rg(T,p,S,g):Ha(T,p,S))):I?Rg(E,p,S,g):Ha(E,p,S)}}if(!c)return w.length?Promise.all(w).then(()=>p):p;const x=[],k=f.keySet,h=c._zod,y=h.def.type;for(const v of Object.keys(g)){if(k.has(v))continue;if(y==="never"){x.push(v);continue}const S=h.run({value:g[v],issues:[]},m);S instanceof Promise?w.push(S.then(b=>Ha(b,p,v))):Ha(S,p,v)}return x.length&&p.issues.push({code:"unrecognized_keys",keys:x,input:g,inst:e}),w.length?Promise.all(w).then(()=>p):p}});function jg(e,t,n,r){for(const o of e)if(o.issues.length===0)return t.value=o.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(o=>o.issues.map(i=>eo(i,r,Qr())))}),t}const SF=Q("$ZodUnion",(e,t)=>{qe.init(e,t),Xe(e._zod,"optin",()=>t.options.some(n=>n._zod.optin==="optional")?"optional":void 0),Xe(e._zod,"optout",()=>t.options.some(n=>n._zod.optout==="optional")?"optional":void 0),Xe(e._zod,"values",()=>{if(t.options.every(n=>n._zod.values))return new Set(t.options.flatMap(n=>Array.from(n._zod.values)))}),Xe(e._zod,"pattern",()=>{if(t.options.every(n=>n._zod.pattern)){const n=t.options.map(r=>r._zod.pattern);return new RegExp(`^(${n.map(r=>ah(r.source)).join("|")})$`)}}),e._zod.parse=(n,r)=>{let o=!1;const i=[];for(const s of t.options){const a=s._zod.run({value:n.value,issues:[]},r);if(a instanceof Promise)i.push(a),o=!0;else{if(a.issues.length===0)return a;i.push(a)}}return o?Promise.all(i).then(s=>jg(s,n,e,r)):jg(i,n,e,r)}}),kF=Q("$ZodIntersection",(e,t)=>{qe.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,i=t.left._zod.run({value:o,issues:[]},r),s=t.right._zod.run({value:o,issues:[]},r);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([l,c])=>Pg(n,l,c)):Pg(n,i,s)}});function If(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(ql(e)&&ql(t)){const n=Object.keys(t),r=Object.keys(e).filter(i=>n.indexOf(i)!==-1),o={...e,...t};for(const i of r){const s=If(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const o=e[r],i=t[r],s=If(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[r,...s.mergeErrorPath]};n.push(s.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Pg(e,t,n){if(t.issues.length&&e.issues.push(...t.issues),n.issues.length&&e.issues.push(...n.issues),Es(e))return e;const r=If(t.value,n.value);if(!r.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(r.mergeErrorPath)}`);return e.value=r.data,e}const EF=Q("$ZodRecord",(e,t)=>{qe.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!ql(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const i=[];if(t.keyType._zod.values){const s=t.keyType._zod.values;n.value={};for(const l of s)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){const c=t.valueType._zod.run({value:o[l],issues:[]},r);c instanceof Promise?i.push(c.then(f=>{f.issues.length&&n.issues.push(...yo(l,f.issues)),n.value[l]=f.value})):(c.issues.length&&n.issues.push(...yo(l,c.issues)),n.value[l]=c.value)}let a;for(const l in o)s.has(l)||(a=a??[],a.push(l));a&&a.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:a})}else{n.value={};for(const s of Reflect.ownKeys(o)){if(s==="__proto__")continue;const a=t.keyType._zod.run({value:s,issues:[]},r);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(a.issues.length){n.issues.push({origin:"record",code:"invalid_key",issues:a.issues.map(c=>eo(c,r,Qr())),input:s,path:[s],inst:e}),n.value[a.value]=a.value;continue}const l=t.valueType._zod.run({value:o[s],issues:[]},r);l instanceof Promise?i.push(l.then(c=>{c.issues.length&&n.issues.push(...yo(s,c.issues)),n.value[a.value]=c.value})):(l.issues.length&&n.issues.push(...yo(s,l.issues)),n.value[a.value]=l.value)}}return i.length?Promise.all(i).then(()=>n):n}}),CF=Q("$ZodEnum",(e,t)=>{qe.init(e,t);const n=C1(t.entries);e._zod.values=new Set(n),e._zod.pattern=new RegExp(`^(${n.filter(r=>Vj.has(typeof r)).map(r=>typeof r=="string"?pa(r):r.toString()).join("|")})$`),e._zod.parse=(r,o)=>{const i=r.value;return e._zod.values.has(i)||r.issues.push({code:"invalid_value",values:n,input:i,inst:e}),r}}),IF=Q("$ZodLiteral",(e,t)=>{qe.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map(n=>typeof n=="string"?pa(n):n?n.toString():String(n)).join("|")})$`),e._zod.parse=(n,r)=>{const o=n.value;return e._zod.values.has(o)||n.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),n}}),TF=Q("$ZodTransform",(e,t)=>{qe.init(e,t),e._zod.parse=(n,r)=>{const o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(s=>(n.value=s,n));if(o instanceof Promise)throw new Zs;return n.value=o,n}}),RF=Q("$ZodOptional",(e,t)=>{qe.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Xe(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Xe(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${ah(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>t.innerType._zod.optin==="optional"?t.innerType._zod.run(n,r):n.value===void 0?n:t.innerType._zod.run(n,r)}),jF=Q("$ZodNullable",(e,t)=>{qe.init(e,t),Xe(e._zod,"optin",()=>t.innerType._zod.optin),Xe(e._zod,"optout",()=>t.innerType._zod.optout),Xe(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${ah(n.source)}|null)$`):void 0}),Xe(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),PF=Q("$ZodDefault",(e,t)=>{qe.init(e,t),e._zod.optin="optional",Xe(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>Fg(i,t)):Fg(o,t)}});function Fg(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const FF=Q("$ZodPrefault",(e,t)=>{qe.init(e,t),e._zod.optin="optional",Xe(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),_F=Q("$ZodNonOptional",(e,t)=>{qe.init(e,t),Xe(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>_g(i,e)):_g(o,e)}});function _g(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const MF=Q("$ZodCatch",(e,t)=>{qe.init(e,t),e._zod.optin="optional",Xe(e._zod,"optout",()=>t.innerType._zod.optout),Xe(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>(n.value=i.value,i.issues.length&&(n.value=t.catchValue({...n,error:{issues:i.issues.map(s=>eo(s,r,Qr()))},input:n.value}),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(i=>eo(i,r,Qr()))},input:n.value}),n.issues=[]),n)}}),$F=Q("$ZodPipe",(e,t)=>{qe.init(e,t),Xe(e._zod,"values",()=>t.in._zod.values),Xe(e._zod,"optin",()=>t.in._zod.optin),Xe(e._zod,"optout",()=>t.out._zod.optout),e._zod.parse=(n,r)=>{const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(i=>Mg(i,t,r)):Mg(o,t,r)}});function Mg(e,t,n){return Es(e)?e:t.out._zod.run({value:e.value,issues:e.issues},n)}const AF=Q("$ZodReadonly",(e,t)=>{qe.init(e,t),Xe(e._zod,"propValues",()=>t.innerType._zod.propValues),Xe(e._zod,"values",()=>t.innerType._zod.values),Xe(e._zod,"optin",()=>t.innerType._zod.optin),Xe(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then($g):$g(o)}});function $g(e){return e.value=Object.freeze(e.value),e}const NF=Q("$ZodCustom",(e,t)=>{nn.init(e,t),qe.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(i=>Ag(i,n,r,e));Ag(o,n,r,e)}});function Ag(e,t,n,r){if(!e){const o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(Ks(o))}}class B1{constructor(){this._map=new Map,this._idmap=new Map}add(t,...n){const r=n[0];if(this._map.set(t,r),r&&typeof r=="object"&&"id"in r){if(this._idmap.has(r.id))throw new Error(`ID ${r.id} already exists in the registry`);this._idmap.set(r.id,t)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};return delete r.id,{...r,...this._map.get(t)}}return this._map.get(t)}has(t){return this._map.has(t)}}function LF(){return new B1}const hs=LF();function zF(e,t){return new e({type:"string",...ye(t)})}function DF(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...ye(t)})}function Ng(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...ye(t)})}function OF(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...ye(t)})}function BF(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ye(t)})}function WF(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ye(t)})}function VF(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ye(t)})}function HF(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...ye(t)})}function UF(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...ye(t)})}function ZF(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...ye(t)})}function KF(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...ye(t)})}function YF(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...ye(t)})}function GF(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...ye(t)})}function XF(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...ye(t)})}function qF(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...ye(t)})}function JF(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...ye(t)})}function QF(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...ye(t)})}function e_(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ye(t)})}function t_(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ye(t)})}function n_(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...ye(t)})}function r_(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...ye(t)})}function o_(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...ye(t)})}function i_(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...ye(t)})}function s_(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ye(t)})}function a_(e,t){return new e({type:"string",format:"date",check:"string_format",...ye(t)})}function l_(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...ye(t)})}function u_(e,t){return new e({type:"string",format:"duration",check:"string_format",...ye(t)})}function c_(e,t){return new e({type:"number",checks:[],...ye(t)})}function d_(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...ye(t)})}function f_(e,t){return new e({type:"boolean",...ye(t)})}function p_(e){return new e({type:"unknown"})}function h_(e,t){return new e({type:"never",...ye(t)})}function Lg(e,t){return new L1({check:"less_than",...ye(t),value:e,inclusive:!1})}function Uc(e,t){return new L1({check:"less_than",...ye(t),value:e,inclusive:!0})}function zg(e,t){return new z1({check:"greater_than",...ye(t),value:e,inclusive:!1})}function Zc(e,t){return new z1({check:"greater_than",...ye(t),value:e,inclusive:!0})}function Dg(e,t){return new FP({check:"multiple_of",...ye(t),value:e})}function W1(e,t){return new MP({check:"max_length",...ye(t),maximum:e})}function Jl(e,t){return new $P({check:"min_length",...ye(t),minimum:e})}function V1(e,t){return new AP({check:"length_equals",...ye(t),length:e})}function m_(e,t){return new NP({check:"string_format",format:"regex",...ye(t),pattern:e})}function g_(e){return new LP({check:"string_format",format:"lowercase",...ye(e)})}function y_(e){return new zP({check:"string_format",format:"uppercase",...ye(e)})}function v_(e,t){return new DP({check:"string_format",format:"includes",...ye(t),includes:e})}function w_(e,t){return new OP({check:"string_format",format:"starts_with",...ye(t),prefix:e})}function x_(e,t){return new BP({check:"string_format",format:"ends_with",...ye(t),suffix:e})}function ha(e){return new WP({check:"overwrite",tx:e})}function b_(e){return ha(t=>t.normalize(e))}function S_(){return ha(e=>e.trim())}function k_(){return ha(e=>e.toLowerCase())}function E_(){return ha(e=>e.toUpperCase())}function C_(e,t,n){return new e({type:"array",element:t,...ye(n)})}function I_(e,t,n){return new e({type:"custom",check:"custom",fn:t,...ye(n)})}class Og{constructor(t){this.counter=0,this.metadataRegistry=(t==null?void 0:t.metadata)??hs,this.target=(t==null?void 0:t.target)??"draft-2020-12",this.unrepresentable=(t==null?void 0:t.unrepresentable)??"throw",this.override=(t==null?void 0:t.override)??(()=>{}),this.io=(t==null?void 0:t.io)??"output",this.seen=new Map}process(t,n={path:[],schemaPath:[]}){var p,m,g;var r;const o=t._zod.def,i={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},s=this.seen.get(t);if(s)return s.count++,n.schemaPath.includes(t)&&(s.cycle=n.path),s.schema;const a={schema:{},count:1,cycle:void 0,path:n.path};this.seen.set(t,a);const l=(m=(p=t._zod).toJSONSchema)==null?void 0:m.call(p);if(l)a.schema=l;else{const w={...n,schemaPath:[...n.schemaPath,t],path:n.path},x=t._zod.parent;if(x)a.ref=x,this.process(x,w),this.seen.get(x).isParent=!0;else{const k=a.schema;switch(o.type){case"string":{const h=k;h.type="string";const{minimum:y,maximum:v,format:S,patterns:b,contentEncoding:E}=t._zod.bag;if(typeof y=="number"&&(h.minLength=y),typeof v=="number"&&(h.maxLength=v),S&&(h.format=i[S]??S,h.format===""&&delete h.format),E&&(h.contentEncoding=E),b&&b.size>0){const I=[...b];I.length===1?h.pattern=I[0].source:I.length>1&&(a.schema.allOf=[...I.map(T=>({...this.target==="draft-7"?{type:"string"}:{},pattern:T.source}))])}break}case"number":{const h=k,{minimum:y,maximum:v,format:S,multipleOf:b,exclusiveMaximum:E,exclusiveMinimum:I}=t._zod.bag;typeof S=="string"&&S.includes("int")?h.type="integer":h.type="number",typeof I=="number"&&(h.exclusiveMinimum=I),typeof y=="number"&&(h.minimum=y,typeof I=="number"&&(I>=y?delete h.minimum:delete h.exclusiveMinimum)),typeof E=="number"&&(h.exclusiveMaximum=E),typeof v=="number"&&(h.maximum=v,typeof E=="number"&&(E<=v?delete h.maximum:delete h.exclusiveMaximum)),typeof b=="number"&&(h.multipleOf=b);break}case"boolean":{const h=k;h.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema");break}case"null":{k.type="null";break}case"any":break;case"unknown":break;case"undefined":{if(this.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema");break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"never":{k.not={};break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{const h=k,{minimum:y,maximum:v}=t._zod.bag;typeof y=="number"&&(h.minItems=y),typeof v=="number"&&(h.maxItems=v),h.type="array",h.items=this.process(o.element,{...w,path:[...w.path,"items"]});break}case"object":{const h=k;h.type="object",h.properties={};const y=o.shape;for(const b in y)h.properties[b]=this.process(y[b],{...w,path:[...w.path,"properties",b]});const v=new Set(Object.keys(y)),S=new Set([...v].filter(b=>{const E=o.shape[b]._zod;return this.io==="input"?E.optin===void 0:E.optout===void 0}));S.size>0&&(h.required=Array.from(S)),((g=o.catchall)==null?void 0:g._zod.def.type)==="never"?h.additionalProperties=!1:o.catchall?o.catchall&&(h.additionalProperties=this.process(o.catchall,{...w,path:[...w.path,"additionalProperties"]})):this.io==="output"&&(h.additionalProperties=!1);break}case"union":{const h=k;h.anyOf=o.options.map((y,v)=>this.process(y,{...w,path:[...w.path,"anyOf",v]}));break}case"intersection":{const h=k,y=this.process(o.left,{...w,path:[...w.path,"allOf",0]}),v=this.process(o.right,{...w,path:[...w.path,"allOf",1]}),S=E=>"allOf"in E&&Object.keys(E).length===1,b=[...S(y)?y.allOf:[y],...S(v)?v.allOf:[v]];h.allOf=b;break}case"tuple":{const h=k;h.type="array";const y=o.items.map((b,E)=>this.process(b,{...w,path:[...w.path,"prefixItems",E]}));if(this.target==="draft-2020-12"?h.prefixItems=y:h.items=y,o.rest){const b=this.process(o.rest,{...w,path:[...w.path,"items"]});this.target==="draft-2020-12"?h.items=b:h.additionalItems=b}o.rest&&(h.items=this.process(o.rest,{...w,path:[...w.path,"items"]}));const{minimum:v,maximum:S}=t._zod.bag;typeof v=="number"&&(h.minItems=v),typeof S=="number"&&(h.maxItems=S);break}case"record":{const h=k;h.type="object",h.propertyNames=this.process(o.keyType,{...w,path:[...w.path,"propertyNames"]}),h.additionalProperties=this.process(o.valueType,{...w,path:[...w.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema");break}case"enum":{const h=k,y=C1(o.entries);y.every(v=>typeof v=="number")&&(h.type="number"),y.every(v=>typeof v=="string")&&(h.type="string"),h.enum=y;break}case"literal":{const h=k,y=[];for(const v of o.values)if(v===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof v=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");y.push(Number(v))}else y.push(v);if(y.length!==0)if(y.length===1){const v=y[0];h.type=v===null?"null":typeof v,h.const=v}else y.every(v=>typeof v=="number")&&(h.type="number"),y.every(v=>typeof v=="string")&&(h.type="string"),y.every(v=>typeof v=="boolean")&&(h.type="string"),y.every(v=>v===null)&&(h.type="null"),h.enum=y;break}case"file":{const h=k,y={type:"string",format:"binary",contentEncoding:"binary"},{minimum:v,maximum:S,mime:b}=t._zod.bag;v!==void 0&&(y.minLength=v),S!==void 0&&(y.maxLength=S),b?b.length===1?(y.contentMediaType=b[0],Object.assign(h,y)):h.anyOf=b.map(E=>({...y,contentMediaType:E})):Object.assign(h,y);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{const h=this.process(o.innerType,w);k.anyOf=[h,{type:"null"}];break}case"nonoptional":{this.process(o.innerType,w),a.ref=o.innerType;break}case"success":{const h=k;h.type="boolean";break}case"default":{this.process(o.innerType,w),a.ref=o.innerType,k.default=JSON.parse(JSON.stringify(o.defaultValue));break}case"prefault":{this.process(o.innerType,w),a.ref=o.innerType,this.io==="input"&&(k._prefault=JSON.parse(JSON.stringify(o.defaultValue)));break}case"catch":{this.process(o.innerType,w),a.ref=o.innerType;let h;try{h=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}k.default=h;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{const h=k,y=t._zod.pattern;if(!y)throw new Error("Pattern not found in template literal");h.type="string",h.pattern=y.source;break}case"pipe":{const h=this.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;this.process(h,w),a.ref=h;break}case"readonly":{this.process(o.innerType,w),a.ref=o.innerType,k.readOnly=!0;break}case"promise":{this.process(o.innerType,w),a.ref=o.innerType;break}case"optional":{this.process(o.innerType,w),a.ref=o.innerType;break}case"lazy":{const h=t._zod.innerType;this.process(h,w),a.ref=h;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}}}}const c=this.metadataRegistry.get(t);return c&&Object.assign(a.schema,c),this.io==="input"&&gt(t)&&(delete a.schema.examples,delete a.schema.default),this.io==="input"&&a.schema._prefault&&((r=a.schema).default??(r.default=a.schema._prefault)),delete a.schema._prefault,this.seen.get(t).schema}emit(t,n){var f,p,m,g,w,x;const r={cycles:(n==null?void 0:n.cycles)??"ref",reused:(n==null?void 0:n.reused)??"inline",external:(n==null?void 0:n.external)??void 0},o=this.seen.get(t);if(!o)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=k=>{var b;const h=this.target==="draft-2020-12"?"$defs":"definitions";if(r.external){const E=(b=r.external.registry.get(k[0]))==null?void 0:b.id,I=r.external.uri??(R=>R);if(E)return{ref:I(E)};const T=k[1].defId??k[1].schema.id??`schema${this.counter++}`;return k[1].defId=T,{defId:T,ref:`${I("__shared")}#/${h}/${T}`}}if(k[1]===o)return{ref:"#"};const v=`#/${h}/`,S=k[1].schema.id??`__schema${this.counter++}`;return{defId:S,ref:v+S}},s=k=>{if(k[1].schema.$ref)return;const h=k[1],{ref:y,defId:v}=i(k);h.def={...h.schema},v&&(h.defId=v);const S=h.schema;for(const b in S)delete S[b];S.$ref=y};if(r.cycles==="throw")for(const k of this.seen.entries()){const h=k[1];if(h.cycle)throw new Error(`Cycle detected: #/${(f=h.cycle)==null?void 0:f.join("/")}/<root>
159
+ })));`),m.write(`newResult[${ss(y)}] = ${v}.value`)}m.write("payload.value = newResult;"),m.write("return payload;");const h=m.compile();return(y,v)=>h(p,y,v)};let o;const i=Tf,s=!j1.jitless,l=s&&Kj.value,c=t.catchall;let f;e._zod.parse=(p,m)=>{f??(f=n.value);const g=p.value;if(!i(g))return p.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),p;const w=[];if(s&&l&&(m==null?void 0:m.async)===!1&&m.jitless!==!0)o||(o=r(t.shape)),p=o(p,m);else{p.value={};const v=f.shape;for(const S of f.keys){const b=v[S],E=b._zod.run({value:g[S],issues:[]},m),I=b._zod.optin==="optional"&&b._zod.optout==="optional";E instanceof Promise?w.push(E.then(T=>I?Fg(T,p,S,g):Ha(T,p,S))):I?Fg(E,p,S,g):Ha(E,p,S)}}if(!c)return w.length?Promise.all(w).then(()=>p):p;const x=[],k=f.keySet,h=c._zod,y=h.def.type;for(const v of Object.keys(g)){if(k.has(v))continue;if(y==="never"){x.push(v);continue}const S=h.run({value:g[v],issues:[]},m);S instanceof Promise?w.push(S.then(b=>Ha(b,p,v))):Ha(S,p,v)}return x.length&&p.issues.push({code:"unrecognized_keys",keys:x,input:g,inst:e}),w.length?Promise.all(w).then(()=>p):p}});function _g(e,t,n,r){for(const o of e)if(o.issues.length===0)return t.value=o.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(o=>o.issues.map(i=>eo(i,r,Qr())))}),t}const TF=Q("$ZodUnion",(e,t)=>{qe.init(e,t),Xe(e._zod,"optin",()=>t.options.some(n=>n._zod.optin==="optional")?"optional":void 0),Xe(e._zod,"optout",()=>t.options.some(n=>n._zod.optout==="optional")?"optional":void 0),Xe(e._zod,"values",()=>{if(t.options.every(n=>n._zod.values))return new Set(t.options.flatMap(n=>Array.from(n._zod.values)))}),Xe(e._zod,"pattern",()=>{if(t.options.every(n=>n._zod.pattern)){const n=t.options.map(r=>r._zod.pattern);return new RegExp(`^(${n.map(r=>uh(r.source)).join("|")})$`)}}),e._zod.parse=(n,r)=>{let o=!1;const i=[];for(const s of t.options){const a=s._zod.run({value:n.value,issues:[]},r);if(a instanceof Promise)i.push(a),o=!0;else{if(a.issues.length===0)return a;i.push(a)}}return o?Promise.all(i).then(s=>_g(s,n,e,r)):_g(i,n,e,r)}}),RF=Q("$ZodIntersection",(e,t)=>{qe.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,i=t.left._zod.run({value:o,issues:[]},r),s=t.right._zod.run({value:o,issues:[]},r);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([l,c])=>Mg(n,l,c)):Mg(n,i,s)}});function Rf(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Jl(e)&&Jl(t)){const n=Object.keys(t),r=Object.keys(e).filter(i=>n.indexOf(i)!==-1),o={...e,...t};for(const i of r){const s=Rf(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const o=e[r],i=t[r],s=Rf(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[r,...s.mergeErrorPath]};n.push(s.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Mg(e,t,n){if(t.issues.length&&e.issues.push(...t.issues),n.issues.length&&e.issues.push(...n.issues),Es(e))return e;const r=Rf(t.value,n.value);if(!r.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(r.mergeErrorPath)}`);return e.value=r.data,e}const jF=Q("$ZodRecord",(e,t)=>{qe.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Jl(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const i=[];if(t.keyType._zod.values){const s=t.keyType._zod.values;n.value={};for(const l of s)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){const c=t.valueType._zod.run({value:o[l],issues:[]},r);c instanceof Promise?i.push(c.then(f=>{f.issues.length&&n.issues.push(...vo(l,f.issues)),n.value[l]=f.value})):(c.issues.length&&n.issues.push(...vo(l,c.issues)),n.value[l]=c.value)}let a;for(const l in o)s.has(l)||(a=a??[],a.push(l));a&&a.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:a})}else{n.value={};for(const s of Reflect.ownKeys(o)){if(s==="__proto__")continue;const a=t.keyType._zod.run({value:s,issues:[]},r);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(a.issues.length){n.issues.push({origin:"record",code:"invalid_key",issues:a.issues.map(c=>eo(c,r,Qr())),input:s,path:[s],inst:e}),n.value[a.value]=a.value;continue}const l=t.valueType._zod.run({value:o[s],issues:[]},r);l instanceof Promise?i.push(l.then(c=>{c.issues.length&&n.issues.push(...vo(s,c.issues)),n.value[a.value]=c.value})):(l.issues.length&&n.issues.push(...vo(s,l.issues)),n.value[a.value]=l.value)}}return i.length?Promise.all(i).then(()=>n):n}}),PF=Q("$ZodEnum",(e,t)=>{qe.init(e,t);const n=P1(t.entries);e._zod.values=new Set(n),e._zod.pattern=new RegExp(`^(${n.filter(r=>Yj.has(typeof r)).map(r=>typeof r=="string"?pa(r):r.toString()).join("|")})$`),e._zod.parse=(r,o)=>{const i=r.value;return e._zod.values.has(i)||r.issues.push({code:"invalid_value",values:n,input:i,inst:e}),r}}),FF=Q("$ZodLiteral",(e,t)=>{qe.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map(n=>typeof n=="string"?pa(n):n?n.toString():String(n)).join("|")})$`),e._zod.parse=(n,r)=>{const o=n.value;return e._zod.values.has(o)||n.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),n}}),_F=Q("$ZodTransform",(e,t)=>{qe.init(e,t),e._zod.parse=(n,r)=>{const o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(s=>(n.value=s,n));if(o instanceof Promise)throw new Zs;return n.value=o,n}}),MF=Q("$ZodOptional",(e,t)=>{qe.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Xe(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Xe(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${uh(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>t.innerType._zod.optin==="optional"?t.innerType._zod.run(n,r):n.value===void 0?n:t.innerType._zod.run(n,r)}),$F=Q("$ZodNullable",(e,t)=>{qe.init(e,t),Xe(e._zod,"optin",()=>t.innerType._zod.optin),Xe(e._zod,"optout",()=>t.innerType._zod.optout),Xe(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${uh(n.source)}|null)$`):void 0}),Xe(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),AF=Q("$ZodDefault",(e,t)=>{qe.init(e,t),e._zod.optin="optional",Xe(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>$g(i,t)):$g(o,t)}});function $g(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const NF=Q("$ZodPrefault",(e,t)=>{qe.init(e,t),e._zod.optin="optional",Xe(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),LF=Q("$ZodNonOptional",(e,t)=>{qe.init(e,t),Xe(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>Ag(i,e)):Ag(o,e)}});function Ag(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const zF=Q("$ZodCatch",(e,t)=>{qe.init(e,t),e._zod.optin="optional",Xe(e._zod,"optout",()=>t.innerType._zod.optout),Xe(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>(n.value=i.value,i.issues.length&&(n.value=t.catchValue({...n,error:{issues:i.issues.map(s=>eo(s,r,Qr()))},input:n.value}),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(i=>eo(i,r,Qr()))},input:n.value}),n.issues=[]),n)}}),DF=Q("$ZodPipe",(e,t)=>{qe.init(e,t),Xe(e._zod,"values",()=>t.in._zod.values),Xe(e._zod,"optin",()=>t.in._zod.optin),Xe(e._zod,"optout",()=>t.out._zod.optout),e._zod.parse=(n,r)=>{const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(i=>Ng(i,t,r)):Ng(o,t,r)}});function Ng(e,t,n){return Es(e)?e:t.out._zod.run({value:e.value,issues:e.issues},n)}const OF=Q("$ZodReadonly",(e,t)=>{qe.init(e,t),Xe(e._zod,"propValues",()=>t.innerType._zod.propValues),Xe(e._zod,"values",()=>t.innerType._zod.values),Xe(e._zod,"optin",()=>t.innerType._zod.optin),Xe(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(Lg):Lg(o)}});function Lg(e){return e.value=Object.freeze(e.value),e}const BF=Q("$ZodCustom",(e,t)=>{nn.init(e,t),qe.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(i=>zg(i,n,r,e));zg(o,n,r,e)}});function zg(e,t,n,r){if(!e){const o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(Ks(o))}}class Z1{constructor(){this._map=new Map,this._idmap=new Map}add(t,...n){const r=n[0];if(this._map.set(t,r),r&&typeof r=="object"&&"id"in r){if(this._idmap.has(r.id))throw new Error(`ID ${r.id} already exists in the registry`);this._idmap.set(r.id,t)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};return delete r.id,{...r,...this._map.get(t)}}return this._map.get(t)}has(t){return this._map.has(t)}}function WF(){return new Z1}const hs=WF();function VF(e,t){return new e({type:"string",...ye(t)})}function HF(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...ye(t)})}function Dg(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...ye(t)})}function UF(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...ye(t)})}function ZF(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ye(t)})}function KF(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ye(t)})}function YF(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ye(t)})}function GF(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...ye(t)})}function XF(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...ye(t)})}function qF(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...ye(t)})}function JF(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...ye(t)})}function QF(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...ye(t)})}function e_(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...ye(t)})}function t_(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...ye(t)})}function n_(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...ye(t)})}function r_(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...ye(t)})}function o_(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...ye(t)})}function i_(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ye(t)})}function s_(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ye(t)})}function a_(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...ye(t)})}function l_(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...ye(t)})}function u_(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...ye(t)})}function c_(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...ye(t)})}function d_(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ye(t)})}function f_(e,t){return new e({type:"string",format:"date",check:"string_format",...ye(t)})}function p_(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...ye(t)})}function h_(e,t){return new e({type:"string",format:"duration",check:"string_format",...ye(t)})}function m_(e,t){return new e({type:"number",checks:[],...ye(t)})}function g_(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...ye(t)})}function y_(e,t){return new e({type:"boolean",...ye(t)})}function v_(e){return new e({type:"unknown"})}function w_(e,t){return new e({type:"never",...ye(t)})}function Og(e,t){return new W1({check:"less_than",...ye(t),value:e,inclusive:!1})}function Yc(e,t){return new W1({check:"less_than",...ye(t),value:e,inclusive:!0})}function Bg(e,t){return new V1({check:"greater_than",...ye(t),value:e,inclusive:!1})}function Gc(e,t){return new V1({check:"greater_than",...ye(t),value:e,inclusive:!0})}function Wg(e,t){return new NP({check:"multiple_of",...ye(t),value:e})}function K1(e,t){return new zP({check:"max_length",...ye(t),maximum:e})}function Ql(e,t){return new DP({check:"min_length",...ye(t),minimum:e})}function Y1(e,t){return new OP({check:"length_equals",...ye(t),length:e})}function x_(e,t){return new BP({check:"string_format",format:"regex",...ye(t),pattern:e})}function b_(e){return new WP({check:"string_format",format:"lowercase",...ye(e)})}function S_(e){return new VP({check:"string_format",format:"uppercase",...ye(e)})}function k_(e,t){return new HP({check:"string_format",format:"includes",...ye(t),includes:e})}function E_(e,t){return new UP({check:"string_format",format:"starts_with",...ye(t),prefix:e})}function C_(e,t){return new ZP({check:"string_format",format:"ends_with",...ye(t),suffix:e})}function ha(e){return new KP({check:"overwrite",tx:e})}function I_(e){return ha(t=>t.normalize(e))}function T_(){return ha(e=>e.trim())}function R_(){return ha(e=>e.toLowerCase())}function j_(){return ha(e=>e.toUpperCase())}function P_(e,t,n){return new e({type:"array",element:t,...ye(n)})}function F_(e,t,n){return new e({type:"custom",check:"custom",fn:t,...ye(n)})}class Vg{constructor(t){this.counter=0,this.metadataRegistry=(t==null?void 0:t.metadata)??hs,this.target=(t==null?void 0:t.target)??"draft-2020-12",this.unrepresentable=(t==null?void 0:t.unrepresentable)??"throw",this.override=(t==null?void 0:t.override)??(()=>{}),this.io=(t==null?void 0:t.io)??"output",this.seen=new Map}process(t,n={path:[],schemaPath:[]}){var p,m,g;var r;const o=t._zod.def,i={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},s=this.seen.get(t);if(s)return s.count++,n.schemaPath.includes(t)&&(s.cycle=n.path),s.schema;const a={schema:{},count:1,cycle:void 0,path:n.path};this.seen.set(t,a);const l=(m=(p=t._zod).toJSONSchema)==null?void 0:m.call(p);if(l)a.schema=l;else{const w={...n,schemaPath:[...n.schemaPath,t],path:n.path},x=t._zod.parent;if(x)a.ref=x,this.process(x,w),this.seen.get(x).isParent=!0;else{const k=a.schema;switch(o.type){case"string":{const h=k;h.type="string";const{minimum:y,maximum:v,format:S,patterns:b,contentEncoding:E}=t._zod.bag;if(typeof y=="number"&&(h.minLength=y),typeof v=="number"&&(h.maxLength=v),S&&(h.format=i[S]??S,h.format===""&&delete h.format),E&&(h.contentEncoding=E),b&&b.size>0){const I=[...b];I.length===1?h.pattern=I[0].source:I.length>1&&(a.schema.allOf=[...I.map(T=>({...this.target==="draft-7"?{type:"string"}:{},pattern:T.source}))])}break}case"number":{const h=k,{minimum:y,maximum:v,format:S,multipleOf:b,exclusiveMaximum:E,exclusiveMinimum:I}=t._zod.bag;typeof S=="string"&&S.includes("int")?h.type="integer":h.type="number",typeof I=="number"&&(h.exclusiveMinimum=I),typeof y=="number"&&(h.minimum=y,typeof I=="number"&&(I>=y?delete h.minimum:delete h.exclusiveMinimum)),typeof E=="number"&&(h.exclusiveMaximum=E),typeof v=="number"&&(h.maximum=v,typeof E=="number"&&(E<=v?delete h.maximum:delete h.exclusiveMaximum)),typeof b=="number"&&(h.multipleOf=b);break}case"boolean":{const h=k;h.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema");break}case"null":{k.type="null";break}case"any":break;case"unknown":break;case"undefined":{if(this.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema");break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"never":{k.not={};break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{const h=k,{minimum:y,maximum:v}=t._zod.bag;typeof y=="number"&&(h.minItems=y),typeof v=="number"&&(h.maxItems=v),h.type="array",h.items=this.process(o.element,{...w,path:[...w.path,"items"]});break}case"object":{const h=k;h.type="object",h.properties={};const y=o.shape;for(const b in y)h.properties[b]=this.process(y[b],{...w,path:[...w.path,"properties",b]});const v=new Set(Object.keys(y)),S=new Set([...v].filter(b=>{const E=o.shape[b]._zod;return this.io==="input"?E.optin===void 0:E.optout===void 0}));S.size>0&&(h.required=Array.from(S)),((g=o.catchall)==null?void 0:g._zod.def.type)==="never"?h.additionalProperties=!1:o.catchall?o.catchall&&(h.additionalProperties=this.process(o.catchall,{...w,path:[...w.path,"additionalProperties"]})):this.io==="output"&&(h.additionalProperties=!1);break}case"union":{const h=k;h.anyOf=o.options.map((y,v)=>this.process(y,{...w,path:[...w.path,"anyOf",v]}));break}case"intersection":{const h=k,y=this.process(o.left,{...w,path:[...w.path,"allOf",0]}),v=this.process(o.right,{...w,path:[...w.path,"allOf",1]}),S=E=>"allOf"in E&&Object.keys(E).length===1,b=[...S(y)?y.allOf:[y],...S(v)?v.allOf:[v]];h.allOf=b;break}case"tuple":{const h=k;h.type="array";const y=o.items.map((b,E)=>this.process(b,{...w,path:[...w.path,"prefixItems",E]}));if(this.target==="draft-2020-12"?h.prefixItems=y:h.items=y,o.rest){const b=this.process(o.rest,{...w,path:[...w.path,"items"]});this.target==="draft-2020-12"?h.items=b:h.additionalItems=b}o.rest&&(h.items=this.process(o.rest,{...w,path:[...w.path,"items"]}));const{minimum:v,maximum:S}=t._zod.bag;typeof v=="number"&&(h.minItems=v),typeof S=="number"&&(h.maxItems=S);break}case"record":{const h=k;h.type="object",h.propertyNames=this.process(o.keyType,{...w,path:[...w.path,"propertyNames"]}),h.additionalProperties=this.process(o.valueType,{...w,path:[...w.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema");break}case"enum":{const h=k,y=P1(o.entries);y.every(v=>typeof v=="number")&&(h.type="number"),y.every(v=>typeof v=="string")&&(h.type="string"),h.enum=y;break}case"literal":{const h=k,y=[];for(const v of o.values)if(v===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof v=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");y.push(Number(v))}else y.push(v);if(y.length!==0)if(y.length===1){const v=y[0];h.type=v===null?"null":typeof v,h.const=v}else y.every(v=>typeof v=="number")&&(h.type="number"),y.every(v=>typeof v=="string")&&(h.type="string"),y.every(v=>typeof v=="boolean")&&(h.type="string"),y.every(v=>v===null)&&(h.type="null"),h.enum=y;break}case"file":{const h=k,y={type:"string",format:"binary",contentEncoding:"binary"},{minimum:v,maximum:S,mime:b}=t._zod.bag;v!==void 0&&(y.minLength=v),S!==void 0&&(y.maxLength=S),b?b.length===1?(y.contentMediaType=b[0],Object.assign(h,y)):h.anyOf=b.map(E=>({...y,contentMediaType:E})):Object.assign(h,y);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{const h=this.process(o.innerType,w);k.anyOf=[h,{type:"null"}];break}case"nonoptional":{this.process(o.innerType,w),a.ref=o.innerType;break}case"success":{const h=k;h.type="boolean";break}case"default":{this.process(o.innerType,w),a.ref=o.innerType,k.default=JSON.parse(JSON.stringify(o.defaultValue));break}case"prefault":{this.process(o.innerType,w),a.ref=o.innerType,this.io==="input"&&(k._prefault=JSON.parse(JSON.stringify(o.defaultValue)));break}case"catch":{this.process(o.innerType,w),a.ref=o.innerType;let h;try{h=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}k.default=h;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{const h=k,y=t._zod.pattern;if(!y)throw new Error("Pattern not found in template literal");h.type="string",h.pattern=y.source;break}case"pipe":{const h=this.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;this.process(h,w),a.ref=h;break}case"readonly":{this.process(o.innerType,w),a.ref=o.innerType,k.readOnly=!0;break}case"promise":{this.process(o.innerType,w),a.ref=o.innerType;break}case"optional":{this.process(o.innerType,w),a.ref=o.innerType;break}case"lazy":{const h=t._zod.innerType;this.process(h,w),a.ref=h;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}}}}const c=this.metadataRegistry.get(t);return c&&Object.assign(a.schema,c),this.io==="input"&&gt(t)&&(delete a.schema.examples,delete a.schema.default),this.io==="input"&&a.schema._prefault&&((r=a.schema).default??(r.default=a.schema._prefault)),delete a.schema._prefault,this.seen.get(t).schema}emit(t,n){var f,p,m,g,w,x;const r={cycles:(n==null?void 0:n.cycles)??"ref",reused:(n==null?void 0:n.reused)??"inline",external:(n==null?void 0:n.external)??void 0},o=this.seen.get(t);if(!o)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=k=>{var b;const h=this.target==="draft-2020-12"?"$defs":"definitions";if(r.external){const E=(b=r.external.registry.get(k[0]))==null?void 0:b.id,I=r.external.uri??(j=>j);if(E)return{ref:I(E)};const T=k[1].defId??k[1].schema.id??`schema${this.counter++}`;return k[1].defId=T,{defId:T,ref:`${I("__shared")}#/${h}/${T}`}}if(k[1]===o)return{ref:"#"};const v=`#/${h}/`,S=k[1].schema.id??`__schema${this.counter++}`;return{defId:S,ref:v+S}},s=k=>{if(k[1].schema.$ref)return;const h=k[1],{ref:y,defId:v}=i(k);h.def={...h.schema},v&&(h.defId=v);const S=h.schema;for(const b in S)delete S[b];S.$ref=y};if(r.cycles==="throw")for(const k of this.seen.entries()){const h=k[1];if(h.cycle)throw new Error(`Cycle detected: #/${(f=h.cycle)==null?void 0:f.join("/")}/<root>
160
160
 
161
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const k of this.seen.entries()){const h=k[1];if(t===k[0]){s(k);continue}if(r.external){const v=(p=r.external.registry.get(k[0]))==null?void 0:p.id;if(t!==k[0]&&v){s(k);continue}}if((m=this.metadataRegistry.get(k[0]))==null?void 0:m.id){s(k);continue}if(h.cycle){s(k);continue}if(h.count>1&&r.reused==="ref"){s(k);continue}}const a=(k,h)=>{const y=this.seen.get(k),v=y.def??y.schema,S={...v};if(y.ref===null)return;const b=y.ref;if(y.ref=null,b){a(b,h);const E=this.seen.get(b).schema;E.$ref&&h.target==="draft-7"?(v.allOf=v.allOf??[],v.allOf.push(E)):(Object.assign(v,E),Object.assign(v,S))}y.isParent||this.override({zodSchema:k,jsonSchema:v,path:y.path??[]})};for(const k of[...this.seen.entries()].reverse())a(k[0],{target:this.target});const l={};if(this.target==="draft-2020-12"?l.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?l.$schema="http://json-schema.org/draft-07/schema#":console.warn(`Invalid target: ${this.target}`),(g=r.external)!=null&&g.uri){const k=(w=r.external.registry.get(t))==null?void 0:w.id;if(!k)throw new Error("Schema is missing an `id` property");l.$id=r.external.uri(k)}Object.assign(l,o.def);const c=((x=r.external)==null?void 0:x.defs)??{};for(const k of this.seen.entries()){const h=k[1];h.def&&h.defId&&(c[h.defId]=h.def)}r.external||Object.keys(c).length>0&&(this.target==="draft-2020-12"?l.$defs=c:l.definitions=c);try{return JSON.parse(JSON.stringify(l))}catch{throw new Error("Error converting schema to JSON.")}}}function T_(e,t){if(e instanceof B1){const r=new Og(t),o={};for(const a of e._idmap.entries()){const[l,c]=a;r.process(c)}const i={},s={registry:e,uri:t==null?void 0:t.uri,defs:o};for(const a of e._idmap.entries()){const[l,c]=a;i[l]=r.emit(c,{...t,external:s})}if(Object.keys(o).length>0){const a=r.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[a]:o}}return{schemas:i}}const n=new Og(t);return n.process(e),n.emit(e,t)}function gt(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const o=e._zod.def;switch(o.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return gt(o.element,n);case"object":{for(const i in o.shape)if(gt(o.shape[i],n))return!0;return!1}case"union":{for(const i of o.options)if(gt(i,n))return!0;return!1}case"intersection":return gt(o.left,n)||gt(o.right,n);case"tuple":{for(const i of o.items)if(gt(i,n))return!0;return!!(o.rest&&gt(o.rest,n))}case"record":return gt(o.keyType,n)||gt(o.valueType,n);case"map":return gt(o.keyType,n)||gt(o.valueType,n);case"set":return gt(o.valueType,n);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return gt(o.innerType,n);case"lazy":return gt(o.getter(),n);case"default":return gt(o.innerType,n);case"prefault":return gt(o.innerType,n);case"custom":return!1;case"transform":return!0;case"pipe":return gt(o.in,n)||gt(o.out,n);case"success":return!1;case"catch":return!1}throw new Error(`Unknown schema type: ${o.type}`)}const R_=Q("ZodISODateTime",(e,t)=>{nF.init(e,t),rt.init(e,t)});function j_(e){return s_(R_,e)}const P_=Q("ZodISODate",(e,t)=>{rF.init(e,t),rt.init(e,t)});function F_(e){return a_(P_,e)}const __=Q("ZodISOTime",(e,t)=>{oF.init(e,t),rt.init(e,t)});function M_(e){return l_(__,e)}const $_=Q("ZodISODuration",(e,t)=>{iF.init(e,t),rt.init(e,t)});function A_(e){return u_($_,e)}const N_=(e,t)=>{j1.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>Qj(e,n)},flatten:{value:n=>Jj(e,n)},addIssue:{value:n=>e.issues.push(n)},addIssues:{value:n=>e.issues.push(...n)},isEmpty:{get(){return e.issues.length===0}}})},Ku=Q("ZodError",N_,{Parent:Error}),L_=eP(Ku),z_=tP(Ku),D_=F1(Ku),O_=_1(Ku),lt=Q("ZodType",(e,t)=>(qe.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),e.clone=(n,r)=>No(e,n,r),e.brand=()=>e,e.register=(n,r)=>(n.add(e,r),e),e.parse=(n,r)=>L_(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>D_(e,n,r),e.parseAsync=async(n,r)=>z_(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>O_(e,n,r),e.spa=e.safeParseAsync,e.refine=(n,r)=>e.check(_M(n,r)),e.superRefine=n=>e.check(MM(n)),e.overwrite=n=>e.check(ha(n)),e.optional=()=>Vg(e),e.nullable=()=>Hg(e),e.nullish=()=>Vg(Hg(e)),e.nonoptional=n=>EM(e,n),e.array=()=>at(e),e.or=n=>dh([e,n]),e.and=n=>pM(e,n),e.transform=n=>Ug(e,vM(n)),e.default=n=>bM(e,n),e.prefault=n=>kM(e,n),e.catch=n=>IM(e,n),e.pipe=n=>Ug(e,n),e.readonly=()=>jM(e),e.describe=n=>{const r=e.clone();return hs.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){var n;return(n=hs.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return hs.get(e);const r=e.clone();return hs.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),H1=Q("_ZodString",(e,t)=>{ch.init(e,t),lt.init(e,t);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...r)=>e.check(m_(...r)),e.includes=(...r)=>e.check(v_(...r)),e.startsWith=(...r)=>e.check(w_(...r)),e.endsWith=(...r)=>e.check(x_(...r)),e.min=(...r)=>e.check(Jl(...r)),e.max=(...r)=>e.check(W1(...r)),e.length=(...r)=>e.check(V1(...r)),e.nonempty=(...r)=>e.check(Jl(1,...r)),e.lowercase=r=>e.check(g_(r)),e.uppercase=r=>e.check(y_(r)),e.trim=()=>e.check(S_()),e.normalize=(...r)=>e.check(b_(...r)),e.toLowerCase=()=>e.check(k_()),e.toUpperCase=()=>e.check(E_())}),B_=Q("ZodString",(e,t)=>{ch.init(e,t),H1.init(e,t),e.email=n=>e.check(DF(W_,n)),e.url=n=>e.check(HF(V_,n)),e.jwt=n=>e.check(i_(oM,n)),e.emoji=n=>e.check(UF(H_,n)),e.guid=n=>e.check(Ng(Bg,n)),e.uuid=n=>e.check(OF(Ua,n)),e.uuidv4=n=>e.check(BF(Ua,n)),e.uuidv6=n=>e.check(WF(Ua,n)),e.uuidv7=n=>e.check(VF(Ua,n)),e.nanoid=n=>e.check(ZF(U_,n)),e.guid=n=>e.check(Ng(Bg,n)),e.cuid=n=>e.check(KF(Z_,n)),e.cuid2=n=>e.check(YF(K_,n)),e.ulid=n=>e.check(GF(Y_,n)),e.base64=n=>e.check(n_(tM,n)),e.base64url=n=>e.check(r_(nM,n)),e.xid=n=>e.check(XF(G_,n)),e.ksuid=n=>e.check(qF(X_,n)),e.ipv4=n=>e.check(JF(q_,n)),e.ipv6=n=>e.check(QF(J_,n)),e.cidrv4=n=>e.check(e_(Q_,n)),e.cidrv6=n=>e.check(t_(eM,n)),e.e164=n=>e.check(o_(rM,n)),e.datetime=n=>e.check(j_(n)),e.date=n=>e.check(F_(n)),e.time=n=>e.check(M_(n)),e.duration=n=>e.check(A_(n))});function he(e){return zF(B_,e)}const rt=Q("ZodStringFormat",(e,t)=>{Je.init(e,t),H1.init(e,t)}),W_=Q("ZodEmail",(e,t)=>{KP.init(e,t),rt.init(e,t)}),Bg=Q("ZodGUID",(e,t)=>{UP.init(e,t),rt.init(e,t)}),Ua=Q("ZodUUID",(e,t)=>{ZP.init(e,t),rt.init(e,t)}),V_=Q("ZodURL",(e,t)=>{YP.init(e,t),rt.init(e,t)}),H_=Q("ZodEmoji",(e,t)=>{GP.init(e,t),rt.init(e,t)}),U_=Q("ZodNanoID",(e,t)=>{XP.init(e,t),rt.init(e,t)}),Z_=Q("ZodCUID",(e,t)=>{qP.init(e,t),rt.init(e,t)}),K_=Q("ZodCUID2",(e,t)=>{JP.init(e,t),rt.init(e,t)}),Y_=Q("ZodULID",(e,t)=>{QP.init(e,t),rt.init(e,t)}),G_=Q("ZodXID",(e,t)=>{eF.init(e,t),rt.init(e,t)}),X_=Q("ZodKSUID",(e,t)=>{tF.init(e,t),rt.init(e,t)}),q_=Q("ZodIPv4",(e,t)=>{sF.init(e,t),rt.init(e,t)}),J_=Q("ZodIPv6",(e,t)=>{aF.init(e,t),rt.init(e,t)}),Q_=Q("ZodCIDRv4",(e,t)=>{lF.init(e,t),rt.init(e,t)}),eM=Q("ZodCIDRv6",(e,t)=>{uF.init(e,t),rt.init(e,t)}),tM=Q("ZodBase64",(e,t)=>{cF.init(e,t),rt.init(e,t)}),nM=Q("ZodBase64URL",(e,t)=>{fF.init(e,t),rt.init(e,t)}),rM=Q("ZodE164",(e,t)=>{pF.init(e,t),rt.init(e,t)}),oM=Q("ZodJWT",(e,t)=>{mF.init(e,t),rt.init(e,t)}),U1=Q("ZodNumber",(e,t)=>{O1.init(e,t),lt.init(e,t),e.gt=(r,o)=>e.check(zg(r,o)),e.gte=(r,o)=>e.check(Zc(r,o)),e.min=(r,o)=>e.check(Zc(r,o)),e.lt=(r,o)=>e.check(Lg(r,o)),e.lte=(r,o)=>e.check(Uc(r,o)),e.max=(r,o)=>e.check(Uc(r,o)),e.int=r=>e.check(Wg(r)),e.safe=r=>e.check(Wg(r)),e.positive=r=>e.check(zg(0,r)),e.nonnegative=r=>e.check(Zc(0,r)),e.negative=r=>e.check(Lg(0,r)),e.nonpositive=r=>e.check(Uc(0,r)),e.multipleOf=(r,o)=>e.check(Dg(r,o)),e.step=(r,o)=>e.check(Dg(r,o)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function ie(e){return c_(U1,e)}const iM=Q("ZodNumberFormat",(e,t)=>{gF.init(e,t),U1.init(e,t)});function Wg(e){return d_(iM,e)}const sM=Q("ZodBoolean",(e,t)=>{yF.init(e,t),lt.init(e,t)});function Vt(e){return f_(sM,e)}const aM=Q("ZodUnknown",(e,t)=>{vF.init(e,t),lt.init(e,t)});function ji(){return p_(aM)}const lM=Q("ZodNever",(e,t)=>{wF.init(e,t),lt.init(e,t)});function Z1(e){return h_(lM,e)}const uM=Q("ZodArray",(e,t)=>{xF.init(e,t),lt.init(e,t),e.element=t.element,e.min=(n,r)=>e.check(Jl(n,r)),e.nonempty=n=>e.check(Jl(1,n)),e.max=(n,r)=>e.check(W1(n,r)),e.length=(n,r)=>e.check(V1(n,r)),e.unwrap=()=>e.element});function at(e,t){return C_(uM,e,t)}const cM=Q("ZodObject",(e,t)=>{bF.init(e,t),lt.init(e,t),Xe(e,"shape",()=>t.shape),e.keyof=()=>lr(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ji()}),e.loose=()=>e.clone({...e._zod.def,catchall:ji()}),e.strict=()=>e.clone({...e._zod.def,catchall:Z1()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>Yj(e,n),e.merge=n=>Gj(e,n),e.pick=n=>Zj(e,n),e.omit=n=>Kj(e,n),e.partial=(...n)=>Xj(Y1,e,n[0]),e.required=(...n)=>qj(G1,e,n[0])});function ve(e,t){const n={type:"object",get shape(){return lh(this,"shape",{...e}),this.shape},...ye(t)};return new cM(n)}const dM=Q("ZodUnion",(e,t)=>{SF.init(e,t),lt.init(e,t),e.options=t.options});function dh(e,t){return new dM({type:"union",options:e,...ye(t)})}const fM=Q("ZodIntersection",(e,t)=>{kF.init(e,t),lt.init(e,t)});function pM(e,t){return new fM({type:"intersection",left:e,right:t})}const K1=Q("ZodRecord",(e,t)=>{EF.init(e,t),lt.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function tr(e,t,n){return new K1({type:"record",keyType:e,valueType:t,...ye(n)})}function hM(e,t,n){return new K1({type:"record",keyType:dh([e,Z1()]),valueType:t,...ye(n)})}const Tf=Q("ZodEnum",(e,t)=>{CF.init(e,t),lt.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const i={};for(const s of r)if(n.has(s))i[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new Tf({...t,checks:[],...ye(o),entries:i})},e.exclude=(r,o)=>{const i={...t.entries};for(const s of r)if(n.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new Tf({...t,checks:[],...ye(o),entries:i})}});function lr(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new Tf({type:"enum",entries:n,...ye(t)})}const mM=Q("ZodLiteral",(e,t)=>{IF.init(e,t),lt.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function gM(e,t){return new mM({type:"literal",values:Array.isArray(e)?e:[e],...ye(t)})}const yM=Q("ZodTransform",(e,t)=>{TF.init(e,t),lt.init(e,t),e._zod.parse=(n,r)=>{n.addIssue=i=>{if(typeof i=="string")n.issues.push(Ks(i,n.value,t));else{const s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=e),s.continue??(s.continue=!0),n.issues.push(Ks(s))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n)):(n.value=o,n)}});function vM(e){return new yM({type:"transform",transform:e})}const Y1=Q("ZodOptional",(e,t)=>{RF.init(e,t),lt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Vg(e){return new Y1({type:"optional",innerType:e})}const wM=Q("ZodNullable",(e,t)=>{jF.init(e,t),lt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Hg(e){return new wM({type:"nullable",innerType:e})}const xM=Q("ZodDefault",(e,t)=>{PF.init(e,t),lt.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function bM(e,t){return new xM({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const SM=Q("ZodPrefault",(e,t)=>{FF.init(e,t),lt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function kM(e,t){return new SM({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const G1=Q("ZodNonOptional",(e,t)=>{_F.init(e,t),lt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function EM(e,t){return new G1({type:"nonoptional",innerType:e,...ye(t)})}const CM=Q("ZodCatch",(e,t)=>{MF.init(e,t),lt.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function IM(e,t){return new CM({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const TM=Q("ZodPipe",(e,t)=>{$F.init(e,t),lt.init(e,t),e.in=t.in,e.out=t.out});function Ug(e,t){return new TM({type:"pipe",in:e,out:t})}const RM=Q("ZodReadonly",(e,t)=>{AF.init(e,t),lt.init(e,t)});function jM(e){return new RM({type:"readonly",innerType:e})}const PM=Q("ZodCustom",(e,t)=>{NF.init(e,t),lt.init(e,t)});function FM(e){const t=new nn({check:"custom"});return t._zod.check=e,t}function _M(e,t={}){return I_(PM,e,t)}function MM(e){const t=FM(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(Ks(r,n.value,t._zod.def));else{const o=r;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),n.issues.push(Ks(o))}},e(n.value,n)));return t}const Yu=lr(["full-bleed","video-top","pip-bubble","graphic-only","blurred-behind","lower-third","split-left","split-right"]),Gu=lr(["TitleCard","StatCard","RuleCard","StrikethroughReveal","FlowDiagram","TerminalMock","ChatMock","ScreenshotFrame","BulletList"]),$M=ve({startWord:ie().int().nonnegative(),endWord:ie().int().nonnegative()}),AM=ve({id:he(),anchor:$M,layout:Yu,component:Gu,props:tr(he(),ji()),overrides:tr(he(),ji()).default({}),rationale:he().optional()});ve({id:he(),kind:lr(["graphic","plain"]).optional(),layout:Yu,component:Gu.optional(),props:tr(he(),ji()).optional(),startSec:ie().nonnegative(),endSec:ie().nonnegative(),graphicRect:ve({x:ie(),y:ie(),w:ie(),h:ie()}).optional(),elements:tr(he(),ve({dx:ie().optional(),dy:ie().optional(),scale:ie().positive().optional(),hidden:Vt().optional()})).optional(),video:ve({scale:ie().positive().max(4).optional(),dy:ie().optional(),dx:ie().optional(),autoZoom:Vt().optional()}).optional(),pip:ve({cornerRadius:ie().min(0).max(1).optional(),x:ie().min(0).max(1).optional(),y:ie().min(0).max(1).optional()}).optional(),captionY:ie().min(0).max(1).optional(),captionScale:ie().min(.2).max(3).optional(),pinned:Vt().optional()}).superRefine((e,t)=>{e.kind!=="plain"&&(e.component===void 0||e.props===void 0)&&t.addIssue({code:"custom",message:'a graphic cue requires component and props; only kind: "plain" may omit them'})});ve({centerYFrac:ie().min(0).max(1),sizeFrac:ie().min(0).max(1).optional(),centerXFrac:ie().min(0).max(1).optional(),sourceAspect:ie().positive().optional(),subject:lr(["face","screen"]).optional()});const Xu=ve({bg:he().default("#0B0B0E"),fg:he().default("#FFFFFF"),accent:he().default("#FFE14D"),muted:he().default("#9A9AA3"),success:he().default("#5FBF77"),cardBg:he().default("#15151B"),cardBorder:he().default("#2A2A33"),danger:he().default("#FF5C5C"),radiusPx:ie().default(24),fontDisplay:he().default("'Inter', 'Helvetica Neue', 'Arial Black', Arial, sans-serif"),fontMono:he().default("'SF Mono', 'Cascadia Code', Consolas, monospace")}),NM=Xu.parse({}),LM=ve({eyebrow:he().max(28).optional(),title:he().min(1).max(48).describe("the claim WITHOUT the emphasis token — never repeat the emphasis here"),emphasis:he().max(16).optional().describe("the number/punch token pulled OUT of the title (e.g. '861%') — not a duplicate of it"),sub:he().max(64).optional()}),zM=ve({label:he().min(1).max(28),value:he().min(1).max(12),caption:he().max(40).optional(),inverted:Vt().default(!1)}),DM=ve({kicker:he().min(1).max(24),text:he().min(1).max(40),struck:he().max(40).optional()}),OM=ve({lines:at(ve({text:he().min(1).max(32),struck:Vt().default(!1),mark:lr(["none","cross","check"]).default("none")})).min(1).max(4)}),BM=ve({title:he().max(28).optional(),items:at(he().min(1).max(36)).min(2).max(5)}),WM=ve({nodes:at(he().min(1).max(16)).min(2).max(5),emphasizeLast:Vt().default(!0)}),VM=ve({windows:at(ve({title:he().max(24),lines:at(he().max(40)).min(1).max(6)})).min(1).max(5),fanOut:he().max(20).optional()}),HM=ve({messages:at(ve({from:lr(["user","agent"]),text:he().min(1).max(60)})).min(1).max(4),keyword:he().max(16).optional().describe("ONLY for a 'comment <word>' ask: the single distinctive word the viewer types, plain and unformatted. Leave unset for any other CTA — especially 'reply with a number/which one', where there is no word to type. Never a referential filler like 'number', 'answer', 'comment' or 'below'.")}),UM=ve({src:he().optional().describe("OMIT THIS unless the user supplied an actual image file beside the video — never invent a filename from the transcript; without it the frame renders as a styled placeholder, which is the intended look"),label:he().max(32).optional(),kenBurns:Vt().default(!0)}),X1={TitleCard:{propsSchema:LM,defaultProps:{title:"TITLE"},defaultLayout:"pip-bubble",altLayouts:[],whenToUse:"The core claim or hook as big typography; use `emphasis` for a huge number or punch word."},StatCard:{propsSchema:zM,defaultProps:{label:"METRIC",value:"+0%"},defaultLayout:"video-top",altLayouts:["blurred-behind"],whenToUse:"One striking metric (value like '+242%', '×3', '5s'); punchline in `caption`."},RuleCard:{propsSchema:DM,defaultProps:{kicker:"RULE",text:"DO THE THING"},defaultLayout:"video-top",altLayouts:["blurred-behind"],whenToUse:"A prescriptive takeaway ('CAPACITY RULE / CAP ACTIVE AGENTS'); `struck` shows the rejected alternative."},StrikethroughReveal:{propsSchema:OM,defaultProps:{lines:[{text:"NOT THIS",struck:!0}]},defaultLayout:"blurred-behind",altLayouts:["graphic-only"],whenToUse:'Negation/contrast beat — big words over the blurred speaker. Strike EVERY line of the phrase the speaker negates, not just its tail — a half-struck claim reads as a typo. For wrong-vs-right lists, set mark: "cross"/"check" (✗/✓) per line instead.'},FlowDiagram:{propsSchema:WM,defaultProps:{nodes:["A","B"]},defaultLayout:"graphic-only",altLayouts:[],whenToUse:"A causal chain or pipeline as chips with arrows (TEAM → AI AGENTS → CHURN)."},TerminalMock:{propsSchema:VM,defaultProps:{windows:[{title:"terminal-01",lines:["$ run"]}]},defaultLayout:"graphic-only",altLayouts:[],whenToUse:"Anything about running code/processes/agents — stylized terminal windows."},ChatMock:{propsSchema:HM,defaultProps:{messages:[{from:"user",text:"hello"}]},defaultLayout:"blurred-behind",altLayouts:["graphic-only"],whenToUse:"A quoted phrase or exchange as chat bubbles over the blurred speaker; for a comment-CTA beat, set `keyword` to the word viewers should type."},ScreenshotFrame:{propsSchema:UM,defaultProps:{},defaultLayout:"video-top",altLayouts:["blurred-behind"],whenToUse:"Reference to a document/PR/review — a framed screenshot look with a label chip."},BulletList:{propsSchema:BM,defaultProps:{items:["FIRST","SECOND"]},defaultLayout:"blurred-behind",altLayouts:["graphic-only"],whenToUse:"An ENUMERATION — the speaker lists two or more parallel things ('what you need is X, Y, Z'). One bullet per item, optional kicker title. Use this for lists instead of bending TitleCard or StrikethroughReveal around them."}};function Zg(e,t,n={}){const r=X1[e],o={...r.defaultProps,...t,...n},i=r.propsSchema.safeParse(o);return i.success?i.data:null}function ZM(e){const t=X1[e];if(!t)return[];const n=T_(t.propsSchema),r=[];for(const[o,i]of Object.entries(n.properties??{})){if(Array.isArray(i.enum)&&i.enum.every(s=>typeof s=="string")){r.push({key:o,kind:"enum",options:i.enum});continue}i.type==="boolean"&&r.push({key:o,kind:"boolean",fallback:i.default===!0})}return r}const KM=ve({text:he(),start:ie().nonnegative(),end:ie().nonnegative(),conf:ie().min(0).max(1).optional()}),YM=ve({language:he().default("en"),words:at(KM)}),GM=lr(["exact","light","standard","aggressive"]),q1=lr(["silence","pause","filler","retake","user","clip"]),Kg=ve({srcIn:ie().nonnegative(),srcOut:ie().nonnegative(),kind:lr(["keep","remove"]),reason:q1.optional(),confidence:ie().min(0).max(1).optional()}),Za=ve({start:ie(),end:ie()}),XM=ve({silences:at(Za),gaps:at(Za),cuttable:at(Za),breaths:at(Za).default([]),fillers:at(ve({wordIndex:ie().int(),text:he(),start:ie(),end:ie()}))}),qM=ve({duration:ie().positive(),width:ie().int().positive(),height:ie().int().positive(),fps:ie().positive(),hasAudio:Vt(),rotation:ie().int().optional()}),JM=ve({width:ie().int().positive().default(1080),height:ie().int().positive().default(1920),fps:ie().positive().default(30)});ve({version:gM(1),source:ve({path:he(),probe:qM,audioPath:he().optional(),mezzaninePath:he().optional(),face:ve({centerXFrac:ie(),centerYFrac:ie(),sizeFrac:ie(),framesSampled:ie().int(),framesDetected:ie().int()}).nullable().optional()}),cleanup:GM,intent:he().optional(),transcript:YM.optional(),repairs:at(ve({startWord:ie().int(),endWord:ie().int(),heard:he(),correction:he(),applied:Vt(),rejected:he().optional()})).optional(),analysis:XM.optional(),cutlist:at(Kg).optional(),cutlistProposed:at(Kg).optional(),clip:ve({targetSec:ie().positive(),startWord:ie().int().nonnegative(),endWord:ie().int().nonnegative(),startSec:ie().nonnegative(),endSec:ie().nonnegative(),reason:he()}).optional(),scenes:at(AM).optional(),producer:ve({provider:he(),models:at(he()).default([]),cached:Vt().default(!1),at:he().optional()}).optional(),theme:Xu.optional(),render:JM});const QM=ve({dx:ie().optional(),dy:ie().optional(),scale:ie().positive().optional(),hidden:Vt().optional()}),J1=ve({props:tr(he(),ji()).default({}),elements:tr(he(),QM).default({}),timing:ve({startSec:ie().nonnegative(),endSec:ie().nonnegative()}).optional(),component:Gu.optional(),layout:Yu.optional(),video:ve({scale:ie().positive().max(4).optional(),dy:ie().optional(),dx:ie().optional(),autoZoom:Vt().optional()}).optional(),pip:ve({cornerRadius:ie().min(0).max(1).optional(),x:ie().min(0).max(1).optional(),y:ie().min(0).max(1).optional()}).optional(),captionY:ie().min(0).max(1).optional(),captionScale:ie().min(.2).max(3).optional(),graphicRect:ve({x:ie().min(0).max(1),y:ie().min(0).max(1),w:ie().min(.08).max(1),h:ie().min(.05).max(1)}).optional(),hidden:Vt().optional()}),e$=ve({text:he().min(1).max(80),was:he()}),t$=ve({fromKey:he().regex(/^w\d+$/),toKey:he().regex(/^w\d+$/),text:he().min(1).max(400),was:he()});function Yg(e,t,n){var r;return((r=e[t])==null?void 0:r.was)??n}function Gg(e,t,n,r){var o;return((o=e.find(i=>i.fromKey===t&&i.toKey===n))==null?void 0:o.was)??r}function Q1(e){return String(Math.round(e*1e3))}const n$=dh([ve({at:ie().finite().nonnegative(),id:he().min(1)}),ie().finite().nonnegative().transform(e=>({at:e,id:Q1(e)}))]);function r$(e,t){const n=Q1(e),r=new Set(t.map(o=>o.id));if(!r.has(n))return n;for(let o=2;;o++){const i=`${n}-${o}`;if(!r.has(i))return i}}const o$=ve({theme:Xu.partial().default({}),captionsHidden:Vt().optional(),scenes:tr(he(),J1).default({}),captions:tr(he(),e$).default({}),captionWordsHidden:tr(he(),ve({was:he()})).default({}),captionRangeEdits:at(t$).default([]),captionLineTiming:tr(he(),ve({lead:ie().min(-30).max(30),tail:ie().min(-30).max(30)})).default({}),splits:at(n$).default([]),cuts:at(ve({startSec:ie().nonnegative(),endSec:ie().nonnegative(),src:ve({startSec:ie().nonnegative(),endSec:ie().nonnegative()}).optional()})).default([]),cleanup:ve({reasons:hM(q1,Vt()).default({}),kept:at(ve({srcIn:ie().nonnegative(),srcOut:ie().nonnegative()})).default([])}).default({reasons:{},kept:[]})}),i$=()=>o$.parse({});function s$(e,t){return Zg(e,{},t)??Zg(e,{},{})}function a$(e,t){const n=e[t],r=t.indexOf("@");if(r===-1)return n;const o=e[t.slice(0,r)];if(!o)return n;const{timing:i,hidden:s,...a}=o;return n?{...a,...n,props:{...a.props,...n.props},elements:{...a.elements,...n.elements},...a.video||n.video?{video:{...a.video,...n.video}}:{},...a.pip||n.pip?{pip:{...a.pip,...n.pip}}:{}}:{...a,props:{...a.props},elements:{...a.elements}}}function Rf(e,t){const n=new Set(e.map(i=>i.id)),r=Object.keys(t.scenes).filter(i=>!n.has(i));return{cues:e.map(i=>{const s=a$(t.scenes,i.id);if(!s)return i;const a=s.component!==void 0&&s.component!==i.component,l=s.component??i.component,c=s.component!==void 0&&a?s$(s.component,s.props):{...i.props,...s.props},f=s.layout!==void 0&&s.layout!==i.layout,{graphicRect:p,...m}=i;return{...f?m:i,component:l,layout:s.layout??i.layout,props:c,...Object.keys(s.elements).length>0?{elements:s.elements}:{},...s.video?{video:s.video}:{},...s.pip?{pip:s.pip}:{},...s.captionY!==void 0?{captionY:s.captionY}:{},...s.captionScale!==void 0?{captionScale:s.captionScale}:{},...s.graphicRect?{graphicRect:s.graphicRect}:{},...s.timing&&!i.pinned?{startSec:s.timing.startSec,endSec:s.timing.endSec,pinned:!0}:{}}}),orphans:r}}const Ql=.3;function fh(e,t){const n=[...e];for(const r of[...t].sort((o,i)=>o.at-i.at)){const o=n.findIndex(s=>r.at>=s.startSec+Ql&&r.at<=s.endSec-Ql);if(o===-1)continue;const i=n[o];n.splice(o,1,{...i,endSec:r.at},{...i,id:`${i.id.split("@")[0]}@${r.id}`,startSec:r.at})}return n}function eb(e,t){const n=[];return{cues:e.filter(o=>{var i;return((i=t.scenes[o.id])==null?void 0:i.hidden)!==!0?!0:(n.push(o.id),!1)}),hidden:n}}function l$(e,t){return eb(fh(e,t.splits),t)}function kn(e){if(!Number.isFinite(e))throw new Error(`captionKeyFor: caption words need a finite srcStart (§137), got ${String(e)} — run backfillSrcStart on lines read from a pre-§137 render-props.json`);return`w${Math.round(e*1e3)}`}function Ys(e){return/^\d+$/.test(e)}function Ze(e){return!e||!Number.isFinite(e.srcStart)?null:kn(e.srcStart)}const u$=8;function c$(e,t,n){var i,s;if(!Ys(e))return{to:e};const r=Number(e);if(((i=n[r])==null?void 0:i.text)===t.was)return Xg(n[r]);const o=[];for(let a=1;a<=u$;a++)for(const l of[r-a,r+a])((s=n[l])==null?void 0:s.text)===t.was&&o.push(l);return o.length===0?{to:null,reason:n.some(l=>l.text===t.was)?"out-of-range":"not-found"}:o.length>1?{to:null,reason:"ambiguous"}:Xg(n[o[0]])}function Xg(e){const t=Ze(e);return t===null?{to:null,reason:"unanchorable"}:{to:t}}function d$(e,t){const n=t.flatMap(a=>a.words),r={},o=[],i=Object.entries(e).map(([a,l])=>({key:a,edit:l,legacy:Ys(a),claim:c$(a,l,n)})),s=new Map;for(const a of i){if(a.claim.to===null)continue;const l=s.get(a.claim.to);l?l.push(a):s.set(a.claim.to,[a])}for(const a of i){if(a.claim.to===null){o.push({key:a.key,was:a.edit.was,reason:a.claim.reason});continue}const l=s.get(a.claim.to),c=l.length===1?l[0]:l.find(f=>!f.legacy);if(c===a){r[a.claim.to]=a.edit;continue}o.push({key:a.key,was:a.edit.was,reason:c===void 0?"collision":"superseded"})}return{edits:r,unresolved:o}}function f$(e,t){const n={...t.edits};for(const r of t.unresolved){if(r.reason==="superseded")continue;const o=e[r.key];o!==void 0&&(n[r.key]=o)}return n}function p$(e,t){const n=[];if(Object.keys(t).length===0)return{lines:[...e],dropped:n};const r=new Set,o=e.map(i=>({...i,words:i.words.map(s=>{const a=Ze(s);if(a===null)return s;const l=t[a];return l?r.has(a)?(n.push({key:a,expected:l.was,found:s.text,reason:"duplicate-anchor"}),s):(r.add(a),s.text!==l.was?(n.push({key:a,expected:l.was,found:s.text}),s):{...s,text:l.text}):s})}));for(const[i,s]of Object.entries(t))r.has(i)||n.push({key:i,expected:s.was,found:null});return{lines:o,dropped:n}}function h$(e,t,n,r){const o=e.map(l=>l.length+1),i=o.reduce((l,c)=>l+c,0),s=[];let a=t;for(let l=0;l<e.length;l++){const c=(n-t)*o[l]/i,f=l===e.length-1?n:a+c;s.push({text:e[l],start:a,end:f,srcStart:r[l]}),a=f}return s}function m$(e,t){const n=[];if(t.length===0)return{lines:[...e],dropped:n};let r=[...e];const o=new Set,i=new Set;for(const s of t){const a=`${s.fromKey}..${s.toKey}`,l=[];for(let M=0;M<r.length;M++)for(let $=0;$<r[M].words.length;$++)l.push({line:M,word:$,w:r[M].words[$]});const c=l.findIndex(M=>Ze(M.w)===s.fromKey);if(o.has(a)||i.has(s.fromKey)){n.push({key:a,expected:s.was,found:c===-1?null:l[c].w.text,reason:"duplicate-anchor"});continue}if(c===-1){n.push({key:a,expected:s.was,found:null});continue}let f=-1;for(let M=c;M<l.length;M++)if(Ze(l[M].w)===s.toKey){f=M;break}if(f===-1){n.push({key:a,expected:s.was,found:null});continue}const p=l.slice(c,f+1),m=p.map(M=>M.w.text).join(" ").normalize("NFC");if(m!==s.was.normalize("NFC")){n.push({key:a,expected:s.was,found:m});continue}const g=s.text.trim().split(/\s+/).filter(Boolean);if(g.length===0){n.push({key:a,expected:s.was,found:m});continue}o.add(a);for(const M of p){const $=Ze(M.w);$!==null&&i.add($)}if(g.length===p.length){const M=new Map(p.map(($,V)=>[`${$.line}:${$.word}`,g[V]]));r=r.map(($,V)=>({...$,words:$.words.map((D,L)=>{const j=M.get(`${V}:${L}`);return j===void 0?D:{...D,text:j}})}));continue}const w=[],x=new Map;for(const M of p){const $=x.get(M.line);$?($.last=M.word,$.words.push(M.w)):(w.push(M.line),x.set(M.line,{first:M.word,last:M.word,words:[M.w]}))}const k=w.map(M=>x.get(M).words.reduce(($,V)=>$+(V.end-V.start),0)),h=k.reduce((M,$)=>M+$,0),y=h>0?k:k.map(()=>1),v=h>0?h:k.length,S=y.map(M=>g.length*M/v),b=S.map(M=>Math.floor(M));let E=g.length-b.reduce((M,$)=>M+$,0);const I=S.map((M,$)=>({i:$,rem:M-Math.floor(M)})).sort((M,$)=>$.rem-M.rem||M.i-$.i);for(let M=0;E>0;M=(M+1)%I.length)b[I[M].i]++,E--;const T=p[0].w.srcStart,R=p[p.length-1].w.srcStart,F=g.map((M,$)=>g.length===1?T:T+(R-T)*$/(g.length-1));let A=0;const W=[];for(let M=0;M<r.length;M++){const $=r[M],V=x.get(M);if(!V){W.push($);continue}const D=b[w.indexOf(M)],L=g.slice(A,A+D),j=F.slice(A,A+D);A+=D;const C=D===0?[]:h$(L,V.words[0].start,V.words[V.words.length-1].end,j),P=[...$.words.slice(0,V.first),...C,...$.words.slice(V.last+1)];P.length!==0&&W.push({...$,words:P})}r=W}return{lines:r,dropped:n}}function g$(e,t){const n=[];if(Object.keys(t).length===0)return{lines:[...e],dropped:n};const r=new Set,o=[];for(const i of e){const s=[];for(const m of i.words){const g=Ze(m),w=g===null?void 0:t[g];if(g===null||!w){s.push(m);continue}if(r.has(g)){n.push({key:g,expected:w.was,found:m.text,reason:"duplicate-anchor"}),s.push(m);continue}if(r.add(g),m.text!==w.was){n.push({key:g,expected:w.was,found:m.text}),s.push(m);continue}}if(s.length===i.words.length){o.push(i);continue}if(s.length===0)continue;const a=i.words[i.words.length-1],l=s[0],c=s[s.length-1],f=l===i.words[0]?i.start:l.start,p=c===a?i.end:Math.max(c.end,c.end+(i.end-a.end));o.push({words:s,start:f,end:p})}for(const[i,s]of Object.entries(t))r.has(i)||n.push({key:i,expected:s.was,found:null});return{lines:o,dropped:n}}const eu=.05;function y$(e,t,n,r,o){const i=n-t;if(!(i>0))return e.map(l=>({...l}));const s=(o-r)/i,a=l=>r+(l-t)*s;return e.map(l=>({...l,start:a(l.start),end:a(l.end)}))}function tb(e,t){const n=[],r=e.length;if(r===0){for(const f of Object.keys(t))n.push({key:f,expected:"",found:null});return{lines:[],dropped:n}}if(Object.keys(t).length===0)return{lines:[...e],dropped:n};const o=e.map(f=>f.start),i=e.map(f=>f.end),s=new Set;for(let f=0;f<r;f++){const p=e[f],m=Ze(p.words[0]),g=m===null?void 0:t[m];if(!(m===null||!g)){if(s.has(m)){n.push({key:m,expected:"",found:p.words[0].text,reason:"duplicate-anchor"});continue}s.add(m),i[f]=p.end+g.tail,f+1<r&&e[f+1].start===p.end&&(o[f+1]=i[f]),o[f]=p.start+g.lead,f>0&&e[f-1].end===p.start&&(i[f-1]=o[f])}}const a=e[0].start,l=e[r-1].end;for(let f=0;f<r;f++){const p=f===0?a:Math.max(a,i[f-1]);o[f]=Math.min(Math.max(o[f],p),l),i[f]=Math.min(Math.max(i[f],o[f]+eu),l)}for(let f=r-1;f>=0;f--){const p=f===r-1?l:Math.min(l,o[f+1]);i[f]=Math.max(Math.min(i[f],p),a),o[f]=Math.max(Math.min(o[f],i[f]-eu),a)}const c=e.map((f,p)=>{const m=o[p],g=i[p];return m===f.start&&g===f.end?f:{...f,start:m,end:g,words:y$(f.words,f.start,f.end,m,g)}});for(const f of Object.keys(t))s.has(f)||n.push({key:f,expected:"",found:null});return{lines:c,dropped:n}}function v$(e,t){return Xu.parse({...e,...t.theme})}function qg(e,t,n,r){const o=e.scenes[t]??J1.parse({});return{...e,scenes:{...e.scenes,[t]:{...o,elements:{...o.elements,[n]:{...o.elements[n],...r}}}}}}function w$(e,t,n){const r=e.scenes[t];if(!r)return e;const{[n]:o,...i}=r.elements;return{...e,scenes:{...e.scenes,[t]:{...r,elements:i}}}}function x$(e,t,n){const r=e.scenes[t],o=r==null?void 0:r.elements[n];if(!r||!(o!=null&&o.hidden))return e;const{hidden:i,...s}=o,{[n]:a,...l}=r.elements,c=Object.keys(s).length>0?{...r.elements,[n]:s}:l;return{...e,scenes:{...e.scenes,[t]:{...r,elements:c}}}}function b$(e,t){const n=e.scenes[t];if(!n||!n.timing)return e;const{timing:r,...o}=n;return{...e,scenes:{...e.scenes,[t]:o}}}function S$(e,t){const n=e.scenes[t];if(!n||!n.graphicRect)return e;const{graphicRect:r,...o}=n;return{...e,scenes:{...e.scenes,[t]:o}}}function nb(e){const t=e.indexOf("@");return t===-1?e:e.slice(0,t)}const k$=.6;function E$(e,t){const n=new Set([0]);for(const r of e??[])Number.isFinite(r)&&r>0&&r<t&&n.add(r);return[...n].sort((r,o)=>r-o)}function C$(e,t){const n=t.outputDurationSec,r=[...e].sort((f,p)=>f.startSec-p.startSec);if(n<=0)return r;const o=E$(t.clipStarts,n),i=[];let s=0;for(const f of r)f.startSec-s>1e-9&&i.push({start:s,end:f.startSec}),s=Math.max(s,f.endSec);n-s>1e-9&&i.push({start:s,end:n});const a=[];for(const f of i){const p=o.filter(g=>g>f.start+1e-9&&g<f.end-1e-9),m=[f.start,...p,f.end];for(let g=0;g<m.length-1;g++){const w=m[g],x=m[g+1];if(x-w<k$)continue;let k=0;for(let h=0;h<o.length;h++)o[h]<=w+1e-9&&(k=h);a.push({start:w,end:x,clip:k})}}const l=new Map,c=a.map(f=>{const p=l.get(f.clip)??0;return l.set(f.clip,p+1),{id:p===0?`take-${f.clip}`:`take-${f.clip}-${p}`,kind:"plain",layout:"full-bleed",startSec:f.start,endSec:f.end}});return[...r,...c].sort((f,p)=>f.startSec-p.startSec)}const I$=1.05;function T$(e,t){for(const r of e)if(t>=r.startSec&&t<r.endSec){const o=r.endSec-r.startSec,i=o>0?(t-r.startSec)/o:1,s=.5-.5*Math.cos(Math.PI*i);return r.from+(r.to-r.from)*s}const n=e[e.length-1];return n&&t===n.endSec?n.to:1}function R$(e,t,n){if(e.length===0)return{x:0,y:0,w:(n==null?void 0:n.width)??0,h:(n==null?void 0:n.height)??0,full:!0};if(t<e[0].startSec)return e[0].rect;for(const r of e)if(t>=r.startSec&&t<r.endSec)return r.rect;return e[e.length-1].rect}class rb{constructor(t){Ae(this,"spans");Ae(this,"outputDuration");let n=-1/0;for(const i of t){if(i.srcOut<i.srcIn)throw new Error(`segment ends before it starts: ${i.srcIn}..${i.srcOut}`);if(i.srcIn<n)throw new Error(`cutlist segments overlap at ${i.srcIn}`);n=i.srcOut}const r=[];let o=0;for(const i of t){if(i.kind!=="keep"||i.srcOut<=i.srcIn)continue;const s=i.srcOut-i.srcIn;r.push({srcIn:i.srcIn,srcOut:i.srcOut,outIn:o,outOut:o+s}),o+=s}this.spans=r,this.outputDuration=o}toOutput(t){for(const i of this.spans)if(t>=i.srcIn&&t<=i.srcOut)return i.outIn+(t-i.srcIn);const n=1e-9;let r=null,o=1/0;for(const i of this.spans){const s=t<i.srcIn?i.srcIn-t:t-i.srcOut;s<o&&(o=s,r=i)}if(r&&o<=n){const i=Math.min(Math.max(t,r.srcIn),r.srcOut);return r.outIn+(i-r.srcIn)}return null}toOutputClamped(t){const n=this.toOutput(t);if(n!==null)return n;let r=0;for(const o of this.spans)if(o.srcOut<=t)r=o.outOut;else if(o.srcIn>=t)return o.outIn;return r}toSource(t){const n=this.spans;if(n.length===0)return 0;const r=n[0];if(t<=r.outIn)return r.srcIn;for(const o of n)if(t>=o.outIn&&t<=o.outOut)return o.srcIn+(t-o.outIn);return n[n.length-1].srcOut}mapWord(t){const n=(t.start+t.end)/2;if(this.toOutput(n)===null&&this.toOutput(t.start)===null&&this.toOutput(t.end)===null)return null;const r=this.toOutputClamped(t.start),o=this.toOutputClamped(t.end);return o<=r?null:{start:r,end:o}}}function qu(e){return new rb(e.map(t=>({srcIn:t.srcIn,srcOut:t.srcOut,kind:"keep"})))}function ob(e,t,n){return Math.abs(e.outputDuration-t.outputDuration)>n||e.spans.length!==t.spans.length?!1:e.spans.every((r,o)=>{const i=t.spans[o];return Math.abs(r.srcIn-i.srcIn)<=n&&Math.abs(r.srcOut-i.srcOut)<=n&&Math.abs(r.outIn-i.outIn)<=n&&Math.abs(r.outOut-i.outOut)<=n})}function Jg(e,t){const n=o=>o.words;if(e.every(o=>n(o).every(i=>i.srcStart!==void 0)))return[...e];const r=qu(t);return e.map(o=>({...o,words:n(o).map(i=>i.srcStart===void 0?{...i,srcStart:r.toSource(i.start)}:i)}))}const j$=/[\p{Script=Arabic}\p{Script=Hebrew}\p{Script=Syriac}\p{Script=Thaana}\p{Script=Nko}]/u,P$=new RegExp("\\p{L}","u");function ph(e){for(const t of e){if(j$.test(t))return"rtl";if(P$.test(t))return"ltr"}return"ltr"}const Gs="Noto Nastaliq Urdu",ib="fonts/NotoNastaliqUrdu-Bold.ttf";function F$(e){return e.some(t=>ph(t.words.map(n=>n.text).join(" "))==="rtl")}const sb=9,_$=new Set(["a","an","and","as","at","but","by","for","from","in","is","it","of","on","or","the","to","with","that","this","my","your","so","had","has","have","was","were","will","can","should","i"]);function M$(e,t=sb){const n=e.trim().replace(/\s+/g," ");if(!n)return n;const r=a=>a.split(" ").filter(Boolean);if(r(n).length<=t)return n;const o=n.split(/\s*[—–:]\s*|\s+-\s+/)[0].trim(),i=r(o).length>=3?o:n,s=r(i).slice(0,t);for(;s.length>3&&_$.has(s[s.length-1].toLowerCase().replace(/\W/g,""));)s.pop();return s.join(" ").replace(/[,;:—–-]+$/,"")}function hh(e){return e!=="user"&&e!=="clip"}function ab(e,t){if(!t)return[];const n=t.kept??[];return e.filter(r=>{var o;return r.kind==="remove"&&hh(r.reason)&&(r.reason!==void 0&&((o=t.reasons)==null?void 0:o[r.reason])===!1||n.some(i=>i.srcIn<r.srcOut&&i.srcOut>r.srcIn))})}function $$(e,t){const n=new Set(ab(e,t));if(n.size===0)return[...e];const r=[];for(const o of e){const i=n.has(o)?{srcIn:o.srcIn,srcOut:o.srcOut,kind:"keep"}:o,s=r[r.length-1];if(s!==void 0&&s.kind==="keep"&&i.kind==="keep"){s.srcOut=i.srcOut;continue}r.push(i.kind==="keep"?{srcIn:i.srcIn,srcOut:i.srcOut,kind:"keep"}:i)}return r}function A$(e,t,n,r,o){const i=n.toSource(t),s=r.toOutput(i);if(s!==null)return s;const a=r.toOutputClamped(i);return o.push(`${e} at ${t.toFixed(3)}s fell inside the new cut — snapped to ${a.toFixed(3)}s`),a}function N$(e,t){const n=[...t].sort((o,i)=>o.start-i.start);if(n.length===0)return[...e];const r=[];for(const o of e){if(o.kind!=="keep"){r.push(o);continue}let i=o.srcIn;for(const s of n){const a=Math.max(i,s.start),l=Math.min(o.srcOut,s.end);a>=l||(a>i&&r.push({srcIn:i,srcOut:a,kind:"keep"}),r.push({srcIn:a,srcOut:l,kind:"remove",reason:"user",confidence:1}),i=l)}i<o.srcOut&&r.push({srcIn:i,srcOut:o.srcOut,kind:"keep"})}return r}const lb=1e-6;function L$(e,t,n,r){var i;if(!(Object.values((t==null?void 0:t.reasons)??{}).some(s=>s===!1)||(((i=t==null?void 0:t.kept)==null?void 0:i.length)??0)>0)||e.length===0||r.length===0)return null;try{const s=$$(e,t),a=n.flatMap(f=>f.src&&f.src.endSec>f.src.startSec?[{start:f.src.startSec,end:f.src.endSec}]:[]),l=new rb(N$(s,a)),c=qu(r);return ob(c,l,lb)?null:{oldMap:c,newMap:l}}catch{return null}}function z$(e){if(e===null){const r=o=>o;return{toLive:r,fromLive:r,hasOldClockPreimage:()=>!0}}const{oldMap:t,newMap:n}=e;return{toLive:r=>{const o=t.toSource(r);return n.toOutput(o)??n.toOutputClamped(o)},fromLive:r=>{const o=n.toSource(r);return t.toOutput(o)??t.toOutputClamped(o)},hasOldClockPreimage:r=>t.toOutput(n.toSource(r))!==null}}function ub(e,t,n){const r=e.fromLive(t),o=e.fromLive(n);return o-r<lb?{kind:"degenerate"}:e.hasOldClockPreimage(t)&&e.hasOldClockPreimage(n)?{kind:"exact",startSec:r,endSec:o}:{kind:"shrunk",startSec:r,endSec:o,report:`cut ${t.toFixed(3)}s–${n.toFixed(3)}s trimmed to the last render's ${r.toFixed(3)}s–${o.toFixed(3)}s — the revived material at its edge isn't in the last render yet`}}function D$(e,t,n){const r=[],o=(s,a)=>A$(s,a,t,n,r),i={spans:n.spans.map(s=>({...s})),outputDurationSec:n.outputDuration,captionLines:e.captionLines.map((s,a)=>({...s,start:o(`caption line ${a+1} start`,s.start),end:o(`caption line ${a+1} end`,s.end),words:s.words.map(l=>({...l,start:o(`caption word "${l.text}" start`,l.start),end:o(`caption word "${l.text}" end`,l.end)}))})),sceneCues:e.sceneCues.map(s=>({...s,startSec:o(`scene "${s.id}" start`,s.startSec),endSec:o(`scene "${s.id}" end`,s.endSec)})),punch:{scale:1,allowed:[]}};return e.zoomPlan&&(i.zoomPlan=e.zoomPlan.map((s,a)=>({...s,startSec:o(`zoom segment ${a+1} start`,s.startSec),endSec:o(`zoom segment ${a+1} end`,s.endSec)}))),e.ctaWindow&&(i.ctaWindow={startSec:o("CTA window start",e.ctaWindow.startSec),endSec:o("CTA window end",e.ctaWindow.endSec)}),e.sourceTextRegions&&(i.sourceTextRegions=e.sourceTextRegions.map((s,a)=>({...s,startSec:o(`source text region ${a+1} start`,s.startSec),endSec:o(`source text region ${a+1} end`,s.endSec)}))),{fields:i,reports:r}}const rn={width:1080,height:1920};rn.width;rn.height;const ma={centerYFrac:.38,sizeFrac:.22},O$=.35,B$=.45,cb=1-1/I$,W$=.4*cb,V$=.6*cb;function db(e,t,n=rn){const r=e.w*n.width,o=e.h*n.height;return Math.max(o,r/(t.sourceAspect??n.width/n.height))}function H$(e,t,n=rn){if(t.subject==="screen")return .5;const r=e.h*n.height,o=db(e,t,n),i=o-r;if(i<=1)return .5;const s=t.sizeFrac??ma.sizeFrac,a=(t.centerYFrac-s/2-O$*s)*o,l=(t.centerYFrac+s/2)*o,c=(a+l)/2-B$*r,f=a-W$*r,p=l+V$*r-r,m=p<=f?Math.min(Math.max(c,p),f):p;return Math.min(1,Math.max(0,m/i))}function U$(e,t,n,r,o=rn){if(r.length===0)return e;const i=t.h*o.height,s=db(t,n,o);if(s-i<=1)return e;const l=i/s,c=1-l;if(c<=0)return e;let f=e*c;for(let p=0;p<r.length+1;p++){const m=r.find(v=>{const S=v.y,b=v.y+v.h,E=f+l,I=S<f&&f<b,T=S<E&&E<b;return I||T});if(!m)break;const g=[],w=m.y+m.h;w<=c&&g.push(w);const x=m.y-l;if(x>=0&&g.push(x),m.h<=l){const v=Math.max(0,m.y+m.h-l),S=Math.min(c,m.y);v<=S&&g.push(Math.min(Math.max(f,v),S))}const k=n.sizeFrac??ma.sizeFrac,h=n.centerYFrac+k/2,y=g.filter(v=>v+l>=h);if(y.length===0)return e;f=y.reduce((v,S)=>Math.abs(S-f)<Math.abs(v-f)?S:v)}return Math.min(1,Math.max(0,f/c))}function Z$(e,t,n=rn){if(t.subject==="screen")return .5;const r=e.w*n.width,o=e.h*n.height,i=Math.max(r,o*(t.sourceAspect??n.width/n.height)),s=i-r;if(s<=1||t.centerXFrac===void 0)return .5;const a=t.centerXFrac*i-r/2;return Math.min(1,Math.max(0,a/s))}const K$={top:.12,bottom:.22,right:.16,left:.04},Y$={top:.06,bottom:.12,right:.05,left:.05};function Qn(e=rn){return e.width>e.height?Y$:K$}function G$(e=rn){const t=Qn(e);return{x:t.left,y:t.top,w:1-t.left-t.right,h:1-t.top-t.bottom}}const X$=.08,q$=.05;function tu(e,t=rn){const n=G$(t),r=1e-9,o=(c,f,p)=>c<f-r?f:c>p+r?p:c,i=o(e.w,X$,n.w),s=o(e.h,q$,n.h),a=o(e.x,n.x,n.x+n.w-i),l=o(e.y,n.y,n.y+n.h-s);return{x:a,y:l,w:i,h:s}}const Qg=.045;function J$(e){return e.width>e.height?44:64}const fr={x:0,y:0,w:1,h:1},Kc=.3,Wo={x:.5-Kc/2,y:.66,w:Kc,h:Kc*1080/1920};function Io(e,t=ma,n=[],r=rn){const o=a=>U$(H$(a,t,r),a,t,n,r),i=a=>Z$(a,t,r),s=r.width>r.height;switch(e){case"full-bleed":return{video:{rect:fr,cornerRadius:0,blurPx:0,dim:0,opacity:1,objectPosY:o(fr),objectPosX:i(fr)},graphic:null,captionAnchor:s?.8:.7};case"lower-third":{const a=s?{x:.05,y:.7,w:.62,h:.18}:{x:.04,y:.56,w:.8,h:.22};return{video:{rect:fr,cornerRadius:0,blurPx:0,dim:0,opacity:1,objectPosY:o(fr),objectPosX:i(fr)},graphic:a,captionAnchor:s?.62:.49}}case"split-left":case"split-right":{if(s){const l=e==="split-left",c={x:l?0:.5,y:0,w:.5,h:1};return{video:{rect:c,cornerRadius:0,blurPx:0,dim:0,opacity:1,objectPosY:o(c),objectPosX:i(c)},graphic:l?{x:.55,y:.2,w:.4,h:.56}:{x:.05,y:.2,w:.4,h:.56},captionAnchor:.82}}const a={x:0,y:0,w:1,h:.5};return{video:{rect:a,cornerRadius:0,blurPx:0,dim:0,opacity:1,objectPosY:o(a),objectPosX:i(a)},graphic:{x:.04,y:.58,w:.8,h:.2},captionAnchor:.53}}case"video-top":{const a={x:0,y:0,w:1,h:.42};return{video:{rect:a,cornerRadius:0,blurPx:0,dim:0,opacity:1,objectPosY:o(a),objectPosX:i(a)},graphic:{x:.04,y:.54,w:.8,h:.24},captionAnchor:.48}}case"pip-bubble":return{video:{rect:Wo,cornerRadius:1,blurPx:0,dim:0,opacity:1,objectPosY:o(Wo),objectPosX:i(Wo)},graphic:{x:.06,y:.14,w:.78,h:.42},captionAnchor:s?.78:.61};case"graphic-only":return{video:{rect:Wo,cornerRadius:1,blurPx:0,dim:0,opacity:0,objectPosY:o(Wo),objectPosX:i(Wo)},graphic:{x:.04,y:.14,w:.8,h:.54},captionAnchor:s?.8:.73};case"blurred-behind":return{video:{rect:fr,cornerRadius:0,blurPx:22,dim:.55,opacity:1,objectPosY:o(fr),objectPosX:i(fr)},graphic:{x:.07,y:.24,w:.77,h:.36},captionAnchor:s?.8:.69}}}const Q$={x:.07,y:.24,w:.77,h:.36};function fb(e,t=rn){return e.graphicRect?tu(e.graphicRect,t):Io(e.layout,ma,[],t).graphic??Q$}const pb=.35;function Xr(e,t){for(const n of e)if(t>=n.startSec&&t<n.endSec)return n;return null}function In(e,t,n){return e+(t-e)*n}function e4(e,t,n){return{x:In(e.x,t.x,n),y:In(e.y,t.y,n),w:In(e.w,t.w,n),h:In(e.h,t.h,n)}}function ey(e,t,n){return{rect:e4(e.rect,t.rect,n),cornerRadius:In(e.cornerRadius,t.cornerRadius,n),blurPx:In(e.blurPx,t.blurPx,n),dim:In(e.dim,t.dim,n),opacity:In(e.opacity,t.opacity,n),objectPosY:In(e.objectPosY,t.objectPosY,n),objectPosX:In(e.objectPosX,t.objectPosX,n)}}function nu(e){return e*e*(3-2*e)}function hb(e){return e.filter(t=>!(t.kind==="plain"&&t.layout==="full-bleed"))}function Yc(e,t,n,r){const o=Io(e.layout,t,n,r).video,i=e.layout==="pip-bubble"?e.pip:void 0;if(!i)return o;const s={...o.rect,x:Math.min(Math.max(i.x??o.rect.x,0),1-o.rect.w),y:Math.min(Math.max(i.y??o.rect.y,0),1-o.rect.h)};return{...o,rect:s,cornerRadius:i.cornerRadius??o.cornerRadius}}function t4(e,t,n=ma,r=[],o=rn){const i=hb(e),s=r.filter(h=>t>=h.startSec&&t<h.endSec),a=Io("full-bleed",n,s,o).video,l=Xr(i,t);if(!l)return a;const c=Yc(l,n,s,o),f=Math.min(pb,(l.endSec-l.startSec)/2),p=t-l.startSec,m=l.endSec-t,g=Xr(i,l.startSec-.001),w=Xr(i,l.endSec+.001),x=g?Yc(g,n,s,o):a,k=w?Yc(w,n,s,o):a;return p<f?ey(x,c,nu(p/f)):m<f?ey(c,k,nu(1-m/f)):c}function n4(e,t,n,r){return[n!==0||r!==0?`translate(${n}px, ${r}px)`:"",e*t!==1?`scale(${e*t})`:""].filter(Boolean).join(" ")||void 0}function Gc(e){return e==="pip-bubble"||e==="graphic-only"?1:0}function r4(e,t){const n=hb(e),r=Xr(n,t);if(!r)return 0;const o=Gc(r.layout),i=Math.min(pb,(r.endSec-r.startSec)/2),s=Xr(n,r.startSec-.001),a=Xr(n,r.endSec+.001),l=s?Gc(s.layout):0,c=a?Gc(a.layout):0,f=t-r.startSec,p=r.endSec-t;return f<i?In(l,o,nu(f/i)):p<i?In(o,c,nu(1-p/i)):o}function o4(e,t,n){return e.filter(r=>(r.startSec??Number.NEGATIVE_INFINITY)<n&&(r.endSec??Number.POSITIVE_INFINITY)>t)}function i4(e,t){let n=0;for(const r of t){const o=Math.max(e.y,r.y),i=Math.min(e.y+e.h,r.y+r.h);i>o&&(n+=i-o)}return Math.min(1,n/e.h)}function s4(e,t,n,r=rn){const o=Io(e,void 0,[],r),i=Qn(r),s=o.captionAnchor,a=l=>{const c={y:l-Qg,h:Qg*2};if(c.y<i.top||c.y+c.h>1-i.bottom||i4(c,t)>0)return!1;const f=n??o.graphic;return!(f&&Math.min(c.y+c.h,f.y+f.h)-Math.max(c.y,f.y)>0)};if(a(s))return s;for(let l=.02;l<=.6;l+=.02)for(const c of[s-l,s+l])if(a(c))return c;return s}const a4=.3,l4=.3,u4=.133,mh=e=>e*(2-e);function mb(e,t=a4,n=l4){if(e<=0)return{enterSec:0,exitSec:0};const r=t+n;if(r<=e)return{enterSec:t,exitSec:n};const o=e/r;return{enterSec:t*o,exitSec:n*o}}const ty=.4;function c4(e,t){if(!t)return e;const n=e.replace(/^[^A-Za-z0-9]+|[^A-Za-z0-9]+$/g,"");return n.toLowerCase()!==t.toLowerCase()?e:e.replace(n,`"${n.toUpperCase()}"`)}function d4(e,t){return t?e>=t.startSec-ty&&e<=t.endSec+ty:!1}function f4(e,t){return e??J$(t)}function p4(e){return e*10/64}function h4(e){return{fontFamily:(e==null?void 0:e.fontDisplay)??"'Inter', 'Helvetica Neue', 'Arial Black', Arial, sans-serif",color:(e==null?void 0:e.fg)??"white"}}function m4(e,t){return e==="rtl"?`'${Gs}', ${t}`:t}function g4(e){return e==="rtl"?1.9:1.15}const y4=()=>{const[e]=le.useState(()=>QE(`load ${Gs}`));return le.useEffect(()=>{let t=!1;const n=()=>{t||(t=!0,eC(e))};return new FontFace(Gs,`url("${eh(ib)}") format("truetype")`,{weight:"900"}).load().then(o=>{document.fonts.add(o),n()},n),n},[e]),null},v4=({line:e,wordOffset:t,verticalAnchor:n,fontSizePx:r,activeColor:o,fontFamily:i,textColor:s,ctaKeyword:a,ctaWindow:l})=>{const c=Ft(),{fps:f,width:p,height:m}=ht(),g=Qn({width:p,height:m}),w=e.start+c/f,x=ph(e.words.map(k=>k.text).join(" "));return u.jsx(Hn,{style:{pointerEvents:"none"},children:u.jsx("div",{style:{position:"absolute",top:`${n*100}%`,left:0,right:0,transform:"translateY(-50%)",direction:x,display:"flex",justifyContent:"center",gap:"0.28em",flexWrap:"wrap",paddingLeft:`${g.left*100}%`,paddingRight:`${g.right*100}%`,fontFamily:m4(x,i),fontWeight:900,fontSize:r,lineHeight:g4(x),textAlign:"center",color:s,WebkitTextStroke:`${p4(r)}px rgba(0,0,0,0.85)`,paintOrder:"stroke fill",textShadow:`0 4px ${r*24/64}px rgba(0,0,0,0.55)`},children:e.words.map((k,h)=>{const y=Math.max(k.end,k.start+.12),v=w>=k.start&&w<=y,S=v?Math.min(1,(w-k.start)/u4):0,b=mh(S);return u.jsx("span",{"data-caption-word":t+h,"data-caption-text":k.text,"data-caption-src":Ze(k)===null?void 0:k.srcStart,style:{display:"inline-block",pointerEvents:"auto",transform:b>0?`scale(${1+.08*b})`:"scale(1)",color:v?o:s},children:c4(k.text,d4(k.start,l)?a:void 0)},h)})})})},w4=({lines:e,cues:t=[],verticalAnchor:n=.76,fontSizePx:r,activeColor:o="#FFE14D",theme:i,ctaKeyword:s,ctaWindow:a,sourceTextRegions:l=[]})=>{const{fps:c,width:f,height:p}=ht(),m={width:f,height:p},g=f4(r,m),{fontFamily:w,color:x}=h4(i),k=[];let h=0;for(const y of e)k.push(h),h+=y.words.length;return u.jsxs(Hn,{children:[F$(e)?u.jsx(y4,{}):null,e.map((y,v)=>{const S=t.length>0?Xr(t,y.start):null,b=(S==null?void 0:S.captionY)!==void 0?S.captionY:t.length>0||l.length>0?s4((S==null?void 0:S.layout)??"full-bleed",o4(l,y.start,y.end),S==null?void 0:S.graphicRect,m):n,{from:E,durationInFrames:I}=ih(y.start,y.end,c);return u.jsx(_t,{from:E,durationInFrames:I,children:u.jsx(v4,{line:y,wordOffset:k[v],verticalAnchor:b,fontSizePx:g*((S==null?void 0:S.captionScale)??1),activeColor:o,fontFamily:w,textColor:x,ctaKeyword:s,ctaWindow:a})},v)})]})};function gb(e,t,n,r=.5,o=.5){const i=Math.max(1,e.width),s=Math.max(1,e.height),a=Math.max(1,t.w),l=Math.max(1,t.h),c=Math.max(n.width/a,n.height/l),f=-t.x*c+(n.width-a*c)*ny(r),p=-t.y*c+(n.height-l*c)*ny(o);return{width:i*c,height:s*c,left:f,top:p}}function ny(e){return Number.isFinite(e)?Math.min(1,Math.max(0,e)):.5}function yb(e,t,n){const r=Math.max(1,e.width),o=Math.max(1,e.height),i=Math.max(1,t.w),s=Math.max(1,t.h),a=Math.min(n.width/i,n.height/s),l=-t.x*a+(n.width-i*a)/2,c=-t.y*a+(n.height-s*a)/2;return{width:r*a,height:o*a,left:l,top:c}}function x4(e,t){return yb(e,{x:0,y:0,w:e.width,h:e.height},t)}function vb(e,t){if(e.length===0)return t;for(const o of e)if(t>=o.outIn&&t<o.outOut)return o.srcIn+(t-o.outIn);const n=e[0];return t<n.outIn?n.srcIn:e[e.length-1].srcOut}function b4(e,t,n,r,o,i){return e==="fit"?yb(t,n,r):gb(t,n,r,o,i)}function S4(e,t,n,r){return e.length===0?{x:0,y:0,w:r.width,h:r.height,full:!0}:R$(e,vb(t,n),r)}function k4(e,t,n){if(e.length===0)return null;const r=vb(t,n);if(r<e[0].startSec)return e[0];for(const o of e)if(r>=o.startSec&&r<o.endSec)return o;return e[e.length-1]}function E4(e,t,n,r,o,i,s,a,l){if(!o)return null;if(e&&e.length>0){const f=k4(e,n,r);if(f)return gb(o,f.window,s,f.bias.x,f.bias.y)}if(!t||t.length<2)return null;const c=S4(t,n,r,o);return c.full?null:b4(i,o,c,s,a,l)}const C4=({cues:e,theme:t,face:n,zoomPlan:r,sourceTextRegions:o,contentTimeline:i,framingTimeline:s,spans:a,sourceSize:l,contentCropMode:c="cover",sourceFit:f="cover",children:p})=>{const m=Ft(),{fps:g,width:w,height:x}=ht(),k=m/g,y=t4(e,k,n??void 0,o??[],{width:w,height:x}),v=r4(e,k),S=y.rect.w*w,b=y.rect.h*x,E=y.cornerRadius*Math.min(S,b)/2,I=Xr(e,k),T=I==null?void 0:I.video,R=r&&r.length>0?T$(r,k):1,F=Math.max(0,y.opacity*(1-.6*y.cornerRadius)),A=(T==null?void 0:T.autoZoom)!==!1,W=f==="contain"&&l!==void 0,M=A&&!W?1+(R-1)*F:1,$=(T==null?void 0:T.scale)??1,V=(T==null?void 0:T.dx)??0,D=(T==null?void 0:T.dy)??0,L=n4(M,$,V,D);return u.jsxs(Hn,{children:[u.jsx(Hn,{style:{background:t.bg,opacity:v}}),u.jsxs("div",{"data-edit-video":I==null?void 0:I.id,style:{position:"absolute",left:`${y.rect.x*100}%`,top:`${y.rect.y*100}%`,width:S,height:b,borderRadius:E,overflow:"hidden",opacity:y.opacity,backgroundColor:W?t.bg:void 0,boxShadow:y.cornerRadius>.5?"0 18px 60px rgba(0,0,0,0.55)":void 0},children:[u.jsx("div",{style:{position:"absolute",inset:0,filter:y.blurPx>.5?`blur(${y.blurPx}px)`:void 0,transform:L,transformOrigin:"50% 40%","--ossclip-obj-y":`${y.objectPosY*100}%`,"--ossclip-obj-x":`${y.objectPosX*100}%`},children:W?u.jsx(I4,{source:l,slot:{width:S,height:b},children:p}):u.jsx(T4,{timeline:i,framing:s,spans:a,sourceSize:l,mode:c,tSec:k,slot:{width:S,height:b},posX:y.objectPosX,posY:y.objectPosY,children:p})}),u.jsx("div",{style:{position:"absolute",inset:0,background:"black",opacity:y.dim}})]})]})},I4=({source:e,slot:t,children:n})=>{const r=x4(e,t);return u.jsx("div",{style:{position:"absolute",width:r.width,height:r.height,left:r.left,top:r.top},children:n})},T4=({timeline:e,framing:t,spans:n,sourceSize:r,mode:o,tSec:i,slot:s,posX:a,posY:l,children:c})=>{const f=E4(t,e,n??[],i,r,o,s,a,l);return f?u.jsx("div",{style:{position:"absolute",width:f.width,height:f.height,left:f.left,top:f.top},children:c}):u.jsx("div",{style:{position:"absolute",inset:0},children:c})},gh=.94,R4=new Set(["FlowDiagram","StrikethroughReveal","ChatMock","BulletList"]),ry=2.4,Ka=.45,Ju=.58,Nt=.72,j4=.62;function Go(e,t,n,r,o){const i=Math.max(1,Math.floor(n/Math.max(1,o*t)));return Math.max(1,Math.ceil(e/i))*t*r}const Ye=e=>typeof e=="string"?e:"",Dr=e=>Array.isArray(e)?e:[];function P4(e,t,n,r=1/0){switch(e){case"TitleCard":{const o=n-80,i=Ye(t.emphasis),s=28;let a=0,l=0;Ye(t.eyebrow)&&(a+=34*1.2,l++),i&&(a+=210*.95,l++);const c=i?64:96;return a+=Go(Ye(t.title).length,c,o,1.05,Nt),l++,Ye(t.sub)&&(a+=Go(Ye(t.sub).length,40,o,1.2,Ju),l++),a+s*Math.max(0,l-1)}case"StatCard":{const o=Go(Ye(t.label).length,42,n*.55,1.15,Nt);let i=88+Math.max(o,110*1.15)+4;return Ye(t.caption)&&(i+=30+(38*1.2+32+4)),i}case"RuleCard":{const o=n-60-96;let i=80;return i+=30*1.2+14,i+=Go(Ye(t.text).length,72,o,1.02,Nt),Ye(t.struck)&&(i+=26+Go(Ye(t.struck).length,44,o,1.2,Nt)),i}case"StrikethroughReveal":{const o=Dr(t.lines).map(a=>Ye(a==null?void 0:a.text)),i=kb(o,n,r),s=o.reduce((a,l)=>a+Sb(l,i,n).length,0);return s*i*1.08+i*.2*Math.max(0,s-1)}case"FlowDiagram":{const o=Dr(t.nodes).map(l=>Ye(l)),i=Math.max(1,o.length),{mode:s,fontSize:a}=Pb(o,n,r);return s==="row"?a*Cs+4:a*(Cs*i+jb*(i-1))}case"TerminalMock":{const o=Dr(t.windows);let i=0;for(const s of o){const a=Dr(s==null?void 0:s.lines);i+=56.8+2,i+=Math.max(1,a.length)*27*1.2+8*Math.max(0,a.length-1)+36,i+=4}return i+=22*Math.max(0,o.length-1),Ye(t.fanOut)&&(i+=22+40*1.2),i}case"ChatMock":{const o=Tb(t).map(s=>s.text),i=Rb(o,{widthPx:n,heightPx:r});return Ib(o,i,n)}case"ScreenshotFrame":{const o=n*.94;return(Ye(t.src)?o*9/16:480)+4}case"BulletList":{const o=Dr(t.items).map(s=>Ye(s)),i=bb(o,n,r,!!Ye(t.title),Ye(t.title));return A4(o.length,i,!!Ye(t.title))}}}const _r=e=>Ye(e).split(/\s+/).reduce((t,n)=>Math.max(t,n.length),0);function F4(e,t){switch(e){case"RuleCard":{const n=_r(t.kicker)*30*(Nt+.28),r=_r(t.text)*72*Nt,o=_r(t.struck)*44*(Nt+.04),i=Math.max(n,r,o);return i>0?156+i:0}case"TitleCard":{const n=Ye(t.emphasis)?64:96,r=_r(t.eyebrow)*34*(Nt+.35),o=_r(t.emphasis)*210*Nt,i=_r(t.title)*n*(Nt+.02),s=_r(t.sub)*40*Ju,a=Math.max(r,o,i,s);return a>0?80+a:0}case"TerminalMock":{let n=0;for(const r of Dr(t.windows))for(const o of Dr(r==null?void 0:r.lines))n=Math.max(n,Ye(o).length);return n>0?108+n*27*j4:0}case"StatCard":{const n=Ye(t.value).length*110*Nt;return n===0?0:164+_r(t.label)*42*Nt+40+n}default:return 0}}const oy=36,_4=120,wb=1.6,xb=.88,M4=(Nt+.28)*.36,$4=1.1;function A4(e,t,n){return(Math.max(1,e)*wb+(n?xb:0))*t}function bb(e,t=831,n=1/0,r=!1,o=""){const i=e.reduce((l,c)=>Math.max(l,c.length),0);if(i===0)return oy;const s=Math.min(t/(i*Nt+$4),o?t/(o.length*M4):1/0),a=n*gh/(Math.max(1,e.length)*wb+(r?xb:0));return Math.max(oy,Math.min(_4,Math.floor(Math.min(s,a))))}const N4=92,L4=44,z4=150,D4=[" → "," -> "," → "," > "];function Sb(e,t,n){const r=o=>o.length*t*Nt<=n;if(r(e))return[e];for(const o of D4){if(!e.includes(o))continue;const s=e.split(o).map((a,l)=>l===0?a:`${o.trim()} ${a}`.trim());if(s.every(r))return s}return[e]}function kb(e,t=831,n=1/0){const r=e.reduce((s,a)=>Math.max(s,a.length),0);if(r===0)return N4;const o=t/(r*Nt),i=n/(Math.max(1,e.length)*1.28);return Math.max(L4,Math.min(z4,Math.floor(Math.min(o,i))))}const iy=22,sy=44,O4=96,ay=22,Eb=.85,Cb=.82;function Ib(e,t,n){const o=(n-80)*Cb-2*t*Eb;let i=0;for(const s of e)i+=Go(s.length,t,o,1.2,Ju)+t*1.2+4;return i+t*.5*Math.max(0,e.length-1)}function Tb(e){const t=Ye(e.keyword);return t?[{from:"user",text:`"${t.toUpperCase()}"`}]:Dr(e.messages).map(n=>{const r=n??{};return{from:r.from==="agent"?"agent":"user",text:Ye(r.text)}})}function Rb(e,t={}){const n=t.widthPx??831,r=t.heightPx??1/0,o=n-80,i=e.reduce((p,m)=>Math.max(p,m.length),0);if(i===0)return sy;const s=e.flatMap(p=>p.split(/\s+/)).reduce((p,m)=>Math.max(p,m.length),0),a=p=>o*Cb/(p*Ju+2*Eb),l=Math.min(i,ay),c=i>ay?sy:O4;let f=Math.floor(Math.min(a(l),a(s),c));for(;f>iy&&Ib(e,f,n)>r*gh;)f-=1;return Math.max(iy,f)}const ly=26,B4=22,W4=76,Cs=2.1,jb=2.05;function Pb(e,t,n=1/0){const r=e.reduce((x,k)=>x+k.length,0),o=Math.max(1,e.length),i=.78,s=1.6,a=1.8,l=t-20,c=Math.floor(Math.min(l/(i*r+s*o+a*(o-1)),n/Cs)),f=Math.max(...e.map(x=>x.length),1),p=Cs*o+jb*(o-1),m=Math.floor(Math.min(l/(i*f+s),n/p,W4)),g=c>=ly;return m>=B4?g?c*Cs>=m*p?{mode:"row",fontSize:c}:{mode:"stack",fontSize:m}:{mode:"stack",fontSize:m}:{mode:"row",fontSize:Math.max(ly,c)}}function V4(e,t,n){if(R4.has(e))return 1;const r=n.heightPx*gh,o=c=>P4(e,t,n.widthPx/c)*c<=r;if(!o(Ka))return Ka;const i=F4(e,t),s=i>0?n.widthPx/i:ry;let a=Ka,l=Math.max(Ka,Math.min(ry,s));if(l<=a)return a;for(let c=0;c<24;c++){const f=(a+l)/2;o(f)?a=f:l=f}return a}function Et(e=0){const t=Ft(),{fps:n}=ht();return pf({frame:t-e,fps:n,config:{damping:200,stiffness:130},durationInFrames:Math.round(n*.5)})}function nr(e,t=26){return{opacity:e,transform:`translateY(${(1-e)*t}px)`}}function To(e){return{opacity:e,transform:`scale(${.9+.1*e})`}}function H4(e,t){return!e||t===1?e:Object.fromEntries(Object.entries(e).map(([n,r])=>[n,{...r,...r.dx!==void 0?{dx:r.dx/t}:{},...r.dy!==void 0?{dy:r.dy/t}:{}}]))}function wt(e,t){const n=e==null?void 0:e[t];if(!n)return{};if(n.hidden)return{display:"none"};const r=[`translate(${n.dx??0}px, ${n.dy??0}px)`];return n.scale!==void 0&&n.scale!==1&&r.push(`scale(${n.scale})`),{transform:r.join(" ")}}const U4=({props:e,theme:t,edits:n})=>{var l;const r=Et(0),o=Et(5),i=Et(10),s=(l=e.emphasis)==null?void 0:l.trim(),a=!!s&&s.toLowerCase().includes(e.title.trim().toLowerCase());return u.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:28,textAlign:"center",fontFamily:t.fontDisplay,color:t.fg,padding:"0 40px"},children:[e.eyebrow?u.jsx("div",{"data-edit-id":"eyebrow",style:{...nr(r),fontSize:34,fontWeight:700,letterSpacing:"0.35em",color:t.muted,textTransform:"uppercase",...wt(n,"eyebrow")},children:e.eyebrow}):null,s?u.jsx("div",{"data-edit-id":"emphasis",style:{...nr(o,40),fontSize:210,fontWeight:900,lineHeight:.95,...wt(n,"emphasis")},children:s}):null,a?null:u.jsx("div",{"data-edit-id":"title",style:{...nr(s?i:o,34),fontSize:s?64:96,fontWeight:900,lineHeight:1.05,textTransform:"uppercase",letterSpacing:"0.02em",...wt(n,"title")},children:e.title}),e.sub?u.jsx("div",{"data-edit-id":"sub",style:{...nr(i),fontSize:40,fontWeight:600,color:t.muted,...wt(n,"sub")},children:e.sub}):null]})},Z4=({props:e,theme:t,edits:n})=>{const r=Et(0),o=Et(6),i=e.inverted;return u.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:30,fontFamily:t.fontDisplay,width:"100%",padding:"0 30px"},children:[u.jsxs("div",{style:{...To(r),display:"flex",alignItems:"center",justifyContent:"space-between",gap:40,width:"100%",background:i?t.fg:t.cardBg,color:i?t.bg:t.fg,border:`2px solid ${i?t.fg:t.cardBorder}`,borderRadius:t.radiusPx,padding:"44px 52px"},children:[u.jsx("div",{"data-edit-id":"label",style:{fontSize:42,fontWeight:800,textTransform:"uppercase",letterSpacing:"0.06em",lineHeight:1.15,maxWidth:"55%",...wt(n,"label")},children:e.label}),u.jsx("div",{"data-edit-id":"value",style:{fontSize:110,fontWeight:900,whiteSpace:"nowrap",...wt(n,"value")},children:e.value})]}),e.caption?u.jsx("div",{"data-edit-id":"caption",style:{...nr(o),fontSize:38,fontWeight:800,color:t.fg,background:t.cardBg,border:`2px solid ${t.cardBorder}`,borderRadius:t.radiusPx/2,padding:"16px 30px",textTransform:"uppercase",letterSpacing:"0.08em",...wt(n,"caption")},children:e.caption}):null]})},K4=({props:e,theme:t,edits:n})=>{const r=Et(0),o=Et(8);return u.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:26,fontFamily:t.fontDisplay,width:"100%",padding:"0 30px"},children:[u.jsxs("div",{style:{...To(r),width:"100%",background:t.fg,color:t.bg,borderRadius:t.radiusPx,padding:"40px 48px",textAlign:"left"},children:[u.jsx("div",{"data-edit-id":"kicker",style:{fontSize:30,fontWeight:800,letterSpacing:"0.28em",textTransform:"uppercase",color:"#55555E",marginBottom:14,fontFamily:t.fontMono,...wt(n,"kicker")},children:e.kicker}),u.jsx("div",{"data-edit-id":"text",style:{fontSize:72,fontWeight:900,lineHeight:1.02,textTransform:"uppercase",...wt(n,"text")},children:e.text})]}),e.struck?u.jsx("div",{"data-edit-id":"struck",style:{...nr(o),fontSize:44,fontWeight:800,color:t.muted,textDecoration:"line-through",textDecorationThickness:6,textDecorationColor:t.danger,textTransform:"uppercase",letterSpacing:"0.04em",...wt(n,"struck")},children:e.struck}):null]})},Y4=({text:e,struck:t,mark:n,delay:r,fontSize:o,theme:i,editId:s,edits:a})=>{const l=Et(r),c=Et(r+8);return u.jsxs("div",{"data-edit-id":s,style:{...nr(l,30),position:"relative",display:"inline-block",...wt(a,s)},children:[u.jsxs("span",{style:{fontSize:o,fontWeight:900,textTransform:"uppercase",lineHeight:1.08,whiteSpace:"nowrap",color:t?i.muted:i.fg},children:[n!=="none"?u.jsx("span",{style:{color:n==="cross"?i.danger:i.success,marginRight:"0.3em"},children:n==="cross"?"✗":"✓"}):null,e]}),t?u.jsx("div",{style:{position:"absolute",left:"-2%",top:"50%",height:o*.11,width:`${c*104}%`,background:i.danger,borderRadius:o*.055,transform:"translateY(-50%) rotate(-2deg)"}}):null]})},G4=({props:e,theme:t,widthPx:n,heightPx:r,edits:o})=>{const i=e.lines.map(l=>(l.mark??"none")!=="none"?`✗ ${l.text}`:l.text),s=kb(i,n,r),a=e.lines.flatMap((l,c)=>Sb(l.text,s,n??831).map((f,p)=>({text:f,struck:l.struck,mark:p===0?l.mark??"none":"none",lineIndex:c})));return u.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:s*.2,textAlign:"center",fontFamily:t.fontDisplay},children:a.map((l,c)=>u.jsx(Y4,{text:l.text,struck:l.struck,mark:l.mark,delay:c*6,fontSize:s,theme:t,editId:`line-${l.lineIndex}`,edits:o},c))})},X4=({text:e,emphasized:t,delay:n,fontSize:r,theme:o,editId:i,edits:s})=>{const a=Et(n);return u.jsx("div",{"data-edit-id":i,style:{...To(a),background:t?o.fg:o.cardBg,color:t?o.bg:o.fg,border:`2px solid ${t?o.fg:o.cardBorder}`,borderRadius:o.radiusPx/2,padding:`${r*.55}px ${r*.8}px`,fontSize:r,fontWeight:900,textTransform:"uppercase",letterSpacing:"0.04em",whiteSpace:"nowrap",fontFamily:o.fontDisplay,...wt(s,i)},children:e})},q4=({delay:e,fontSize:t,theme:n,down:r=!1})=>{const o=Et(e);return u.jsx("div",{style:{opacity:o,color:n.muted,fontSize:t*1.15,fontWeight:700,lineHeight:1,paddingLeft:r?0:t*.55},children:r?"↓":"→"})};function J4(e,t=Q4,n){return Pb(e,t,n)}const Q4=864,eA=({props:e,theme:t,widthPx:n,heightPx:r,edits:o})=>{const{mode:i,fontSize:s}=J4(e.nodes,n,r),a=i==="row";return u.jsx("div",{style:{display:"flex",flexDirection:a?"row":"column",flexWrap:"nowrap",alignItems:"center",justifyContent:"center",gap:a?0:s*.45,padding:"0 10px"},children:e.nodes.map((l,c)=>u.jsxs("div",{style:{display:"flex",flexDirection:a?"row":"column",alignItems:"center",gap:a?s*.55:s*.45},children:[c>0?u.jsx(q4,{delay:c*6+3,fontSize:s,theme:t,down:!a}):null,u.jsx(X4,{text:l,emphasized:e.emphasizeLast&&c===e.nodes.length-1,delay:c*6,fontSize:s,theme:t,editId:`node-${c}`,edits:o})]},c))})},tA=({title:e,lines:t,delay:n,theme:r,editId:o,edits:i})=>{const s=Et(n);return u.jsxs("div",{"data-edit-id":o,style:{...To(s),background:r.cardBg,border:`2px solid ${r.cardBorder}`,borderRadius:r.radiusPx/2,overflow:"hidden",width:"100%",fontFamily:r.fontMono,...wt(i,o)},children:[u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"14px 20px",borderBottom:`2px solid ${r.cardBorder}`},children:[["#FF5F57","#FEBC2E","#28C840"].map(a=>u.jsx("div",{style:{width:16,height:16,borderRadius:8,background:a}},a)),u.jsx("div",{style:{marginLeft:10,fontSize:24,color:r.muted},children:e})]}),u.jsx("div",{style:{padding:"18px 22px",display:"flex",flexDirection:"column",gap:8},children:t.map((a,l)=>u.jsx("div",{style:{fontSize:27,color:r.fg,whiteSpace:"pre"},children:a},l))})]})},nA=({props:e,theme:t,edits:n})=>{const r=Et(e.windows.length*6+4);return u.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:22,width:"100%",padding:"0 30px"},children:[e.windows.map((o,i)=>u.jsx(tA,{title:o.title,lines:o.lines,delay:i*6,theme:t,editId:`window-${i}`,edits:n},i)),e.fanOut?u.jsxs("div",{"data-edit-id":"fanOut",style:{...nr(r),fontFamily:t.fontDisplay,fontSize:40,fontWeight:900,letterSpacing:"0.2em",color:t.fg,textTransform:"uppercase",...wt(n,"fanOut")},children:["⌄ ",e.fanOut]}):null]})},rA=({from:e,text:t,delay:n,fontSize:r,theme:o,editId:i,edits:s})=>{const a=Et(n),l=e==="user";return u.jsx("div",{"data-edit-id":i,style:{...To(a),alignSelf:l?"flex-end":"flex-start",background:l?o.fg:o.cardBg,color:l?o.bg:o.fg,border:`2px solid ${l?o.fg:o.cardBorder}`,borderRadius:28,[l?"borderBottomRightRadius":"borderBottomLeftRadius"]:8,padding:`${r*.6}px ${r*.85}px`,fontSize:r,fontWeight:700,maxWidth:"82%",fontFamily:o.fontDisplay,...wt(s,i)},children:t})},oA=({props:e,theme:t,widthPx:n,heightPx:r,edits:o})=>{const i=Tb(e),s=Rb(i.map(a=>a.text),{widthPx:n,heightPx:r});return u.jsx("div",{style:{display:"flex",flexDirection:"column",gap:s*.5,width:"100%",padding:"0 40px"},children:i.map((a,l)=>u.jsx(rA,{from:a.from,text:a.text,delay:l*8,fontSize:s,theme:t,editId:`message-${l}`,edits:o},l))})},iA=({props:e,theme:t,edits:n})=>{const r=Et(0),o=Et(8),i=Ft(),{fps:s}=ht(),a=e.kenBurns?Di(i,[0,s*8],[1,1.08],{extrapolateRight:"clamp"}):1,l=e.src?/^https?:\/\//.test(e.src)?e.src:eh(e.src):null;return u.jsxs("div",{"data-edit-id":"src",style:{...To(r),position:"relative",width:"94%",...wt(n,"src")},children:[u.jsx("div",{style:{overflow:"hidden",borderRadius:t.radiusPx/2,border:`2px solid ${t.cardBorder}`,background:t.cardBg,boxShadow:"0 24px 80px rgba(0,0,0,0.5)"},children:l?u.jsx(Gp,{src:l,style:{width:"100%",display:"block",transform:`scale(${a})`}}):u.jsx("div",{style:{height:420,display:"flex",flexDirection:"column",gap:14,padding:30,transform:`scale(${a})`},children:[.9,.75,.85,.6,.8,.5].map((c,f)=>u.jsx("div",{style:{height:22,width:`${c*100}%`,borderRadius:6,background:f%3===0?t.cardBorder:"#22222B"}},f))})}),e.label?u.jsx("div",{"data-edit-id":"label",style:{...To(o),position:"absolute",right:-8,bottom:-20,background:t.fg,color:t.bg,fontFamily:t.fontMono,fontSize:28,fontWeight:800,letterSpacing:"0.08em",padding:"12px 22px",borderRadius:10,textTransform:"uppercase",...wt(n,"label")},children:e.label}):null]})},sA=({text:e,index:t,fontSize:n,theme:r,edits:o})=>{const i=`item-${t}`,s=Et(t*7);return u.jsxs("div",{"data-edit-id":i,style:{...nr(s,26),display:"flex",alignItems:"baseline",gap:n*.35,...wt(o,i)},children:[u.jsx("span",{style:{fontSize:n*.75,color:r.accent,fontWeight:900},children:"▸"}),u.jsx("span",{style:{fontSize:n,fontWeight:900,textTransform:"uppercase",lineHeight:1.15,whiteSpace:"nowrap",color:r.fg},children:e})]})},aA=({props:e,theme:t,widthPx:n,heightPx:r,edits:o})=>{const i=bb(e.items,n,r,!!e.title,e.title),s=Et(0);return u.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:i*.45,fontFamily:t.fontDisplay},children:[e.title?u.jsx("div",{"data-edit-id":"title",style:{...nr(s,20),fontSize:i*.36,fontWeight:700,letterSpacing:"0.28em",textTransform:"uppercase",color:t.muted,...wt(o,"title")},children:e.title}):null,e.items.map((a,l)=>u.jsx(sA,{text:a,index:l,fontSize:i,theme:t,edits:o},l))]})},lA={TitleCard:U4,StatCard:Z4,RuleCard:K4,StrikethroughReveal:G4,FlowDiagram:eA,TerminalMock:nA,ChatMock:oA,ScreenshotFrame:iA,BulletList:aA},uA=new Set(["lower-third","full-bleed"]),cA=.55,dA=e=>{const t=/^#([0-9a-fA-F]{6})$/.exec(e.trim()),[n,r,o]=t?[0,2,4].map(i=>Number.parseInt(t[1].slice(i,i+2),16)):[0,0,0];return`rgba(${n}, ${r}, ${o}, ${cA})`},fA=e=>({width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",opacity:e,transform:e<1?`translateY(${(1-e)*18}px)`:void 0}),pA=({durationInFrames:e,children:t})=>{const n=Ft(),{fps:r}=ht(),{exitSec:o}=mb(e/r),i=(e-n)/r,s=o<=0?1:Math.min(1,Math.max(0,i/o));return u.jsx("div",{style:fA(mh(s)),children:t})},hA=({durationInFrames:e,themeBg:t,radiusPx:n})=>{const r=Ft(),{fps:o}=ht(),{enterSec:i}=mb(e/o),s=i<=0?1:Math.min(1,Math.max(0,r/o/i)),a=mh(s);return u.jsx("div",{style:{position:"absolute",inset:0,background:dA(t),backdropFilter:"blur(14px)",WebkitBackdropFilter:"blur(14px)",borderRadius:n,opacity:a,transform:a<1?`translateY(${(1-a)*18}px)`:void 0}})},mA=({cues:e,theme:t})=>{const{fps:n,width:r,height:o}=ht();return u.jsx(Hn,{style:{pointerEvents:"none"},children:e.map(i=>{if(i.kind==="plain"||!i.component||!i.props)return null;const s=fb(i,{width:r,height:o}),a=lA[i.component],{from:l,durationInFrames:c}=ih(i.startSec,i.endSec,n),f=s.w*r,p=s.h*o,m=uA.has(i.layout),g=m?Math.min(24,Math.round(p*.12)):0,w=f-g*2,x=p-g*2,k=V4(i.component,i.props,{widthPx:w,heightPx:x});return u.jsx(_t,{from:l,durationInFrames:c,children:u.jsx("div",{"data-edit-scene":i.id,style:{position:"absolute",left:`${s.x*100}%`,top:`${s.y*100}%`,width:`${s.w*100}%`,height:`${s.h*100}%`,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"auto",overflow:"hidden"},children:u.jsxs(pA,{durationInFrames:c,children:[m?u.jsx(hA,{durationInFrames:c,themeBg:t.bg,radiusPx:t.radiusPx}):null,u.jsx("div",{style:{width:w/k,transform:`scale(${k})`,position:"relative"},children:u.jsx(a,{props:i.props,theme:t,widthPx:w/k,heightPx:x/k,edits:H4(i.elements,k)})})]})})},i.id)})})},gA="made with ossclip",yA=.45,vA=.024;function wA(e=rn){const t=Qn(e);return{xPx:Math.round(t.left*e.width),yPx:Math.round(t.top*e.height),fontPx:Math.round(Math.min(e.width,e.height)*vA),opacity:yA,text:gA}}function xA(e){return e===!0}const bA=({theme:e,frame:t})=>{const n=wA(t);return u.jsx("div",{style:{position:"absolute",left:n.xPx,top:n.yPx,fontFamily:e.fontDisplay,fontSize:n.fontPx,fontWeight:600,letterSpacing:"0.02em",color:e.fg,opacity:n.opacity,pointerEvents:"none",whiteSpace:"nowrap"},children:n.text})};function SA(e){return e!==!0}const kA=({videoFileName:e,spans:t,captionLines:n,sceneCues:r,theme:o,settings:i,face:s,zoomPlan:a,ctaKeyword:l,ctaWindow:c,sourceTextRegions:f,contentTimeline:p,framingTimeline:m,sourceSize:g,contentCropMode:w,sourceFit:x,watermark:k,captionsHidden:h,staticCamera:y,punch:v})=>{if(!e)return u.jsx(Hn,{style:{backgroundColor:"#111",color:"#888",alignItems:"center",justifyContent:"center",fontFamily:"monospace",fontSize:40},children:"no production loaded"});const S=/^https?:\/\//.test(e)?e:eh(e),b=x==="contain"||y===!0?null:Lj(v);return u.jsxs(Hn,{style:{backgroundColor:"black"},children:[u.jsx(C4,{cues:r,theme:o,face:s,zoomPlan:a,sourceTextRegions:f,contentTimeline:p,framingTimeline:m,spans:t,sourceSize:g,contentCropMode:w,sourceFit:x,children:u.jsx(Dj,{src:S,spans:t,...b?{punch:b}:{},...x==="contain"?{punchInScale:1,background:"transparent"}:{},...y===!0?{punchInScale:1}:{}})}),u.jsx(mA,{cues:r,theme:o}),SA(h)?u.jsx(w4,{lines:n,cues:r,activeColor:o.accent,theme:o,ctaKeyword:l,ctaWindow:c,sourceTextRegions:f}):null,xA(k)?u.jsx(bA,{theme:o,frame:{width:i.width,height:i.height}}):null]})},EA=600,CA=()=>({doc:i$(),past:[],future:[],dirty:!1,savedAt:0,lastCoalesce:null}),qn=(e,t)=>e.scenes[t]??{props:{},elements:{}};function IA(e,t){var r;const n=(o,i)=>{const s=Date.now(),a=i!==void 0&&e.lastCoalesce!==null&&e.lastCoalesce.key===i&&s-e.lastCoalesce.at<EA;return{doc:o,past:a?e.past:[...e.past,e.doc],future:[],dirty:!0,savedAt:e.savedAt,lastCoalesce:i!==void 0?{key:i,at:s}:null}};switch(t.type){case"load":return{doc:t.doc,past:[],future:[],dirty:!1,savedAt:0,lastCoalesce:null};case"patchProps":{const o=qn(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...o,props:{...o.props,...t.patch}}}},t.coalesce)}case"patchElement":return n(qg(e.doc,t.sceneId,t.elementId,t.patch),t.coalesce);case"clearElement":return n(w$(e.doc,t.sceneId,t.elementId));case"hideElement":return n(qg(e.doc,t.sceneId,t.elementId,{hidden:!0}));case"restoreElement":{const o=(r=e.doc.scenes[t.sceneId])==null?void 0:r.elements[t.elementId];return o!=null&&o.hidden?n(x$(e.doc,t.sceneId,t.elementId)):e}case"patchTiming":{const o=qn(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...o,timing:{startSec:t.startSec,endSec:t.endSec}}}})}case"clearTiming":return n(b$(e.doc,t.sceneId));case"patchVideo":{const o=qn(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...o,video:{...o.video,...t.patch}}}},t.coalesce)}case"clearVideo":{const o=e.doc.scenes[t.sceneId];if(!(o!=null&&o.video))return e;const{video:i,...s}=o;return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:s}})}case"patchPip":{const o=qn(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...o,pip:{...o.pip,...t.patch}}}},t.coalesce)}case"clearPip":{const o=e.doc.scenes[t.sceneId];if(!(o!=null&&o.pip))return e;const{pip:i,...s}=o;return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:s}})}case"patchCaptionY":{const o=qn(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...o,captionY:t.y}}},t.coalesce)}case"patchCaptionScale":{const o=qn(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...o,captionScale:t.scale}}},t.coalesce)}case"clearCaptionStyle":{const o=e.doc.scenes[t.sceneId];if((o==null?void 0:o.captionY)===void 0&&(o==null?void 0:o.captionScale)===void 0)return e;const{captionY:i,captionScale:s,...a}=o;return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:a}})}case"patchCaptionStyleAll":{const o={...e.doc.scenes};for(const i of t.sceneIds){const s=o[i]??{props:{},elements:{}};o[i]={...s,...t.y!==void 0?{captionY:t.y}:{},...t.scale!==void 0?{captionScale:t.scale}:{}}}return n({...e.doc,scenes:o})}case"addSplit":return e.doc.splits.some(o=>Math.abs(o.at-t.t)<.001)?e:n({...e.doc,splits:[...e.doc.splits,{at:t.t,id:r$(t.t,e.doc.splits)}].sort((o,i)=>o.at-i.at)});case"setCaptionsHidden":{if(t.hidden===(e.doc.captionsHidden===!0))return e;if(t.hidden)return n({...e.doc,captionsHidden:!0});const{captionsHidden:o,...i}=e.doc;return n(i)}case"hideScene":{const o=qn(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...o,hidden:!0}}})}case"restoreScene":{const o=e.doc.scenes[t.sceneId];if(!(o!=null&&o.hidden))return e;const{hidden:i,...s}=o;return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:s}})}case"cutChunk":{const o=e.doc.cuts.filter(i=>i.src!==void 0||i.startSec!==t.startSec||i.endSec!==t.endSec);return n({...e.doc,cuts:[...o,{startSec:t.startSec,endSec:t.endSec}]})}case"restoreChunk":{if(t.index<0||t.index>=e.doc.cuts.length)return e;const o=e.doc.cuts.filter((i,s)=>s!==t.index);return n({...e.doc,cuts:o})}case"patchComponent":{const o=qn(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...o,component:t.component}}})}case"patchLayout":{const{graphicRect:o,...i}=qn(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...i,layout:t.layout}}})}case"patchGraphicRect":{const o=qn(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...o,graphicRect:t.rect}}},t.coalesce)}case"clearGraphicRect":return n(S$(e.doc,t.sceneId));case"patchCaption":{const o=kn(t.srcStart),i=Yg(e.doc.captions,o,t.was);if(t.text===i){const{[o]:s,...a}=e.doc.captions;return n({...e.doc,captions:a})}return n({...e.doc,captions:{...e.doc.captions,[o]:{text:t.text,was:i}}})}case"patchCaptionRange":{const o=kn(t.fromSrcStart),i=kn(t.toSrcStart),s=t.text.trim();if(!s)return e;const a=Gg(e.doc.captionRangeEdits,o,i,t.was);if(s===a){const x=e.doc.captionRangeEdits.filter(k=>k.fromKey!==o||k.toKey!==i);return x.length===e.doc.captionRangeEdits.length?e:n({...e.doc,captionRangeEdits:x})}const l=Math.min(Math.round(t.fromSrcStart*1e3),Math.round(t.toSrcStart*1e3)),c=Math.max(Math.round(t.fromSrcStart*1e3),Math.round(t.toSrcStart*1e3)),f=x=>{if(Ys(x))return!1;const k=Number(x.slice(1));return k>=l&&k<=c},p=Object.fromEntries(Object.entries(e.doc.captions).filter(([x])=>!f(x))),m=Object.fromEntries(Object.entries(e.doc.captionWordsHidden).filter(([x])=>!f(x))),g=Object.fromEntries(Object.entries(e.doc.captionLineTiming).filter(([x])=>!f(x))),w=[...e.doc.captionRangeEdits.filter(x=>{const k=Math.min(Number(x.fromKey.slice(1)),Number(x.toKey.slice(1)));return Math.max(Number(x.fromKey.slice(1)),Number(x.toKey.slice(1)))<l||k>c}),{fromKey:o,toKey:i,text:s,was:a}];return n({...e.doc,captions:p,captionWordsHidden:m,captionLineTiming:g,captionRangeEdits:w})}case"patchCaptionAllOccurrences":{let o=e.doc.captions,i=!1;for(const s of t.entries){const a=kn(s.srcStart),l=Yg(o,a,s.was);if(t.text===l){if(!(a in o))continue;const{[a]:f,...p}=o;o=p,i=!0;continue}const c=o[a];c!==void 0&&c.text===t.text&&c.was===l||(o={...o,[a]:{text:t.text,was:l}},i=!0)}return i?n({...e.doc,captions:o}):e}case"patchCaptionRangeAllOccurrences":{const o=t.text.trim();if(!o)return e;let i=e.doc,s=!1;for(const a of t.entries){const l=kn(a.fromSrcStart),c=kn(a.toSrcStart),f=Gg(i.captionRangeEdits,l,c,a.was);if(o===f){const w=i.captionRangeEdits.filter(x=>x.fromKey!==l||x.toKey!==c);if(w.length===i.captionRangeEdits.length)continue;i={...i,captionRangeEdits:w},s=!0;continue}const p=Math.min(Math.round(a.fromSrcStart*1e3),Math.round(a.toSrcStart*1e3)),m=Math.max(Math.round(a.fromSrcStart*1e3),Math.round(a.toSrcStart*1e3)),g=w=>{if(Ys(w))return!1;const x=Number(w.slice(1));return x>=p&&x<=m};i={...i,captions:Object.fromEntries(Object.entries(i.captions).filter(([w])=>!g(w))),captionWordsHidden:Object.fromEntries(Object.entries(i.captionWordsHidden).filter(([w])=>!g(w))),captionLineTiming:Object.fromEntries(Object.entries(i.captionLineTiming).filter(([w])=>!g(w))),captionRangeEdits:[...i.captionRangeEdits.filter(w=>{const x=Math.min(Number(w.fromKey.slice(1)),Number(w.toKey.slice(1)));return Math.max(Number(w.fromKey.slice(1)),Number(w.toKey.slice(1)))<p||x>m}),{fromKey:l,toKey:c,text:o,was:f}]},s=!0}return s?n(i):e}case"patchCaptionLineTiming":{let o=e.doc.captionLineTiming,i=!1;for(const s of t.entries){const a=kn(s.srcStart);if(Math.abs(s.lead)<.001&&Math.abs(s.tail)<.001){if(!(a in o))continue;const{[a]:c,...f}=o;o=f,i=!0;continue}const l=o[a];l!==void 0&&l.lead===s.lead&&l.tail===s.tail||(o={...o,[a]:{lead:s.lead,tail:s.tail}},i=!0)}return i?n({...e.doc,captionLineTiming:o}):e}case"hideCaptionWords":{const o={...e.doc.captionWordsHidden};let i=!1;for(const s of t.words){const a=kn(s.srcStart);a in o||(o[a]={was:s.was},i=!0)}return i?n({...e.doc,captionWordsHidden:o}):e}case"restoreCaptionWords":{const o={...e.doc.captionWordsHidden};let i=!1;for(const s of t.srcStarts){const a=kn(s);a in o&&(delete o[a],i=!0)}return i?n({...e.doc,captionWordsHidden:o}):e}case"cutWords":{const o={...e.doc.captionWordsHidden};for(const s of t.words){const a=kn(s.srcStart);a in o||(o[a]={was:s.was})}const i=e.doc.cuts.filter(s=>s.src!==void 0||s.startSec!==t.startSec||s.endSec!==t.endSec);return n({...e.doc,captionWordsHidden:o,cuts:[...i,{startSec:t.startSec,endSec:t.endSec}]})}case"setReasonEnabled":{const{reasons:o}=e.doc.cleanup;if(t.enabled){if(!(t.reason in o))return e;const{[t.reason]:i,...s}=o;return n({...e.doc,cleanup:{...e.doc.cleanup,reasons:s}})}return o[t.reason]===!1?e:n({...e.doc,cleanup:{...e.doc.cleanup,reasons:{...o,[t.reason]:!1}}})}case"toggleKept":{if(!(t.srcOut>t.srcIn))return e;const{kept:o}=e.doc.cleanup,i=o.filter(a=>!(a.srcIn<t.srcOut&&a.srcOut>t.srcIn)),s=i.length<o.length?{...e.doc.cleanup,kept:i}:{...e.doc.cleanup,kept:[...o,{srcIn:t.srcIn,srcOut:t.srcOut}]};return n({...e.doc,cleanup:s})}case"patchTheme":return n({...e.doc,theme:{...e.doc.theme,...t.patch}});case"undo":{if(e.past.length===0)return e;const o=e.past[e.past.length-1],i=e.past.slice(0,-1);return{doc:o,past:i,future:[...e.future,e.doc],savedAt:e.savedAt,dirty:i.length!==e.savedAt,lastCoalesce:null}}case"redo":{if(e.future.length===0)return e;const o=e.future[e.future.length-1],i=[...e.past,e.doc];return{doc:o,past:i,future:e.future.slice(0,-1),savedAt:e.savedAt,dirty:i.length!==e.savedAt,lastCoalesce:null}}case"saved":return{...e,dirty:!1,savedAt:e.past.length}}}function TA(){const[e,t]=d.useReducer(IA,void 0,CA),n=async()=>{const r=await fetch("/api/overrides",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify(e.doc)});if(!r.ok){const o=await r.json().catch(()=>({}));throw new Error(o.error??"save failed")}t({type:"saved"})};return{doc:e.doc,dirty:e.dirty,canUndo:e.past.length>0,canRedo:e.future.length>0,load:r=>t({type:"load",doc:r}),undo:()=>t({type:"undo"}),redo:()=>t({type:"redo"}),save:n,patchProps:(r,o,i)=>t({type:"patchProps",sceneId:r,patch:o,coalesce:i}),patchElement:(r,o,i,s)=>t({type:"patchElement",sceneId:r,elementId:o,patch:i,coalesce:s}),clearElement:(r,o)=>t({type:"clearElement",sceneId:r,elementId:o}),hideElement:(r,o)=>t({type:"hideElement",sceneId:r,elementId:o}),restoreElement:(r,o)=>t({type:"restoreElement",sceneId:r,elementId:o}),patchTiming:(r,o,i)=>t({type:"patchTiming",sceneId:r,startSec:o,endSec:i}),clearTiming:r=>t({type:"clearTiming",sceneId:r}),patchVideo:(r,o,i)=>t({type:"patchVideo",sceneId:r,patch:o,coalesce:i}),clearVideo:r=>t({type:"clearVideo",sceneId:r}),patchPip:(r,o,i)=>t({type:"patchPip",sceneId:r,patch:o,coalesce:i}),clearPip:r=>t({type:"clearPip",sceneId:r}),patchCaptionY:(r,o,i)=>t({type:"patchCaptionY",sceneId:r,y:o,coalesce:i}),patchCaptionScale:(r,o,i)=>t({type:"patchCaptionScale",sceneId:r,scale:o,coalesce:i}),clearCaptionStyle:r=>t({type:"clearCaptionStyle",sceneId:r}),patchCaptionStyleAll:(r,o)=>t({type:"patchCaptionStyleAll",sceneIds:r,...o}),addSplit:r=>t({type:"addSplit",t:r}),setCaptionsHidden:r=>t({type:"setCaptionsHidden",hidden:r}),hideScene:r=>t({type:"hideScene",sceneId:r}),restoreScene:r=>t({type:"restoreScene",sceneId:r}),cutChunk:(r,o)=>t({type:"cutChunk",startSec:r,endSec:o}),restoreChunk:r=>t({type:"restoreChunk",index:r}),patchGraphicRect:(r,o,i)=>t({type:"patchGraphicRect",sceneId:r,rect:o,coalesce:i}),clearGraphicRect:r=>t({type:"clearGraphicRect",sceneId:r}),patchComponent:(r,o)=>t({type:"patchComponent",sceneId:r,component:o}),patchLayout:(r,o)=>t({type:"patchLayout",sceneId:r,layout:o}),patchCaption:(r,o,i)=>t({type:"patchCaption",srcStart:r,text:o,was:i}),patchCaptionRange:(r,o,i,s)=>t({type:"patchCaptionRange",fromSrcStart:r,toSrcStart:o,text:i,was:s}),patchCaptionAllOccurrences:(r,o)=>t({type:"patchCaptionAllOccurrences",entries:r,text:o}),patchCaptionRangeAllOccurrences:(r,o)=>t({type:"patchCaptionRangeAllOccurrences",entries:r,text:o}),patchCaptionLineTiming:r=>t({type:"patchCaptionLineTiming",entries:r}),hideCaptionWords:r=>t({type:"hideCaptionWords",words:r}),restoreCaptionWords:r=>t({type:"restoreCaptionWords",srcStarts:r}),cutWords:(r,o,i)=>t({type:"cutWords",words:r,startSec:o,endSec:i}),setReasonEnabled:(r,o)=>t({type:"setReasonEnabled",reason:r,enabled:o}),toggleKept:(r,o)=>t({type:"toggleKept",srcIn:r,srcOut:o}),patchTheme:r=>t({type:"patchTheme",patch:r})}}function uy(e){const t=e==null?void 0:e.closest("[data-edit-id]");if(!t)return null;const n=t.closest("[data-edit-scene]");return n?{sceneId:n.dataset.editScene,elementId:t.dataset.editId}:null}function cy(e){const t=e==null?void 0:e.closest("[data-edit-video]");return(t==null?void 0:t.dataset.editVideo)||null}function dy(e,t,n){const r=e.querySelectorAll(`[data-edit-scene="${t}"] [data-edit-id="${n}"]`);if(r.length===0)return null;let o=1/0,i=1/0,s=-1/0,a=-1/0;return r.forEach(l=>{const c=l.getBoundingClientRect();o=Math.min(o,c.left),i=Math.min(i,c.top),s=Math.max(s,c.right),a=Math.max(a,c.bottom)}),new DOMRect(o,i,s-o,a-i)}const fy=.015,RA=1e-9;function Vo(e,t){let n=null,r=1/0;for(const o of e){const i=Math.abs(o.feature-o.target);i<=t+RA&&i<r&&(n=o,r=i)}return n}function py(e,t,n,r){const o={...e},i=[];if(t==="move"){const s=e.x+e.w/2,a=e.x+e.w,l=.5-e.w/2,c=l>=n.left&&l+e.w<=1-n.right,f=Vo([...c?[{target:.5,feature:s}]:[],{target:n.left,feature:e.x},{target:1-n.right,feature:a}],r);f&&(o.x=e.x+(f.target-f.feature),i.push({axis:"x",at:f.target}));const p=e.y+e.h/2,m=e.y+e.h,g=.5-e.h/2,w=g>=n.top&&g+e.h<=1-n.bottom,x=Vo([...w?[{target:.5,feature:p}]:[],{target:n.top,feature:e.y},{target:1-n.bottom,feature:m}],r);return x&&(o.y=e.y+(x.target-x.feature),i.push({axis:"y",at:x.target})),{rect:o,guides:i}}if(t.includes("w")){const s=Vo([{target:n.left,feature:e.x}],r);if(s){const a=e.x+e.w;o.x=s.target,o.w=a-s.target,i.push({axis:"x",at:s.target})}}else if(t.includes("e")){const s=1-n.right,a=Vo([{target:s,feature:e.x+e.w}],r);a&&(o.w=a.target-e.x,i.push({axis:"x",at:a.target}))}if(t.includes("n")){const s=Vo([{target:n.top,feature:e.y}],r);if(s){const a=e.y+e.h;o.y=s.target,o.h=a-s.target,i.push({axis:"y",at:s.target})}}else if(t.includes("s")){const s=1-n.bottom,a=Vo([{target:s,feature:e.y+e.h}],r);a&&(o.h=a.target-e.y,i.push({axis:"y",at:a.target}))}return{rect:o,guides:i}}function jA(e){const t=e.spans;if(t===void 0)return{};let n;try{n=qu(t).spans.length}catch{return{}}if(n===0)return{};const r={};return e.captionLines&&(r.captionLines=Jg(e.captionLines,t)),e.baseCaptionLines&&(r.baseCaptionLines=Jg(e.baseCaptionLines,t)),r}function hy(e,t){const n=t.baseCaptionLines??t.captionLines??[],r=d$(e.captions,n);return{doc:{...e,captions:f$(e.captions,r)},unresolved:r.unresolved}}function PA(e){const t={};for(const[n,r]of Object.entries(e))Ys(n)||(t[n]=r);return t}function FA(e,t){const n=i=>JSON.stringify([i.text,i.was]),r=new Map;for(const i of Object.values(t))r.set(n(i),(r.get(n(i))??0)+1);const o=[];for(const i of Object.values(e)){const s=r.get(n(i))??0;s>0?r.set(n(i),s-1):o.push(i)}return o}function _A(e){return e.map(t=>`“${t.was}” was retyped as “${t.text}”, and the overrides this render wrote back no longer have it. Retype it if you still want it.`)}function Fb(e){return e.map(t=>{const n=`“${t.was}” was retyped in an older version of this project`;switch(t.reason){case"out-of-range":return`${n}, and the word is still here but too far from where the edit was stored to be sure it is the same one — it was left alone. It is still saved. Retype it here if that is the word you meant.`;case"ambiguous":return`${n}, and more than one word here says it — it was left alone rather than applied to the wrong one. Retype the one you meant.`;case"unanchorable":return`${n}, but this project's files carry no source timing for that word, so nothing can be anchored to it. Re-run produce, then retype it.`;case"collision":return`${n} twice, and both point at the same word — neither was applied. Retype the one you meant.`;case"superseded":return`${n} and again since; the newer edit was kept and the older one dropped.`;default:return`${n}, and no word here says it any more — the cut probably removed it. Retype it if you still want it.`}})}function MA(e){return e.map(t=>t.reason==="duplicate-anchor"?`“${t.expected}” shares its moment with another word — only the first was retyped.`:t.found===null?`“${t.expected}” was retyped, but no word in this cut sits at that moment any more.`:`“${t.expected}” was retyped, but the transcript says “${t.found}” there now.`)}function $A(e){return e.map(t=>t.reason==="duplicate-anchor"?`“${t.expected}” shares its moment with another word — only the first was hidden from the captions.`:t.found===null?`“${t.expected}” was hidden from the captions, but no word in this cut sits at that moment any more — the hidden word no longer exists.`:`“${t.expected}” was hidden from the captions, but the transcript says “${t.found}” there now — it was left visible rather than hiding a different word.`)}function AA(e){return e.map(t=>t.reason==="duplicate-anchor"?`“${t.expected}” was rewritten, but an earlier rewrite already claimed the word it starts on — only the first applied.`:t.found===null?`“${t.expected}” was rewritten, but its words no longer sit at those source moments — re-select and Edit if you still want it.`:`“${t.expected}” was rewritten, but the transcript says “${t.found}” there now — the whole rewrite was left unapplied rather than guessing at part of it.`)}function NA(e){return e.map(t=>t.reason==="duplicate-anchor"?`A re-timed caption (${t.key}) starts on the same moment as another — only the first was re-timed.`:`A re-timed caption (${t.key}) no longer exists — the cut removed it, so its timing nudge was dropped.`)}function LA(e){if(e===void 0||e.trim()==="")return null;const t=Number(e);return Ze({srcStart:t})===null?null:t}function zA(e,t){var i;if(!e)return null;const n=[];if(e.kind!=="plain"&&((i=t.scenes[e.id])==null?void 0:i.hidden)!==!0&&n.push("graphic"),t.cuts.some(s=>s.src===void 0&&s.startSec===e.startSec&&s.endSec===e.endSec)||n.push("take"),n.length===0)return null;const o=nb(e.id);return{sceneId:e.id,rootId:o,isSplitHalf:o!==e.id,startSec:e.startSec,endSec:e.endSec,targets:n}}function my(e,t,n,r){const o={...e};return t==="move"?(o.x+=n,o.y+=r,o):(t.includes("w")&&(o.x+=n,o.w-=n),t.includes("e")&&(o.w+=n),t.includes("n")&&(o.y+=r,o.h-=r),t.includes("s")&&(o.h+=r),o)}const gy=64,Ya=9,Ga=e=>Math.round(e*10)/10,Ho=e=>Math.round(e*1e4)/1e4,_b={position:"absolute",width:10,height:10,background:"#5b8cff",border:"1px solid #0B0B0E",borderRadius:2,pointerEvents:"auto",zIndex:6},yy={nw:{left:0,top:0,transform:"translate(-50%,-50%)",cursor:"nwse-resize"},n:{left:"50%",top:0,transform:"translate(-50%,-50%)",cursor:"ns-resize"},ne:{right:0,top:0,transform:"translate(50%,-50%)",cursor:"nesw-resize"},e:{right:0,top:"50%",transform:"translate(50%,-50%)",cursor:"ew-resize"},se:{right:0,bottom:0,transform:"translate(50%,50%)",cursor:"nwse-resize"},s:{left:"50%",bottom:0,transform:"translate(-50%,50%)",cursor:"ns-resize"},sw:{left:0,bottom:0,transform:"translate(-50%,50%)",cursor:"nesw-resize"},w:{left:0,top:"50%",transform:"translate(-50%,-50%)",cursor:"ew-resize"}},DA={..._b,background:"#ffe14d"},OA={top:{top:0,left:14,right:14,height:10},bottom:{bottom:0,left:14,right:14,height:10},left:{left:0,top:14,bottom:14,width:10},right:{right:0,top:14,bottom:14,width:10}},BA={position:"absolute",cursor:"move",pointerEvents:"auto",zIndex:5},Mb=/^(line|node|message|window|item)-(\d+)$/;function WA(e,t,n){const r=Mb.exec(e);if(!r)return null;const o=r[1],i=Number(r[2]);if(o==="message"&&i===0&&typeof t.keyword=="string"&&t.keyword){const f=n.trim().replace(/^"(.*)"$/,"$1").toLowerCase();return f?{keyword:f}:null}const s=o==="line"?"lines":o==="node"?"nodes":o==="item"?"items":o==="window"?"windows":"messages",a=t[s];if(!Array.isArray(a)||i<0||i>=a.length)return null;const l=a.slice(),c=l[i];if(o==="node"||o==="item")l[i]=n;else if(o==="window"){if(typeof c!="object"||c===null)return null;const f=n.split(`
162
- `).slice(0,6).map(p=>p.slice(0,40));l[i]={...c,lines:f}}else{if(typeof c!="object"||c===null)return null;l[i]={...c,text:n}}return{[s]:l}}function VA(e,t){const n=Mb.exec(e);if(!n){const c=t[e];return typeof c=="string"?c:null}const r=n[1],o=Number(n[2]);if(r==="message"&&o===0&&typeof t.keyword=="string"&&t.keyword)return t.keyword;const s=t[r==="line"?"lines":r==="node"?"nodes":r==="item"?"items":r==="window"?"windows":"messages"];if(!Array.isArray(s)||o<0||o>=s.length)return null;const a=s[o];if(r==="node"||r==="item")return typeof a=="string"?a:null;if(r==="window"){const c=a==null?void 0:a.lines;return Array.isArray(c)&&c.every(f=>typeof f=="string")?c.join(`
163
- `):null}const l=a==null?void 0:a.text;return typeof l=="string"?l:null}function $b(){const e=document.activeElement;(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&e.blur()}const HA=({stageRef:e,selection:t,onSelect:n,edits:r,onSave:o,settings:i,playerRef:s,onTransport:a,onVideoPreview:l,onGraphicPreview:c,cue:f,cues:p,onToggleHelp:m,onRequestDelete:g,fromLive:w=h=>h,hasOldClockPreimage:x=()=>!0,onClockRefused:k=()=>{}})=>{const[h,y]=d.useState(null),v=d.useRef(null),S=d.useRef(0),b=d.useRef(null),E=d.useRef(0),I=d.useRef(null),T=d.useRef(0),R=d.useRef(null),[F,A]=d.useState(!1),[W,M]=d.useState([]),$=d.useRef(null),[V,D]=d.useState(null),[L,j]=d.useState(null),C=d.useRef(null),[P,N]=d.useState({dx:0,dy:0}),O=d.useRef(null),z=d.useRef(t),Z=d.useCallback(B=>{z.current=B,n(B)},[n]);d.useEffect(()=>{z.current=t},[t]);const H=(B,X)=>{const ae=[];let oe=null;for(let Y=0;Y<25;Y++){const q=document.elementFromPoint(B,X);if(!q||q===document.documentElement||q===document.body){oe=q;break}if(oe=q,q.hasAttribute("data-edit-id")||q.hasAttribute("data-edit-scene")||q.hasAttribute("data-caption-word")||q.closest("[data-edit-video]")!==null||["BUTTON","INPUT","SELECT","TEXTAREA"].includes(q.tagName)||!(q instanceof HTMLElement))break;ae.push({el:q,prev:q.style.pointerEvents}),q.style.pointerEvents="none"}return ae.forEach(({el:Y,prev:q})=>{Y.style.pointerEvents=q}),oe},G=d.useCallback(()=>{var q,xe;const B=e.current,X=(q=s.current)==null?void 0:q.getScale(),ae=((xe=B==null?void 0:B.querySelector(".__remotion-player"))==null?void 0:xe.getBoundingClientRect())??(B==null?void 0:B.getBoundingClientRect());if(!ae||!X||X<=0)return null;const oe=i.width*X,Y=i.height*X;return{left:ae.left+(ae.width-oe)/2,top:ae.top+(ae.height-Y)/2,w:oe,h:Y}},[e,s,i]);return d.useEffect(()=>{if(!t){y(null);return}let B;const X=()=>{var oe;const ae=e.current;if(ae){const Y=t.elementId?dy(ae,t.sceneId,t.elementId):((oe=ae.querySelector(`[data-edit-scene="${t.sceneId}"]`))==null?void 0:oe.getBoundingClientRect())??null;y(Y)}B=requestAnimationFrame(X)};return B=requestAnimationFrame(X),()=>cancelAnimationFrame(B)},[e,t]),d.useEffect(()=>{const B=X=>{var Y,q;const ae=e.current;if(!ae||!ae.contains(X.target)||X.altKey||X.button!==0)return;(((Y=z.current)==null?void 0:Y.elementId)&&((q=O.current)==null?void 0:q.contains(X.target))||uy(H(X.clientX,X.clientY))!==null)&&X.stopPropagation()};return window.addEventListener("pointerdown",B,!0),()=>window.removeEventListener("pointerdown",B,!0)},[e]),d.useEffect(()=>{const B=X=>{var ee,ue,se,Re,Ie,De,Qe;const ae=e.current;if(!ae||!ae.contains(X.target))return;const oe=document.activeElement;if((oe instanceof HTMLInputElement||oe instanceof HTMLTextAreaElement)&&oe.contains(X.target)||($b(),X.altKey||X.button!==0))return;const Y=X.target instanceof Element?X.target.closest("[data-el-handle]"):null,q=z.current;if(Y&&(q!=null&&q.elementId)){const ke=dy(ae,q.sceneId,q.elementId);if(ke){const Ee=ke.left+ke.width/2,je=ke.top+ke.height/2,_e=Math.hypot(X.clientX-Ee,X.clientY-je);if(_e>2){const Le=((ue=(ee=r.doc.scenes[q.sceneId])==null?void 0:ee.elements[q.elementId])==null?void 0:ue.scale)??1;$.current={sceneId:q.sceneId,elementId:q.elementId,cx:Ee,cy:je,startDist:_e,prior:Le,factor:1},D(1)}}return}if((se=z.current)!=null&&se.elementId&&((Re=O.current)!=null&&Re.contains(X.target))){C.current={x:X.clientX,y:X.clientY,dx:0,dy:0},N({dx:0,dy:0});return}const xe=X.target instanceof Element?X.target.closest("[data-box-handle]"):null,Se=z.current;if(xe&&Se&&!Se.elementId){const ke=ae.querySelector(`[data-edit-scene="${Se.sceneId}"]`),Ee=G();if(ke&&Ee){const je=ke.getBoundingClientRect();R.current=null,I.current={sceneId:Se.sceneId,handle:xe.dataset.boxHandle,x:X.clientX,y:X.clientY,dx:0,dy:0,start:{x:(je.left-Ee.left)/Ee.w,y:(je.top-Ee.top)/Ee.h,w:je.width/Ee.w,h:je.height/Ee.h}},A(!0)}return}const de=H(X.clientX,X.clientY),K=uy(de);if(!K){const ke=de==null?void 0:de.closest("[data-edit-scene]");if(ke){Z({sceneId:ke.dataset.editScene,elementId:null});return}const Ee=cy(de),je=ae.getBoundingClientRect().bottom;if(Ee&&X.clientY<je-gy){Z({sceneId:Ee,elementId:null});const _e=p.find(dt=>dt.id===Ee);if((_e==null?void 0:_e.layout)==="pip-bubble"&&!X.altKey){const dt=Io("pip-bubble",void 0,[],i).video.rect;b.current={sceneId:Ee,x:X.clientX,y:X.clientY,base:{x:((Ie=_e.pip)==null?void 0:Ie.x)??dt.x,y:((De=_e.pip)==null?void 0:De.y)??dt.y},slot:{w:dt.w,h:dt.h}};return}const Le=(Qe=r.doc.scenes[Ee])==null?void 0:Qe.video;v.current={sceneId:Ee,x:X.clientX,y:X.clientY,dx:0,dy:0,baseDx:(Le==null?void 0:Le.dx)??0,baseDy:(Le==null?void 0:Le.dy)??0};return}Z(null);return}Z({sceneId:K.sceneId,elementId:K.elementId}),C.current={x:X.clientX,y:X.clientY,dx:0,dy:0},N({dx:0,dy:0})};return window.addEventListener("mousedown",B),()=>window.removeEventListener("mousedown",B)},[e,Z,r,G,p,i]),d.useEffect(()=>{const B=()=>{var q,xe;const oe=(q=s.current)==null?void 0:q.getScale(),Y=(xe=e.current)==null?void 0:xe.getBoundingClientRect();return oe&&oe>0?1/oe:Y&&Y.width>0?i.width/Y.width:1},X=oe=>{const Y=e.current;if(Y&&!(I.current||$.current))if(b.current)Y.style.cursor="move";else if(v.current)Y.style.cursor="grabbing";else{const ee=oe.target instanceof Element?oe.target:null,ue=ee!==null&&Y.contains(ee)&&!ee.closest("button, input, select, textarea, [data-edit-id], [data-edit-scene], [data-caption-word]")&&oe.clientY<Y.getBoundingClientRect().bottom-gy,se=ue&&(()=>{var Ie;const Re=cy(ee);return Re!==null&&((Ie=p.find(De=>De.id===Re))==null?void 0:Ie.layout)==="pip-bubble"})();Y.style.cursor=ue?se?"move":"grab":""}const q=$.current;if(q){const ue=Math.hypot(oe.clientX-q.cx,oe.clientY-q.cy)/q.startDist;q.factor=Math.min(4/q.prior,Math.max(.05/q.prior,ue)),D(q.factor);return}const xe=I.current;if(xe){xe.dx=oe.clientX-xe.x,xe.dy=oe.clientY-xe.y,R.current=oe.altKey,T.current||(T.current=requestAnimationFrame(()=>{T.current=0;const ee=I.current,ue=G();if(!ee||!ue)return;const se=tu(my(ee.start,ee.handle,ee.dx/ue.w,ee.dy/ue.h),i);if(oe.altKey)M([]),c({sceneId:ee.sceneId,rect:se});else{const Re=py(se,ee.handle,Qn(i),fy);M(Re.guides),c({sceneId:ee.sceneId,rect:Re.rect})}}));return}if(b.current){E.current||(E.current=requestAnimationFrame(()=>{E.current=0;const ee=b.current,ue=G();if(!ee||!ue)return;const se=(oe.clientX-ee.x)/ue.w,Re=(oe.clientY-ee.y)/ue.h;r.patchPip(ee.sceneId,{x:Ho(Math.min(Math.max(ee.base.x+se,0),1-ee.slot.w)),y:Ho(Math.min(Math.max(ee.base.y+Re,0),1-ee.slot.h))},`pip:${ee.sceneId}:drag`)}));return}const de=v.current;if(de){de.dx=oe.clientX-de.x,de.dy=oe.clientY-de.y,S.current||(S.current=requestAnimationFrame(()=>{S.current=0;const ee=v.current;if(!ee)return;const ue=B();l({sceneId:ee.sceneId,patch:{dx:ee.baseDx+ee.dx*ue,dy:ee.baseDy+ee.dy*ue}})}));return}const K=C.current;K&&(K.dx=oe.clientX-K.x,K.dy=oe.clientY-K.y,N({dx:K.dx,dy:K.dy}))},ae=oe=>{const Y=$.current;if(Y){$.current=null,D(null),Math.abs(Y.factor-1)>.001&&r.patchElement(Y.sceneId,Y.elementId,{scale:Math.round(Y.prior*Y.factor*1e3)/1e3});return}const q=I.current;if(q){if(I.current=null,A(!1),M([]),T.current&&(cancelAnimationFrame(T.current),T.current=0),q.dx!==0||q.dy!==0){const ee=G();if(ee){let ue=tu(my(q.start,q.handle,q.dx/ee.w,q.dy/ee.h),i);(R.current??oe.altKey)||(ue=py(ue,q.handle,Qn(i),fy).rect),r.patchGraphicRect(q.sceneId,{x:Ho(ue.x),y:Ho(ue.y),w:Ho(ue.w),h:Ho(ue.h)})}}R.current=null,c(null);return}if(b.current){b.current=null,E.current&&(cancelAnimationFrame(E.current),E.current=0);return}const Se=v.current;if(Se){if(v.current=null,S.current&&(cancelAnimationFrame(S.current),S.current=0),Se.dx!==0||Se.dy!==0){const ee=B();r.patchVideo(Se.sceneId,{dx:Ga(Se.baseDx+Se.dx*ee),dy:Ga(Se.baseDy+Se.dy*ee)})}l(null);return}const de=C.current,K=z.current;if(!de||!(K!=null&&K.elementId)){C.current=null;return}if(de.dx!==0||de.dy!==0){const ee=B(),ue=r.doc.scenes[K.sceneId],se=ue==null?void 0:ue.elements[K.elementId];r.patchElement(K.sceneId,K.elementId,{dx:Ga(((se==null?void 0:se.dx)??0)+de.dx*ee),dy:Ga(((se==null?void 0:se.dy)??0)+de.dy*ee)})}C.current=null,N({dx:0,dy:0})};return window.addEventListener("mousemove",X),window.addEventListener("mouseup",ae),()=>{window.removeEventListener("mousemove",X),window.removeEventListener("mouseup",ae)}},[r,e,i,s,l,c,G,p]),d.useEffect(()=>{const B=X=>{var xe;const ae=e.current;if(!ae||!ae.contains(X.target))return;const oe=(xe=H(X.clientX,X.clientY))==null?void 0:xe.closest("[data-caption-word]");if(!oe)return;X.preventDefault();const Y=LA(oe.dataset.captionSrc),q=oe.dataset.captionText??"";Y===null||!q||j({srcStart:Y,was:q,draft:q,rect:oe.getBoundingClientRect()})};return window.addEventListener("dblclick",B),()=>window.removeEventListener("dblclick",B)},[e]),d.useEffect(()=>{const B=()=>{const Y=document.activeElement;return Y instanceof HTMLInputElement||Y instanceof HTMLTextAreaElement||Y instanceof HTMLSelectElement||Y instanceof HTMLElement&&Y.isContentEditable},X=()=>{const Y=document.activeElement;return Y instanceof HTMLTextAreaElement||Y instanceof HTMLElement&&Y.isContentEditable?!0:Y instanceof HTMLInputElement&&!["range","checkbox","radio","button"].includes(Y.type)},ae=()=>{const Y=document.activeElement;Y instanceof HTMLElement&&!X()&&Y.blur()},oe=Y=>{var xe,Se,de;if(L!==null)return;const q=Y.metaKey||Y.ctrlKey;if(Y.key==="Escape"){if(B()){(xe=document.activeElement)==null||xe.blur();return}Z(null)}else if(q&&Y.key.toLowerCase()==="z")Y.preventDefault(),Y.shiftKey?r.redo():r.undo();else if(q&&Y.key.toLowerCase()==="y")Y.preventDefault(),r.redo();else if(q&&Y.key.toLowerCase()==="s")Y.preventDefault(),o();else if(Y.key===" "&&!q){if(X())return;const K=document.activeElement;if(K instanceof HTMLElement&&K.tagName==="BUTTON"&&((Se=e.current)!=null&&Se.contains(K)))return;ae(),Y.preventDefault(),(de=s.current)==null||de.toggle()}else if(!q&&["j","k","l"].includes(Y.key.toLowerCase())){if(X())return;ae(),Y.preventDefault(),a(Y.key.toUpperCase())}else if(!q&&!Y.altKey&&(Y.key==="ArrowLeft"||Y.key==="ArrowRight")){if(B())return;Y.preventDefault();const K=s.current;if(!K)return;K.seekTo(Math.max(0,K.getCurrentFrame()+(Y.key==="ArrowRight"?1:-1)))}else if(q&&Y.key.toLowerCase()==="b"){if(X())return;Y.preventDefault();const K=s.current;if(!K)return;const ee=K.getCurrentFrame()/i.fps;if(!p.find(se=>ee>=se.startSec+Ql&&ee<=se.endSec-Ql))return;if(!x(ee)){k("Can't split here: this moment isn't in the last render yet — render once (or re-remove the pause) to split here.");return}r.addSplit(Math.round(w(ee)*1e3)/1e3)}else if(!q&&Y.altKey&&(Y.key==="ArrowLeft"||Y.key==="ArrowRight")){if(X())return;const K=z.current,ee=K?(()=>{const ue=p.findIndex(se=>se.id===K.sceneId);return ue===-1?void 0:p[ue+(Y.key==="ArrowRight"?1:-1)]})():p[Y.key==="ArrowRight"?0:p.length-1];if(!ee)return;Y.preventDefault(),Z({sceneId:ee.id,elementId:null})}else if(q&&(Y.key==="ArrowLeft"||Y.key==="ArrowRight")){if(X())return;Y.preventDefault();const K=s.current;if(!K)return;const ee=K.getCurrentFrame()/i.fps,ue=p.findIndex(Re=>ee>=Re.startSec&&ee<Re.endSec),se=p[(ue===-1?0:ue)+(Y.key==="ArrowRight"?1:-1)];if(!se)return;K.seekTo(Math.round(se.startSec*i.fps)),Z({sceneId:se.id,elementId:null})}else if(!q&&!Y.altKey&&Y.key==="?"){if(B())return;Y.preventDefault(),m()}else if(!q&&(Y.key==="Delete"||Y.key==="Backspace")){if(B())return;const K=z.current;if(!K||K.elementId!==null||!f||f.id!==K.sceneId)return;const ee=zA(f,r.doc);if(!ee)return;Y.preventDefault(),g(ee)}};return window.addEventListener("keydown",oe),()=>window.removeEventListener("keydown",oe)},[Z,r,L,o,s,e,a,f,p,i,m,g,w,x,k]),u.jsxs("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},children:[P.dx!==0||P.dy!==0||F?u.jsx("div",{"data-testid":"safe-area-guide",style:{position:"absolute",left:`${Qn(i).left*100}%`,top:`${Qn(i).top*100}%`,right:`${Qn(i).right*100}%`,bottom:`${Qn(i).bottom*100}%`,border:"1px dashed rgba(255, 225, 77, 0.45)",boxShadow:"0 0 0 9999px rgba(0, 0, 0, 0.18)",pointerEvents:"none"}}):null,W.map(B=>u.jsx("div",{"data-testid":`guide-${B.axis}`,style:{position:"absolute",pointerEvents:"none",background:"#FFE14D",...B.axis==="x"?{left:`${B.at*100}%`,top:0,bottom:0,width:1}:{top:`${B.at*100}%`,left:0,right:0,height:1}}},B.axis)),h&&t?u.jsxs("div",{ref:O,"data-testid":"overlay-box",style:{position:"fixed",pointerEvents:"auto",left:h.left+P.dx-Ya/2+h.width*(1-(V??1))/2,top:h.top+P.dy-Ya/2+h.height*(1-(V??1))/2,width:h.width*(V??1)+Ya,height:h.height*(V??1)+Ya,border:t.elementId?"2px dashed #ffe14d":"2px dashed #5b8cff",borderRadius:4,boxShadow:"0 0 0 1px rgba(0,0,0,0.35)",cursor:t.elementId?"grab":"default"},children:[t.elementId?u.jsx("div",{style:{position:"absolute",bottom:"100%",left:0,marginBottom:4,fontSize:10,fontFamily:"ui-monospace, 'SF Mono', monospace",letterSpacing:"0.04em",textTransform:"uppercase",color:"#0B0B0E",background:"#ffe14d",padding:"2px 6px",borderRadius:3,whiteSpace:"nowrap"},children:t.elementId}):null,t.elementId?["nw","ne","se","sw"].map(B=>u.jsx("div",{"data-el-handle":B,"data-testid":`el-handle-${B}`,style:{...DA,...yy[B]}},B)):null,!t.elementId&&f&&f.kind!=="plain"?u.jsxs(u.Fragment,{children:[["top","bottom","left","right"].map(B=>u.jsx("div",{"data-box-handle":"move","data-testid":B==="top"?"box-handle-move":`box-handle-move-${B}`,style:{...BA,...OA[B]}},B)),["nw","n","ne","e","se","s","sw","w"].map(B=>u.jsx("div",{"data-box-handle":B,"data-testid":`box-handle-${B}`,style:{..._b,...yy[B]}},B))]}):null]}):null,L?u.jsx("input",{autoFocus:!0,"data-testid":"caption-edit",value:L.draft,onChange:B=>j({...L,draft:B.target.value}),onBlur:()=>{const B=L.draft.trim();B&&r.patchCaption(L.srcStart,B,L.was),j(null)},onKeyDown:B=>{B.key==="Enter"&&B.target.blur(),B.key==="Escape"&&j(null)},style:{position:"fixed",pointerEvents:"auto",left:L.rect.left-4,top:L.rect.top-4,width:Math.max(L.rect.width+40,90),height:L.rect.height+8,fontSize:Math.max(13,Math.min(L.rect.height*.7,28)),fontFamily:"'Inter', system-ui, sans-serif",fontWeight:800,border:"2px solid #FFE14D",borderRadius:4,padding:"0 4px",background:"#0B0B0E",color:"#fff",outline:"none",zIndex:11}}):null]})},ln={display:"flex",flexDirection:"column",gap:6},as={display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},We={fontSize:11,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"#9A9AA3"},di={fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",fontSize:13,background:"#0F0F14",border:"1px solid #2A2A33",borderRadius:6,color:"#fff",padding:"6px 8px",width:"100%"},jf={...di,fontFamily:"'Inter', system-ui, sans-serif"},ot={display:"flex",flexDirection:"column",gap:14,padding:"16px 18px",borderBottom:"1px solid #22222a"},sn={fontSize:12,fontWeight:600,color:"#FF5C5C",background:"transparent",border:"1px solid #452626",borderRadius:6,padding:"7px 10px",cursor:"pointer"},an=()=>{var e,t;(t=(e=document.activeElement)==null?void 0:e.blur)==null||t.call(e)},UA=e=>String(Math.round(e*1e3)/1e3),Xt=({id:e,value:t,onCommit:n,min:r,max:o,dragStep:i})=>{const[s,a]=le.useState(null),[l,c]=le.useState(!1),f=le.useRef(null),p=le.useRef(null),m=r??-1/0,g=o??1/0,w=i??(r!==void 0&&o!==void 0?(o-r)/240:.5),x=s!==null;return u.jsxs("div",{style:ln,children:[u.jsx("span",{style:We,children:e}),u.jsx("input",{type:"text",inputMode:"decimal",ref:f,"data-testid":`field-${e}`,style:{...di,...x?{}:{cursor:"ew-resize",touchAction:"none"},...l?{borderColor:"#FFE14D",color:"#FFE14D"}:{}},value:s??(Number.isFinite(t)?UA(t):"0"),onFocus:k=>a(k.target.value),onBlur:()=>a(null),onPointerDown:k=>{x||(k.preventDefault(),p.current={x:k.clientX,v:Number.isFinite(t)?t:0,moved:!1},k.currentTarget.setPointerCapture(k.pointerId),c(!0))},onPointerMove:k=>{const h=p.current;if(!h)return;const y=k.clientX-h.x;if(!h.moved&&Math.abs(y)<=2)return;h.moved=!0;const v=Math.round(Math.min(g,Math.max(m,h.v+y*w))*1e3)/1e3;n(v)},onPointerUp:()=>{var h,y,v;const k=((h=p.current)==null?void 0:h.moved)===!0;p.current=null,c(!1),k||((y=f.current)==null||y.focus(),(v=f.current)==null||v.select())},onPointerCancel:()=>{p.current=null,c(!1)},onChange:k=>{a(k.target.value);const h=k.target.value.trim();if(h==="")return;const y=Number(h.replace(",","."));Number.isFinite(y)&&n(Math.min(g,Math.max(m,y)))}})]})},Xa=({id:e,value:t,isColor:n,onCommit:r})=>u.jsxs("div",{style:ln,children:[u.jsx("span",{style:We,children:e}),u.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[n?u.jsx("input",{type:"color",value:t,onChange:o=>r(o.target.value),style:{width:28,height:28,border:"1px solid #2A2A33",borderRadius:6,padding:0,background:"none"}}):null,u.jsx("input",{"data-testid":`theme-${e}`,style:{...jf,flex:1},value:t,onChange:o=>r(o.target.value)})]})]}),ZA=({selection:e,cue:t,frame:n,allSceneIds:r,edits:o,onSelect:i,resolvedTheme:s,anchorText:a,onVideoPreview:l,runInfo:c,captionsHiddenByFlag:f,fromLive:p=w=>w,hasOldClockPreimage:m=()=>!0,onClockRefused:g=()=>{}})=>{var S,b,E,I,T,R,F,A,W,M,$,V;if(e!=null&&e.elementId&&t){const D=e.elementId,L=((S=t.elements)==null?void 0:S[D])??{},j=t.props?VA(D,t.props):null,C=/^window-\d+$/.test(D);return u.jsxs("div",{children:[u.jsxs("div",{style:ot,children:[u.jsx("span",{style:We,children:"Selected"}),u.jsx("div",{style:{fontSize:15,fontWeight:700,fontFamily:"ui-monospace, monospace"},children:D})]}),(()=>{var H;const P=/^line-(\d+)$/.exec(D),N=(H=t.props)==null?void 0:H.lines;if(t.component!=="StrikethroughReveal"||!P||!Array.isArray(N))return null;const O=Number(P[1]),z=N[O];if(!z)return null;const Z=z.struck?"struck":(z.mark??"none")!=="none"?z.mark:"plain";return u.jsx("div",{style:ot,children:u.jsxs("div",{style:ln,children:[u.jsx("span",{style:We,children:"Line style"}),u.jsxs("select",{"data-testid":"line-style",style:di,value:Z,onChange:G=>{const B=G.target.value,X=N.slice();X[O]={...X[O],struck:B==="struck",mark:B==="cross"||B==="check"?B:"none"},o.patchProps(e.sceneId,{lines:X})},children:[u.jsx("option",{value:"plain",children:"plain"}),u.jsx("option",{value:"struck",children:"struck through"}),u.jsx("option",{value:"cross",children:"✗ wrong"}),u.jsx("option",{value:"check",children:"✓ right"})]})]})})})(),j!==null?u.jsx("div",{style:ot,children:u.jsxs("div",{style:ln,children:[u.jsx("span",{style:We,children:"Text"}),(()=>{const P=N=>{const O=t.props??{},z=/^(line|node|message|window|item)-\d+$/.test(D)?WA(D,O,N):{[D]:N};z&&o.patchProps(e.sceneId,z,`text:${e.sceneId}:${D}`)};return C?u.jsx("textarea",{style:{...jf,resize:"vertical",fontFamily:"inherit"},"data-testid":"element-text",rows:Math.min(6,Math.max(2,j.split(`
164
- `).length)),value:j,onChange:N=>P(N.target.value)}):u.jsx("input",{style:jf,"data-testid":"element-text",value:j,onChange:N=>P(N.target.value)})})()]})}):null,u.jsxs("div",{style:ot,children:[u.jsxs("div",{style:ln,children:[u.jsxs("span",{style:We,children:["scale"," ",u.jsxs("span",{style:{color:"#EDEDF2"},children:[(L.scale??1).toFixed(2),"×"]})]}),u.jsx("input",{type:"range","data-testid":"el-scale-slider",min:.1,max:3,step:.01,value:L.scale??1,onChange:P=>o.patchElement(e.sceneId,D,{scale:Number(P.target.value)},`element:${e.sceneId}:${D}:scale`)})]}),u.jsxs("div",{style:as,children:[u.jsx(Xt,{id:"x",value:L.dx??0,dragStep:1,onCommit:P=>o.patchElement(e.sceneId,D,{dx:P},`element:${e.sceneId}:${D}:dx`)}),u.jsx(Xt,{id:"y",value:L.dy??0,dragStep:1,onCommit:P=>o.patchElement(e.sceneId,D,{dy:P},`element:${e.sceneId}:${D}:dy`)})]}),u.jsx(Xt,{id:"scale",value:L.scale??1,min:.05,max:4,dragStep:.01,onCommit:P=>o.patchElement(e.sceneId,D,{scale:P},`element:${e.sceneId}:${D}:scale`)})]}),u.jsxs("div",{style:ot,children:[u.jsx("button",{style:sn,onClick:()=>{an(),o.clearElement(e.sceneId,D)},children:"Reset element"}),u.jsx("button",{"data-testid":"delete-element",style:{...sn,marginTop:8},onClick:()=>{an(),o.hideElement(e.sceneId,D),i({sceneId:e.sceneId,elementId:null})},children:"Delete element"})]})]})}if(e&&t){const D=t.kind==="plain";if(((b=o.doc.scenes[e.sceneId])==null?void 0:b.hidden)===!0)return u.jsx("div",{children:u.jsxs("div",{style:ot,children:[u.jsx("span",{style:We,children:"Scene"}),u.jsxs("div",{style:{fontSize:15,fontWeight:700,fontFamily:"ui-monospace, monospace"},children:[e.sceneId," ",u.jsx("span",{style:{color:"#9A9AA3",fontWeight:400},children:"(deleted)"})]}),u.jsx("div",{style:{fontSize:12,color:"#9A9AA3"},children:"Its window plays as a plain take. Restore brings the graphic back."}),u.jsx("button",{"data-testid":"restore-scene",style:{...sn,color:"#5FBF77",border:"1px solid #24402c"},onClick:()=>{an(),o.restoreScene(e.sceneId)},children:"Restore scene"})]})});const L=o.doc.cuts.findIndex(C=>C.src===void 0&&C.startSec===t.startSec&&C.endSec===t.endSec);if(L!==-1)return u.jsx("div",{children:u.jsxs("div",{style:ot,children:[u.jsx("span",{style:We,children:D?"Take":"Scene"}),u.jsxs("div",{style:{fontSize:15,fontWeight:700,fontFamily:"ui-monospace, monospace"},children:[e.sceneId," ",u.jsx("span",{style:{color:"#9A9AA3",fontWeight:400},children:"(marked for removal)"})]}),u.jsx("div",{style:{fontSize:12,color:"#9A9AA3"},children:"Struck through on the timeline. It disappears from the output on the next produce/Render — this preview still plays it (the editor doesn't re-derive a second cut timeline just to show one early)."}),u.jsx("button",{"data-testid":"restore-chunk",style:{...sn,color:"#5FBF77",border:"1px solid #24402c"},onClick:()=>{an(),o.restoreChunk(L)},children:"Restore"})]})});const j=Object.entries(t.elements??{}).filter(([,C])=>C.hidden===!0).map(([C])=>{var O,z;const N=((z=(O=o.doc.scenes[e.sceneId])==null?void 0:O.elements[C])==null?void 0:z.hidden)===!0?e.sceneId:nb(e.sceneId);return{id:C,owningSceneId:N}});return u.jsxs("div",{children:[u.jsxs("div",{style:ot,children:[u.jsx("span",{style:We,children:D?"Take":"Scene"}),u.jsx("div",{style:{fontSize:15,fontWeight:700,fontFamily:"ui-monospace, monospace"},children:e.sceneId}),D?u.jsx("div",{style:{fontSize:12,color:"#9A9AA3"},children:"A continuous stretch of the talking head — no graphic. Frame it below; its window follows the cut."}):null]}),u.jsxs("div",{style:ot,children:[!D&&t.component?u.jsxs("div",{style:ln,children:[u.jsx("span",{style:We,children:"Component"}),u.jsx("select",{style:di,value:t.component,onChange:C=>o.patchComponent(e.sceneId,C.target.value),children:Gu.options.map(C=>u.jsx("option",{value:C,children:C},C))})]}):null,!D&&t.component?ZM(t.component).map(C=>{var P,N,O;return C.kind==="boolean"?u.jsxs("div",{style:ln,children:[u.jsx("span",{style:We,children:C.key}),u.jsx("input",{type:"checkbox","data-testid":`prop-${C.key}`,checked:typeof((P=t.props)==null?void 0:P[C.key])=="boolean"?t.props[C.key]:C.fallback===!0,onChange:z=>o.patchProps(e.sceneId,{[C.key]:z.target.checked})})]},C.key):u.jsxs("div",{style:ln,children:[u.jsx("span",{style:We,children:C.key}),u.jsx("select",{style:di,"data-testid":`prop-${C.key}`,value:String(((N=t.props)==null?void 0:N[C.key])??((O=C.options)==null?void 0:O[0])??""),onChange:z=>o.patchProps(e.sceneId,{[C.key]:z.target.value}),children:(C.options??[]).map(z=>u.jsx("option",{value:z,children:z},z))})]},C.key)}):null,u.jsxs("div",{style:ln,children:[u.jsx("span",{style:We,children:"Layout"}),u.jsx("select",{style:di,"data-testid":"layout-select",value:t.layout,onChange:C=>o.patchLayout(e.sceneId,C.target.value),children:Yu.options.map(C=>u.jsx("option",{value:C,children:C},C))})]})]}),u.jsxs("div",{style:ot,children:[u.jsx("span",{style:We,children:"Video framing"}),u.jsxs("div",{style:ln,children:[u.jsxs("span",{style:We,children:["zoom"," ",u.jsxs("span",{style:{color:"#EDEDF2"},children:[(((E=t.video)==null?void 0:E.scale)??1).toFixed(2),"×"]})]}),u.jsx("input",{type:"range","data-testid":"zoom-slider",min:.5,max:3,step:.01,value:((I=t.video)==null?void 0:I.scale)??1,onChange:C=>l({sceneId:e.sceneId,patch:{scale:Number(C.target.value)}}),onPointerUp:C=>{const P=Number(C.target.value);o.patchVideo(e.sceneId,{scale:P},`video:${e.sceneId}:scale`),l(null)},onKeyUp:C=>{if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(C.key))return;const N=Number(C.target.value);o.patchVideo(e.sceneId,{scale:N},`video:${e.sceneId}:scale`),l(null)}})]}),u.jsxs("label",{style:{display:"flex",gap:8,alignItems:"center",fontSize:12,color:"#9A9AA3",cursor:"pointer"},children:[u.jsx("input",{type:"checkbox","data-testid":"auto-zoom",checked:((T=t.video)==null?void 0:T.autoZoom)!==!1,onChange:C=>o.patchVideo(e.sceneId,{autoZoom:C.target.checked})}),"auto zoom (the slow push composes on top of your zoom)"]}),u.jsx("div",{style:{fontSize:12,color:"#9A9AA3"},children:"Pan: drag the picture on the stage."}),u.jsx(Xt,{id:"scale",value:((R=t.video)==null?void 0:R.scale)??1,min:.05,max:4,dragStep:.01,onCommit:C=>o.patchVideo(e.sceneId,{scale:C},`video:${e.sceneId}:scale`)}),u.jsxs("div",{style:as,children:[u.jsx(Xt,{id:"dx",value:((F=t.video)==null?void 0:F.dx)??0,dragStep:1,onCommit:C=>o.patchVideo(e.sceneId,{dx:C},`video:${e.sceneId}:dx`)}),u.jsx(Xt,{id:"dy",value:((A=t.video)==null?void 0:A.dy)??0,dragStep:1,onCommit:C=>o.patchVideo(e.sceneId,{dy:C},`video:${e.sceneId}:dy`)})]}),t.video?u.jsx("button",{style:sn,onClick:()=>{an(),o.clearVideo(e.sceneId)},children:"Reset framing"}):null]}),t.layout==="pip-bubble"?(()=>{const C=Io("pip-bubble",void 0,[],n).video,P=t.pip??{},N=P.cornerRadius??C.cornerRadius;return u.jsxs("div",{style:ot,children:[u.jsx("span",{style:We,children:"PiP bubble"}),u.jsxs("div",{style:ln,children:[u.jsxs("span",{style:We,children:["roundness"," ",u.jsx("span",{style:{color:"#EDEDF2"},children:N.toFixed(2)})]}),u.jsx("input",{type:"range","data-testid":"pip-roundness",min:0,max:1,step:.01,value:N,onChange:O=>o.patchPip(e.sceneId,{cornerRadius:Number(O.target.value)},`pip:${e.sceneId}:cornerRadius`)})]}),u.jsxs("div",{style:as,children:[u.jsx(Xt,{id:"pip-x",value:P.x??C.rect.x,min:0,max:1-C.rect.w,dragStep:.002,onCommit:O=>o.patchPip(e.sceneId,{x:O},`pip:${e.sceneId}:x`)}),u.jsx(Xt,{id:"pip-y",value:P.y??C.rect.y,min:0,max:1-C.rect.h,dragStep:.002,onCommit:O=>o.patchPip(e.sceneId,{y:O},`pip:${e.sceneId}:y`)})]}),t.pip?u.jsx("button",{"data-testid":"reset-pip",style:sn,onClick:()=>{an(),o.clearPip(e.sceneId)},children:"Reset bubble"}):null]})})():null,(()=>{var N;if(D)return null;const C=fb(t,n),P=O=>z=>o.patchGraphicRect(e.sceneId,tu({...C,[O]:z},n),`box:${e.sceneId}:${O}`);return u.jsxs("div",{style:ot,children:[u.jsx("span",{style:We,children:"Graphic box"}),u.jsx("div",{style:{fontSize:12,color:"#9A9AA3"},children:"Frame fractions — or drag the handles on the stage."}),u.jsxs("div",{style:as,children:[u.jsx(Xt,{id:"box-x",value:C.x,min:0,max:1,dragStep:.002,onCommit:P("x")}),u.jsx(Xt,{id:"box-y",value:C.y,min:0,max:1,dragStep:.002,onCommit:P("y")})]}),u.jsxs("div",{style:as,children:[u.jsx(Xt,{id:"box-w",value:C.w,min:.08,max:1,dragStep:.002,onCommit:P("w")}),u.jsx(Xt,{id:"box-h",value:C.h,min:.05,max:1,dragStep:.002,onCommit:P("h")})]}),(N=o.doc.scenes[e.sceneId])!=null&&N.graphicRect?u.jsx("button",{"data-testid":"reset-box",style:sn,onClick:()=>{an(),o.clearGraphicRect(e.sceneId)},children:"Reset box"}):null]})})(),(()=>{const C=Io(t.layout,void 0,[],n).captionAnchor,P=t.captionY??C,N=t.captionScale??1,O=o.doc.scenes[e.sceneId];return u.jsxs("div",{style:ot,children:[u.jsx("span",{style:We,children:"Captions"}),o.doc.captionsHidden===!0||f===!0?u.jsxs("div",{"data-testid":"captions-hidden-hint",style:{fontSize:12,color:"#FFE14D"},children:["Captions are hidden globally",f===!0?" (--no-captions)":" (Theme panel)"," — these settings are kept and apply when captions are shown again."]}):null,u.jsxs("div",{style:ln,children:[u.jsxs("span",{style:We,children:["position"," ",u.jsx("span",{style:{color:"#EDEDF2"},children:P.toFixed(2)})]}),u.jsx("input",{type:"range","data-testid":"caption-y-slider",min:.05,max:.95,step:.01,value:P,onChange:z=>o.patchCaptionY(e.sceneId,Number(z.target.value),`captionY:${e.sceneId}`)})]}),u.jsxs("div",{style:ln,children:[u.jsxs("span",{style:We,children:["scale"," ",u.jsxs("span",{style:{color:"#EDEDF2"},children:[N.toFixed(2),"×"]})]}),u.jsx("input",{type:"range","data-testid":"caption-scale-slider",min:.2,max:3,step:.01,value:N,onChange:z=>o.patchCaptionScale(e.sceneId,Number(z.target.value),`captionScale:${e.sceneId}`)})]}),u.jsx(Xt,{id:"caption-scale",value:N,min:.2,max:3,dragStep:.01,onCommit:z=>o.patchCaptionScale(e.sceneId,z,`captionScale:${e.sceneId}`)}),u.jsx("button",{"data-testid":"caption-y-all",style:{...sn,color:"#EDEDF2",border:"1px solid #2A2A33"},title:"Write this scene's caption position and scale to every scene — one undo step",onClick:()=>{an(),o.patchCaptionStyleAll(r,{y:P,scale:N})},children:"Apply to all scenes"}),(O==null?void 0:O.captionY)!==void 0||(O==null?void 0:O.captionScale)!==void 0?u.jsx("button",{"data-testid":"reset-caption-y",style:sn,onClick:()=>{an(),o.clearCaptionStyle(e.sceneId)},children:"Reset captions"}):null]})})(),u.jsxs("div",{style:ot,children:[u.jsx("span",{style:We,children:"Timing"}),u.jsxs("div",{"data-testid":"timing-range",style:{fontSize:13,fontFamily:"ui-monospace, 'SF Mono', monospace"},children:[t.startSec.toFixed(2),"s – ",t.endSec.toFixed(2),"s",u.jsxs("span",{style:{color:"#9A9AA3"},children:[" ","(",(t.endSec-t.startSec).toFixed(2),"s)"]})]}),u.jsx("div",{style:{fontSize:12,color:t.pinned?"#FFE14D":"#9A9AA3"},children:D?"Derived from the cut — not movable":t.pinned?"Pinned to these times":"Tracking transcript"}),!t.pinned&&a?u.jsxs("div",{style:{fontSize:12,color:"#9A9AA3",fontStyle:"italic"},children:["“",a,"”"]}):null,t.pinned?u.jsx("button",{style:sn,onClick:()=>{an(),o.clearTiming(e.sceneId)},children:"Un-pin (re-anchor to words)"}):null]}),D?null:u.jsx("div",{style:ot,children:u.jsx("button",{"data-testid":"delete-scene",style:sn,onClick:()=>{an(),o.hideScene(e.sceneId)},children:"Delete scene"})}),j.length>0?u.jsxs("div",{style:ot,children:[u.jsx("span",{style:We,children:"Hidden elements"}),j.map(({id:C,owningSceneId:P})=>u.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[u.jsx("span",{style:{fontSize:13,fontFamily:"ui-monospace, monospace",color:"#C9C9D4"},children:C}),u.jsx("button",{"data-testid":`restore-element-${C}`,style:{...sn,color:"#5FBF77",border:"1px solid #24402c",padding:"4px 8px"},onClick:()=>{an(),o.restoreElement(P,C)},children:"Restore"})]},C))]}):null,u.jsxs("div",{style:ot,children:[u.jsx("div",{style:{fontSize:12,color:"#9A9AA3"},children:"Removes this window from the output on the next produce/Render. Struck through here until then — the preview keeps playing it."}),u.jsx("button",{"data-testid":"cut-chunk",style:sn,onClick:()=>{an();const C=ub({fromLive:p,hasOldClockPreimage:m},t.startSec,t.endSec);if(C.kind==="degenerate"){g("Can't cut this window: it isn't in the last render yet — render once (or re-remove the pause) to cut it.");return}C.kind==="shrunk"&&console.warn(`ossclip cut preview: ${C.report}`),o.cutChunk(C.startSec,C.endSec)},children:"Delete this chunk"})]})]})}const w=o.doc.theme,x=(D,L)=>o.patchTheme({[D]:L}),k=D=>`${Math.floor(D/60)}:${String(Math.floor(D%60)).padStart(2,"0")}`,h=((W=c==null?void 0:c.usage)==null?void 0:W.totals)??null,y=((M=c==null?void 0:c.production)==null?void 0:M.producer)??null,v=(($=c==null?void 0:c.production)==null?void 0:$.clip)??null;return u.jsxs("div",{children:[u.jsxs("div",{style:ot,children:[u.jsx("span",{style:We,children:"Theme"}),u.jsx("div",{style:{fontSize:12,color:"#9A9AA3"},children:"Nothing selected — global tokens."})]}),u.jsxs("div",{style:ot,children:[u.jsx(Xa,{id:"accent",value:w.accent??s.accent,isColor:!0,onCommit:D=>x("accent",D)}),u.jsx(Xa,{id:"bg",value:w.bg??s.bg,isColor:!0,onCommit:D=>x("bg",D)}),u.jsx(Xa,{id:"fg",value:w.fg??s.fg,isColor:!0,onCommit:D=>x("fg",D)}),u.jsx(Xt,{id:"radiusPx",value:w.radiusPx??s.radiusPx,min:0,dragStep:.5,onCommit:D=>x("radiusPx",D)}),u.jsx(Xa,{id:"fontDisplay",value:w.fontDisplay??s.fontDisplay,isColor:!1,onCommit:D=>x("fontDisplay",D)})]}),u.jsxs("div",{style:ot,children:[u.jsx("span",{style:We,children:"Captions"}),u.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,color:"#EDEDF2",cursor:"pointer"},children:[u.jsx("input",{type:"checkbox","data-testid":"captions-visible-toggle",checked:o.doc.captionsHidden!==!0&&f!==!0,disabled:f===!0&&o.doc.captionsHidden!==!0,onChange:D=>o.setCaptionsHidden(!D.target.checked)}),"Show captions"]}),o.doc.captionsHidden===!0?u.jsx("div",{style:{fontSize:12,color:"#9A9AA3"},children:"Hidden everywhere — the CTA keyword styling rides the caption track, so it is hidden too. Per-scene caption position/scale edits are kept."}):null,f===!0?u.jsx("div",{"data-testid":"captions-flag-note",style:{fontSize:12,color:"#FFE14D"},children:"This project was produced with --no-captions, which Render replays — the toggle can't bring captions back here; re-run produce without the flag."}):null]}),y||h?u.jsxs("div",{style:ot,"data-testid":"run-info",children:[u.jsx("span",{style:We,children:"This video"}),y?u.jsxs("div",{style:{fontSize:12,color:"#C9C9D4"},children:["planned by ",u.jsx("span",{style:{color:"#EDEDF2"},children:y.provider}),y.models.length>0?` (${y.models.join(", ")})`:"",y.cached?" · reused from cache":"",y.at?` · ${new Date(y.at).toLocaleString()}`:""]}):null,h?u.jsxs("div",{style:{fontSize:12,color:"#C9C9D4"},children:[h.calls," LLM call",h.calls===1?"":"s"," ·"," ",h.inputTokens.toLocaleString()," in / ",h.outputTokens.toLocaleString()," out tokens",h.anyEstimated?" (partly estimated)":""]}):null,h&&h.equivalentUsd!==null?u.jsx("div",{style:{fontSize:12,color:"#C9C9D4"},children:h.allUnbilled?`~$${h.equivalentUsd.toFixed(2)} of API-rate work, covered by the subscription`:h.billedUsd!==null?`~$${h.billedUsd.toFixed(2)} charged at API rates`:`~$${h.equivalentUsd.toFixed(2)} at API rates`}):null,v?u.jsxs("div",{style:{fontSize:12,color:"#C9C9D4"},children:["clip: ",k(v.startSec),"–",k(v.endSec),(V=c==null?void 0:c.production)!=null&&V.sourceDuration?` of ${k(c.production.sourceDuration)}`:""," ","(--clip ",v.targetSec,")"]}):null]}):null,u.jsx("div",{style:ot,children:u.jsx("div",{"data-testid":"ai-disclaimer",style:{fontSize:12,color:"#9A9AA3"},children:"AI can make mistakes. The cut, captions and graphics are generated — review them before publishing."})})]})},Xc=1.2,ru=.05;function KA(e,t,n,r){return n<=0||r<=0?0:Math.min(1,Math.max(0,(e-t)/n))*r}const YA=16,GA=e=>Math.min(YA,Math.max(1,e));function XA(e,t,n,r,o){if(e<=0||n<=0)return 0;const s=(r+o)*(t/e),a=Math.max(0,t*n-n);return Math.min(a,Math.max(0,s-o))}const yh=e=>e.filter(t=>t.kind!=="plain");function qA(e,t,n,r){const o=yh(e),i=o.findIndex(g=>g.id===t),s=o[i];if(!s)return null;const a=s.endSec-s.startSec,l=i>0?o[i-1]:void 0,c=i<o.length-1?o[i+1]:void 0,f=l?l.endSec+ru:0,p=c?c.startSec-ru:r,m=Math.min(Math.max(s.startSec+n,f),Math.max(f,p-a));return{startSec:m,endSec:m+a}}function JA(e,t,n,r,o){const i=yh(e),s=i.findIndex(g=>g.id===t),a=s>0?i[s-1]:void 0,l=s>=0&&s<i.length-1?i[s+1]:void 0,c=a?a.endSec+ru:0,f=l?l.startSec-ru:o;let p=Math.min(Math.max(n,c),Math.max(c,f-Xc)),m=Math.max(Math.min(r,f),p+Xc);return m>f&&(m=f,p=Math.max(c,m-Xc)),{startSec:p,endSec:m}}function vy(e,t,n,r){const o=[0,r,n];for(const a of yh(e))a.id!==t&&o.push(a.startSec,a.endSec);o.sort((a,l)=>a-l);const i=[];let s;for(const a of o)(s===void 0||a-s>1e-6)&&(i.push(a),s=a);return i}function qa(e,t,n){if(n<=0||t.length===0)return{sec:e,snapped:null};let r=null,o=1/0;for(const i of t){const s=Math.abs(e-i);(s<o||s===o&&r!==null&&i<r)&&(r=i,o=s)}return r===null||o>n?{sec:e,snapped:null}:{sec:r,snapped:r}}function Ab(e,t){if(e.length===0)return 0;for(const r of e)if(t>=r.srcIn&&t<=r.srcOut)return r.outIn+(t-r.srcIn);let n=0;for(const r of e)if(r.srcOut<=t)n=r.outOut;else if(r.srcIn>=t)return r.outIn;return n}function qc(e,t){const n=Math.max(0,e);if(t<=0)return`${n.toFixed(1)}s`;const r=Math.floor(n),o=Math.floor(r/60),i=r%60,s=Math.floor((n-r)*t),a=String(Math.max(1,Math.ceil(t)-1)).length;return`${o}:${String(i).padStart(2,"0")}:${String(s).padStart(a,"0")}`}const vh={silence:"#4DA3FF",pause:"#B78CFF",filler:"#FFB84D",retake:"#FF7AB8",user:"#6BDD8B",clip:"#4DDCD4"},QA="#8a8a95";function e3(e){const t=`${(e.srcOut-e.srcIn).toFixed(1)}s removed`;return e.reason?`${e.reason} · ${t}`:t}const t3=1e-6;function n3(e,t,n){if(t.length===0)return[];const r=new Set(ab(e,n)),o=[];for(const i of e){if(i.kind!=="remove"||i.srcOut<=i.srcIn)continue;const s=Ab(t,i.srcIn),a=o.filter(l=>Math.abs(l.outSec-s)<t3).length;o.push({srcIn:i.srcIn,srcOut:i.srcOut,reason:i.reason,outSec:s,label:e3(i),color:i.reason?vh[i.reason]:QA,stackIndex:a,vetoable:hh(i.reason),vetoed:r.has(i)})}return o}const r3={silence:"Silences",pause:"Pauses",filler:"Fillers",retake:"Retakes",user:"Your cuts",clip:"Clip window"};function o3(e){const t=new Map;for(const n of e){if(n.kind!=="remove"||n.reason===void 0||!hh(n.reason)||n.srcOut<=n.srcIn)continue;const r=t.get(n.reason)??{reason:n.reason,count:0,seconds:0};r.count+=1,r.seconds+=n.srcOut-n.srcIn,t.set(n.reason,r)}return Object.keys(vh).map(n=>t.get(n)).filter(n=>n!==void 0)}const i3=10,s3=4,wy=8,xy=8,a3=300,l3=e=>{const t=Math.max(0,Math.round(e));return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`},u3=(e,t)=>{const[n,r]=le.useState({}),o=le.useRef({}),i=t.map(s=>s.toFixed(1)).join(",");return le.useEffect(()=>{if(!e||t.length===0)return;const s=[...new Set(t.map(p=>p.toFixed(1)))].filter(p=>o.current[p]===void 0);if(s.length===0)return;let a=!1;const l=document.createElement("video");l.src=e,l.muted=!0,l.preload="auto";const c=document.createElement("canvas");return(async()=>{await new Promise((m,g)=>{l.onloadedmetadata=()=>m(),l.onerror=()=>g(new Error("no video for thumbnails"))}),c.width=168,c.height=Math.max(1,Math.round(168*l.videoHeight/Math.max(1,l.videoWidth)));const p=c.getContext("2d");if(p){for(const m of s){if(a)return;await new Promise(g=>{l.onseeked=()=>g(),l.currentTime=Math.max(0,Number(m))}),p.drawImage(l,0,0,c.width,c.height),o.current[m]=c.toDataURL("image/jpeg",.6)}a||r({...o.current})}})().catch(()=>{}),()=>{a=!0,l.removeAttribute("src"),l.load()}},[e,i]),n},c3=({cues:e,ghosts:t,cuts:n=[],spans:r=[],cleanup:o=[],durationSec:i,fps:s,playerRef:a,selection:l,onSelect:c,edits:f,videoSrc:p,toSourceSec:m,toLive:g=w=>w})=>{const w=d.useRef(null),x=d.useRef(null),k=d.useRef(!1),h=d.useRef(null),[y,v]=d.useState(0),S=d.useRef(y);S.current=y;const[b,E]=d.useState(null),[I,T]=d.useState(1),R=le.useMemo(()=>m?e.filter(C=>C.kind==="plain").map(C=>m((C.startSec+C.endSec)/2)):[],[e,m]),F=u3(p,R),A=d.useRef(null),W=d.useRef(null),M=d.useCallback((C,P)=>{const N=A.current;T(O=>{const z=GA(C);if(z===O||!N)return z;const Z=N.getBoundingClientRect();return W.current={prevZoom:O,anchorX:P!==void 0?P-Z.left:Z.width/2},z})},[]);d.useLayoutEffect(()=>{const C=A.current,P=W.current;!C||!P||(W.current=null,C.scrollLeft=XA(P.prevZoom,I,C.clientWidth,C.scrollLeft,P.anchorX))},[I]);const $=d.useRef(I);$.current=I,d.useEffect(()=>{const C=A.current;if(!C)return;const P=N=>{N.ctrlKey||N.metaKey?(N.preventDefault(),M($.current*Math.exp(-N.deltaY*.01),N.clientX)):C.scrollWidth>C.clientWidth&&(N.preventDefault(),C.scrollLeft+=N.deltaY+N.deltaX)};return C.addEventListener("wheel",P,{passive:!1}),()=>C.removeEventListener("wheel",P)},[M]),d.useEffect(()=>{const C=a.current;if(!C)return;v(C.getCurrentFrame());const P=N=>v(N.detail.frame);return C.addEventListener("frameupdate",P),()=>C.removeEventListener("frameupdate",P)},[a]),d.useEffect(()=>{const C=A.current;if(!C||i<=0||C.scrollWidth<=C.clientWidth)return;const P=y/s/i*C.scrollWidth,{scrollLeft:N,clientWidth:O}=C;(P<N||P>N+O)&&(C.scrollLeft=Math.max(0,Math.min(C.scrollWidth-O,P-O*.1)))},[y,s,i]),d.useEffect(()=>{var P,N;if(!l)return;const C=(P=A.current)==null?void 0:P.querySelector(`[data-testid="timeline-block-${l.sceneId}"]`);(N=C==null?void 0:C.scrollIntoView)==null||N.call(C,{inline:"nearest",block:"nearest"})},[l]);const V=d.useCallback(C=>{var O;const P=w.current;if(!P||i<=0)return;const N=P.getBoundingClientRect();(O=a.current)==null||O.seekTo(Math.round(KA(C,N.left,N.width,i)*s))},[a,i,s]),D=d.useCallback((C,P)=>N=>{N.stopPropagation(),N.preventDefault();const O=w.current;O&&(x.current={sceneId:C.id,edge:P,startContentX:N.clientX-O.getBoundingClientRect().left,origStart:C.startSec,origEnd:C.endSec},E({sceneId:C.id,startSec:C.startSec,endSec:C.endSec,snapped:null}))},[]),L=d.useRef(0);d.useEffect(()=>{const C=O=>{const z=A.current;if(!z||z.scrollWidth<=z.clientWidth)return;const Z=Date.now();if(Z-L.current<a3)return;const H=z.getBoundingClientRect(),G=z.scrollWidth-z.clientWidth;O>=H.right-xy&&z.scrollLeft<G?(z.scrollLeft=Math.min(G,z.scrollLeft+z.clientWidth),L.current=Z):O<=H.left+xy&&z.scrollLeft>0&&(z.scrollLeft=Math.max(0,z.scrollLeft-z.clientWidth),L.current=Z)},P=O=>{var Se;if((k.current||((Se=h.current)==null?void 0:Se.moved)===!0||x.current!==null)&&C(O.clientX),k.current){V(O.clientX);return}const Z=h.current;if(Z&&i>0){if(!Z.moved&&Math.abs(O.clientX-Z.startX)<s3)return;if(Z.moved=!0,Z.scrub){V(O.clientX);return}const de=w.current,K=de==null?void 0:de.getBoundingClientRect(),ee=K?(O.clientX-K.left-Z.startContentX)/K.width*i:0;let ue=ee,se=null;const Re=K&&K.width>0&&!O.altKey?e.find(De=>De.id===Z.sceneId):void 0;if(Re&&K){const De=wy/(K.width/i),Qe=vy(e,Z.sceneId,S.current/s,i),ke=Re.startSec+ee,Ee=Re.endSec+ee,je=qa(ke,Qe,De),_e=qa(Ee,Qe,De),Le=je.snapped===null?1/0:Math.abs(je.sec-ke),dt=_e.snapped===null?1/0:Math.abs(_e.sec-Ee);Le<=dt&&je.snapped!==null?(ue=ee+(je.sec-ke),se=je.snapped):_e.snapped!==null&&(ue=ee+(_e.sec-Ee),se=_e.snapped)}const Ie=qA(e,Z.sceneId,ue,i);if(Ie){const De=se!==null&&(Math.abs(Ie.startSec-se)<1e-6||Math.abs(Ie.endSec-se)<1e-6)?se:null;E({sceneId:Z.sceneId,...Ie,snapped:De})}return}const H=x.current;if(!H||i<=0)return;const G=w.current;if(!G)return;const B=G.getBoundingClientRect(),X=(O.clientX-B.left-H.startContentX)/B.width*i;let ae=H.edge==="start"?H.origStart+X:H.origStart,oe=H.edge==="end"?H.origEnd+X:H.origEnd,Y=null;if(!O.altKey&&B.width>0){const de=wy/(B.width/i),K=vy(e,H.sceneId,S.current/s,i);if(H.edge==="start"){const ee=qa(ae,K,de);ae=ee.sec,Y=ee.snapped}else{const ee=qa(oe,K,de);oe=ee.sec,Y=ee.snapped}}const q=JA(e,H.sceneId,ae,oe,i),xe=Y!==null&&(Math.abs(q.startSec-Y)<1e-6||Math.abs(q.endSec-Y)<1e-6)?Y:null;E({sceneId:H.sceneId,...q,snapped:xe})},N=O=>{k.current=!1;const z=h.current;if(z){h.current=null,z.moved&&!z.scrub&&E(H=>(H&&H.sceneId===z.sceneId&&f.patchTiming(z.sceneId,H.startSec,H.endSec),null));return}const Z=x.current;Z&&(E(H=>(H&&H.sceneId===Z.sceneId&&(H.startSec!==Z.origStart||H.endSec!==Z.origEnd)&&f.patchTiming(Z.sceneId,H.startSec,H.endSec),null)),x.current=null)};return window.addEventListener("mousemove",P),window.addEventListener("mouseup",N),()=>{window.removeEventListener("mousemove",P),window.removeEventListener("mouseup",N)}},[e,i,f,V,s]);const j=i>0?Math.min(1,y/s/i)*100:0;return u.jsxs("div",{style:d3,onMouseDownCapture:$b,children:[u.jsxs("div",{style:f3,children:[u.jsx("span",{style:h3,children:"ctrl+scroll to zoom"}),u.jsx("button",{"data-testid":"zoom-out",style:Jc,onClick:()=>M(I/2),disabled:I<=1,title:"Zoom out (ctrl/cmd + scroll on the timeline)",children:"−"}),u.jsxs("span",{"data-testid":"zoom-level",style:p3,children:[Math.round(I*10)/10,"×"]}),u.jsx("button",{"data-testid":"zoom-in",style:Jc,onClick:()=>M(I*2),disabled:I>=16,title:"Zoom in (ctrl/cmd + scroll on the timeline)",children:"+"}),u.jsx("button",{"data-testid":"zoom-fit",style:{...Jc,width:"auto",padding:"0 8px"},onClick:()=>M(1),disabled:I<=1,title:"Fit the whole clip in view",children:"fit"})]}),u.jsx("div",{ref:A,"data-testid":"timeline-scroller",style:m3,children:u.jsxs("div",{style:{width:`${I*100}%`,minWidth:"100%",paddingBottom:6},children:[u.jsx("div",{"data-testid":"ruler",style:g3,onMouseDown:C=>{C.preventDefault(),V(C.clientX),k.current=!0},children:(()=>{var H;if(i<=0)return u.jsx("span",{style:Qc,children:"0:00"});const P=(((H=A.current)==null?void 0:H.clientWidth)??1200)*I/i;let O=[.5,1,2,5,10,15,30,60,120,300,600].find(G=>G*P>=70)??600;for(;i/(O/5)>600;)O*=2;const z=O/5,Z=[];for(let G=0;G<=i+1e-6;G+=z){const B=Math.round(G/z)%5===0,X=`${G/i*100}%`;Z.push(u.jsx("div",{style:{position:"absolute",left:X,bottom:0,width:1,height:B?8:4,background:B?"#3A3A44":"#26262e",pointerEvents:"none"}},G.toFixed(3))),B&&G+z<=i&&Z.push(u.jsx("span",{style:{...Qc,position:"absolute",left:X,top:0,transform:G===0?void 0:"translateX(-50%)",pointerEvents:"none"},children:l3(G)},`l${G.toFixed(3)}`))}return u.jsxs(u.Fragment,{children:[Z,u.jsx("span",{style:{...Qc,position:"absolute",right:2,top:0,pointerEvents:"none"},children:qc(i,s)})]})})()}),u.jsxs("div",{ref:w,style:y3,onMouseDown:C=>{C.preventDefault(),V(C.clientX),k.current=!0},children:[e.map(C=>{const P=C.kind==="plain",N=(b==null?void 0:b.sceneId)===C.id,O=N?b.startSec:C.startSec,z=N?b.endSec:C.endSec,Z=i>0?O/i*100:0,H=i>0?Math.max(0,(z-O)/i*100):0,G=(l==null?void 0:l.sceneId)===C.id,B=P&&m?F[m((C.startSec+C.endSec)/2).toFixed(1)]:void 0;return u.jsxs("div",{"data-testid":`timeline-block-${C.id}`,onMouseDown:X=>{var ae;X.stopPropagation(),X.preventDefault(),c({sceneId:C.id,elementId:null}),h.current={sceneId:C.id,startX:X.clientX,startContentX:X.clientX-(((ae=w.current)==null?void 0:ae.getBoundingClientRect().left)??0),moved:!1,scrub:P}},style:{...by,left:`${Z}%`,width:`${H}%`,zIndex:N?4:G?3:1,border:G?"2px solid #5b8cff":P?"1px solid #22222a":"1px solid #2A2A33",backgroundColor:G?"#1c2333":P?"#131318":"#1A1A21",...B?{backgroundImage:`linear-gradient(rgba(10,10,14,0.35), rgba(10,10,14,0.6)), url(${B})`,backgroundSize:"auto 100%, auto 100%",backgroundRepeat:"repeat-x"}:{}},children:[u.jsx("span",{style:P?B?{...Ja,color:"#D8D8DE",textShadow:"0 1px 2px rgba(0,0,0,0.9)"}:{...Ja,color:"#55555f"}:Ja,children:C.id}),!P&&C.pinned?u.jsx("span",{style:v3,children:"PIN"}):null,P?null:u.jsxs(u.Fragment,{children:[u.jsx("div",{onMouseDown:D(C,"start"),style:{...ky,left:0,cursor:"ew-resize"}}),u.jsx("div",{onMouseDown:D(C,"end"),style:{...ky,right:0,cursor:"ew-resize"}})]})]},C.id)}),t.map(C=>{const P=i>0?C.startSec/i*100:0,N=i>0?Math.max(0,(C.endSec-C.startSec)/i*100):0,O=(l==null?void 0:l.sceneId)===C.id;return u.jsx("div",{"data-testid":`timeline-block-${C.id}`,onMouseDown:z=>{z.stopPropagation(),z.preventDefault(),c({sceneId:C.id,elementId:null})},style:{...by,left:`${P}%`,width:`${N}%`,zIndex:O?3:2,border:O?"2px dashed #5b8cff":"1px dashed #6a6a75",background:"transparent"},children:u.jsx("span",{style:{...Ja,color:"#6a6a75",textDecoration:"line-through"},children:C.id})},`ghost-${C.id}`)}),n.map((C,P)=>{const N=z=>i>0?Math.min(100,Math.max(0,z/i*100)):0;if(!C.src){const z=Math.min(Math.max(g(C.startSec),0),i),Z=Math.min(Math.max(g(C.endSec),0),i),H=N(z),G=i>0?Math.max(0,(Z-z)/i*100):0;return u.jsx("div",{"data-testid":`timeline-cut-${C.startSec}-${C.endSec}`,style:{...w3,left:`${H}%`,width:`${G}%`},children:u.jsx("div",{style:x3})},`cut-${P}-${C.startSec}-${C.endSec}`)}if(r.length===0)return null;const O=N(Ab(r,C.src.startSec));return u.jsx("div",{"data-testid":`timeline-cut-seam-${C.startSec}-${C.endSec}`,title:"Restore cut — the material returns on the next produce/Render",onMouseDown:z=>{z.stopPropagation(),z.preventDefault(),f.restoreChunk(P)},style:{...b3,left:`${O}%`},children:u.jsx("div",{style:S3})},`cut-${P}-${C.startSec}-${C.endSec}`)}),n3(o,r,f.doc.cleanup).map(C=>{const P=i>0?Math.min(100,Math.max(0,C.outSec/i*100)):0,N=C.vetoed?`${C.label} — declined: kept, playing in the preview (click to re-remove)`:C.vetoable?`${C.label} — click to keep this; the preview updates immediately`:C.label;return u.jsx("div",{"data-testid":`timeline-removal-${C.srcIn}-${C.srcOut}`,...C.vetoed?{"data-vetoed":"true"}:{},title:N,...C.vetoable?{onMouseDown:O=>{O.stopPropagation(),O.preventDefault(),f.toggleKept(C.srcIn,C.srcOut)}}:{},style:{...k3,...C.vetoable?{cursor:"pointer"}:{},left:`${P}%`,marginLeft:-3+C.stackIndex*7},children:u.jsx("div",{style:C.vetoed?{...Sy,background:"transparent",border:`1px solid ${C.color}`,opacity:.55}:{...Sy,background:C.color}})},`removal-${C.srcIn}-${C.srcOut}`)}),b?u.jsxs("div",{"data-testid":"drag-readout",style:{...Ey,left:`${i>0?b.startSec/i*100:0}%`,transform:i>0&&b.startSec/i>.85?"translateX(-100%)":Ey.transform},children:[qc(b.startSec,s)," – ",qc(b.endSec,s)]}):null,(b==null?void 0:b.snapped)!==null&&(b==null?void 0:b.snapped)!==void 0?u.jsx("div",{"data-testid":"snap-tick",style:{...E3,left:`${i>0?b.snapped/i*100:0}%`}}):null,u.jsx("div",{"data-testid":"playhead",style:{...C3,left:`${j}%`},children:u.jsx("div",{"data-testid":"playhead-grab",onMouseDown:C=>{C.stopPropagation(),C.preventDefault(),k.current=!0},style:I3})})]})]})})]})},d3={flexShrink:0,borderTop:"1px solid #1E1E24",background:"#111116",padding:"6px 20px 8px"},f3={display:"flex",justifyContent:"flex-end",alignItems:"center",gap:6,marginBottom:4},Jc={width:22,height:18,fontSize:12,lineHeight:1,color:"#EDEDF2",background:"#1A1A21",border:"1px solid #2A2A33",borderRadius:4,cursor:"pointer",padding:0},p3={fontSize:10,fontFamily:"ui-monospace, 'SF Mono', monospace",color:"#9A9AA3",minWidth:26,textAlign:"center"},h3={fontSize:10,color:"#55555f",marginRight:4,userSelect:"none"},m3={overflowX:"auto",overflowY:"hidden"},g3={position:"relative",height:18,padding:"0 2px",marginBottom:4,borderBottom:"1px solid #1E1E24",cursor:"ew-resize",userSelect:"none"},Qc={fontSize:10,fontFamily:"ui-monospace, 'SF Mono', monospace",color:"#9A9AA3"},y3={position:"relative",height:44,background:"#0F0F14",border:"1px solid #2A2A33",borderRadius:6,overflow:"visible",userSelect:"none"},by={position:"absolute",top:3,bottom:3,borderRadius:4,boxSizing:"border-box",cursor:"pointer",display:"flex",alignItems:"center",overflow:"hidden"},Ja={fontSize:10,fontFamily:"ui-monospace, 'SF Mono', monospace",textTransform:"uppercase",letterSpacing:"0.04em",color:"#9A9AA3",padding:"0 8px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",pointerEvents:"none"},v3={position:"absolute",top:3,right:3,fontSize:9,fontFamily:"ui-monospace, 'SF Mono', monospace",letterSpacing:"0.04em",textTransform:"uppercase",color:"#0B0B0E",background:"#ffe14d",padding:"1px 5px",borderRadius:3,pointerEvents:"none"},w3={position:"absolute",top:3,bottom:3,zIndex:3,pointerEvents:"none",borderRadius:4,border:"1px solid rgba(255,92,92,0.6)",background:"repeating-linear-gradient(135deg, rgba(255,92,92,0.22), rgba(255,92,92,0.22) 6px, transparent 6px, transparent 12px)"},x3={position:"absolute",left:0,right:0,top:"50%",height:2,background:"rgba(255,92,92,0.8)"},b3={position:"absolute",top:-4,bottom:-4,width:12,marginLeft:-6,zIndex:4,cursor:"pointer",pointerEvents:"auto"},S3={position:"absolute",left:"50%",top:0,bottom:0,width:2,background:"#FF5C5C",pointerEvents:"none"},k3={position:"absolute",top:-4,bottom:-4,width:6,marginLeft:-3,zIndex:3,pointerEvents:"auto"},Sy={position:"absolute",left:"50%",top:0,bottom:0,width:2,pointerEvents:"none"},ky={position:"absolute",top:0,bottom:0,width:i3},E3={position:"absolute",top:-4,bottom:-4,width:1,zIndex:6,background:"#FFE14D",pointerEvents:"none"},Ey={position:"absolute",bottom:"100%",marginBottom:3,transform:"translateX(-4px)",whiteSpace:"nowrap",fontSize:10,fontFamily:"ui-monospace, 'SF Mono', monospace",color:"#0B0B0E",background:"#FFE14D",padding:"1px 5px",borderRadius:3,zIndex:6,pointerEvents:"none"},C3={position:"absolute",top:-26,bottom:-4,width:2,zIndex:5,background:"#FFE14D",pointerEvents:"none"},I3={position:"absolute",top:0,bottom:0,left:-4,width:10,pointerEvents:"auto",cursor:"ew-resize"};function T3(e,t,n){const r=e.filter(m=>Ze(m.word)!==null);if(r.length===0)return null;const o=e[0].word,i=e[e.length-1].word,s=Math.max(o.start,t??0),a=i.end;if(a<=s)return null;const l=[];e.every(m=>{const g=Ze(m.word);return g!==null&&g in n.captionWordsHidden})||l.push("caption");const f=n.cuts.some(m=>m.src===void 0&&m.startSec===s&&m.endSec===a),p=e.some(m=>m.synthetic);return!f&&!p&&l.push("caption-video"),l.length===0?null:{startSec:s,endSec:a,words:r.map(m=>({srcStart:m.word.srcStart,was:m.live})),targets:l}}function R3(e,t,n,r){const o=n-t+1;if(o<=0||t<0||n>=e.length)return[];const i=f=>f.map(p=>p.live).join(" ").normalize("NFC"),s=e.slice(t,n+1),a=i(s),l=o===1?Ze(s[0].word):null,c=[];for(let f=0;f+o<=e.length;){if(f>t-o&&f<=n){f=n+1;continue}const p=e.slice(f,f+o),m=p.every(w=>Ze(w.word)!==null&&r(w.word)===void 0),g=l!==null&&Ze(p[0].word)===l;if(m&&!g&&i(p)===a){c.push({fromSrcStart:p[0].word.srcStart,toSrcStart:p[o-1].word.srcStart,was:p.map(w=>w.base).join(" ").normalize("NFC"),rawWas:p.map(w=>w.base).join(" ")}),f+=o;continue}f++}return c}function j3(e,t,n,r,o){const i=Math.max(0,Math.floor(o)),s=new Float32Array(i);if(i===0||!(r>n)||!(t>0)||e.length===0)return{buckets:s,fromSec:n,toSec:r};const a=r-n;for(let l=0;l<i;l++){const c=Math.max(0,Math.ceil((n+a*l/i)*t)),f=Math.min(e.length,Math.ceil((n+a*(l+1)/i)*t));let p=0;for(let m=c;m<f;m++){const g=Math.abs(e[m]);g>p&&(p=g)}s[l]=p}return{buckets:s,fromSec:n,toSec:r}}const lo=280,un=48,Qa=1;let el=null;const P3=e=>((el===null||el.key!==e)&&(el={key:e,promise:(async()=>{if(typeof AudioContext>"u"||typeof fetch>"u")return null;const t=await fetch("/media/audio.wav");if(!t.ok)return null;const n=await t.arrayBuffer(),r=new AudioContext;try{const o=await r.decodeAudioData(n);return{channel:o.getChannelData(0).slice(),sampleRate:o.sampleRate}}finally{r.close()}})().catch(()=>null)}),el.promise),Cy=6,Iy=8,F3=e=>{const t=e.anchorTop+e.anchorHeight+Cy,n=e.anchorTop-e.menuH-Cy,o=t+e.menuH<=e.scrollTop+e.clientHeight||n<e.scrollTop?t:n,i=e.anchorLeft+e.anchorWidth/2-e.menuW/2,s=Math.max(Iy,Math.min(i,e.clientWidth-e.menuW-Iy));return{top:o,left:s}},Ty="transcript-word-",Ry=e=>{var o;if(e===null)return null;const t=e.nodeType===3?e.parentElement:e,n=((o=t==null?void 0:t.closest)==null?void 0:o.call(t,`[data-testid^="${Ty}"]`))??null;if(n===null)return null;const r=Number(n.getAttribute("data-testid").slice(Ty.length));return Number.isInteger(r)?r:null},_3=e=>({lo:e.prev===null?e.track.start:e.prev.end===e.span.start?e.prev.start+eu:e.prev.end,hi:e.next===null?e.track.end:e.next.start===e.span.end?e.next.end-eu:e.next.start}),M3=(e,t,n)=>{const r=Math.min(Math.max(e.start,t),n);return{start:r,end:Math.min(Math.max(e.end,r),n)}},$3=e=>{if(e.edge==="band"){const t=Math.min(Math.max(e.dSec,e.lo-e.span.start),e.hi-e.span.end);return{start:e.span.start+t,end:e.span.end+t}}return e.edge==="lead"?{start:Math.min(Math.max(e.span.start+e.dSec,e.lo),Math.min(e.hi,e.span.end)),end:e.span.end}:{start:e.span.start,end:Math.max(Math.min(e.span.end+e.dSec,e.hi),Math.max(e.lo,e.span.start))}},A3=e=>{const t=e.span.end-e.span.start,n=t>0?(e.newSpan.end-e.newSpan.start)/t:1,r=i=>e.newSpan.start+(i-e.span.start)*n,o=e.lines.map(i=>({srcStart:i.srcStart,lead:r(i.start)-i.start,tail:r(i.end)-i.end}));return e.prev!==null&&e.prev.end===e.span.start&&o.unshift({srcStart:e.prev.srcStart,lead:e.prev.lead,tail:e.newSpan.start-e.prev.end}),e.next!==null&&e.next.start===e.span.end&&o.push({srcStart:e.next.srcStart,lead:e.newSpan.end-e.next.start,tail:e.next.tail}),o},tl=(e,t)=>{const n=e[t],r=n==null?void 0:n.words[0],o=Ze(r);if(!n||!r||o===null)return null;const i=n.words[n.words.length-1];return{key:o,srcStart:r.srcStart,start:n.start,end:n.end,srcEnd:Number.isFinite(i.srcStart)?i.srcStart+(i.end-i.start):r.srcStart+(n.end-n.start)}},N3=(e,t)=>{const n=[];let r=0;for(const o of e){const i=new Set(o.words.map(l=>Ze(l)).filter(l=>l!==null)),s=t[r],a=l=>{const c=Ze(l);return c!==null&&i.has(c)};s!==void 0&&s.words.some(a)?(n.push(r),r++):n.push(null)}return n},L3=({baseLines:e,liveLines:t,timingLines:n,fps:r,playerRef:o,edits:i,onDeleteWords:s,width:a,workdir:l,toPlayerSec:c=p=>p,fromPlayerSec:f=p=>p})=>{const[p,m]=d.useState(""),[g,w]=d.useState(null),[x,k]=d.useState(null),[h,y]=d.useState(null),[v,S]=d.useState(null),[b,E]=d.useState(!1),I=d.useRef(null),[T,R]=d.useState(null),[F,A]=d.useState(null),[W,M]=d.useState(null),[$,V]=d.useState(!1),[D,L]=d.useState(null),[j,C]=d.useState(!1),P=d.useRef(null),N=d.useRef(null),O=d.useMemo(()=>{const _=new Map;for(const U of e)for(const re of U.words){const fe=Ze(re);if(fe===null)continue;const we=_.get(fe);we?we.push(re.text):_.set(fe,[re.text])}return _},[e]),z=d.useMemo(()=>{var fe;const _=[];let U=0;const re=new Map;for(let we=0;we<t.length;we++){const be=t[we];for(let Pe=0;Pe<be.words.length;Pe++){const Me=be.words[Pe],He=Ze(Me);let ze;if(He!==null){const ge=re.get(He)??0;re.set(He,ge+1),ze=(fe=O.get(He))==null?void 0:fe[ge]}_.push({index:U,base:ze??Me.text,live:Me.text,synthetic:He!==null&&ze===void 0,start:Me.start,end:Me.end,lineIndex:we,word:Me}),U++}}return _},[O,t]);d.useEffect(()=>{k(null),y(null)},[z.length]);const Z=d.useMemo(()=>new Set(Object.keys(i.doc.captionWordsHidden)),[i.doc.captionWordsHidden]),H=_=>{const U=Ze(_.word);return U!==null&&Z.has(U)},G=d.useMemo(()=>ph(z.map(_=>_.live).join(" ")),[z]);d.useEffect(()=>{if(G!=="rtl"||typeof FontFace>"u"||!document.fonts)return;let _=!1;for(const U of document.fonts)U.family===Gs&&(_=!0);if(!_)try{new FontFace(Gs,`url("/media/${ib}") format("truetype")`).load().then(re=>document.fonts.add(re),()=>{})}catch{}},[G]),d.useEffect(()=>{const _=o.current;if(!_)return;const U=re=>{const fe=f(re.detail.frame/r),we=z.find(be=>fe>=be.start&&fe<be.end);M(be=>we?we.index===be?be:we.index:be)};return _.addEventListener("frameupdate",U),()=>_.removeEventListener("frameupdate",U)},[o,r,z,f]),d.useEffect(()=>{var _,U,re;W!==null&&((re=(U=(_=P.current)==null?void 0:_.querySelector(`[data-testid="transcript-word-${W}"]`))==null?void 0:U.scrollIntoView)==null||re.call(U,{block:"nearest"}))},[W]);const B=p.trim().normalize("NFC").toLowerCase(),X=d.useMemo(()=>B?z.filter(_=>_.live.normalize("NFC").toLowerCase().includes(B)).map(_=>_.index):[],[B,z]),ae=d.useMemo(()=>B?new Set(X):null,[B,X]),[oe,Y]=d.useState(0),q=_=>{var U,re,fe;(fe=(re=(U=P.current)==null?void 0:U.querySelector(`[data-testid="transcript-word-${_}"]`))==null?void 0:re.scrollIntoView)==null||fe.call(re,{block:"center"})};d.useEffect(()=>{Y(0),X.length>0&&q(X[0])},[X]);const xe=_=>{if(X.length===0)return;const U=(oe+_+X.length)%X.length;Y(U),q(X[U])},Se=_=>{const U=_.draft.trim();U&&i.patchCaption(_.srcStart,U,_.base),w(null)},de=_=>{Ze(_.word)!==null&&K(_.word)===void 0&&w({index:_.index,draft:_.live,srcStart:_.word.srcStart,base:_.base})},K=_=>{const U=Ze(_);if(U===null)return;const re=Number(U.slice(1));return i.doc.captionRangeEdits.find(fe=>{const we=Number(fe.fromKey.slice(1)),be=Number(fe.toKey.slice(1));return re>=Math.min(we,be)&&re<=Math.max(we,be)})},ee=x===null?null:Math.min(x.anchor,x.focus),ue=x===null?null:Math.max(x.anchor,x.focus),se=ee===null||ue===null?[]:z.slice(ee,ue+1),Re=se.length>0&&se.every(H),Ie=se.some(_=>Ze(_.word)===null),De=se.map(_=>K(_.word)).find(_=>_!==void 0),Qe=_=>{var He,ze,ge;if(g!==null||h!==null||v!==null)return;const U=P.current;if(!U)return;const re=(He=document.getSelection)==null?void 0:He.call(document);if(!re||re.isCollapsed)return;const{anchorNode:fe,focusNode:we}=re;if(!fe||!we||!U.contains(fe)||!U.contains(we))return;const be=we.nodeType===3?we.parentElement:we;if((ze=be==null?void 0:be.closest)!=null&&ze.call(be,"input, textarea"))return;const Pe=Ry(fe),Me=Ry(we);Pe===null||Me===null||_.detail>=2&&Pe===Me||(k({anchor:Math.min(Pe,Me),focus:Math.max(Pe,Me)}),(ge=re.removeAllRanges)==null||ge.call(re))};d.useLayoutEffect(()=>{if(ee===null||ue===null){L(null);return}const _=P.current,U=(_==null?void 0:_.querySelector(`[data-testid="transcript-word-${ee}"]`))??null,re=(_==null?void 0:_.querySelector(`[data-testid="transcript-word-${ue}"]`))??null;if(!_||re===null){L(null);return}const fe=U!==null&&U.offsetTop===re.offsetTop,we=fe?Math.min(U.offsetLeft,re.offsetLeft):re.offsetLeft,be=fe?Math.max(U.offsetLeft+U.offsetWidth,re.offsetLeft+re.offsetWidth):re.offsetLeft+re.offsetWidth,Pe=N.current,Me=F3({anchorTop:re.offsetTop,anchorHeight:re.offsetHeight,anchorLeft:we,anchorWidth:be-we,menuW:(Pe==null?void 0:Pe.offsetWidth)??0,menuH:(Pe==null?void 0:Pe.offsetHeight)??0,scrollTop:_.scrollTop,clientWidth:_.clientWidth,clientHeight:_.clientHeight});L(He=>He!==null&&He.top===Me.top&&He.left===Me.left?He:Me)},[ee,ue,a,g,h,v,D]),d.useEffect(()=>{C(!1),S(null)},[ee,ue]),d.useEffect(()=>{h!==null&&(ee!==h.selLo||ue!==h.selHi)&&y(null)},[h,ee,ue]);const ke=d.useMemo(()=>h!==null&&ee!==null&&ue!==null?R3(z,ee,ue,K):[],[h,ee,ue,z,i.doc.captionRangeEdits]),Ee=()=>{if(se.length===0||Ie)return;const _=T3(se.map(U=>({word:U.word,live:U.live,synthetic:U.synthetic})),ee!==null&&ee>0?z[ee-1].end:null,i.doc);_!==null&&(s(_),k(null))},je=()=>{if(se.length===0||Ie)return;const _=De;if(_!==void 0){const U=Math.min(Number(_.fromKey.slice(1)),Number(_.toKey.slice(1))),re=Math.max(Number(_.fromKey.slice(1)),Number(_.toKey.slice(1))),fe=z.filter(we=>{const be=Ze(we.word);if(be===null)return!1;const Pe=Number(be.slice(1));return Pe>=U&&Pe<=re});if(fe.length===0)return;k({anchor:fe[0].index,focus:fe[fe.length-1].index}),y({draft:fe.map(we=>we.live).join(" ").normalize("NFC"),fromSrcStart:Number(_.fromKey.slice(1))/1e3,toSrcStart:Number(_.toKey.slice(1))/1e3,was:fe.map(we=>we.base).join(" ").normalize("NFC"),rawWas:fe.map(we=>we.base).join(" "),covered:!0,selLo:fe[0].index,selHi:fe[fe.length-1].index});return}y({draft:se.map(U=>U.live).join(" ").normalize("NFC"),fromSrcStart:se[0].word.srcStart,toSrcStart:se[se.length-1].word.srcStart,was:se.map(U=>U.base).join(" ").normalize("NFC"),rawWas:se.map(U=>U.base).join(" "),covered:!1,selLo:ee,selHi:ue})},_e=_=>{const U=_.draft.trim();if(U){const re=U.split(/\s+/).filter(Boolean);!_.covered&&_.fromSrcStart===_.toSrcStart&&re.length===1?i.patchCaption(_.fromSrcStart,U,_.rawWas):i.patchCaptionRange(_.fromSrcStart,_.toSrcStart,U,_.was),k(null)}y(null)},Le=_=>{const U=_.draft.trim();if(U){const re=U.split(/\s+/).filter(Boolean);!_.covered&&_.fromSrcStart===_.toSrcStart&&re.length===1?i.patchCaptionAllOccurrences([{srcStart:_.fromSrcStart,was:_.rawWas},...ke.map(fe=>({srcStart:fe.fromSrcStart,was:fe.rawWas}))],U):i.patchCaptionRangeAllOccurrences([{fromSrcStart:_.fromSrcStart,toSrcStart:_.toSrcStart,was:_.was},...ke],U),k(null)}y(null)},dt=()=>{se.length===0||Ie||(i.hideCaptionWords(se.filter(_=>!H(_)).map(_=>({srcStart:_.word.srcStart,was:_.live}))),k(null))},Kt=()=>{se.length!==0&&(i.restoreCaptionWords(se.filter(H).map(_=>_.word.srcStart)),k(null))},gn=d.useMemo(()=>N3(t,n),[t,n]),Zn=_=>{var fe;const U=gn[_]??null;if(U===null)return;const re=Ze((fe=n[U])==null?void 0:fe.words[0]);return re===null?void 0:i.doc.captionLineTiming[re]},Mt=se.length===0?0:se[se.length-1].lineIndex-se[0].lineIndex+1,Kn=()=>{var He,ze;if(se.length===0||Ie)return;const _=n,U=gn[se[0].lineIndex]??null,re=gn[se[se.length-1].lineIndex]??null;if(U===null||re===null)return;const fe=[];for(let ge=U;ge<=re;ge++){const Ce=tl(_,ge);if(Ce===null)return;fe.push(Ce)}const we=fe[0],be=fe[fe.length-1],Pe={start:we.start,end:be.end},Me=_3({prev:U>0?_[U-1]:null,next:re<_.length-1?_[re+1]:null,span:Pe,track:{start:_[0].start,end:_[_.length-1].end}});S({track:_,from:U,to:re,span:Pe,bounds:Me,newSpan:M3({start:Pe.start+(((He=i.doc.captionLineTiming[we.key])==null?void 0:He.lead)??0),end:Pe.end+(((ze=i.doc.captionLineTiming[be.key])==null?void 0:ze.tail)??0)},Me.lo,Me.hi)})},Yt=d.useMemo(()=>{if(v===null)return null;const _=[];for(let U=v.from;U<=v.to;U++){const re=tl(v.track,U);if(re===null)return null;_.push(re)}return{lines:_,prev:v.from>0?tl(v.track,v.from-1):null,next:v.to<v.track.length-1?tl(v.track,v.to+1):null}},[v]),yn=d.useMemo(()=>{var we,be;if(v===null||Yt===null)return null;const{lines:_,prev:U,next:re}=Yt,fe=i.doc.captionLineTiming;return A3({lines:_,span:v.span,newSpan:v.newSpan,prev:U===null?null:{...U,lead:((we=fe[U.key])==null?void 0:we.lead)??0},next:re===null?null:{...re,tail:((be=fe[re.key])==null?void 0:be.tail)??0}})},[v,Yt,i.doc.captionLineTiming]),Gt=d.useMemo(()=>{if(v===null||yn===null)return null;const _={...i.doc.captionLineTiming};for(const U of yn)_[kn(U.srcStart)]={lead:U.lead,tail:U.tail};return tb(v.track,_).lines},[v,yn,i.doc.captionLineTiming]),ft=d.useMemo(()=>{if(v===null||Gt===null)return null;const _=Gt[v.from],U=Gt[v.to];return _&&U?{start:_.start,end:U.end}:null},[v,Gt]),vn=v===null?0:v.to-v.from+1,Ot=d.useMemo(()=>{if(v===null||Yt===null)return null;const _=Yt.prev??Yt.lines[0],U=Yt.next??Yt.lines[Yt.lines.length-1];return{srcStart:_.srcStart,srcEnd:U.srcEnd,outStart:_.start,dur:U.srcEnd-_.srcStart+2*Qa}},[v,Yt]);d.useEffect(()=>{A(null)},[l]),d.useEffect(()=>{if(v===null||F!==null)return;let _=!1;return P3(l).then(U=>{!_&&U!==null&&A(U)}),()=>{_=!0}},[v,F,l]);const _n=_=>Ot===null?0:(_-Ot.outStart+Qa)/Ot.dur*lo;d.useEffect(()=>{var He;if(v===null||ft===null||Gt===null||Ot===null)return;const _=I.current,U=((He=_==null?void 0:_.getContext)==null?void 0:He.call(_,"2d"))??null;if(!_||!U)return;const re=_n;U.fillStyle="#0F0F14",U.fillRect(0,0,lo,un);const fe=Math.floor(lo/2),we=F===null?new Float32Array(fe):j3(F.channel,F.sampleRate,Ot.srcStart-Qa,Ot.srcEnd+Qa,fe).buckets;U.fillStyle="#4a4a58";const be=lo/fe;for(let ze=0;ze<fe;ze++){const ge=Math.max(1,we[ze]*(un-4));U.fillRect(ze*be,(un-ge)/2,Math.max(1,be-1),ge)}U.fillStyle="rgba(255, 225, 77, 0.06)";for(const ze of[v.from-1,v.to+1]){const ge=Gt[ze];ge&&U.fillRect(re(ge.start),0,Math.max(1,re(ge.end)-re(ge.start)),un)}const Pe=re(ft.start),Me=re(ft.end);U.fillStyle="rgba(255, 225, 77, 0.18)",U.fillRect(Pe,0,Math.max(1,Me-Pe),un),U.fillStyle="#7a7a88";for(let ze=Math.max(0,v.from-1);ze<=v.to+1;ze++){const ge=Gt[ze];ge&&(ze!==v.from&&U.fillRect(re(ge.start),0,1,un),ze!==v.to&&U.fillRect(re(ge.end),0,1,un))}U.fillStyle="#FFE14D",U.fillRect(Pe-1,0,2,un),U.fillRect(Me-1,0,2,un)},[v,ft,Gt,Ot,F]);const Yn=Ot===null?0:Ot.dur/lo,Mn=v===null||ft===null||Ot===null?null:{lead:_n(ft.start),tail:_n(ft.end)},Tr=_=>U=>{v!==null&&(U.preventDefault(),R({edge:_,startX:U.clientX,span:v.newSpan}))};d.useEffect(()=>{if(T===null||v===null)return;const _=re=>{S({...v,newSpan:$3({edge:T.edge,span:T.span,dSec:(re.clientX-T.startX)*Yn,lo:v.bounds.lo,hi:v.bounds.hi})})},U=()=>R(null);return window.addEventListener("pointermove",_),window.addEventListener("pointerup",U),window.addEventListener("pointercancel",U),window.addEventListener("blur",U),()=>{window.removeEventListener("pointermove",_),window.removeEventListener("pointerup",U),window.removeEventListener("pointercancel",U),window.removeEventListener("blur",U)}},[T,v,Yn]),d.useEffect(()=>{v===null&&T!==null&&R(null)},[v,T]);const ur=()=>{if(ft===null)return;const _=o.current;if(_){if(b){_.pause(),E(!1);return}_.seekTo(Math.ceil(c(ft.start)*r)),_.play(),E(!0)}};d.useEffect(()=>{if(!b||ft===null)return;const _=o.current;if(!_)return;const U=c(ft.end),re=fe=>{fe.detail.frame/r>=U&&(_.pause(),E(!1))};return _.addEventListener("frameupdate",re),()=>_.removeEventListener("frameupdate",re)},[b,ft,r,o,c]),d.useEffect(()=>{const _=o.current;if(!_)return;const U=()=>E(!1);return _.addEventListener("pause",U),()=>_.removeEventListener("pause",U)}),d.useEffect(()=>{var _;v!==null||!b||((_=o.current)==null||_.pause(),E(!1))},[v,b,o]);const cr=_=>{i.patchCaptionLineTiming(_),S(null)};return u.jsxs("div",{"data-testid":"transcript-panel",style:{...z3,width:a},children:[u.jsxs("div",{style:D3,children:[u.jsx("span",{style:O3,children:"Transcript"}),u.jsxs("div",{style:eN,children:[u.jsx("span",{style:Py,children:"Click to jump · double-click to retype · drag to select"}),u.jsx("button",{"data-testid":"transcript-help-toggle",style:tN,onClick:()=>V(_=>!_),title:"What each gesture does","aria-label":"Transcript help","aria-expanded":$,children:"?"})]}),$?u.jsx("div",{"data-testid":"transcript-help",style:Py,children:"Drag across words — or shift-click — to mark a run. Its toolbar offers Edit (rewrite freely — word count may change, captions only; works on a single word too, the way to split a merged one), Timing (whole CAPTIONS — drag the waveform handles to move when they come in and go out, or drag between them to shift them all, taking the time from the captions either side) and Delete — from the captions only (restorable — the word stays here and in the audio) or from the video too, on the next Render. Double-click retype stays 1:1 — word count and timing fixed, so scene anchors and the caption highlight keep working."}):null,u.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[u.jsx("input",{"data-testid":"transcript-search",style:{...B3,flex:1},placeholder:"Find a word…",value:p,onChange:_=>m(_.target.value),onKeyDown:_=>{_.key==="Enter"&&(_.preventDefault(),xe(_.shiftKey?-1:1))}}),u.jsx("button",{"data-testid":"transcript-prev",style:Fy,onClick:()=>xe(-1),disabled:X.length===0,title:"Previous match (⇧Enter)","aria-label":"Previous match",children:"‹"}),u.jsx("button",{"data-testid":"transcript-next",style:Fy,onClick:()=>xe(1),disabled:X.length===0,title:"Next match (Enter)","aria-label":"Next match",children:"›"})]}),ae?u.jsx("div",{"data-testid":"transcript-match-count",style:{fontSize:11,color:"#9A9AA3"},children:X.length===0?"0 matches":`${oe+1}/${X.length} match${X.length===1?"":"es"}`}):null]}),u.jsxs("div",{style:W3,"data-testid":"transcript-body",dir:G,ref:P,onMouseUp:Qe,tabIndex:0,onKeyDown:_=>{if(!(g!==null||h!==null)){if(v!==null){_.key==="Escape"&&(_.stopPropagation(),S(null));return}if(_.key==="Escape"){if(x===null)return;_.stopPropagation(),k(null),y(null);return}(_.key==="Delete"||_.key==="Backspace")&&x!==null&&(_.preventDefault(),_.stopPropagation(),Re?Kt():Ee())}},children:[z.map((_,U)=>{const re=K(_.word),fe=Zn(_.lineIndex),we=H(_)?"hidden from captions — select and Restore":re!==void 0?`part of a rewritten range (was “${re.was}”) — select it and use Edit`:_.synthetic?`rewritten (was “${_.base}”) — select and Edit to change`:_.live!==_.base?`edited (was “${_.base}”) — double-click to retype`:"click to jump · double-click to retype";return u.jsxs(le.Fragment,{children:[U>0?" ":null,(g==null?void 0:g.index)===_.index?u.jsx("input",{autoFocus:!0,"data-testid":"transcript-edit",style:iN,value:g.draft,onChange:be=>w({...g,draft:be.target.value}),onBlur:()=>Se(g),onKeyDown:be=>{be.key==="Enter"&&be.target.blur(),be.key==="Escape"&&w(null)}}):u.jsx("span",{"data-testid":`transcript-word-${_.index}`,onClick:be=>{var Pe;if(h!==null&&y(null),v!==null&&S(null),be.shiftKey){k(Me=>Me===null?{anchor:_.index,focus:_.index}:{...Me,focus:_.index});return}(Pe=o.current)==null||Pe.seekTo(Math.ceil(c(_.start)*r)),k({anchor:_.index,focus:_.index})},onDoubleClick:()=>de(_),title:fe===void 0?we:`${we} · caption timing adjusted (${Math.round(fe.lead*1e3)}ms in / ${Math.round(fe.tail*1e3)}ms out) — Timing to change`,style:{...V3,...fe!==void 0?X3:{},...H(_)?G3:{},..._.live!==_.base||_.synthetic?Z3:{},...ee!==null&&_.index>=ee&&_.index<=ue?Y3:{},...ae!=null&&ae.has(_.index)?H3:{},...X[oe]===_.index?U3:{},...W===_.index?K3:{}},children:_.live})]},_.index)}),x!==null&&D!==null&&g===null&&h===null&&v===null?u.jsxs("div",{"data-testid":"transcript-selection-menu",role:"menu",ref:N,dir:"ltr",style:{...wl,top:D.top,left:D.left},children:[u.jsx(Uo,{"data-testid":"transcript-edit-range",onClick:je,disabled:Ie,title:Ie?"A selected word has no source anchor (this project predates them) — re-run produce first":De!==void 0?"Re-edit the rewritten range this selection touches":se.length===1?"Retype this word (1:1 — same as double-click)":"Rewrite these words as free text — word count may change",children:"Edit"}),u.jsx(Uo,{"data-testid":"transcript-timing",onClick:Kn,disabled:se.length===0||Ie,title:Ie?"A selected word has no source anchor (this project predates them) — re-run produce first":Mt===1?"Adjust when this caption appears and leaves":`Adjust when these ${Mt} captions appear and leave`,children:"Timing"}),Re?u.jsx(Uo,{"data-testid":"transcript-restore",onClick:Kt,title:"Show these words in the captions again",children:"Restore"}):u.jsxs("span",{style:{position:"relative"},children:[u.jsx(Uo,{"data-testid":"transcript-delete-menu",onClick:()=>C(_=>!_),title:"Delete these words — from the captions only, or from the video too",children:"Delete ▾"}),j?u.jsxs("div",{"data-testid":"transcript-delete-flyout",dir:"ltr",style:nN,children:[u.jsx(Uo,{"data-testid":"transcript-hide",onClick:()=>{C(!1),dt()},disabled:Ie,title:Ie?"A selected word has no source anchor (this project predates them) — re-run produce first":"Hide these words from the captions — restorable, the words stay here and in the audio",children:"Delete captions"}),u.jsx(Uo,{"data-testid":"transcript-delete",onClick:()=>{C(!1),Ee()},disabled:Ie,title:Ie?"A selected word has no source anchor (this project predates them) — re-run produce first":"Delete these words — from the captions only, or from the video too",children:"Delete + video…"})]}):null]}),u.jsxs("span",{style:_y,children:[se.length," word",se.length===1?"":"s"]})]}):null,h!==null&&D!==null?u.jsxs("div",{"data-testid":"transcript-range-popover",ref:N,dir:"ltr",style:{...wl,top:D.top,left:D.left,flexDirection:"column",alignItems:"stretch",gap:6},children:[u.jsx("textarea",{autoFocus:!0,"data-testid":"transcript-range-edit",rows:3,dir:"auto",style:oN,value:h.draft,onChange:_=>y({...h,draft:_.target.value}),onKeyDown:_=>{_.key==="Enter"&&!_.shiftKey&&(_.preventDefault(),_e(h)),_.key==="Escape"&&y(null)}}),u.jsxs("div",{style:{display:"flex",gap:6},children:[u.jsx("button",{"data-testid":"transcript-apply",style:Zo,onClick:()=>_e(h),title:"Rewrite this selection (Enter)",children:"Apply"}),ke.length>0?u.jsxs("button",{"data-testid":"transcript-apply-all",style:Zo,onClick:()=>Le(h),title:"Rewrite this selection AND every other place the same words occur — one undo step",children:["Apply to all (",ke.length,")"]}):null,u.jsx("button",{style:Zo,onClick:()=>y(null),title:"Discard the rewrite (Esc)",children:"Cancel"})]})]}):null,v!==null&&ft!==null&&D!==null?u.jsxs("div",{"data-testid":"transcript-timing-popover",ref:N,dir:"ltr",style:{...wl,top:D.top,left:D.left,flexDirection:"column",alignItems:"stretch",gap:6},children:[u.jsxs("div",{style:{position:"relative",width:lo,height:un},children:[u.jsx("canvas",{"data-testid":"transcript-timing-canvas",ref:I,width:lo,height:un,style:{display:"block",borderRadius:4}}),Mn!==null?u.jsxs(u.Fragment,{children:[u.jsx("div",{"data-testid":"transcript-timing-band",title:vn===1?"Drag to shift this caption, its duration intact":"Drag to shift these captions, every duration intact",onPointerDown:Tr("band"),style:{...J3,left:Mn.lead,width:Math.max(0,Mn.tail-Mn.lead),cursor:(T==null?void 0:T.edge)==="band"?"grabbing":"grab"}}),u.jsx(jy,{"data-testid":"transcript-timing-handle-lead",title:vn===1?"Drag to move when this caption comes in — the previous caption gives up the time":"Drag to move when the first caption comes in — the previous caption gives up the time",x:Mn.lead,active:(T==null?void 0:T.edge)==="lead",onPointerDown:Tr("lead")}),u.jsx(jy,{"data-testid":"transcript-timing-handle-tail",title:vn===1?"Drag to move when this caption goes out — the next caption gives up the time":"Drag to move when the last caption goes out — the next caption gives up the time",x:Mn.tail,active:(T==null?void 0:T.edge)==="tail",onPointerDown:Tr("tail")})]}):null]}),u.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[u.jsx("button",{"data-testid":"transcript-timing-play",style:Zo,onClick:ur,title:b?"Pause":vn===1?"Play just this caption's span":"Play just these captions' span",children:b?"Pause":"Play"}),u.jsxs("span",{"data-testid":"transcript-timing-span",style:_y,children:[ft.start.toFixed(2),"s – ",ft.end.toFixed(2),"s",` · ${vn} caption${vn===1?"":"s"}`]}),u.jsx("button",{"data-testid":"transcript-timing-apply",style:Zo,onClick:()=>{yn!==null&&cr(yn)},title:vn===1?"Store this caption's timing — the neighbour's matching seam moves with it":"Store these captions' timing — one undo step for the whole gesture",children:"Apply"}),u.jsx("button",{"data-testid":"transcript-timing-cancel",style:Zo,onClick:()=>S(null),title:"Discard the nudge (Esc)",children:"Cancel"})]})]}):null]})]})},Uo=({children:e,...t})=>{const[n,r]=d.useState(!1);return u.jsx("button",{role:"menuitem",...t,style:{...rN,...n&&!t.disabled?{background:"#34343F"}:{},...t.disabled?{opacity:.5,cursor:"default"}:{}},onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:e})},jy=({x:e,active:t,...n})=>{const[r,o]=d.useState(!1);return u.jsx("div",{...n,style:{...q3,left:e-Nb/2},onPointerEnter:()=>o(!0),onPointerLeave:()=>o(!1),children:u.jsx("div",{style:{...Q3,background:t?"#fff":r?"#FFF0A0":"#FFE14D",width:t?4:2}})})},z3={flexShrink:0,display:"flex",flexDirection:"column",background:"#111116",minHeight:0},D3={display:"flex",flexDirection:"column",gap:8,padding:"14px 14px 10px",borderBottom:"1px solid #1E1E24"},O3={fontSize:11,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"#9A9AA3"},Py={fontSize:11,lineHeight:1.45,color:"#6a6a75"},B3={fontFamily:"'Inter', system-ui, sans-serif",fontSize:13,background:"#0F0F14",border:"1px solid #2A2A33",borderRadius:6,color:"#fff",padding:"6px 8px"},W3={flex:1,position:"relative",fontFamily:"'Inter', 'Noto Nastaliq Urdu', 'Geeza Pro', 'Noto Naskh Arabic', system-ui, sans-serif",overflowY:"auto",overflowX:"hidden",overflowWrap:"break-word",padding:"10px 14px 16px",fontSize:13,lineHeight:2,color:"#C9C9D4"},V3={cursor:"pointer",borderRadius:3,padding:"2px 4px",unicodeBidi:"isolate"},H3={background:"#2b2b1a",outline:"1px solid #6b6432"},U3={background:"#3d3a17",outline:"2px solid #FFE14D",color:"#fff"},Fy={width:26,height:30,fontSize:16,lineHeight:1,color:"#EDEDF2",background:"#1A1A21",border:"1px solid #2A2A33",borderRadius:6,cursor:"pointer",padding:0},Z3={color:"#FFE14D"},K3={textDecoration:"underline",textUnderlineOffset:4},Y3={background:"#FFE14D",color:"#111",borderRadius:0,boxShadow:"-4px 0 0 0 #FFE14D, 4px 0 0 0 #FFE14D"},G3={textDecoration:"line-through",color:"#6a6a75"},X3={borderBottom:"1px dotted #9A9AA3"},Nb=12,q3={position:"absolute",top:0,width:Nb,height:un,cursor:"ew-resize",touchAction:"none",display:"flex",justifyContent:"center"},J3={position:"absolute",top:0,height:un,touchAction:"none"},Q3={height:"100%",borderRadius:1,pointerEvents:"none"},eN={display:"flex",gap:6,alignItems:"center",justifyContent:"space-between"},tN={width:20,height:20,fontSize:11,lineHeight:1,color:"#9A9AA3",background:"#1A1A21",border:"1px solid #2A2A33",borderRadius:6,cursor:"pointer",padding:0,flexShrink:0},wl={position:"absolute",zIndex:31,background:"#262630",border:"1px solid #3A3A47",borderRadius:10,padding:"4px 6px",boxShadow:"0 14px 34px rgba(0,0,0,0.66), 0 2px 6px rgba(0,0,0,0.4)",display:"flex",flexDirection:"row",alignItems:"center",gap:2},nN={...wl,top:"100%",left:0,marginTop:4,zIndex:32,minWidth:170,flexDirection:"column",alignItems:"stretch"},_y={fontSize:11,color:"#9A9AA3",paddingInline:"6px 8px",whiteSpace:"nowrap"},rN={fontSize:12,fontWeight:600,color:"#EDEDF2",background:"transparent",border:"none",borderRadius:6,padding:"6px 10px",cursor:"pointer",textAlign:"left",whiteSpace:"nowrap"},oN={fontFamily:"'Inter', 'Noto Nastaliq Urdu', 'Geeza Pro', 'Noto Naskh Arabic', system-ui, sans-serif",fontSize:13,width:280,background:"#0F0F14",border:"1px solid #FFE14D",borderRadius:4,color:"#fff",padding:"4px 6px",resize:"vertical"},Zo={fontSize:11,color:"#EDEDF2",background:"#34343F",border:"1px solid #45454F",borderRadius:6,cursor:"pointer",padding:"4px 8px"},iN={fontFamily:"'Inter', 'Noto Nastaliq Urdu', 'Geeza Pro', 'Noto Naskh Arabic', system-ui, sans-serif",fontSize:13,width:110,background:"#0F0F14",border:"1px solid #FFE14D",borderRadius:4,color:"#fff",padding:"1px 4px"},sN=[{title:"transport",rows:[["space","play / pause"],["J / K / L","reverse · pause · forward (tap again to speed up)"],["← / →","step one frame back / forward"],["⌘/ctrl + ← / →","jump to and select the previous / next scene"]]},{title:"selection",rows:[["click","select scene or element"],["⌥ + ← / →","select previous / next scene"],["esc","clear selection · close dialogs"]]},{title:"editing",rows:[["⌘/ctrl + B","split the scene at the playhead"],["delete / backspace","delete the selected scene — asks graphic or whole take (§139)"],["enter (in that dialog)","confirm the highlighted option"],["⌘/ctrl + Z","undo"],["⌘/ctrl + ⇧ + Z","redo (⌘Y works too)"],["⌘/ctrl + S","save"],["double-click caption word","retype it in place"],["drag element / corner handles","move · resize"],["drag picture","pan the video framing"],["drag a scene block / edge on the timeline","snaps to scene edges + the playhead (hold ⌥ while dragging to disable)"],["drag a box on the stage","snaps to centre / safe-area guides (hold ⌥ mid-drag to disable)"]]},{title:"view",rows:[["⌘/ctrl + scroll on preview","zoom the view (never edits)"],["⌥-drag / middle-drag","pan the zoomed view"],["⌘/ctrl + scroll on timeline","zoom the timeline"],["?","this reference"]]}],aN=({onClose:e})=>(d.useEffect(()=>{const t=n=>{n.key==="Escape"&&(n.stopPropagation(),e())};return window.addEventListener("keydown",t,!0),()=>window.removeEventListener("keydown",t,!0)},[e]),u.jsx("div",{style:lN,onMouseDown:e,children:u.jsxs("div",{"data-testid":"shortcuts-modal",style:uN,onMouseDown:t=>t.stopPropagation(),children:[u.jsxs("div",{style:cN,children:[u.jsx("span",{style:dN,children:"keybinds"}),u.jsx("span",{style:fN,children:"esc close"})]}),u.jsx("div",{style:pN,children:"available commands and configured shortcuts"}),sN.map(t=>u.jsxs("div",{style:{marginTop:18},children:[u.jsx("div",{style:hN,children:t.title}),t.rows.map(([n,r])=>u.jsxs("div",{style:mN,children:[u.jsx("span",{style:gN,children:n}),u.jsx("span",{style:yN,children:r})]},n))]},t.title))]})})),lN={position:"fixed",inset:0,zIndex:30,background:"rgba(5,5,8,0.6)",display:"flex",alignItems:"center",justifyContent:"center"},uN={width:620,maxWidth:"90vw",maxHeight:"82vh",overflowY:"auto",background:"#12121A",border:"1px solid #3A3A48",borderRadius:8,padding:"20px 26px 26px",fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace"},cN={display:"flex",justifyContent:"space-between",alignItems:"center"},dN={fontSize:18,fontWeight:700,color:"#EDEDF2"},fN={fontSize:13,fontWeight:700,color:"#0B0B0E",background:"#a8c7fa",borderRadius:4,padding:"3px 10px"},pN={fontSize:13,color:"#6a6a75",marginTop:4},hN={fontSize:14,fontWeight:700,color:"#8ab4f8",marginBottom:6},mN={display:"flex",gap:16,padding:"3px 0"},gN={width:290,flexShrink:0,color:"#c5a3ff",fontWeight:600,fontSize:13},yN={color:"#C9C9D4",fontSize:13},My={graphic:{label:"just the graphic",detail:e=>e.isSplitHalf?"this half only — the take underneath keeps playing":"the take underneath keeps playing"},take:{label:"the whole take",detail:e=>`cuts ${(e.endSec-e.startSec).toFixed(1)}s out of the video`}},vN=({plan:e,onConfirm:t,onCancel:n})=>{const[r,o]=d.useState(e.targets[0]),i=d.useRef(null),s=d.useRef(null);return d.useEffect(()=>{const a=l=>{if(l.key==="Escape"){l.stopPropagation(),n();return}if(l.key!=="Tab")return;const c=i.current;if(!c)return;const f=c.querySelectorAll("input, button"),p=f[0],m=f[f.length-1];!p||!m||(l.shiftKey&&document.activeElement===p?(l.preventDefault(),m.focus()):!l.shiftKey&&document.activeElement===m&&(l.preventDefault(),p.focus()))};return window.addEventListener("keydown",a,!0),()=>window.removeEventListener("keydown",a,!0)},[n]),d.useEffect(()=>{var l;const a=document.activeElement;return(l=s.current)==null||l.focus(),()=>{var c;return(c=a==null?void 0:a.focus)==null?void 0:c.call(a)}},[]),u.jsx("div",{style:wN,onMouseDown:n,children:u.jsxs("form",{ref:i,"data-testid":"delete-scene-modal",role:"dialog","aria-modal":"true","aria-label":`Delete ${e.rootId}`,style:xN,onMouseDown:a=>a.stopPropagation(),onSubmit:a=>{a.preventDefault(),t(r)},children:[u.jsxs("div",{style:bN,children:[u.jsxs("span",{style:SN,children:["delete ",e.rootId,e.isSplitHalf?u.jsx("span",{style:kN,children:"half"}):null,"?"]}),u.jsx("span",{style:EN,children:"esc cancel"})]}),u.jsx("div",{style:CN,children:"undoable with ⌘Z, like every other edit"}),u.jsx("div",{style:{marginTop:16},children:e.targets.map(a=>u.jsxs("label",{style:IN,"data-testid":`delete-option-${a}`,children:[u.jsx("input",{type:"radio",name:"delete-target",value:a,checked:r===a,onChange:()=>o(a),style:TN}),u.jsxs("span",{children:[u.jsx("span",{style:RN,children:My[a].label}),u.jsx("span",{style:jN,children:My[a].detail(e)})]})]},a))}),u.jsxs("div",{style:PN,children:[u.jsx("button",{type:"button","data-testid":"delete-cancel",style:Lb,onClick:n,children:"Cancel"}),u.jsx("button",{ref:s,type:"submit","data-testid":"delete-confirm",style:FN,children:"Delete"})]})]})})},wN={position:"fixed",inset:0,zIndex:30,background:"rgba(5,5,8,0.6)",display:"flex",alignItems:"center",justifyContent:"center"},xN={width:420,maxWidth:"90vw",background:"#12121A",border:"1px solid #3A3A48",borderRadius:8,padding:"18px 22px 20px",fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace"},bN={display:"flex",justifyContent:"space-between",alignItems:"center",gap:12},SN={fontSize:16,fontWeight:700,color:"#EDEDF2"},kN={fontSize:11,fontWeight:700,color:"#0B0B0E",background:"#c5a3ff",borderRadius:4,padding:"2px 6px",marginLeft:6},EN={fontSize:12,fontWeight:700,color:"#0B0B0E",background:"#a8c7fa",borderRadius:4,padding:"3px 10px",whiteSpace:"nowrap"},CN={fontSize:12,color:"#6a6a75",marginTop:4},IN={display:"flex",alignItems:"flex-start",gap:10,padding:"8px 0",cursor:"pointer"},TN={accentColor:"#8ab4f8",marginTop:2,cursor:"pointer"},RN={display:"block",fontSize:13,fontWeight:600,color:"#EDEDF2"},jN={display:"block",fontSize:12,color:"#9A9AA3",marginTop:2},PN={display:"flex",justifyContent:"flex-end",gap:8,marginTop:14},Lb={fontSize:12,fontWeight:600,color:"#C9C9D4",background:"transparent",border:"1px solid #2A2A33",borderRadius:6,padding:"7px 12px",cursor:"pointer",fontFamily:"inherit"},FN={...Lb,color:"#FF5C5C",border:"1px solid #452626"},$y={caption:{label:"Remove from captions only",detail:()=>"restorable — the words stay in the transcript and the audio"},"caption-video":{label:"Remove captions + video",detail:e=>`cuts ${(e.endSec-e.startSec).toFixed(1)}s out of the video on the next Render; captions disappear now`}},_N=({plan:e,onConfirm:t,onCancel:n})=>{const[r,o]=d.useState(e.targets[0]),i=d.useRef(null),s=d.useRef(null);d.useEffect(()=>{const l=c=>{if(c.key==="Escape"){c.stopPropagation(),n();return}if(c.key!=="Tab")return;const f=i.current;if(!f)return;const p=f.querySelectorAll("input, button"),m=p[0],g=p[p.length-1];!m||!g||(c.shiftKey&&document.activeElement===m?(c.preventDefault(),g.focus()):!c.shiftKey&&document.activeElement===g&&(c.preventDefault(),m.focus()))};return window.addEventListener("keydown",l,!0),()=>window.removeEventListener("keydown",l,!0)},[n]),d.useEffect(()=>{var c;const l=document.activeElement;return(c=s.current)==null||c.focus(),()=>{var f;return(f=l==null?void 0:l.focus)==null?void 0:f.call(l)}},[]);const a=e.words.length;return u.jsx("div",{style:MN,onMouseDown:n,children:u.jsxs("form",{ref:i,"data-testid":"delete-words-modal",role:"dialog","aria-modal":"true","aria-label":`Delete ${a} word${a===1?"":"s"}`,style:$N,onMouseDown:l=>l.stopPropagation(),onSubmit:l=>{l.preventDefault(),t(r)},children:[u.jsxs("div",{style:AN,children:[u.jsxs("span",{style:NN,children:["delete ",a," word",a===1?"":"s","?"]}),u.jsx("span",{style:LN,children:"esc cancel"})]}),u.jsx("div",{style:zN,children:"undoable with ⌘Z, like every other edit"}),u.jsx("div",{style:{marginTop:16},children:e.targets.map(l=>u.jsxs("label",{style:DN,"data-testid":`delete-words-option-${l}`,children:[u.jsx("input",{type:"radio",name:"delete-words-target",value:l,checked:r===l,onChange:()=>o(l),style:ON}),u.jsxs("span",{children:[u.jsx("span",{style:BN,children:$y[l].label}),u.jsx("span",{style:WN,children:$y[l].detail(e)})]})]},l))}),u.jsxs("div",{style:VN,children:[u.jsx("button",{type:"button","data-testid":"delete-words-cancel",style:zb,onClick:n,children:"Cancel"}),u.jsx("button",{ref:s,type:"submit","data-testid":"delete-words-confirm",style:HN,children:"Delete"})]})]})})},MN={position:"fixed",inset:0,zIndex:30,background:"rgba(5,5,8,0.6)",display:"flex",alignItems:"center",justifyContent:"center"},$N={width:420,maxWidth:"90vw",background:"#12121A",border:"1px solid #3A3A48",borderRadius:8,padding:"18px 22px 20px",fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace"},AN={display:"flex",justifyContent:"space-between",alignItems:"center",gap:12},NN={fontSize:16,fontWeight:700,color:"#EDEDF2"},LN={fontSize:12,fontWeight:700,color:"#0B0B0E",background:"#a8c7fa",borderRadius:4,padding:"3px 10px",whiteSpace:"nowrap"},zN={fontSize:12,color:"#6a6a75",marginTop:4},DN={display:"flex",alignItems:"flex-start",gap:10,padding:"8px 0",cursor:"pointer"},ON={accentColor:"#8ab4f8",marginTop:2,cursor:"pointer"},BN={display:"block",fontSize:13,fontWeight:600,color:"#EDEDF2"},WN={display:"block",fontSize:12,color:"#9A9AA3",marginTop:2},VN={display:"flex",justifyContent:"flex-end",gap:8,marginTop:14},zb={fontSize:12,fontWeight:600,color:"#C9C9D4",background:"transparent",border:"1px solid #2A2A33",borderRadius:6,padding:"7px 12px",cursor:"pointer",fontFamily:"inherit"},HN={...zb,color:"#FF5C5C",border:"1px solid #452626"},UN=(e,t=3)=>{const n=e.split("/");if(n.length<=t)return{head:"",tail:e};const r=n.length-t;return{head:n.slice(0,r).join("/")||"/",tail:n.slice(r).join("/")}},Ay=e=>e.scrollTop+e.clientHeight<e.scrollHeight-1,ZN=(e,t,n)=>n<=0?-1:Math.max(0,Math.min(n-1,e+t)),Ny=({recent:e,required:t,onOpen:n,onClose:r})=>{const[o,i]=d.useState(null),[s,a]=d.useState(null),[l,c]=d.useState(!1),f=d.useRef(null),p=d.useRef(null),[m,g]=d.useState(!1),[w,x]=d.useState(!1),k=()=>{g(f.current?Ay(f.current):!1)},h=()=>{x(p.current?Ay(p.current):!1)},y=async b=>{try{const E=await fetch(`/api/fs${b?`?dir=${encodeURIComponent(b)}`:""}`),I=await E.json();if(!E.ok)throw new Error(I.error??`listing failed: ${E.status}`);i(I)}catch(E){a(E instanceof Error?E.message:String(E))}};d.useEffect(()=>{y()},[]),d.useEffect(()=>{const b=()=>{k(),h()};return b(),window.addEventListener("resize",b),()=>window.removeEventListener("resize",b)},[o,e]),d.useEffect(()=>{if(t)return;const b=E=>{E.key==="Escape"&&(E.stopPropagation(),r())};return window.addEventListener("keydown",b,!0),()=>window.removeEventListener("keydown",b,!0)},[t,r]);const v=b=>{var F;const E=b.key==="ArrowDown"?1:b.key==="ArrowUp"?-1:0;if(E===0&&b.key!=="Home"&&b.key!=="End")return;const I=Array.from(b.currentTarget.querySelectorAll("button"));if(I.length===0)return;const T=I.indexOf(document.activeElement),R=b.key==="Home"?0:b.key==="End"?I.length-1:ZN(T,E,I.length);b.preventDefault(),(F=I[R])==null||F.focus()},S=b=>{c(!0),a(null),n(b).then(E=>{c(!1),E&&a(E)})};return u.jsx("div",{style:KN,onMouseDown:t?void 0:r,children:u.jsxs("div",{"data-testid":"project-picker",style:YN,onMouseDown:b=>b.stopPropagation(),children:[u.jsxs("div",{style:GN,children:[u.jsx("span",{style:XN,children:t?"open a project":"switch project"}),t?null:u.jsx("button",{"data-testid":"project-picker-close",style:qN,onClick:r,children:"esc close"})]}),u.jsx("div",{style:JN,children:"A project is a work directory a `ossclip produce` run wrote — the folder holding render-props.json."}),s?u.jsx("div",{"data-testid":"project-picker-error",style:QN,children:s}):null,e.length>0?u.jsxs("div",{style:{marginTop:16,flexShrink:0},children:[u.jsx("div",{style:Ly,children:"recent"}),u.jsx("div",{ref:p,className:"ossclip-scroll-list",style:w?{...zy,...Oy}:zy,onScroll:h,onKeyDown:v,"data-testid":"project-recent-list",children:e.map(b=>{const{head:E,tail:I}=UN(b);return u.jsxs("button",{"data-testid":"project-recent",className:"ossclip-picker-row",style:{...ed,...o5},disabled:l,onClick:()=>S(b),title:b,children:[u.jsx("span",{style:{color:"#FFE14D",flexShrink:0},children:"▸"}),u.jsxs("span",{style:i5,children:[u.jsx("span",{style:s5,children:I}),E?u.jsx("span",{style:a5,children:E}):null]})]},b)})})]}):null,u.jsxs("div",{style:r5,children:[u.jsx("div",{style:Ly,children:"browse"}),u.jsxs("div",{style:{color:"#6a6a75",fontSize:12,marginBottom:6},children:["Folders only — hidden ones are omitted, and any projects produced inside a folder show up directly as ",u.jsx("span",{style:{color:"#FFE14D"},children:"▸ .ossclip/…"})," entries."]}),o?u.jsxs(u.Fragment,{children:[u.jsxs("div",{style:e5,children:[u.jsx("span",{style:t5,title:o.dir,children:o.dir}),o.isWorkdir?u.jsx("button",{"data-testid":"project-open-current",style:n5,disabled:l,onClick:()=>S(o.dir),children:"open this project"}):null]}),u.jsxs("div",{ref:f,className:"ossclip-scroll-list",style:m?{...Dy,...Oy}:Dy,onScroll:k,onKeyDown:v,"data-testid":"project-fs-list",children:[o.parent?u.jsxs("button",{"data-testid":"project-fs-up",className:"ossclip-picker-row",style:ed,disabled:l,onClick:()=>void y(o.parent),children:[u.jsx("span",{style:{color:"#6a6a75",flexShrink:0},children:"↑"}),u.jsx("span",{style:By,children:".."})]}):null,o.entries.map(b=>u.jsxs("button",{"data-testid":b.isWorkdir?"project-fs-workdir":"project-fs-dir",className:`ossclip-picker-row${b.isWorkdir?" is-workdir":""}`,style:ed,disabled:l,onClick:()=>b.isWorkdir?S(b.path):void y(b.path),title:b.path,children:[u.jsx("span",{style:{flexShrink:0,color:b.isWorkdir?"#FFE14D":"#6a6a75"},children:b.isWorkdir?"▸":"▪"}),u.jsxs("span",{style:By,children:[b.name,b.isWorkdir?null:u.jsx("span",{style:{color:"#55555f"},children:"/"})]}),b.isWorkdir?u.jsx("span",{style:l5,children:"project"}):null]},b.path)),o.entries.length===0?u.jsx("div",{style:{color:"#6a6a75",fontSize:12,padding:"6px 8px"},children:"no folders here"}):null]})]}):u.jsx("div",{style:{color:"#6a6a75",fontSize:13},children:"loading…"})]})]})})},KN={position:"fixed",inset:0,zIndex:30,background:"rgba(5,5,8,0.6)",display:"flex",alignItems:"center",justifyContent:"center"},YN={width:620,maxWidth:"90vw",maxHeight:"82vh",boxSizing:"border-box",display:"flex",flexDirection:"column",background:"#12121A",border:"1px solid #3A3A48",borderRadius:8,padding:"20px 26px 26px",fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace"},GN={display:"flex",justifyContent:"space-between",alignItems:"center"},XN={fontSize:18,fontWeight:700,color:"#EDEDF2"},qN={fontSize:13,fontWeight:700,color:"#0B0B0E",background:"#a8c7fa",border:"none",borderRadius:4,padding:"3px 10px",cursor:"pointer"},JN={fontSize:13,color:"#6a6a75",marginTop:4},QN={marginTop:12,fontSize:13,color:"#FF5C5C"},Ly={fontSize:14,fontWeight:700,color:"#8ab4f8",marginBottom:6},e5={display:"flex",alignItems:"center",gap:10,marginBottom:6},t5={fontSize:12,color:"#9A9AA3",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},n5={flexShrink:0,fontSize:12,fontWeight:700,color:"#0B0B0E",background:"#FFE14D",border:"1px solid #FFE14D",borderRadius:6,padding:"4px 10px",cursor:"pointer"},r5={marginTop:16,display:"flex",flexDirection:"column",flex:1,minHeight:0},zy={maxHeight:218,overflowY:"auto",overscrollBehavior:"contain",flexShrink:0,display:"flex",flexDirection:"column",gap:2},Dy={flex:1,minHeight:0,overflowY:"auto",overscrollBehavior:"contain",display:"flex",flexDirection:"column",gap:2},Oy={maskImage:"linear-gradient(to bottom, black calc(100% - 24px), transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black calc(100% - 24px), transparent 100%)"},ed={flexShrink:0,minHeight:34,display:"flex",alignItems:"center",gap:8,width:"100%",boxSizing:"border-box",textAlign:"left",fontFamily:"inherit",fontSize:13,lineHeight:1.4,borderRadius:6,padding:"6px 10px",cursor:"pointer",overflow:"hidden"},By={overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},o5={minHeight:46,alignItems:"center"},i5={display:"flex",flexDirection:"column",minWidth:0},s5={color:"#EDEDF2",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},a5={fontSize:11,color:"#6a6a75",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},l5={marginLeft:10,fontSize:11,fontWeight:700,color:"#FFE14D"},u5=({defaultOutPath:e,onCancel:t,onConfirm:n})=>{const[r,o]=d.useState(e??""),[i,s]=d.useState(!1);d.useEffect(()=>{const l=c=>{c.key==="Escape"?(c.stopPropagation(),t()):c.key==="Enter"&&!i&&(c.preventDefault(),n(r.trim()?r.trim():void 0))};return window.addEventListener("keydown",l,!0),()=>window.removeEventListener("keydown",l,!0)},[t,n,r,i]);const a=async()=>{s(!0);try{const l=await fetch("/api/pick-save-path",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({defaultPath:r||e})});if(l.ok){const c=await l.json();c.path&&o(c.path)}}catch{}finally{s(!1)}};return u.jsx("div",{style:c5,onMouseDown:t,children:u.jsxs("div",{"data-testid":"render-modal",style:d5,onMouseDown:l=>l.stopPropagation(),children:[u.jsxs("div",{style:f5,children:[u.jsx("div",{style:p5,children:"🎬 Render Master Video"}),u.jsx("button",{style:h5,onClick:t,children:"✕"})]}),u.jsx("div",{style:m5,children:"Choose where to export your rendered master cut, or keep the default location."}),u.jsxs("div",{style:{marginTop:20},children:[u.jsx("label",{style:g5,children:"Export File Destination"}),u.jsxs("div",{style:y5,children:[u.jsx("input",{"data-testid":"render-outpath-input",type:"text",value:r,onChange:l=>o(l.target.value),placeholder:"e.g. /Users/name/Movies/final-cut.mp4",style:v5,autoFocus:!0}),u.jsx("button",{"data-testid":"render-browse-btn",style:w5,onClick:a,disabled:i,title:"Open native file picker to choose destination",children:i?"Browsing…":"📁 Browse…"})]})]}),u.jsxs("div",{style:x5,children:[u.jsx("button",{style:b5,onClick:t,children:"Cancel"}),u.jsx("button",{"data-testid":"render-confirm-btn",style:S5,onClick:()=>n(r.trim()?r.trim():void 0),children:"Start Render ⚡"})]})]})})},c5={position:"fixed",inset:0,zIndex:40,background:"rgba(5,5,8,0.75)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center"},d5={width:560,maxWidth:"92vw",background:"#12121A",border:"1px solid #3A3A48",borderRadius:10,padding:"24px 28px",boxShadow:"0 20px 40px rgba(0,0,0,0.6)",fontFamily:"ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},f5={display:"flex",justifyContent:"space-between",alignItems:"center"},p5={fontSize:18,fontWeight:700,color:"#EDEDF2",letterSpacing:"-0.01em"},h5={background:"transparent",border:"none",color:"#8B8B9E",fontSize:16,cursor:"pointer",padding:"4px 8px",borderRadius:4},m5={fontSize:13,color:"#8B8B9E",marginTop:6,lineHeight:1.4},g5={display:"block",fontSize:12,fontWeight:600,color:"#C9C9D4",marginBottom:8,textTransform:"uppercase",letterSpacing:"0.04em"},y5={display:"flex",gap:8},v5={flex:1,background:"#09090D",border:"1px solid #2C2C38",borderRadius:6,padding:"10px 14px",color:"#EDEDF2",fontSize:13,fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",outline:"none"},w5={background:"#1E1E2A",border:"1px solid #3A3A48",borderRadius:6,color:"#EDEDF2",padding:"0 16px",fontSize:13,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap"},x5={display:"flex",justifyContent:"flex-end",gap:12,marginTop:24},b5={background:"transparent",border:"1px solid #2C2C38",borderRadius:6,color:"#C9C9D4",padding:"9px 18px",fontSize:13,fontWeight:600,cursor:"pointer"},S5={background:"#00E5A3",border:"none",borderRadius:6,color:"#051A13",padding:"9px 20px",fontSize:13,fontWeight:700,cursor:"pointer",boxShadow:"0 2px 10px rgba(0,229,163,0.3)"};function k5(e){switch(e){case"override":return"Project override";case"flag":case"config":return"Your default portrait"}}function E5(e){const t=/^data:([^;,]+);base64,(.+)$/s.exec(e);return t?{mimeType:t[1],data:t[2]}:null}function C5(e){switch(e){case"no-youtube":return'This project was produced without the YouTube pack. The AI thumbnail needs --youtube — run produce with it (or set "youtube": true in ~/.ossclip/config.json) and render once.';case"no-portrait":return'No portrait photo is configured — the thumbnail uses it as the likeness reference. Set "portrait" in ~/.ossclip/config.json or run produce with --portrait <path>.';case"no-key":return"GEMINI_API_KEY is not set in the environment the edit server runs in.";case"portrait-missing":return"The configured portrait photo no longer exists on disk.";default:return"The AI thumbnail is unavailable for this project."}}const Wy=60,I5=({onClose:e})=>{const[t,n]=d.useState(null),[r,o]=d.useState(null),[i,s]=d.useState(""),[a,l]=d.useState(""),[c,f]=d.useState(""),[p,m]=d.useState(null),[g,w]=d.useState(!1),[x,k]=d.useState(null),[h,y]=d.useState(null),v=d.useRef(null);d.useEffect(()=>{const R=F=>{F.key==="Escape"&&(F.stopPropagation(),e())};return window.addEventListener("keydown",R,!0),()=>window.removeEventListener("keydown",R,!0)},[e]),d.useEffect(()=>{(async()=>{try{const R=await fetch("/api/thumbnail"),F=await R.json();if(!R.ok)throw new Error(F.error??`GET /api/thumbnail failed: ${R.status}`);n(F),m(F.imageUrl),F.concept&&(s(F.concept.overlayText),l(F.concept.scene),f(F.concept.styleNotes))}catch(R){o(R instanceof Error?R.message:String(R))}})()},[]);const S=async()=>{w(!0),k(null);try{const R=await fetch("/api/thumbnail/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({concept:{scene:a,overlayText:i,styleNotes:c}})}),F=await R.json();if(!R.ok||F.ok!==!0){k(F.error??`regenerate failed: ${R.status}`);return}m(F.imageUrl??null)}catch(R){k(R instanceof Error?R.message:String(R))}finally{w(!1)}},b=R=>{n(F=>F&&{...F,portrait:R})},E=async R=>{y(null);try{const F=await new Promise(($,V)=>{const D=new FileReader;D.onload=()=>$(String(D.result)),D.onerror=()=>V(new Error("could not read the image file")),D.readAsDataURL(R)}),A=E5(F);if(A===null){y("could not read the image file");return}const W=await fetch("/api/thumbnail/portrait",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(A)}),M=await W.json();if(!W.ok||M.ok!==!0){y(M.error??`swap failed: ${W.status}`);return}b(M.portrait??null)}catch(F){y(F instanceof Error?F.message:String(F))}},I=async()=>{y(null);try{const R=await fetch("/api/thumbnail/portrait",{method:"DELETE"}),F=await R.json();if(!R.ok||F.ok!==!0){y(F.error??`reset failed: ${R.status}`);return}b(F.portrait??null)}catch(R){y(R instanceof Error?R.message:String(R))}},T=(t==null?void 0:t.status)==="unavailable";return u.jsx("div",{style:T5,onMouseDown:e,children:u.jsxs("div",{"data-testid":"thumbnail-modal",style:R5,onMouseDown:R=>R.stopPropagation(),children:[u.jsxs("div",{style:j5,children:[u.jsx("div",{style:P5,children:"AI Thumbnail"}),u.jsx("button",{style:F5,onClick:e,"aria-label":"Close",children:"✕"})]}),r?u.jsxs("div",{"data-testid":"thumbnail-load-error",style:od,children:["Couldn't load the thumbnail state: ",r]}):t===null?u.jsx("div",{style:td,children:"Loading…"}):T?u.jsx("div",{"data-testid":"thumbnail-unavailable",style:{...td,marginTop:12},children:C5(t.reason)}):u.jsxs(u.Fragment,{children:[t.status==="skipped"?u.jsx("div",{"data-testid":"thumbnail-skipped-note",style:{...td,marginTop:8},children:"Thumbnail was skipped at the concept approval prompt — regenerating replaces that decision."}):null,u.jsx("div",{style:_5,children:p?u.jsx("img",{"data-testid":"thumbnail-image",src:p,alt:"Current AI thumbnail",style:M5}):u.jsx("div",{"data-testid":"thumbnail-placeholder",style:$5,children:"No thumbnail generated yet — edit the concept and hit Regenerate."})}),t.portrait?u.jsxs("div",{"data-testid":"portrait-strip",style:A5,children:[u.jsx("img",{"data-testid":"portrait-preview",src:t.portrait.url,alt:"Portrait reference",style:N5}),u.jsxs("div",{style:{flex:1,minWidth:0},children:[u.jsx("div",{"data-testid":"portrait-source",style:L5,children:k5(t.portrait.source)}),u.jsx("div",{style:Hy,children:"The swap applies to this project only and is used by future renders too."})]}),u.jsx("button",{"data-testid":"portrait-swap-btn",style:Vy,onClick:()=>{var R;return(R=v.current)==null?void 0:R.click()},disabled:g,children:"Swap face…"}),t.portrait.source==="override"?u.jsx("button",{"data-testid":"portrait-reset-btn",style:Vy,onClick:()=>void I(),disabled:g,children:"Use default"}):null,u.jsx("input",{ref:v,"data-testid":"portrait-file-input",type:"file",accept:"image/png,image/jpeg,image/webp",style:{display:"none"},onChange:R=>{var A;const F=(A=R.target.files)==null?void 0:A[0];R.target.value="",F&&E(F)}})]}):null,h?u.jsx("div",{"data-testid":"portrait-error",style:od,children:h}):null,u.jsxs("div",{style:{marginTop:16},children:[u.jsxs("label",{style:nd,children:["Overlay text — the words ON the image (",Wy," chars, 4–9 words)"]}),u.jsx("input",{"data-testid":"thumbnail-overlay-input",type:"text",maxLength:Wy,value:i,onChange:R=>s(R.target.value),style:rd})]}),u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:nd,children:"Scene — what the image shows"}),u.jsx("textarea",{"data-testid":"thumbnail-scene-input",value:a,onChange:R=>l(R.target.value),rows:3,style:{...rd,resize:"vertical"}})]}),u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:nd,children:"Style notes — palette, lighting, mood"}),u.jsx("textarea",{"data-testid":"thumbnail-style-input",value:c,onChange:R=>f(R.target.value),rows:3,style:{...rd,resize:"vertical"}})]}),x?u.jsx("div",{"data-testid":"thumbnail-error",style:od,children:x}):null,u.jsxs("div",{style:z5,children:[u.jsx("div",{style:Hy,children:"Regenerating replaces the video's .thumbnail.png and saves this concept for future renders."}),u.jsx("button",{"data-testid":"thumbnail-regenerate-btn",style:{...D5,...g?{opacity:.6,cursor:"default"}:{}},onClick:()=>void S(),disabled:g,children:g?"Generating…":"Regenerate"})]})]})]})})},T5={position:"fixed",inset:0,zIndex:40,background:"rgba(5,5,8,0.75)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center"},R5={width:560,maxWidth:"92vw",maxHeight:"90vh",overflowY:"auto",background:"#12121A",border:"1px solid #3A3A48",borderRadius:10,padding:"24px 28px",boxShadow:"0 20px 40px rgba(0,0,0,0.6)",fontFamily:"ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},j5={display:"flex",justifyContent:"space-between",alignItems:"center"},P5={fontSize:18,fontWeight:700,color:"#EDEDF2",letterSpacing:"-0.01em"},F5={background:"transparent",border:"none",color:"#8B8B9E",fontSize:16,cursor:"pointer",padding:"4px 8px",borderRadius:4},td={fontSize:13,color:"#8B8B9E",marginTop:6,lineHeight:1.4},_5={marginTop:16,border:"1px solid #2C2C38",borderRadius:6,background:"#09090D",aspectRatio:"16 / 9",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden"},M5={width:"100%",height:"100%",objectFit:"contain"},$5={color:"#8B8B9E",fontSize:13,padding:16,textAlign:"center"},A5={display:"flex",alignItems:"center",gap:12,marginTop:12,padding:"10px 12px",border:"1px solid #2C2C38",borderRadius:6,background:"#09090D"},N5={width:44,height:44,borderRadius:6,objectFit:"cover",flexShrink:0,border:"1px solid #2C2C38"},L5={fontSize:12,fontWeight:600,color:"#C9C9D4",marginBottom:2},Vy={background:"transparent",border:"1px solid #3A3A48",borderRadius:6,color:"#C9C9D4",padding:"7px 12px",fontSize:12,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap"},nd={display:"block",fontSize:12,fontWeight:600,color:"#C9C9D4",marginBottom:8,textTransform:"uppercase",letterSpacing:"0.04em"},rd={width:"100%",boxSizing:"border-box",background:"#09090D",border:"1px solid #2C2C38",borderRadius:6,padding:"10px 14px",color:"#EDEDF2",fontSize:13,fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",outline:"none"},od={marginTop:12,color:"#FF5C5C",fontSize:13,fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",whiteSpace:"pre-wrap"},z5={display:"flex",justifyContent:"space-between",alignItems:"center",gap:12,marginTop:20},Hy={fontSize:12,color:"#8B8B9E",lineHeight:1.4},D5={background:"#00E5A3",border:"none",borderRadius:6,color:"#051A13",padding:"9px 20px",fontSize:13,fontWeight:700,cursor:"pointer",whiteSpace:"nowrap",boxShadow:"0 2px 10px rgba(0,229,163,0.3)"},O5=({cutlist:e,edits:t,onClose:n})=>{d.useEffect(()=>{const i=s=>{s.key==="Escape"&&(s.stopPropagation(),n())};return window.addEventListener("keydown",i,!0),()=>window.removeEventListener("keydown",i,!0)},[n]);const r=o3(e),o=t.doc.cleanup.kept.length;return u.jsx("div",{style:B5,onMouseDown:n,children:u.jsxs("div",{"data-testid":"cleanup-modal",style:W5,onMouseDown:i=>i.stopPropagation(),children:[u.jsxs("div",{style:V5,children:[u.jsx("div",{style:H5,children:"Cleanup"}),u.jsx("button",{style:U5,onClick:n,"aria-label":"Close",children:"✕"})]}),u.jsx("div",{style:Uy,children:"What produce removed, by reason. Untick a category to keep it — the preview plays your choice immediately and the next render applies it. Individual removals can be kept by clicking their seam on the timeline."}),r.length===0?u.jsx("div",{"data-testid":"cleanup-empty",style:{...Uy,marginTop:16},children:"This run proposed no removals to review."}):u.jsx("div",{style:{marginTop:16},children:r.map(i=>{const s=t.doc.cleanup.reasons[i.reason]!==!1;return u.jsxs("label",{"data-testid":`cleanup-reason-${i.reason}`,style:Z5,children:[u.jsx("input",{type:"checkbox","data-testid":`cleanup-checkbox-${i.reason}`,checked:s,onChange:a=>t.setReasonEnabled(i.reason,a.target.checked)}),u.jsx("span",{style:{...K5,background:vh[i.reason]}}),u.jsxs("span",{style:{...Y5,...s?{}:{color:"#8B8B9E"}},children:[r3[i.reason]," — ",i.count," removal",i.count===1?"":"s"," ","· ",i.seconds.toFixed(1),"s"]}),s?null:u.jsx("span",{"data-testid":`cleanup-declined-${i.reason}`,style:G5,children:"kept — live in the preview"})]},i.reason)})}),o>0?u.jsxs("div",{"data-testid":"cleanup-kept-note",style:{...X5,marginTop:12},children:[o," individual removal",o===1?"":"s"," kept via timeline seams."]}):null]})})},B5={position:"fixed",inset:0,zIndex:40,background:"rgba(5,5,8,0.75)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center"},W5={width:460,maxWidth:"92vw",maxHeight:"90vh",overflowY:"auto",background:"#12121A",border:"1px solid #3A3A48",borderRadius:10,padding:"24px 28px",boxShadow:"0 20px 40px rgba(0,0,0,0.6)",fontFamily:"ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},V5={display:"flex",justifyContent:"space-between",alignItems:"center"},H5={fontSize:18,fontWeight:700,color:"#EDEDF2",letterSpacing:"-0.01em"},U5={background:"transparent",border:"none",color:"#8B8B9E",fontSize:16,cursor:"pointer",padding:"4px 8px",borderRadius:4},Uy={fontSize:13,color:"#8B8B9E",marginTop:6,lineHeight:1.4},Z5={display:"flex",alignItems:"center",gap:10,padding:"8px 10px",border:"1px solid #2C2C38",borderRadius:6,background:"#09090D",marginBottom:8,cursor:"pointer"},K5={width:10,height:10,borderRadius:2,flexShrink:0},Y5={fontSize:13,color:"#EDEDF2",flex:1,minWidth:0},G5={fontSize:11,color:"#FFE14D",whiteSpace:"nowrap"},X5={fontSize:12,color:"#8B8B9E",lineHeight:1.4},Zy=3,Ky=5,id=500;function q5(e){return e.split(/\s+/).filter(t=>t.replace(/^#+/,"").length>0).map(t=>t.startsWith("#")?t:`#${t}`)}function J5(e){return e.map(t=>t.startsWith("#")?t:`#${t}`).join(" ")}function Db(e){return e.split(",").map(t=>t.trim()).filter(t=>t.length>0)}function Ob(e){return e.join(", ")}function Q5(e){return Ob(Db(e)).length}function eL(e){const t=Math.max(0,Math.floor(e));return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`}function tL(e){return`[${{browse:"Browse",search:"Search",benefit:"Benefit",alt:"Alt"}[e]}]`}const nL="This run never generated YouTube metadata. Run produce with --youtube (and an LLM provider) once — the pack lands here afterwards.",rL=({onClose:e})=>{var W;const[t,n]=d.useState(null),[r,o]=d.useState(null),[i,s]=d.useState([]),[a,l]=d.useState(null),[c,f]=d.useState(""),[p,m]=d.useState(""),[g,w]=d.useState(""),[x,k]=d.useState(null),[h,y]=d.useState(null),[v,S]=d.useState(null),[b,E]=d.useState(!1),[I,T]=d.useState(null);d.useEffect(()=>{const M=$=>{$.key==="Escape"&&($.stopPropagation(),e())};return window.addEventListener("keydown",M,!0),()=>window.removeEventListener("keydown",M,!0)},[e]);const R=d.useCallback(async()=>{try{const M=await fetch("/api/youtube"),$=await M.json();if(!M.ok)throw new Error($.error??`GET /api/youtube failed: ${M.status}`);n($),$.pack&&(s($.pack.titles),l($.pack.titleAngles??null),f($.pack.description),m(J5($.pack.hashtags)),w(Ob($.pack.tags)),k($.pack.hook60??null),y($.pack.linkedinPost??null),S($.pack.communityPost??null))}catch(M){o(M instanceof Error?M.message:String(M))}},[]);d.useEffect(()=>{R()},[R]);const F=async()=>{var M;E(!0),T(null);try{const $=await fetch("/api/youtube",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({pack:{titles:i,...a!==null?{titleAngles:a}:{},description:c,hashtags:q5(p),tags:Db(g),...(M=t==null?void 0:t.pack)!=null&&M.chapters?{chapters:t.pack.chapters}:{},...x!==null?{hook60:x}:{},...h!==null?{linkedinPost:h}:{},...v!==null?{communityPost:v}:{}}})}),V=await $.json();if(!$.ok||V.ok!==!0){T(V.error??`save failed: ${$.status}`);return}await R()}catch($){T($ instanceof Error?$.message:String($))}finally{E(!1)}},A=Q5(g);return u.jsx("div",{style:oL,onMouseDown:e,children:u.jsxs("div",{"data-testid":"youtube-modal",style:iL,onMouseDown:M=>M.stopPropagation(),children:[u.jsxs("div",{style:sL,children:[u.jsx("div",{style:aL,children:"YouTube SEO metadata"}),u.jsx("button",{style:lL,onClick:e,"aria-label":"Close",children:"✕"})]}),r?u.jsxs("div",{"data-testid":"youtube-load-error",style:Xy,children:["Couldn't load the YouTube pack: ",r]}):t===null?u.jsx("div",{style:Yy,children:"Loading…"}):t.available?u.jsxs(u.Fragment,{children:[u.jsxs("div",{style:{marginTop:16},children:[u.jsxs("label",{style:Mr,children:["Title options (",Zy,"–",Ky,", up to 100 chars each)"]}),i.map((M,$)=>u.jsxs("div",{style:uL,children:[(a==null?void 0:a[$])!==void 0?u.jsx("span",{"data-testid":`youtube-title-angle-${$}`,style:cL,children:tL(a[$])}):null,u.jsx("input",{"data-testid":`youtube-title-input-${$}`,type:"text",maxLength:100,value:M,onChange:V=>s(D=>D.map((L,j)=>j===$?V.target.value:L)),style:uo}),u.jsx("button",{"data-testid":`youtube-title-remove-${$}`,style:Gy,disabled:i.length<=Zy,onClick:()=>{s(V=>V.filter((D,L)=>L!==$)),l(V=>V&&V.filter((D,L)=>L!==$))},"aria-label":`Remove title ${$+1}`,children:"✕"})]},$)),u.jsx("button",{"data-testid":"youtube-title-add",style:Gy,disabled:i.length>=Ky,onClick:()=>{s(M=>[...M,""]),l(M=>M&&[...M,"alt"])},children:"+ Add title"})]}),u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:Mr,children:"Description"}),u.jsx("textarea",{"data-testid":"youtube-description-input",value:c,onChange:M=>f(M.target.value),rows:6,style:{...uo,resize:"vertical"}})]}),u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:Mr,children:"Hashtags — space-separated, # added if missing"}),u.jsx("input",{"data-testid":"youtube-hashtags-input",type:"text",value:p,onChange:M=>m(M.target.value),style:uo})]}),u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:Mr,children:"Tags — comma-separated"}),u.jsx("input",{"data-testid":"youtube-tags-input",type:"text",value:g,onChange:M=>w(M.target.value),style:uo}),u.jsxs("div",{"data-testid":"youtube-tags-counter",style:{...dL,...A>id?{color:"#FFB84D"}:{}},children:[A," / ",id,A>id?" — tags past the budget are dropped on save":""]})]}),(W=t.pack)!=null&&W.chapters&&t.pack.chapters.length>0?u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:Mr,children:"Chapters (read-only — embedded in the description on save/render)"}),u.jsx("div",{"data-testid":"youtube-chapters",style:fL,children:t.pack.chapters.map((M,$)=>u.jsxs("div",{children:[eL(M.atSec)," ",M.title]},$))}),u.jsx("div",{style:qy,children:"Timestamps are measured from the actual edit, so they are not hand-editable here; the .youtube.md splices them into the description's Timestamps block for you."})]}):null,x!==null?u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:Mr,children:"First-60s hook strategy (for you — never uploaded)"}),u.jsx("textarea",{"data-testid":"youtube-hook60-input",value:x,onChange:M=>k(M.target.value),rows:3,style:{...uo,resize:"vertical"}})]}):null,h!==null?u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:Mr,children:"LinkedIn post"}),u.jsx("textarea",{"data-testid":"youtube-linkedin-input",value:h,onChange:M=>y(M.target.value),rows:6,style:{...uo,resize:"vertical"}})]}):null,v!==null?u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:Mr,children:"Community post"}),u.jsx("textarea",{"data-testid":"youtube-community-input",value:v,onChange:M=>S(M.target.value),rows:3,style:{...uo,resize:"vertical"}})]}):null,I?u.jsx("div",{"data-testid":"youtube-error",style:Xy,children:I}):null,u.jsxs("div",{style:pL,children:[u.jsx("div",{style:qy,children:"Saves for future renders and rewrites the .youtube.md file now. Delete youtube-pack-approved.json in the workdir to let the AI regenerate."}),u.jsx("button",{"data-testid":"youtube-save-btn",style:{...hL,...b?{opacity:.6,cursor:"default"}:{}},onClick:()=>void F(),disabled:b,children:b?"Saving…":"Save"})]})]}):u.jsx("div",{"data-testid":"youtube-unavailable",style:{...Yy,marginTop:12},children:nL})]})})},oL={position:"fixed",inset:0,zIndex:40,background:"rgba(5,5,8,0.75)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center"},iL={width:620,maxWidth:"92vw",maxHeight:"90vh",overflowY:"auto",background:"#12121A",border:"1px solid #3A3A48",borderRadius:10,padding:"24px 28px",boxShadow:"0 20px 40px rgba(0,0,0,0.6)",fontFamily:"ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},sL={display:"flex",justifyContent:"space-between",alignItems:"center"},aL={fontSize:18,fontWeight:700,color:"#EDEDF2",letterSpacing:"-0.01em"},lL={background:"transparent",border:"none",color:"#8B8B9E",fontSize:16,cursor:"pointer",padding:"4px 8px",borderRadius:4},Yy={fontSize:13,color:"#8B8B9E",marginTop:6,lineHeight:1.4},Mr={display:"block",fontSize:12,fontWeight:600,color:"#C9C9D4",marginBottom:8,textTransform:"uppercase",letterSpacing:"0.04em"},uo={width:"100%",boxSizing:"border-box",background:"#09090D",border:"1px solid #2C2C38",borderRadius:6,padding:"10px 14px",color:"#EDEDF2",fontSize:13,fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",outline:"none"},uL={display:"flex",gap:8,alignItems:"center",marginBottom:8},cL={fontSize:11,fontWeight:700,color:"#8B8B9E",fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",whiteSpace:"nowrap",minWidth:62},Gy={fontSize:12,fontWeight:600,color:"#C9C9D4",background:"#1A1A21",border:"1px solid #2A2A33",borderRadius:6,padding:"6px 10px",cursor:"pointer",whiteSpace:"nowrap"},dL={marginTop:6,fontSize:12,color:"#8B8B9E",fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace"},fL={border:"1px solid #2C2C38",borderRadius:6,background:"#09090D",padding:"10px 14px",color:"#C9C9D4",fontSize:13,fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",lineHeight:1.6},Xy={marginTop:12,color:"#FF5C5C",fontSize:13,fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",whiteSpace:"pre-wrap"},pL={display:"flex",justifyContent:"space-between",alignItems:"center",gap:12,marginTop:20},qy={fontSize:12,color:"#8B8B9E",lineHeight:1.4,marginTop:6},hL={background:"#00E5A3",border:"none",borderRadius:6,color:"#051A13",padding:"9px 20px",fontSize:13,fontWeight:700,cursor:"pointer",whiteSpace:"nowrap",boxShadow:"0 2px 10px rgba(0,229,163,0.3)"};function mL(e){switch(e){case"no-destination":return"This workdir has no cover.json and no recorded --out, so there is nowhere to write a cover. Run `ossclip produce` once with an output path, or `ossclip cover --out <path>` from a terminal.";default:return"The cover is unavailable for this project."}}function gL(e){const t=e.trim().replace(/\s+/g," "),n=M$(t);return{preview:n,trimmed:n!==t}}function yL(e){if(e.trim()==="")return{ok:!0};const t=Number(e);return!Number.isFinite(t)||t<0?{ok:!1,message:`"${e}" is not a timestamp in seconds — 0 or more, please.`}:{ok:!0,atSec:t}}function Jy(e){return e!==null&&e.frame.sourceVideo!==null?{enabled:!0}:{enabled:!1,note:"There is no record of the original take for this project, so only the finished video can be read. The next `ossclip produce` records one."}}function vL(e){return e==="final"?"A frame from the finished video carries the burned-in captions, graphics and watermark.":"The original take — clean, framed the way produce framed it. Needs a cover.json."}function wL(e){return{...e.typed===(e.persistedText??"")?{}:{text:e.typed},...e.atSec===void 0?{}:{atSec:e.atSec},from:e.from}}const xL=({onClose:e,playheadSec:t})=>{const[n,r]=d.useState(null),[o,i]=d.useState(null),[s,a]=d.useState(""),[l,c]=d.useState(""),[f,p]=d.useState("final"),[m,g]=d.useState(null),[w,x]=d.useState(!1),[k,h]=d.useState(null),[y,v]=d.useState([]);d.useEffect(()=>{const R=F=>{F.key==="Escape"&&(F.stopPropagation(),e())};return window.addEventListener("keydown",R,!0),()=>window.removeEventListener("keydown",R,!0)},[e]),d.useEffect(()=>{(async()=>{try{const R=await fetch("/api/cover"),F=await R.json();if(!R.ok)throw new Error(F.error??`GET /api/cover failed: ${R.status}`);r(F),g(F.imageUrl),F.provenance&&(a(F.provenance.text),Jy(F.provenance).enabled&&p(F.provenance.frame.source))}catch(R){i(R instanceof Error?R.message:String(R))}})()},[]);const S=yL(l),b=gL(s),E=Jy((n==null?void 0:n.provenance)??null),I=async()=>{var R;if(S.ok){x(!0),h(null),v([]);try{const F=await fetch("/api/cover/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(wL({typed:s,persistedText:((R=n==null?void 0:n.provenance)==null?void 0:R.text)??null,atSec:S.atSec,from:f}))}),A=await F.json();if(!F.ok||A.ok!==!0){h(A.error??`regenerate failed: ${F.status}`);return}if(g(A.imageUrl??null),v(A.notes??[]),A.provenance){const W=A.provenance;r(M=>M&&{...M,provenance:W,status:"ready"}),a(W.text)}c("")}catch(F){h(F instanceof Error?F.message:String(F))}finally{x(!1)}}},T=(n==null?void 0:n.status)==="unavailable";return u.jsx("div",{style:bL,onMouseDown:e,children:u.jsxs("div",{"data-testid":"cover-modal",style:SL,onMouseDown:R=>R.stopPropagation(),children:[u.jsxs("div",{style:kL,children:[u.jsx("div",{style:EL,children:"Cover image"}),u.jsx("button",{style:CL,onClick:e,"aria-label":"Close",children:"✕"})]}),o?u.jsxs("div",{"data-testid":"cover-load-error",style:ad,children:["Couldn't load the cover state: ",o]}):n===null?u.jsx("div",{style:Qy,children:"Loading…"}):T?u.jsx("div",{"data-testid":"cover-unavailable",style:{...Qy,marginTop:12},children:mL(n.reason)}):u.jsxs(u.Fragment,{children:[u.jsx("div",{style:IL,children:m?u.jsx("img",{"data-testid":"cover-image",src:m,alt:"Current cover",style:TL}):u.jsx("div",{"data-testid":"cover-placeholder",style:RL,children:"No cover on disk yet — set a headline and hit Apply."})}),u.jsxs("div",{style:{marginTop:16},children:[u.jsxs("label",{style:ev,children:["Headline — at most ",sb," words (§35)"]}),u.jsx("input",{"data-testid":"cover-text-input",type:"text",value:s,onChange:R=>a(R.target.value),style:tv}),b.trimmed?u.jsxs("div",{"data-testid":"cover-headline-preview",style:{...Ko,marginTop:6},children:["Will render as: “",b.preview,"”"]}):null]}),u.jsxs("div",{style:{marginTop:16},children:[u.jsx("label",{style:ev,children:"Frame"}),u.jsxs("div",{style:nv,children:[u.jsx("button",{"data-testid":"cover-playhead-btn",style:sd,onClick:()=>c(t().toFixed(2)),disabled:w,children:"Use current playhead"}),u.jsx("input",{"data-testid":"cover-at-input",type:"text",inputMode:"decimal",placeholder:"seconds — blank keeps the current still",value:l,onChange:R=>c(R.target.value),style:{...tv,flex:1}})]}),S.ok?null:u.jsx("div",{"data-testid":"cover-at-error",style:ad,children:S.message}),u.jsx("div",{style:{...nv,marginTop:10},children:["final","source"].map(R=>{const F=R==="source"&&!E.enabled;return u.jsx("button",{"data-testid":`cover-from-${R}`,style:{...sd,...f===R?jL:{},...F?{opacity:.5,cursor:"default"}:{}},onClick:()=>p(R),disabled:w||F,"aria-pressed":f===R,children:R==="final"?"Finished video":"Original take"},R)})}),u.jsx("div",{"data-testid":"cover-from-note",style:{...Ko,marginTop:6},children:vL(f)}),E.note?u.jsx("div",{"data-testid":"cover-from-disabled-note",style:{...Ko,marginTop:4},children:E.note}):null,u.jsx("div",{style:{...Ko,marginTop:4},children:"Leave the seconds blank and the cover re-uses the still it already has — no frame extraction at all, and this choice does not apply."})]}),y.length>0?u.jsx("div",{"data-testid":"cover-notes",style:{...Ko,marginTop:12},children:y.map(R=>u.jsx("div",{children:R},R))}):null,k?u.jsx("div",{"data-testid":"cover-error",style:ad,children:k}):null,u.jsxs("div",{style:PL,children:[u.jsx("div",{style:Ko,children:n.outPath?`Writes ${n.outPath} — the video itself is untouched.`:"The video itself is untouched."}),u.jsxs("div",{style:{display:"flex",gap:8},children:[u.jsx("button",{"data-testid":"cover-cancel-btn",style:sd,onClick:e,children:"Cancel"}),u.jsx("button",{"data-testid":"cover-apply-btn",style:{...FL,...w||!S.ok?{opacity:.6,cursor:"default"}:{}},onClick:()=>void I(),disabled:w||!S.ok,children:w?"Rebuilding…":"Apply"})]})]})]})]})})},bL={position:"fixed",inset:0,zIndex:40,background:"rgba(5,5,8,0.75)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center"},SL={width:560,maxWidth:"92vw",maxHeight:"90vh",overflowY:"auto",background:"#12121A",border:"1px solid #3A3A48",borderRadius:10,padding:"24px 28px",boxShadow:"0 20px 40px rgba(0,0,0,0.6)",fontFamily:"ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},kL={display:"flex",justifyContent:"space-between",alignItems:"center"},EL={fontSize:18,fontWeight:700,color:"#EDEDF2",letterSpacing:"-0.01em"},CL={background:"transparent",border:"none",color:"#8B8B9E",fontSize:16,cursor:"pointer",padding:"4px 8px",borderRadius:4},Qy={fontSize:13,color:"#8B8B9E",marginTop:6,lineHeight:1.4},IL={marginTop:16,border:"1px solid #2C2C38",borderRadius:6,background:"#09090D",maxHeight:320,minHeight:180,display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden"},TL={maxWidth:"100%",maxHeight:320,objectFit:"contain"},RL={color:"#8B8B9E",fontSize:13,padding:16,textAlign:"center"},ev={display:"block",fontSize:12,fontWeight:600,color:"#C9C9D4",marginBottom:8,textTransform:"uppercase",letterSpacing:"0.04em"},tv={width:"100%",boxSizing:"border-box",background:"#09090D",border:"1px solid #2C2C38",borderRadius:6,padding:"10px 14px",color:"#EDEDF2",fontSize:13,fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",outline:"none"},nv={display:"flex",alignItems:"center",gap:8},sd={background:"transparent",border:"1px solid #3A3A48",borderRadius:6,color:"#C9C9D4",padding:"9px 12px",fontSize:12,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap"},jL={borderColor:"#5b8cff",color:"#EDEDF2"},ad={marginTop:12,color:"#FF5C5C",fontSize:13,fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",whiteSpace:"pre-wrap"},PL={display:"flex",justifyContent:"space-between",alignItems:"center",gap:12,marginTop:20},Ko={fontSize:12,color:"#8B8B9E",lineHeight:1.4,wordBreak:"break-all"},FL={background:"#00E5A3",border:"none",borderRadius:6,color:"#051A13",padding:"9px 20px",fontSize:13,fontWeight:700,cursor:"pointer",whiteSpace:"nowrap",boxShadow:"0 2px 10px rgba(0,229,163,0.3)"};function nl(e){for(let t=e.length-1;t>=0;t--){const n=/^\s*(\d{1,3})%\s*$/.exec(e[t]);if(n)return Math.min(100,Number(n[1]))}return null}function _L(e){const t=n=>{for(let r=e.length-1;r>=0;r--)if(n.test(e[r]))return e[r]};return[t(/^▸ producing scenes/),t(/^▸ llm:/)].filter(n=>n!==void 0)}function rv(e,t){const n=Math.max(0,Math.floor((t-e)/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,"0")}`}function ML(e,t){return e?{load:e,notifyDiscard:t}:{load:null,notifyDiscard:!1}}function $L(e,t){return e===null||e===t}function AL(e){const t=e.lines??[];return e.running?{running:!0,lines:t,startedAt:e.startedAt,resumed:!0}:e.exitCode===null||t.length===0?null:e.exitCode===0?{running:!1,lines:t,succeeded:!0,startedAt:e.startedAt,resumed:!0}:{running:!1,lines:t,failed:e.exitCode,cancelled:e.cancelled,startedAt:e.startedAt,resumed:!0}}function NL(e){if(e.dirty){if(e.renderRunning){e.onBlocked();return}e.save().catch(t=>e.onSaveError(t instanceof Error?t.message:String(t)))}}function LL(e,t,n=r=>r){const{cues:r}=Rf(e,t);return fh(r,t.splits).filter(i=>{var s;return((s=t.scenes[i.id])==null?void 0:s.hidden)===!0}).map(i=>({...i,startSec:n(i.startSec),endSec:n(i.endSec)}))}const ov=e=>({...e,...jA(e)}),iv=e=>{const t=Fb(e);e.forEach((n,r)=>{console.warn(`ossclip §137: dropped caption edit ${JSON.stringify(n)} — ${t[r]}`)})},zL=()=>{const e=TA(),t=d.useRef(e.dirty);t.current=e.dirty;const[n,r]=d.useState(!1),[o,i]=d.useState(!1),[s,a]=d.useState(null),[l,c]=d.useState(null),[f,p]=d.useState([]),[m,g]=d.useState([]),w=d.useRef(e.doc.captions);w.current=e.doc.captions;const[x,k]=d.useState(null),[h,y]=d.useState(null),[v,S]=d.useState(null),[b,E]=d.useState([]),[I,T]=d.useState(null),[R,F]=d.useState(null),[A,W]=d.useState(!1),[M,$]=d.useState(1),[V,D]=d.useState(null),[L,j]=d.useState(!1),[C,P]=d.useState([]),[N,O]=d.useState(null),z=d.useRef(null),[Z,H]=d.useState(!1),[G,B]=d.useState(null),[X,ae]=d.useState(!1),[oe,Y]=d.useState(),q=d.useRef(null);d.useEffect(()=>()=>{q.current!==null&&window.clearInterval(q.current)},[]);const[xe,Se]=d.useState(null),de=d.useRef(null),K=d.useRef(null),ee=d.useRef(null),ue=d.useRef(null),[se,Re]=d.useState(null),[Ie,De]=d.useState(null),Qe=d.useCallback(J=>{var Oe;if(ee.current=J,De(J),(Oe=ue.current)==null||Oe.disconnect(),ue.current=null,!J)return;const te=()=>Re({w:Math.max(0,J.clientWidth-ud*2),h:Math.max(0,J.clientHeight-ud*2)});te();const ce=new ResizeObserver(te);ce.observe(J),ue.current=ce},[]),[ke,Ee]=d.useState(1),je=d.useRef(ke);je.current=ke;const _e=d.useRef(null),Le=d.useCallback((J,te)=>{const ce=ee.current,Oe=Math.min(8,Math.max(.25,J)),mt=je.current;if(ce&&Oe!==mt){const It=ce.getBoundingClientRect();_e.current={prev:mt,ax:((te==null?void 0:te.x)??It.left+It.width/2)-It.left,ay:((te==null?void 0:te.y)??It.top+It.height/2)-It.top,sl:ce.scrollLeft,st:ce.scrollTop}}Ee(Oe)},[]);d.useLayoutEffect(()=>{const J=ee.current,te=_e.current;if(!J||!te)return;_e.current=null;const ce=ke/te.prev;J.scrollLeft=(te.sl+te.ax)*ce-te.ax,J.scrollTop=(te.st+te.ay)*ce-te.ay},[ke]),d.useEffect(()=>{const J=Ie;if(!J)return;const te=ce=>{(ce.ctrlKey||ce.metaKey)&&(ce.preventDefault(),Le(je.current*Math.exp(-ce.deltaY*.01),{x:ce.clientX,y:ce.clientY}))};return J.addEventListener("wheel",te,{passive:!1}),()=>J.removeEventListener("wheel",te)},[Ie,Le]);const dt=d.useRef(null);d.useEffect(()=>{const J=ce=>{const Oe=dt.current,mt=ee.current;!Oe||!mt||(mt.scrollLeft=Oe.sl-(ce.clientX-Oe.x),mt.scrollTop=Oe.st-(ce.clientY-Oe.y))},te=()=>{dt.current=null};return window.addEventListener("mousemove",J),window.addEventListener("mouseup",te),()=>{window.removeEventListener("mousemove",J),window.removeEventListener("mouseup",te)}},[]);const[Kt,gn]=d.useState(!1),[Zn,Mt]=d.useState(()=>{const J=Number(window.localStorage.getItem(av));return Number.isFinite(J)&&J>0?lv(J):300}),Kn=d.useRef(null);d.useEffect(()=>{const J=ce=>{const Oe=Kn.current;Oe&&Mt(lv(Oe.startW+(ce.clientX-Oe.startX)))},te=()=>{Kn.current&&(Kn.current=null,Mt(ce=>(window.localStorage.setItem(av,String(ce)),ce)))};return window.addEventListener("mousemove",J),window.addEventListener("mouseup",te),()=>{window.removeEventListener("mousemove",J),window.removeEventListener("mouseup",te)}},[]);const[Yt,yn]=d.useState(!1),[Gt,ft]=d.useState(!1),[vn,Ot]=d.useState(!1),[_n,Yn]=d.useState(!1),[Mn,Tr]=d.useState(!1),[ur,cr]=d.useState(!1);d.useEffect(()=>{if(!_n)return;const J=te=>{te.key==="Escape"&&(te.stopPropagation(),Yn(!1))};return window.addEventListener("keydown",J,!0),()=>window.removeEventListener("keydown",J,!0)},[_n]);const[_,U]=d.useState(null),[re,fe]=d.useState(null),[we,be]=d.useState(!0),Pe=d.useCallback(J=>{const te=Nj({rate:M,playing:A},J);$(te.rate);const ce=K.current;ce&&(te.playing&&!A&&ce.play(),!te.playing&&A&&ce.pause())},[M,A]);d.useEffect(()=>{const J=K.current;if(!J)return;const te=()=>W(!0),ce=()=>W(!1);return J.addEventListener("play",te),J.addEventListener("pause",ce),()=>{J.removeEventListener("play",te),J.removeEventListener("pause",ce)}});const Me=d.useCallback(()=>{if(q.current!==null)return;const J=window.setInterval(()=>{(async()=>{try{const ce=await(await fetch("/api/render/status")).json();if(ce.running||ce.exitCode===null){B(Oe=>({running:ce.running,lines:ce.lines??[],startedAt:ce.startedAt??(Oe==null?void 0:Oe.startedAt)}));return}if(q.current!==null&&(window.clearInterval(q.current),q.current=null),ce.exitCode===0){const mt=await(await fetch("/api/production")).json(),It=ov(mt.renderProps);y(It),H(!!mt.canRender);const Lo=ML(mt.overrides,t.current);if(Lo.load){const Gn=w.current,wn=hy(Lo.load,It);e.load(wn.doc),iv(wn.unresolved),p(wn.unresolved);const xn=_A(FA(Gn,wn.doc.captions));for(const oc of xn)console.warn(`ossclip §137: ${oc}`);g(xn)}else p([]),g([]);Lo.notifyDiscard&&r(!0),B(Gn=>({running:!1,lines:ce.lines??[],succeeded:!0,startedAt:ce.startedAt??(Gn==null?void 0:Gn.startedAt),finishedAt:Date.now()})),fetch("/api/reveal-output",{method:"POST"}).catch(()=>{})}else B({running:!1,lines:ce.lines??[],failed:ce.exitCode,cancelled:ce.cancelled})}catch{q.current===null&&Me()}})()},1e3);q.current=J},[]),He=d.useCallback(async()=>{const J=await fetch("/api/production");if(!J.ok)throw new Error(`GET /api/production failed: ${J.status}`);const te=await J.json();if(te.defaultOutPath&&Y(te.defaultOutPath),P(te.recent??[]),te.noWorkdir){p([]),g([]),j(!0);return}const ce=ov(te.renderProps);y(ce);const Oe=z.current,mt=te.workdir??null;z.current=mt,O(mt),H(!!te.canRender);const It=hy(te.overrides,ce);e.load(It.doc),iv(It.unresolved),p(It.unresolved),g([]),fetch("/api/usage").then(async xn=>S(xn.ok?await xn.json():null)).catch(()=>S(null)),fetch("/api/cleanup").then(async xn=>E(xn.ok?(await xn.json()).cutlist??[]:[])).catch(()=>E([]));const Gn=await(await fetch("/api/render/status")).json(),wn=$L(Oe,mt)?AL(Gn):null;wn&&(B(wn),wn.running?Me():be(!1))},[Me]);d.useEffect(()=>{He().catch(J=>T(J instanceof Error?J.message:String(J)))},[]);const ze=d.useCallback(async J=>{if(e.dirty&&!window.confirm("Unsaved edits will be lost — switch projects anyway?"))return null;try{const te=await fetch("/api/workdir",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:J})}),ce=await te.json().catch(()=>({}));return te.ok?(F(null),D(null),Se(null),B(null),Ee(1),y(null),j(!1),await He(),null):ce.error??`open failed: ${te.status}`}catch(te){return te instanceof Error?te.message:String(te)}},[e.dirty,He]),ge=d.useMemo(()=>{if(!h)return{lines:[],dropped:[]};const J=h.baseCaptionLines??h.captionLines??[];return p$(J,PA(e.doc.captions))},[h,e.doc.captions]),Ce=d.useMemo(()=>h?m$(ge.lines,e.doc.captionRangeEdits):{lines:[],dropped:[]},[h,ge,e.doc.captionRangeEdits]),Ct=d.useMemo(()=>h?g$(Ce.lines,e.doc.captionWordsHidden):{lines:[],dropped:[]},[h,Ce,e.doc.captionWordsHidden]),$n=d.useMemo(()=>h?tb(Ct.lines,e.doc.captionLineTiming):{lines:[],dropped:[]},[h,Ct,e.doc.captionLineTiming]),Qu=d.useMemo(()=>Fb(f),[f]),Hi=d.useMemo(()=>[...MA(ge.dropped),...AA(Ce.dropped),...$A(Ct.dropped),...NA($n.dropped)],[ge,Ce,Ct,$n]),ec=Hi.join(`
165
- `),Bb=Hi.length>0&&ec!==x;d.useEffect(()=>{if(Hi.length!==0)for(const J of Hi)console.warn(`ossclip §137: ${J}`)},[ec]);const dr=d.useMemo(()=>h?L$(b,e.doc.cleanup,e.doc.cuts,h.spans??[]):null,[h,b,e.doc.cleanup,e.doc.cuts]),An=d.useMemo(()=>z$(dr),[dr]),Rr=d.useMemo(()=>{if(!h)return null;const J=(h.baseSceneCues??h.sceneCues??[]).filter(bn=>bn.kind!=="plain"),te=h.baseTheme??h.theme??NM,{cues:ce}=Rf(J,e.doc),{cues:Oe}=l$(ce,e.doc),mt=C$(Oe,{outputDurationSec:h.outputDurationSec,clipStarts:(h.spans??[]).map(bn=>bn.outIn)}),It=fh(mt,e.doc.splits),{cues:Lo}=Rf(It,e.doc),{cues:Gn}=eb(Lo,e.doc);let wn=V?Gn.map(bn=>bn.id===V.sceneId?{...bn,video:{...bn.video,...V.patch}}:bn):Gn;xe&&(wn=wn.map(bn=>bn.id===xe.sceneId?{...bn,graphicRect:xe.rect}:bn));const xn={...h,sceneCues:wn,captionLines:$n.lines,theme:v$(te,e.doc),captionsHidden:h.captionsHiddenByFlag===!0||e.doc.captionsHidden===!0,videoFileName:`/media/${h.videoFileName}`};if(!dr)return{props:xn,reports:[]};const{fields:oc,reports:Kb}=D$(xn,dr.oldMap,dr.newMap);return{props:{...xn,...oc},reports:Kb}},[h,e.doc,V,xe,$n,dr]),$e=Rr===null?null:Rr.props,Wb=((Rr==null?void 0:Rr.reports)??[]).join(`
166
- `);d.useEffect(()=>{if(!(!Rr||Rr.reports.length===0))for(const J of Rr.reports)console.warn(`ossclip cut preview: ${J}`)},[Wb]);const tc=d.useRef(null);d.useEffect(()=>{if(!h){tc.current=null;return}const J=dr?dr.newMap:qu(h.spans??[]),te=tc.current;if(tc.current={props:h,map:J},!te||te.props!==h||ob(te.map,J,1e-6))return;const ce=K.current;if(!ce)return;const Oe=h.settings.fps,mt=te.map.toSource(ce.getCurrentFrame()/Oe),It=J.toOutput(mt)??J.toOutputClamped(mt);ce.seekTo(Math.round(It*Oe))},[dr,h]);const wh=()=>{NL({dirty:e.dirty,renderRunning:(G==null?void 0:G.running)===!0,save:e.save,onBlocked:()=>i(!0),onSaveError:J=>T(J)})},xh=d.useCallback(async J=>{try{e.dirty&&await e.save();const te=await fetch("/api/render",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(J?{out:J}:{})});if(!te.ok){const ce=await te.json().catch(()=>({}));throw new Error(ce.error??`render failed to start: ${te.status}`)}B({running:!0,lines:[],startedAt:Date.now()}),be(!0),a(null),Me()}catch(te){a(te instanceof Error?te.message:String(te))}},[e,Me]),nc=d.useMemo(()=>{if(!h)return[];const J=(h.baseSceneCues??h.sceneCues??[]).filter(te=>te.kind!=="plain");return LL(J,e.doc,An.toLive)},[h,e.doc,An]),jr=d.useMemo(()=>R?($e==null?void 0:$e.sceneCues.find(J=>J.id===R.sceneId))??nc.find(J=>J.id===R.sceneId)??null:null,[$e,R,nc]),Vb=d.useMemo(()=>{if(!jr||!$e)return;const J=$e.captionLines.filter(ce=>ce.start<jr.endSec&&ce.end>jr.startSec).flatMap(ce=>ce.words).filter(ce=>ce.start<jr.endSec&&ce.end>jr.startSec).map(ce=>ce.text);if(J.length===0)return;const te=J.join(" ");return te.length>90?`${te.slice(0,90)}…`:te},[jr,$e]);if(I)return u.jsx("div",{style:ld,children:u.jsxs("div",{style:{padding:24,color:"#FF5C5C",fontFamily:"ui-monospace, monospace"},children:["Couldn't load the production: ",I]})});if(!$e)return u.jsx("div",{style:ld,children:L?u.jsx(Ny,{recent:C,required:!0,onOpen:ze,onClose:()=>{}}):u.jsx("div",{style:{padding:24,color:"#9A9AA3"},children:"Loading production…"})});const Hb=$e.settings.width/$e.settings.height,Ub=se?Math.max(220,Math.min(se.w,se.h*Hb)):380,Zb=Math.round(Ub*ke),rc=u.jsx("button",{"data-testid":"render-logs-toggle",style:{...it,padding:"2px 8px"},onClick:()=>be(J=>!J),title:we?"Collapse the log":"Expand the log",children:we?"▾ logs":"▸ logs"});return u.jsxs("div",{style:ld,children:[u.jsxs("div",{style:WL,children:[u.jsx("span",{style:VL,children:"ossclip"}),N?u.jsx("span",{"data-testid":"workdir-label",style:HL,title:N,children:N.split("/").filter(Boolean).slice(-2).join("/")}):null,u.jsxs("div",{style:{display:"flex",gap:8},children:[u.jsx("button",{"data-testid":"open-button",style:it,onClick:()=>j(!0),title:N?`Open another project — currently ${N}`:"Open another project",children:"Open"}),u.jsx("button",{"data-testid":"undo-button",style:it,onClick:()=>e.undo(),disabled:!e.canUndo,title:"Undo (⌘Z)","aria-label":"Undo",children:u.jsx(OL,{})}),u.jsx("button",{"data-testid":"redo-button",style:it,onClick:()=>e.redo(),disabled:!e.canRedo,title:"Redo (⌘⇧Z)","aria-label":"Redo",children:u.jsx(BL,{})}),u.jsx("button",{"data-testid":"transcript-toggle",style:{...it,...Kt?{borderColor:"#5b8cff"}:{}},onClick:()=>gn(J=>!J),title:"Find and retype caption words across the whole transcript",children:"Transcript"}),u.jsx("button",{"data-testid":"cover-button",style:{...it,...Mn?{borderColor:"#5b8cff"}:{}},onClick:()=>Tr(!0),title:"Retype the cover headline or re-cut its frame — seconds, no re-render",children:"Cover"}),u.jsx("button",{"data-testid":"cleanup-button",style:{...it,...ur?{borderColor:"#5b8cff"}:{}},onClick:()=>cr(!0),title:"Review what produce removed — keep whole categories; the preview plays your choices immediately",children:"Cleanup"}),u.jsxs("div",{style:{position:"relative"},children:[u.jsx("button",{"data-testid":"youtube-menu",style:{...it,..._n||Gt||vn?{borderColor:"#5b8cff"}:{}},onClick:()=>Yn(J=>!J),title:"AI thumbnail and SEO metadata for the YouTube upload","aria-haspopup":"menu","aria-expanded":_n,children:"YouTube ▾"}),_n?u.jsxs(u.Fragment,{children:[u.jsx("div",{style:KL,onMouseDown:()=>Yn(!1)}),u.jsxs("div",{style:YL,role:"menu",children:[u.jsx("button",{"data-testid":"youtube-menu-thumbnail",style:sv,role:"menuitem",onClick:()=>{Yn(!1),ft(!0)},children:"Thumbnail"}),u.jsx("button",{"data-testid":"youtube-menu-seo",style:sv,role:"menuitem",onClick:()=>{Yn(!1),Ot(!0)},children:"SEO metadata"})]})]}):null]}),u.jsx("button",{style:{...it,...e.dirty?ZL:{}},onClick:wh,disabled:!e.dirty||(G==null?void 0:G.running)===!0,title:(G==null?void 0:G.running)===!0?"Can't save while a render is running":void 0,children:"Save"}),u.jsxs("div",{style:{display:"inline-flex",alignItems:"center"},children:[u.jsx("button",{"data-testid":"render-button",style:{...it,borderTopRightRadius:0,borderBottomRightRadius:0,borderRight:"none"},onClick:()=>void xh(),disabled:!Z||(G==null?void 0:G.running)===!0,title:Z?"Saves if needed, then replays the last completed produce command — pipeline flags come from that run; your saved edits apply on top":"No command.json in this workdir — run `ossclip produce` once in a terminal; it records the invocation and Render replays it",children:G!=null&&G.running?"Rendering…":"Render"}),u.jsx("button",{"data-testid":"render-destination-button",style:{...it,borderTopLeftRadius:0,borderBottomLeftRadius:0,padding:"7px 8px"},onClick:()=>ae(!0),disabled:!Z||(G==null?void 0:G.running)===!0,title:"Choose export file destination (Browse…)",children:"▾"})]})]}),u.jsx("span",{style:{...UL,color:e.dirty?"#FFE14D":"#5FBF77"},...e.dirty?{"data-testid":"dirty"}:{},children:e.dirty?"● Unsaved changes":"✓ Saved"}),u.jsx("button",{"data-testid":"shortcuts-button",style:{...it,padding:"7px 10px"},onClick:()=>yn(J=>!J),title:"Keyboard shortcuts (?)",children:"?"})]}),Yt?u.jsx(aN,{onClose:()=>yn(!1)}):null,Gt?u.jsx(I5,{onClose:()=>ft(!1)}):null,ur?u.jsx(O5,{cutlist:b,edits:e,onClose:()=>cr(!1)}):null,vn?u.jsx(rL,{onClose:()=>Ot(!1)}):null,Mn?u.jsx(xL,{onClose:()=>Tr(!1),playheadSec:()=>{var J;return An.fromLive((((J=K.current)==null?void 0:J.getCurrentFrame())??0)/$e.settings.fps)}}):null,X?u.jsx(u5,{defaultOutPath:oe,onCancel:()=>ae(!1),onConfirm:J=>{ae(!1),xh(J)}}):null,_?u.jsx(vN,{plan:_,onCancel:()=>U(null),onConfirm:J=>{if(J==="graphic")e.hideScene(_.sceneId);else{const te=ub(An,_.startSec,_.endSec);te.kind==="degenerate"?c("Can't cut this window: it isn't in the last render yet — render once (or re-remove the pause) to cut it."):(te.kind==="shrunk"&&console.warn(`ossclip cut preview: ${te.report}`),e.cutChunk(te.startSec,te.endSec))}U(null)}}):null,re?u.jsx(_N,{plan:re,onCancel:()=>fe(null),onConfirm:J=>{J==="caption"?e.hideCaptionWords(re.words):e.cutWords(re.words,re.startSec,re.endSec),fe(null)}}):null,L?u.jsx(Ny,{recent:C,required:!1,onOpen:ze,onClose:()=>j(!1)}):null,G?u.jsxs("div",{"data-testid":"render-log",style:{...rz,borderColor:G.failed!==void 0?"#FF5C5C":"#2A2A33"},children:[G.failed!==void 0?u.jsxs("div",{style:{color:G.cancelled?"#9A9AA3":"#FF5C5C",marginBottom:4},"data-testid":G.cancelled?"render-cancelled":"render-failed",children:[G.cancelled?"render cancelled":`render failed (exit ${G.failed})`,u.jsx("button",{style:{...it,marginLeft:10,padding:"2px 8px"},onClick:()=>B(null),children:"Dismiss"}),u.jsx("span",{style:{marginLeft:6},children:rc})]}):null,G.succeeded?u.jsxs("div",{"data-testid":"render-succeeded",style:uv,children:[u.jsxs("span",{style:{color:"#5FBF77"},children:["✓ done",G.startedAt!=null&&G.finishedAt!==void 0?` · ${rv(G.startedAt,G.finishedAt)}`:""]}),u.jsx("button",{"data-testid":"render-open-folder",style:{...it,padding:"2px 8px"},onClick:()=>void fetch("/api/reveal-output",{method:"POST"}).catch(()=>{}),title:"Reveal the rendered file in your file manager",children:"Open folder"}),u.jsx("button",{style:{...it,padding:"2px 8px"},onClick:()=>B(null),children:"Dismiss"}),rc]}):null,G.running?u.jsxs("div",{"data-testid":"render-status",style:uv,children:[u.jsx("style",{children:"@keyframes ossclip-spin { to { transform: rotate(360deg) } }"}),u.jsx("span",{style:oz,"aria-hidden":!0}),u.jsxs("span",{style:{color:"#EDEDF2"},children:["rendering",G.startedAt!=null?` · ${rv(G.startedAt,Date.now())}`:"",nl(G.lines)!==null?` · ${nl(G.lines)}%`:""]}),nl(G.lines)!==null?u.jsx("div",{style:iz,children:u.jsx("div",{"data-testid":"render-progress-bar",style:{...sz,width:`${nl(G.lines)}%`}})}):null,u.jsx("button",{"data-testid":"render-cancel",style:{...it,padding:"2px 8px"},onClick:()=>void fetch("/api/render/cancel",{method:"POST"}),children:"Cancel"}),rc]}):null,we?u.jsxs(u.Fragment,{children:[_L(G.lines).map(J=>u.jsx("div",{"data-testid":"render-pinned",style:{color:"#C9C9D4"},children:J},J)),u.jsx(DL,{lines:G.lines})]}):null]}):null,n?u.jsxs("div",{"data-testid":"reanchor-notice",style:Yo,children:["Render re-anchored your saved cuts and splits — edits made while it ran were dropped, not merged, to avoid overwriting that anchor.",u.jsx("button",{style:{...it,marginLeft:10,padding:"2px 8px"},onClick:()=>r(!1),children:"Dismiss"})]}):null,Qu.length>0||m.length>0?u.jsxs("div",{"data-testid":"caption-migration-notice",style:Yo,children:[[...Qu,...m].map((J,te)=>u.jsx("div",{children:J},te)),u.jsx("button",{style:{...it,marginLeft:10,padding:"2px 8px"},onClick:()=>{p([]),g([])},children:"Dismiss"})]}):null,Bb?u.jsxs("div",{"data-testid":"caption-dropped-notice",style:Yo,children:[Hi.map((J,te)=>u.jsx("div",{children:J},te)),u.jsx("button",{style:{...it,marginLeft:10,padding:"2px 8px"},onClick:()=>k(ec),children:"Dismiss"})]}):null,o?u.jsxs("div",{"data-testid":"save-blocked-notice",style:Yo,children:["Can't save while a render is running — it's writing its own overrides.json right now. Wait for it to finish (or cancel it) before saving.",u.jsx("button",{style:{...it,marginLeft:10,padding:"2px 8px"},onClick:()=>i(!1),children:"Dismiss"})]}):null,s!==null?u.jsxs("div",{"data-testid":"render-refused-notice",style:Yo,children:["Render didn't start: ",s,u.jsx("button",{style:{...it,marginLeft:10,padding:"2px 8px"},onClick:()=>a(null),children:"Dismiss"})]}):null,l!==null?u.jsxs("div",{"data-testid":"clock-refused-notice",style:Yo,children:[l,u.jsx("button",{style:{...it,marginLeft:10,padding:"2px 8px"},onClick:()=>c(null),children:"Dismiss"})]}):null,u.jsxs("div",{style:GL,children:[Kt?u.jsxs(u.Fragment,{children:[u.jsx(L3,{baseLines:(h==null?void 0:h.baseCaptionLines)??(h==null?void 0:h.captionLines)??[],liveLines:Ce.lines,timingLines:Ct.lines,fps:$e.settings.fps,playerRef:K,edits:e,onDeleteWords:fe,width:Zn,workdir:N,toPlayerSec:An.toLive,fromPlayerSec:An.fromLive}),u.jsx("div",{"data-testid":"transcript-divider",style:XL,title:"Drag to resize the transcript pane",onMouseDown:J=>{J.preventDefault(),Kn.current={startX:J.clientX,startW:Zn}}})]}):null,u.jsxs("div",{style:qL,children:[u.jsx("div",{ref:Qe,style:JL,onMouseDown:J=>{if(J.altKey||J.button===1){J.preventDefault();const te=ee.current;te&&(dt.current={x:J.clientX,y:J.clientY,sl:te.scrollLeft,st:te.scrollTop})}},children:u.jsx("div",{style:{margin:"auto",padding:ud},children:u.jsxs("div",{ref:de,"data-testid":"stage","data-playing":A?"true":"false","data-rate":M,style:{position:"relative",display:"inline-block"},children:[u.jsx(jj,{ref:K,component:kA,inputProps:$e,durationInFrames:Math.max(1,Math.round($e.outputDurationSec*$e.settings.fps)),fps:$e.settings.fps,compositionWidth:$e.settings.width,compositionHeight:$e.settings.height,style:{width:Zb},controls:!0,clickToPlay:!1,playbackRate:M}),u.jsx(HA,{stageRef:de,selection:R,onSelect:F,edits:e,onSave:wh,settings:$e.settings,cues:$e.sceneCues,playerRef:K,cue:jr,onTransport:Pe,onVideoPreview:D,onGraphicPreview:Se,onToggleHelp:()=>yn(J=>!J),onRequestDelete:U,fromLive:An.fromLive,hasOldClockPreimage:An.hasOldClockPreimage,onClockRefused:c}),u.jsx("button",{"data-testid":"rate-chip",onClick:()=>Pe("L"),title:"Playback rate — click to speed up (J/K/L on the keyboard)",style:az,children:M<0?`◂◂ ${Math.abs(M)}×`:`${M}×`})]})})}),u.jsxs("div",{style:QL,children:[u.jsx("button",{"data-testid":"view-zoom-out",style:cd,onClick:()=>Le(ke/2),disabled:ke<=.25,title:"Zoom the preview out — below 100% shrinks under the fitted size",children:"−"}),u.jsxs("span",{"data-testid":"view-zoom-level",style:ez,children:[Math.round(ke*100),"%"]}),u.jsx("button",{"data-testid":"view-zoom-in",style:cd,onClick:()=>Le(ke*2),disabled:ke>=8,title:"Zoom the preview in — a viewing magnifier, it never edits the video",children:"+"}),u.jsx("button",{"data-testid":"view-zoom-fit",style:{...cd,width:"auto",padding:"0 8px"},onClick:()=>Le(1),disabled:Math.abs(ke-1)<.001,title:"Fit the preview to the window",children:"fit"}),u.jsx("span",{style:tz,children:"⌥-drag pans"})]})]}),u.jsx("div",{style:nz,children:u.jsx(ZA,{selection:R,cue:jr,frame:{width:$e.settings.width,height:$e.settings.height},allSceneIds:$e.sceneCues.map(J=>J.id),edits:e,onSelect:F,resolvedTheme:$e.theme,anchorText:Vb,onVideoPreview:D,runInfo:v,captionsHiddenByFlag:(h==null?void 0:h.captionsHiddenByFlag)===!0,fromLive:An.fromLive,hasOldClockPreimage:An.hasOldClockPreimage,onClockRefused:c})})]}),u.jsx(c3,{cues:$e.sceneCues,ghosts:nc,cuts:e.doc.cuts,spans:$e.spans??[],cleanup:b,durationSec:$e.outputDurationSec,fps:$e.settings.fps,playerRef:K,selection:R,onSelect:F,edits:e,videoSrc:$e.videoFileName,toLive:An.toLive,toSourceSec:J=>{var te;for(const ce of $e.spans??[])if(J>=ce.outIn&&J<ce.outOut)return ce.srcIn+(J-ce.outIn);return((te=($e.spans??[])[0])==null?void 0:te.srcIn)??J}})]})},DL=({lines:e})=>{const t=d.useRef(null),n=d.useRef(!0);return d.useEffect(()=>{const r=t.current;r&&n.current&&(r.scrollTop=r.scrollHeight)},[e]),u.jsx("div",{ref:t,"data-testid":"render-tail",onScroll:r=>{const o=r.currentTarget;n.current=o.scrollTop+o.clientHeight>=o.scrollHeight-8},style:{maxHeight:220,overflowY:"auto"},children:e.map((r,o)=>u.jsx("div",{children:r},o))})},OL=()=>u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",style:{display:"block"},children:[u.jsx("path",{d:"M9 14 4 9l5-5"}),u.jsx("path",{d:"M4 9h10.5a5.5 5.5 0 0 1 0 11H11"})]}),BL=()=>u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",style:{display:"block"},children:[u.jsx("path",{d:"m15 14 5-5-5-5"}),u.jsx("path",{d:"M20 9H9.5a5.5 5.5 0 0 0 0 11H13"})]}),ld={fontFamily:"'Inter', system-ui, sans-serif",background:"#0B0B0E",color:"#EDEDF2",height:"100vh",overflow:"hidden",display:"flex",flexDirection:"column"},WL={display:"flex",alignItems:"center",gap:14,padding:"10px 20px",borderBottom:"1px solid #1E1E24",background:"#111116"},VL={fontWeight:800,fontSize:14,letterSpacing:"0.02em",color:"#FFE14D",marginRight:8},HL={fontSize:12,fontFamily:"ui-monospace, 'SF Mono', monospace",color:"#6a6a75",maxWidth:260,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},UL={fontSize:12,fontFamily:"ui-monospace, 'SF Mono', monospace",marginLeft:"auto"},it={fontSize:12,fontWeight:600,color:"#EDEDF2",background:"#1A1A21",border:"1px solid #2A2A33",borderRadius:6,padding:"7px 12px",cursor:"pointer"},ZL={background:"#FFE14D",color:"#0B0B0E",border:"1px solid #FFE14D"},KL={position:"fixed",inset:0,zIndex:30},YL={position:"absolute",top:"calc(100% + 4px)",left:0,zIndex:31,minWidth:150,background:"#1A1A21",border:"1px solid #2A2A33",borderRadius:6,padding:4,boxShadow:"0 10px 24px rgba(0,0,0,0.5)",display:"flex",flexDirection:"column"},sv={fontSize:12,fontWeight:600,color:"#EDEDF2",background:"transparent",border:"none",borderRadius:4,padding:"8px 10px",cursor:"pointer",textAlign:"left"},GL={display:"flex",flex:1,minHeight:0},ud=32,av="ossclip.transcriptWidth",lv=e=>Math.min(640,Math.max(220,e)),XL={width:5,flexShrink:0,cursor:"col-resize",background:"#1E1E24",borderLeft:"1px solid #2A2A33"},qL={position:"relative",flex:1,minWidth:0},JL={position:"absolute",inset:0,display:"flex",overflow:"auto"},QL={position:"absolute",top:10,left:10,zIndex:6,display:"flex",alignItems:"center",gap:6,padding:"4px 6px",background:"rgba(17,17,22,0.85)",border:"1px solid #2A2A33",borderRadius:6},cd={width:22,height:18,fontSize:12,lineHeight:1,color:"#EDEDF2",background:"#1A1A21",border:"1px solid #2A2A33",borderRadius:4,cursor:"pointer",padding:0},ez={fontSize:10,fontFamily:"ui-monospace, 'SF Mono', monospace",color:"#9A9AA3",minWidth:34,textAlign:"center"},tz={fontSize:10,color:"#55555f",userSelect:"none"},nz={width:260,flexShrink:0,borderLeft:"1px solid #1E1E24",background:"#111116",overflowY:"auto"},rz={fontSize:11,fontFamily:"ui-monospace, 'SF Mono', monospace",color:"#9A9AA3",background:"#0F0F14",borderBottom:"1px solid #2A2A33",padding:"6px 20px",whiteSpace:"pre-wrap",flexShrink:0},Yo={display:"flex",alignItems:"center",fontSize:12,fontFamily:"ui-monospace, 'SF Mono', monospace",color:"#FFE14D",background:"#0F0F14",borderBottom:"1px solid #2A2A33",padding:"6px 20px",flexShrink:0},uv={display:"flex",alignItems:"center",gap:10,marginBottom:4},oz={width:12,height:12,flexShrink:0,border:"2px solid #2A2A33",borderTopColor:"#FFE14D",borderRadius:"50%",animation:"ossclip-spin 0.8s linear infinite"},iz={flex:1,maxWidth:260,height:4,background:"#1E1E24",borderRadius:2,overflow:"hidden"},sz={height:"100%",background:"#FFE14D",borderRadius:2,transition:"width 0.6s ease"},az={position:"absolute",top:8,right:8,zIndex:5,fontSize:11,fontWeight:700,fontFamily:"ui-monospace, 'SF Mono', monospace",color:"#FFE14D",background:"rgba(11,11,14,0.75)",border:"1px solid #2A2A33",borderRadius:6,padding:"3px 8px",cursor:"pointer"};dd.createRoot(document.getElementById("root")).render(u.jsx(le.StrictMode,{children:u.jsx(zL,{})}));
161
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const k of this.seen.entries()){const h=k[1];if(t===k[0]){s(k);continue}if(r.external){const v=(p=r.external.registry.get(k[0]))==null?void 0:p.id;if(t!==k[0]&&v){s(k);continue}}if((m=this.metadataRegistry.get(k[0]))==null?void 0:m.id){s(k);continue}if(h.cycle){s(k);continue}if(h.count>1&&r.reused==="ref"){s(k);continue}}const a=(k,h)=>{const y=this.seen.get(k),v=y.def??y.schema,S={...v};if(y.ref===null)return;const b=y.ref;if(y.ref=null,b){a(b,h);const E=this.seen.get(b).schema;E.$ref&&h.target==="draft-7"?(v.allOf=v.allOf??[],v.allOf.push(E)):(Object.assign(v,E),Object.assign(v,S))}y.isParent||this.override({zodSchema:k,jsonSchema:v,path:y.path??[]})};for(const k of[...this.seen.entries()].reverse())a(k[0],{target:this.target});const l={};if(this.target==="draft-2020-12"?l.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?l.$schema="http://json-schema.org/draft-07/schema#":console.warn(`Invalid target: ${this.target}`),(g=r.external)!=null&&g.uri){const k=(w=r.external.registry.get(t))==null?void 0:w.id;if(!k)throw new Error("Schema is missing an `id` property");l.$id=r.external.uri(k)}Object.assign(l,o.def);const c=((x=r.external)==null?void 0:x.defs)??{};for(const k of this.seen.entries()){const h=k[1];h.def&&h.defId&&(c[h.defId]=h.def)}r.external||Object.keys(c).length>0&&(this.target==="draft-2020-12"?l.$defs=c:l.definitions=c);try{return JSON.parse(JSON.stringify(l))}catch{throw new Error("Error converting schema to JSON.")}}}function __(e,t){if(e instanceof Z1){const r=new Vg(t),o={};for(const a of e._idmap.entries()){const[l,c]=a;r.process(c)}const i={},s={registry:e,uri:t==null?void 0:t.uri,defs:o};for(const a of e._idmap.entries()){const[l,c]=a;i[l]=r.emit(c,{...t,external:s})}if(Object.keys(o).length>0){const a=r.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[a]:o}}return{schemas:i}}const n=new Vg(t);return n.process(e),n.emit(e,t)}function gt(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const o=e._zod.def;switch(o.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return gt(o.element,n);case"object":{for(const i in o.shape)if(gt(o.shape[i],n))return!0;return!1}case"union":{for(const i of o.options)if(gt(i,n))return!0;return!1}case"intersection":return gt(o.left,n)||gt(o.right,n);case"tuple":{for(const i of o.items)if(gt(i,n))return!0;return!!(o.rest&&gt(o.rest,n))}case"record":return gt(o.keyType,n)||gt(o.valueType,n);case"map":return gt(o.keyType,n)||gt(o.valueType,n);case"set":return gt(o.valueType,n);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return gt(o.innerType,n);case"lazy":return gt(o.getter(),n);case"default":return gt(o.innerType,n);case"prefault":return gt(o.innerType,n);case"custom":return!1;case"transform":return!0;case"pipe":return gt(o.in,n)||gt(o.out,n);case"success":return!1;case"catch":return!1}throw new Error(`Unknown schema type: ${o.type}`)}const M_=Q("ZodISODateTime",(e,t)=>{aF.init(e,t),rt.init(e,t)});function $_(e){return d_(M_,e)}const A_=Q("ZodISODate",(e,t)=>{lF.init(e,t),rt.init(e,t)});function N_(e){return f_(A_,e)}const L_=Q("ZodISOTime",(e,t)=>{uF.init(e,t),rt.init(e,t)});function z_(e){return p_(L_,e)}const D_=Q("ZodISODuration",(e,t)=>{cF.init(e,t),rt.init(e,t)});function O_(e){return h_(D_,e)}const B_=(e,t)=>{$1.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>oP(e,n)},flatten:{value:n=>rP(e,n)},addIssue:{value:n=>e.issues.push(n)},addIssues:{value:n=>e.issues.push(...n)},isEmpty:{get(){return e.issues.length===0}}})},Yu=Q("ZodError",B_,{Parent:Error}),W_=iP(Yu),V_=sP(Yu),H_=N1(Yu),U_=L1(Yu),lt=Q("ZodType",(e,t)=>(qe.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),e.clone=(n,r)=>Lo(e,n,r),e.brand=()=>e,e.register=(n,r)=>(n.add(e,r),e),e.parse=(n,r)=>W_(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>H_(e,n,r),e.parseAsync=async(n,r)=>V_(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>U_(e,n,r),e.spa=e.safeParseAsync,e.refine=(n,r)=>e.check(LM(n,r)),e.superRefine=n=>e.check(zM(n)),e.overwrite=n=>e.check(ha(n)),e.optional=()=>Zg(e),e.nullable=()=>Kg(e),e.nullish=()=>Zg(Kg(e)),e.nonoptional=n=>jM(e,n),e.array=()=>at(e),e.or=n=>ph([e,n]),e.and=n=>vM(e,n),e.transform=n=>Yg(e,kM(n)),e.default=n=>IM(e,n),e.prefault=n=>RM(e,n),e.catch=n=>FM(e,n),e.pipe=n=>Yg(e,n),e.readonly=()=>$M(e),e.describe=n=>{const r=e.clone();return hs.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){var n;return(n=hs.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return hs.get(e);const r=e.clone();return hs.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),G1=Q("_ZodString",(e,t)=>{fh.init(e,t),lt.init(e,t);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...r)=>e.check(x_(...r)),e.includes=(...r)=>e.check(k_(...r)),e.startsWith=(...r)=>e.check(E_(...r)),e.endsWith=(...r)=>e.check(C_(...r)),e.min=(...r)=>e.check(Ql(...r)),e.max=(...r)=>e.check(K1(...r)),e.length=(...r)=>e.check(Y1(...r)),e.nonempty=(...r)=>e.check(Ql(1,...r)),e.lowercase=r=>e.check(b_(r)),e.uppercase=r=>e.check(S_(r)),e.trim=()=>e.check(T_()),e.normalize=(...r)=>e.check(I_(...r)),e.toLowerCase=()=>e.check(R_()),e.toUpperCase=()=>e.check(j_())}),Z_=Q("ZodString",(e,t)=>{fh.init(e,t),G1.init(e,t),e.email=n=>e.check(HF(K_,n)),e.url=n=>e.check(GF(Y_,n)),e.jwt=n=>e.check(c_(uM,n)),e.emoji=n=>e.check(XF(G_,n)),e.guid=n=>e.check(Dg(Hg,n)),e.uuid=n=>e.check(UF(Ua,n)),e.uuidv4=n=>e.check(ZF(Ua,n)),e.uuidv6=n=>e.check(KF(Ua,n)),e.uuidv7=n=>e.check(YF(Ua,n)),e.nanoid=n=>e.check(qF(X_,n)),e.guid=n=>e.check(Dg(Hg,n)),e.cuid=n=>e.check(JF(q_,n)),e.cuid2=n=>e.check(QF(J_,n)),e.ulid=n=>e.check(e_(Q_,n)),e.base64=n=>e.check(a_(sM,n)),e.base64url=n=>e.check(l_(aM,n)),e.xid=n=>e.check(t_(eM,n)),e.ksuid=n=>e.check(n_(tM,n)),e.ipv4=n=>e.check(r_(nM,n)),e.ipv6=n=>e.check(o_(rM,n)),e.cidrv4=n=>e.check(i_(oM,n)),e.cidrv6=n=>e.check(s_(iM,n)),e.e164=n=>e.check(u_(lM,n)),e.datetime=n=>e.check($_(n)),e.date=n=>e.check(N_(n)),e.time=n=>e.check(z_(n)),e.duration=n=>e.check(O_(n))});function he(e){return VF(Z_,e)}const rt=Q("ZodStringFormat",(e,t)=>{Je.init(e,t),G1.init(e,t)}),K_=Q("ZodEmail",(e,t)=>{JP.init(e,t),rt.init(e,t)}),Hg=Q("ZodGUID",(e,t)=>{XP.init(e,t),rt.init(e,t)}),Ua=Q("ZodUUID",(e,t)=>{qP.init(e,t),rt.init(e,t)}),Y_=Q("ZodURL",(e,t)=>{QP.init(e,t),rt.init(e,t)}),G_=Q("ZodEmoji",(e,t)=>{eF.init(e,t),rt.init(e,t)}),X_=Q("ZodNanoID",(e,t)=>{tF.init(e,t),rt.init(e,t)}),q_=Q("ZodCUID",(e,t)=>{nF.init(e,t),rt.init(e,t)}),J_=Q("ZodCUID2",(e,t)=>{rF.init(e,t),rt.init(e,t)}),Q_=Q("ZodULID",(e,t)=>{oF.init(e,t),rt.init(e,t)}),eM=Q("ZodXID",(e,t)=>{iF.init(e,t),rt.init(e,t)}),tM=Q("ZodKSUID",(e,t)=>{sF.init(e,t),rt.init(e,t)}),nM=Q("ZodIPv4",(e,t)=>{dF.init(e,t),rt.init(e,t)}),rM=Q("ZodIPv6",(e,t)=>{fF.init(e,t),rt.init(e,t)}),oM=Q("ZodCIDRv4",(e,t)=>{pF.init(e,t),rt.init(e,t)}),iM=Q("ZodCIDRv6",(e,t)=>{hF.init(e,t),rt.init(e,t)}),sM=Q("ZodBase64",(e,t)=>{mF.init(e,t),rt.init(e,t)}),aM=Q("ZodBase64URL",(e,t)=>{yF.init(e,t),rt.init(e,t)}),lM=Q("ZodE164",(e,t)=>{vF.init(e,t),rt.init(e,t)}),uM=Q("ZodJWT",(e,t)=>{xF.init(e,t),rt.init(e,t)}),X1=Q("ZodNumber",(e,t)=>{U1.init(e,t),lt.init(e,t),e.gt=(r,o)=>e.check(Bg(r,o)),e.gte=(r,o)=>e.check(Gc(r,o)),e.min=(r,o)=>e.check(Gc(r,o)),e.lt=(r,o)=>e.check(Og(r,o)),e.lte=(r,o)=>e.check(Yc(r,o)),e.max=(r,o)=>e.check(Yc(r,o)),e.int=r=>e.check(Ug(r)),e.safe=r=>e.check(Ug(r)),e.positive=r=>e.check(Bg(0,r)),e.nonnegative=r=>e.check(Gc(0,r)),e.negative=r=>e.check(Og(0,r)),e.nonpositive=r=>e.check(Yc(0,r)),e.multipleOf=(r,o)=>e.check(Wg(r,o)),e.step=(r,o)=>e.check(Wg(r,o)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function ie(e){return m_(X1,e)}const cM=Q("ZodNumberFormat",(e,t)=>{bF.init(e,t),X1.init(e,t)});function Ug(e){return g_(cM,e)}const dM=Q("ZodBoolean",(e,t)=>{SF.init(e,t),lt.init(e,t)});function Vt(e){return y_(dM,e)}const fM=Q("ZodUnknown",(e,t)=>{kF.init(e,t),lt.init(e,t)});function ji(){return v_(fM)}const pM=Q("ZodNever",(e,t)=>{EF.init(e,t),lt.init(e,t)});function q1(e){return w_(pM,e)}const hM=Q("ZodArray",(e,t)=>{CF.init(e,t),lt.init(e,t),e.element=t.element,e.min=(n,r)=>e.check(Ql(n,r)),e.nonempty=n=>e.check(Ql(1,n)),e.max=(n,r)=>e.check(K1(n,r)),e.length=(n,r)=>e.check(Y1(n,r)),e.unwrap=()=>e.element});function at(e,t){return P_(hM,e,t)}const mM=Q("ZodObject",(e,t)=>{IF.init(e,t),lt.init(e,t),Xe(e,"shape",()=>t.shape),e.keyof=()=>lr(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ji()}),e.loose=()=>e.clone({...e._zod.def,catchall:ji()}),e.strict=()=>e.clone({...e._zod.def,catchall:q1()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>Qj(e,n),e.merge=n=>eP(e,n),e.pick=n=>qj(e,n),e.omit=n=>Jj(e,n),e.partial=(...n)=>tP(Q1,e,n[0]),e.required=(...n)=>nP(eb,e,n[0])});function ve(e,t){const n={type:"object",get shape(){return ch(this,"shape",{...e}),this.shape},...ye(t)};return new mM(n)}const gM=Q("ZodUnion",(e,t)=>{TF.init(e,t),lt.init(e,t),e.options=t.options});function ph(e,t){return new gM({type:"union",options:e,...ye(t)})}const yM=Q("ZodIntersection",(e,t)=>{RF.init(e,t),lt.init(e,t)});function vM(e,t){return new yM({type:"intersection",left:e,right:t})}const J1=Q("ZodRecord",(e,t)=>{jF.init(e,t),lt.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function tr(e,t,n){return new J1({type:"record",keyType:e,valueType:t,...ye(n)})}function wM(e,t,n){return new J1({type:"record",keyType:ph([e,q1()]),valueType:t,...ye(n)})}const jf=Q("ZodEnum",(e,t)=>{PF.init(e,t),lt.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const i={};for(const s of r)if(n.has(s))i[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new jf({...t,checks:[],...ye(o),entries:i})},e.exclude=(r,o)=>{const i={...t.entries};for(const s of r)if(n.has(s))delete i[s];else throw new Error(`Key ${s} not found in enum`);return new jf({...t,checks:[],...ye(o),entries:i})}});function lr(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new jf({type:"enum",entries:n,...ye(t)})}const xM=Q("ZodLiteral",(e,t)=>{FF.init(e,t),lt.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function bM(e,t){return new xM({type:"literal",values:Array.isArray(e)?e:[e],...ye(t)})}const SM=Q("ZodTransform",(e,t)=>{_F.init(e,t),lt.init(e,t),e._zod.parse=(n,r)=>{n.addIssue=i=>{if(typeof i=="string")n.issues.push(Ks(i,n.value,t));else{const s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=e),s.continue??(s.continue=!0),n.issues.push(Ks(s))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n)):(n.value=o,n)}});function kM(e){return new SM({type:"transform",transform:e})}const Q1=Q("ZodOptional",(e,t)=>{MF.init(e,t),lt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Zg(e){return new Q1({type:"optional",innerType:e})}const EM=Q("ZodNullable",(e,t)=>{$F.init(e,t),lt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Kg(e){return new EM({type:"nullable",innerType:e})}const CM=Q("ZodDefault",(e,t)=>{AF.init(e,t),lt.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function IM(e,t){return new CM({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const TM=Q("ZodPrefault",(e,t)=>{NF.init(e,t),lt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function RM(e,t){return new TM({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const eb=Q("ZodNonOptional",(e,t)=>{LF.init(e,t),lt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function jM(e,t){return new eb({type:"nonoptional",innerType:e,...ye(t)})}const PM=Q("ZodCatch",(e,t)=>{zF.init(e,t),lt.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function FM(e,t){return new PM({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const _M=Q("ZodPipe",(e,t)=>{DF.init(e,t),lt.init(e,t),e.in=t.in,e.out=t.out});function Yg(e,t){return new _M({type:"pipe",in:e,out:t})}const MM=Q("ZodReadonly",(e,t)=>{OF.init(e,t),lt.init(e,t)});function $M(e){return new MM({type:"readonly",innerType:e})}const AM=Q("ZodCustom",(e,t)=>{BF.init(e,t),lt.init(e,t)});function NM(e){const t=new nn({check:"custom"});return t._zod.check=e,t}function LM(e,t={}){return F_(AM,e,t)}function zM(e){const t=NM(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(Ks(r,n.value,t._zod.def));else{const o=r;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),n.issues.push(Ks(o))}},e(n.value,n)));return t}const Gu=lr(["full-bleed","video-top","pip-bubble","graphic-only","blurred-behind","lower-third","split-left","split-right"]),Xu=lr(["TitleCard","StatCard","RuleCard","StrikethroughReveal","FlowDiagram","TerminalMock","ChatMock","ScreenshotFrame","BulletList"]),hh=ve({startWord:ie().int().nonnegative(),endWord:ie().int().nonnegative()}),DM=ve({id:he(),anchor:hh,layout:Gu,component:Xu,props:tr(he(),ji()),overrides:tr(he(),ji()).default({}),rationale:he().optional()});ve({id:he(),kind:lr(["graphic","plain"]).optional(),anchor:hh.optional(),layout:Gu,component:Xu.optional(),props:tr(he(),ji()).optional(),startSec:ie().nonnegative(),endSec:ie().nonnegative(),graphicRect:ve({x:ie(),y:ie(),w:ie(),h:ie()}).optional(),elements:tr(he(),ve({dx:ie().optional(),dy:ie().optional(),scale:ie().positive().optional(),hidden:Vt().optional()})).optional(),video:ve({scale:ie().positive().max(4).optional(),dy:ie().optional(),dx:ie().optional(),autoZoom:Vt().optional()}).optional(),pip:ve({cornerRadius:ie().min(0).max(1).optional(),x:ie().min(0).max(1).optional(),y:ie().min(0).max(1).optional()}).optional(),captionY:ie().min(0).max(1).optional(),captionScale:ie().min(.2).max(3).optional(),pinned:Vt().optional()}).superRefine((e,t)=>{e.kind!=="plain"&&(e.component===void 0||e.props===void 0)&&t.addIssue({code:"custom",message:'a graphic cue requires component and props; only kind: "plain" may omit them'})});ve({centerYFrac:ie().min(0).max(1),sizeFrac:ie().min(0).max(1).optional(),centerXFrac:ie().min(0).max(1).optional(),sourceAspect:ie().positive().optional(),subject:lr(["face","screen"]).optional()});const qu=ve({bg:he().default("#0B0B0E"),fg:he().default("#FFFFFF"),accent:he().default("#FFE14D"),muted:he().default("#9A9AA3"),success:he().default("#5FBF77"),cardBg:he().default("#15151B"),cardBorder:he().default("#2A2A33"),danger:he().default("#FF5C5C"),radiusPx:ie().default(24),fontDisplay:he().default("'Inter', 'Helvetica Neue', 'Arial Black', Arial, sans-serif"),fontMono:he().default("'SF Mono', 'Cascadia Code', Consolas, monospace")}),OM=qu.parse({}),BM=ve({eyebrow:he().max(28).optional(),title:he().min(1).max(48).describe("the claim WITHOUT the emphasis token — never repeat the emphasis here"),emphasis:he().max(16).optional().describe("the number/punch token pulled OUT of the title (e.g. '861%') — not a duplicate of it"),sub:he().max(64).optional()}),WM=ve({label:he().min(1).max(28),value:he().min(1).max(12),caption:he().max(40).optional(),inverted:Vt().default(!1)}),VM=ve({kicker:he().min(1).max(24),text:he().min(1).max(40),struck:he().max(40).optional()}),HM=ve({lines:at(ve({text:he().min(1).max(32),struck:Vt().default(!1),mark:lr(["none","cross","check"]).default("none")})).min(1).max(4)}),UM=ve({title:he().max(28).optional(),items:at(he().min(1).max(36)).min(2).max(5)}),ZM=ve({nodes:at(he().min(1).max(16)).min(2).max(5),emphasizeLast:Vt().default(!0)}),KM=ve({windows:at(ve({title:he().max(24),lines:at(he().max(40)).min(1).max(6)})).min(1).max(5),fanOut:he().max(20).optional()}),YM=ve({messages:at(ve({from:lr(["user","agent"]),text:he().min(1).max(60)})).min(1).max(4),keyword:he().max(16).optional().describe("ONLY for a 'comment <word>' ask: the single distinctive word the viewer types, plain and unformatted. Leave unset for any other CTA — especially 'reply with a number/which one', where there is no word to type. Never a referential filler like 'number', 'answer', 'comment' or 'below'.")}),GM=ve({src:he().optional().describe("OMIT THIS unless the user supplied an actual image file beside the video — never invent a filename from the transcript; without it the frame renders as a styled placeholder, which is the intended look"),label:he().max(32).optional(),kenBurns:Vt().default(!0)}),tb={TitleCard:{propsSchema:BM,defaultProps:{title:"TITLE"},defaultLayout:"pip-bubble",altLayouts:[],whenToUse:"The core claim or hook as big typography; use `emphasis` for a huge number or punch word."},StatCard:{propsSchema:WM,defaultProps:{label:"METRIC",value:"+0%"},defaultLayout:"video-top",altLayouts:["blurred-behind"],whenToUse:"One striking metric (value like '+242%', '×3', '5s'); punchline in `caption`."},RuleCard:{propsSchema:VM,defaultProps:{kicker:"RULE",text:"DO THE THING"},defaultLayout:"video-top",altLayouts:["blurred-behind"],whenToUse:"A prescriptive takeaway ('CAPACITY RULE / CAP ACTIVE AGENTS'); `struck` shows the rejected alternative."},StrikethroughReveal:{propsSchema:HM,defaultProps:{lines:[{text:"NOT THIS",struck:!0}]},defaultLayout:"blurred-behind",altLayouts:["graphic-only"],whenToUse:'Negation/contrast beat — big words over the blurred speaker. Strike EVERY line of the phrase the speaker negates, not just its tail — a half-struck claim reads as a typo. For wrong-vs-right lists, set mark: "cross"/"check" (✗/✓) per line instead.'},FlowDiagram:{propsSchema:ZM,defaultProps:{nodes:["A","B"]},defaultLayout:"graphic-only",altLayouts:[],whenToUse:"A causal chain or pipeline as chips with arrows (TEAM → AI AGENTS → CHURN)."},TerminalMock:{propsSchema:KM,defaultProps:{windows:[{title:"terminal-01",lines:["$ run"]}]},defaultLayout:"graphic-only",altLayouts:[],whenToUse:"Anything about running code/processes/agents — stylized terminal windows."},ChatMock:{propsSchema:YM,defaultProps:{messages:[{from:"user",text:"hello"}]},defaultLayout:"blurred-behind",altLayouts:["graphic-only"],whenToUse:"A quoted phrase or exchange as chat bubbles over the blurred speaker; for a comment-CTA beat, set `keyword` to the word viewers should type."},ScreenshotFrame:{propsSchema:GM,defaultProps:{},defaultLayout:"video-top",altLayouts:["blurred-behind"],whenToUse:"Reference to a document/PR/review — a framed screenshot look with a label chip."},BulletList:{propsSchema:UM,defaultProps:{items:["FIRST","SECOND"]},defaultLayout:"blurred-behind",altLayouts:["graphic-only"],whenToUse:"An ENUMERATION — the speaker lists two or more parallel things ('what you need is X, Y, Z'). One bullet per item, optional kicker title. Use this for lists instead of bending TitleCard or StrikethroughReveal around them."}};function Gg(e,t,n={}){const r=tb[e],o={...r.defaultProps,...t,...n},i=r.propsSchema.safeParse(o);return i.success?i.data:null}function XM(e){const t=tb[e];if(!t)return[];const n=__(t.propsSchema),r=[];for(const[o,i]of Object.entries(n.properties??{})){if(Array.isArray(i.enum)&&i.enum.every(s=>typeof s=="string")){r.push({key:o,kind:"enum",options:i.enum});continue}i.type==="boolean"&&r.push({key:o,kind:"boolean",fallback:i.default===!0})}return r}const qM=ve({text:he(),start:ie().nonnegative(),end:ie().nonnegative(),conf:ie().min(0).max(1).optional()}),JM=ve({language:he().default("en"),words:at(qM)}),QM=lr(["exact","light","standard","aggressive"]),nb=lr(["silence","pause","filler","retake","user","clip"]),Xg=ve({srcIn:ie().nonnegative(),srcOut:ie().nonnegative(),kind:lr(["keep","remove"]),reason:nb.optional(),confidence:ie().min(0).max(1).optional()}),Za=ve({start:ie(),end:ie()}),e$=ve({silences:at(Za),gaps:at(Za),cuttable:at(Za),breaths:at(Za).default([]),fillers:at(ve({wordIndex:ie().int(),text:he(),start:ie(),end:ie()}))}),t$=ve({duration:ie().positive(),width:ie().int().positive(),height:ie().int().positive(),fps:ie().positive(),hasAudio:Vt(),rotation:ie().int().optional()}),n$=ve({width:ie().int().positive().default(1080),height:ie().int().positive().default(1920),fps:ie().positive().default(30)});ve({version:bM(1),source:ve({path:he(),probe:t$,audioPath:he().optional(),mezzaninePath:he().optional(),face:ve({centerXFrac:ie(),centerYFrac:ie(),sizeFrac:ie(),framesSampled:ie().int(),framesDetected:ie().int()}).nullable().optional()}),cleanup:QM,intent:he().optional(),transcript:JM.optional(),repairs:at(ve({startWord:ie().int(),endWord:ie().int(),heard:he(),correction:he(),applied:Vt(),rejected:he().optional()})).optional(),analysis:e$.optional(),cutlist:at(Xg).optional(),cutlistProposed:at(Xg).optional(),clip:ve({targetSec:ie().positive(),startWord:ie().int().nonnegative(),endWord:ie().int().nonnegative(),startSec:ie().nonnegative(),endSec:ie().nonnegative(),reason:he()}).optional(),scenes:at(DM).optional(),producer:ve({provider:he(),models:at(he()).default([]),cached:Vt().default(!1),at:he().optional()}).optional(),theme:qu.optional(),render:n$});const r$=ve({dx:ie().optional(),dy:ie().optional(),scale:ie().positive().optional(),hidden:Vt().optional()}),rb=ve({props:tr(he(),ji()).default({}),elements:tr(he(),r$).default({}),timing:ve({startSec:ie().nonnegative(),endSec:ie().nonnegative()}).optional(),component:Xu.optional(),layout:Gu.optional(),video:ve({scale:ie().positive().max(4).optional(),dy:ie().optional(),dx:ie().optional(),autoZoom:Vt().optional()}).optional(),pip:ve({cornerRadius:ie().min(0).max(1).optional(),x:ie().min(0).max(1).optional(),y:ie().min(0).max(1).optional()}).optional(),captionY:ie().min(0).max(1).optional(),captionScale:ie().min(.2).max(3).optional(),graphicRect:ve({x:ie().min(0).max(1),y:ie().min(0).max(1),w:ie().min(.08).max(1),h:ie().min(.05).max(1)}).optional(),anchor:hh.optional(),hidden:Vt().optional()}),o$=ve({text:he().min(1).max(80),was:he()}),i$=ve({fromKey:he().regex(/^w\d+$/),toKey:he().regex(/^w\d+$/),text:he().min(1).max(400),was:he()});function qg(e,t,n){var r;return((r=e[t])==null?void 0:r.was)??n}function Jg(e,t,n,r){var o;return((o=e.find(i=>i.fromKey===t&&i.toKey===n))==null?void 0:o.was)??r}function ob(e){return String(Math.round(e*1e3))}const s$=ph([ve({at:ie().finite().nonnegative(),id:he().min(1)}),ie().finite().nonnegative().transform(e=>({at:e,id:ob(e)}))]);function a$(e,t){const n=ob(e),r=new Set(t.map(o=>o.id));if(!r.has(n))return n;for(let o=2;;o++){const i=`${n}-${o}`;if(!r.has(i))return i}}const l$=ve({theme:qu.partial().default({}),captionsHidden:Vt().optional(),scenes:tr(he(),rb).default({}),captions:tr(he(),o$).default({}),captionWordsHidden:tr(he(),ve({was:he()})).default({}),captionRangeEdits:at(i$).default([]),captionLineTiming:tr(he(),ve({lead:ie().min(-30).max(30),tail:ie().min(-30).max(30)})).default({}),splits:at(s$).default([]),cuts:at(ve({startSec:ie().nonnegative(),endSec:ie().nonnegative(),src:ve({startSec:ie().nonnegative(),endSec:ie().nonnegative()}).optional()})).default([]),cleanup:ve({reasons:wM(nb,Vt()).default({}),kept:at(ve({srcIn:ie().nonnegative(),srcOut:ie().nonnegative()})).default([])}).default({reasons:{},kept:[]})}),u$=()=>l$.parse({});function c$(e,t){return Gg(e,{},t)??Gg(e,{},{})}function d$(e,t){const n=e[t],r=t.indexOf("@");if(r===-1)return n;const o=e[t.slice(0,r)];if(!o)return n;const{timing:i,hidden:s,...a}=o;return n?{...a,...n,props:{...a.props,...n.props},elements:{...a.elements,...n.elements},...a.video||n.video?{video:{...a.video,...n.video}}:{},...a.pip||n.pip?{pip:{...a.pip,...n.pip}}:{}}:{...a,props:{...a.props},elements:{...a.elements}}}function Pf(e,t){const n=new Set(e.map(i=>i.id)),r=Object.keys(t.scenes).filter(i=>!n.has(i));return{cues:e.map(i=>{const s=d$(t.scenes,i.id);if(!s)return i;const a=s.component!==void 0&&s.component!==i.component,l=s.component??i.component,c=s.component!==void 0&&a?c$(s.component,s.props):{...i.props,...s.props},f=s.layout!==void 0&&s.layout!==i.layout,{graphicRect:p,...m}=i;return{...f?m:i,component:l,layout:s.layout??i.layout,props:c,...Object.keys(s.elements).length>0?{elements:s.elements}:{},...s.video?{video:s.video}:{},...s.pip?{pip:s.pip}:{},...s.captionY!==void 0?{captionY:s.captionY}:{},...s.captionScale!==void 0?{captionScale:s.captionScale}:{},...s.graphicRect?{graphicRect:s.graphicRect}:{},...s.timing&&!i.pinned?{startSec:s.timing.startSec,endSec:s.timing.endSec,pinned:!0}:{}}}),orphans:r}}const eu=.3;function mh(e,t){const n=[...e];for(const r of[...t].sort((o,i)=>o.at-i.at)){const o=n.findIndex(s=>r.at>=s.startSec+eu&&r.at<=s.endSec-eu);if(o===-1)continue;const i=n[o];n.splice(o,1,{...i,endSec:r.at},{...i,id:`${i.id.split("@")[0]}@${r.id}`,startSec:r.at})}return n}function ib(e,t){const n=[];return{cues:e.filter(o=>{var i;return((i=t.scenes[o.id])==null?void 0:i.hidden)!==!0?!0:(n.push(o.id),!1)}),hidden:n}}function f$(e,t){return ib(mh(e,t.splits),t)}function p$(e,t){const n=new Map;for(const o of t)o.anchor&&n.set(o.id,o.anchor);const r={};for(const[o,i]of Object.entries(e.scenes)){const s=n.get(o);r[o]=s?{...i,anchor:s}:i}return{...e,scenes:r}}function kn(e){if(!Number.isFinite(e))throw new Error(`captionKeyFor: caption words need a finite srcStart (§137), got ${String(e)} — run backfillSrcStart on lines read from a pre-§137 render-props.json`);return`w${Math.round(e*1e3)}`}function Ys(e){return/^\d+$/.test(e)}function Ze(e){return!e||!Number.isFinite(e.srcStart)?null:kn(e.srcStart)}const h$=8;function m$(e,t,n){var i,s;if(!Ys(e))return{to:e};const r=Number(e);if(((i=n[r])==null?void 0:i.text)===t.was)return Qg(n[r]);const o=[];for(let a=1;a<=h$;a++)for(const l of[r-a,r+a])((s=n[l])==null?void 0:s.text)===t.was&&o.push(l);return o.length===0?{to:null,reason:n.some(l=>l.text===t.was)?"out-of-range":"not-found"}:o.length>1?{to:null,reason:"ambiguous"}:Qg(n[o[0]])}function Qg(e){const t=Ze(e);return t===null?{to:null,reason:"unanchorable"}:{to:t}}function g$(e,t){const n=t.flatMap(a=>a.words),r={},o=[],i=Object.entries(e).map(([a,l])=>({key:a,edit:l,legacy:Ys(a),claim:m$(a,l,n)})),s=new Map;for(const a of i){if(a.claim.to===null)continue;const l=s.get(a.claim.to);l?l.push(a):s.set(a.claim.to,[a])}for(const a of i){if(a.claim.to===null){o.push({key:a.key,was:a.edit.was,reason:a.claim.reason});continue}const l=s.get(a.claim.to),c=l.length===1?l[0]:l.find(f=>!f.legacy);if(c===a){r[a.claim.to]=a.edit;continue}o.push({key:a.key,was:a.edit.was,reason:c===void 0?"collision":"superseded"})}return{edits:r,unresolved:o}}function y$(e,t){const n={...t.edits};for(const r of t.unresolved){if(r.reason==="superseded")continue;const o=e[r.key];o!==void 0&&(n[r.key]=o)}return n}function v$(e,t){const n=[];if(Object.keys(t).length===0)return{lines:[...e],dropped:n};const r=new Set,o=e.map(i=>({...i,words:i.words.map(s=>{const a=Ze(s);if(a===null)return s;const l=t[a];return l?r.has(a)?(n.push({key:a,expected:l.was,found:s.text,reason:"duplicate-anchor"}),s):(r.add(a),s.text!==l.was?(n.push({key:a,expected:l.was,found:s.text}),s):{...s,text:l.text}):s})}));for(const[i,s]of Object.entries(t))r.has(i)||n.push({key:i,expected:s.was,found:null});return{lines:o,dropped:n}}function w$(e,t,n,r){const o=e.map(l=>l.length+1),i=o.reduce((l,c)=>l+c,0),s=[];let a=t;for(let l=0;l<e.length;l++){const c=(n-t)*o[l]/i,f=l===e.length-1?n:a+c;s.push({text:e[l],start:a,end:f,srcStart:r[l]}),a=f}return s}function x$(e,t){const n=[];if(t.length===0)return{lines:[...e],dropped:n};let r=[...e];const o=new Set,i=new Set;for(const s of t){const a=`${s.fromKey}..${s.toKey}`,l=[];for(let M=0;M<r.length;M++)for(let $=0;$<r[M].words.length;$++)l.push({line:M,word:$,w:r[M].words[$]});const c=l.findIndex(M=>Ze(M.w)===s.fromKey);if(o.has(a)||i.has(s.fromKey)){n.push({key:a,expected:s.was,found:c===-1?null:l[c].w.text,reason:"duplicate-anchor"});continue}if(c===-1){n.push({key:a,expected:s.was,found:null});continue}let f=-1;for(let M=c;M<l.length;M++)if(Ze(l[M].w)===s.toKey){f=M;break}if(f===-1){n.push({key:a,expected:s.was,found:null});continue}const p=l.slice(c,f+1),m=p.map(M=>M.w.text).join(" ").normalize("NFC");if(m!==s.was.normalize("NFC")){n.push({key:a,expected:s.was,found:m});continue}const g=s.text.trim().split(/\s+/).filter(Boolean);if(g.length===0){n.push({key:a,expected:s.was,found:m});continue}o.add(a);for(const M of p){const $=Ze(M.w);$!==null&&i.add($)}if(g.length===p.length){const M=new Map(p.map(($,V)=>[`${$.line}:${$.word}`,g[V]]));r=r.map(($,V)=>({...$,words:$.words.map((L,A)=>{const R=M.get(`${V}:${A}`);return R===void 0?L:{...L,text:R}})}));continue}const w=[],x=new Map;for(const M of p){const $=x.get(M.line);$?($.last=M.word,$.words.push(M.w)):(w.push(M.line),x.set(M.line,{first:M.word,last:M.word,words:[M.w]}))}const k=w.map(M=>x.get(M).words.reduce(($,V)=>$+(V.end-V.start),0)),h=k.reduce((M,$)=>M+$,0),y=h>0?k:k.map(()=>1),v=h>0?h:k.length,S=y.map(M=>g.length*M/v),b=S.map(M=>Math.floor(M));let E=g.length-b.reduce((M,$)=>M+$,0);const I=S.map((M,$)=>({i:$,rem:M-Math.floor(M)})).sort((M,$)=>$.rem-M.rem||M.i-$.i);for(let M=0;E>0;M=(M+1)%I.length)b[I[M].i]++,E--;const T=p[0].w.srcStart,j=p[p.length-1].w.srcStart,_=g.map((M,$)=>g.length===1?T:T+(j-T)*$/(g.length-1));let N=0;const W=[];for(let M=0;M<r.length;M++){const $=r[M],V=x.get(M);if(!V){W.push($);continue}const L=b[w.indexOf(M)],A=g.slice(N,N+L),R=_.slice(N,N+L);N+=L;const C=L===0?[]:w$(A,V.words[0].start,V.words[V.words.length-1].end,R),P=[...$.words.slice(0,V.first),...C,...$.words.slice(V.last+1)];P.length!==0&&W.push({...$,words:P})}r=W}return{lines:r,dropped:n}}function b$(e,t){const n=[];if(Object.keys(t).length===0)return{lines:[...e],dropped:n};const r=new Set,o=[];for(const i of e){const s=[];for(const m of i.words){const g=Ze(m),w=g===null?void 0:t[g];if(g===null||!w){s.push(m);continue}if(r.has(g)){n.push({key:g,expected:w.was,found:m.text,reason:"duplicate-anchor"}),s.push(m);continue}if(r.add(g),m.text!==w.was){n.push({key:g,expected:w.was,found:m.text}),s.push(m);continue}}if(s.length===i.words.length){o.push(i);continue}if(s.length===0)continue;const a=i.words[i.words.length-1],l=s[0],c=s[s.length-1],f=l===i.words[0]?i.start:l.start,p=c===a?i.end:Math.max(c.end,c.end+(i.end-a.end));o.push({words:s,start:f,end:p})}for(const[i,s]of Object.entries(t))r.has(i)||n.push({key:i,expected:s.was,found:null});return{lines:o,dropped:n}}const tu=.05;function S$(e,t,n,r,o){const i=n-t;if(!(i>0))return e.map(l=>({...l}));const s=(o-r)/i,a=l=>r+(l-t)*s;return e.map(l=>({...l,start:a(l.start),end:a(l.end)}))}function sb(e,t){const n=[],r=e.length;if(r===0){for(const f of Object.keys(t))n.push({key:f,expected:"",found:null});return{lines:[],dropped:n}}if(Object.keys(t).length===0)return{lines:[...e],dropped:n};const o=e.map(f=>f.start),i=e.map(f=>f.end),s=new Set;for(let f=0;f<r;f++){const p=e[f],m=Ze(p.words[0]),g=m===null?void 0:t[m];if(!(m===null||!g)){if(s.has(m)){n.push({key:m,expected:"",found:p.words[0].text,reason:"duplicate-anchor"});continue}s.add(m),i[f]=p.end+g.tail,f+1<r&&e[f+1].start===p.end&&(o[f+1]=i[f]),o[f]=p.start+g.lead,f>0&&e[f-1].end===p.start&&(i[f-1]=o[f])}}const a=e[0].start,l=e[r-1].end;for(let f=0;f<r;f++){const p=f===0?a:Math.max(a,i[f-1]);o[f]=Math.min(Math.max(o[f],p),l),i[f]=Math.min(Math.max(i[f],o[f]+tu),l)}for(let f=r-1;f>=0;f--){const p=f===r-1?l:Math.min(l,o[f+1]);i[f]=Math.max(Math.min(i[f],p),a),o[f]=Math.max(Math.min(o[f],i[f]-tu),a)}const c=e.map((f,p)=>{const m=o[p],g=i[p];return m===f.start&&g===f.end?f:{...f,start:m,end:g,words:S$(f.words,f.start,f.end,m,g)}});for(const f of Object.keys(t))s.has(f)||n.push({key:f,expected:"",found:null});return{lines:c,dropped:n}}function k$(e,t){return qu.parse({...e,...t.theme})}function ey(e,t,n,r){const o=e.scenes[t]??rb.parse({});return{...e,scenes:{...e.scenes,[t]:{...o,elements:{...o.elements,[n]:{...o.elements[n],...r}}}}}}function E$(e,t,n){const r=e.scenes[t];if(!r)return e;const{[n]:o,...i}=r.elements;return{...e,scenes:{...e.scenes,[t]:{...r,elements:i}}}}function C$(e,t,n){const r=e.scenes[t],o=r==null?void 0:r.elements[n];if(!r||!(o!=null&&o.hidden))return e;const{hidden:i,...s}=o,{[n]:a,...l}=r.elements,c=Object.keys(s).length>0?{...r.elements,[n]:s}:l;return{...e,scenes:{...e.scenes,[t]:{...r,elements:c}}}}function I$(e,t){const n=e.scenes[t];if(!n||!n.timing)return e;const{timing:r,...o}=n;return{...e,scenes:{...e.scenes,[t]:o}}}function T$(e,t){const n=e.scenes[t];if(!n||!n.graphicRect)return e;const{graphicRect:r,...o}=n;return{...e,scenes:{...e.scenes,[t]:o}}}function ab(e){const t=e.indexOf("@");return t===-1?e:e.slice(0,t)}const R$=.6;function j$(e,t){const n=new Set([0]);for(const r of e??[])Number.isFinite(r)&&r>0&&r<t&&n.add(r);return[...n].sort((r,o)=>r-o)}function P$(e,t){const n=t.outputDurationSec,r=[...e].sort((f,p)=>f.startSec-p.startSec);if(n<=0)return r;const o=j$(t.clipStarts,n),i=[];let s=0;for(const f of r)f.startSec-s>1e-9&&i.push({start:s,end:f.startSec}),s=Math.max(s,f.endSec);n-s>1e-9&&i.push({start:s,end:n});const a=[];for(const f of i){const p=o.filter(g=>g>f.start+1e-9&&g<f.end-1e-9),m=[f.start,...p,f.end];for(let g=0;g<m.length-1;g++){const w=m[g],x=m[g+1];if(x-w<R$)continue;let k=0;for(let h=0;h<o.length;h++)o[h]<=w+1e-9&&(k=h);a.push({start:w,end:x,clip:k})}}const l=new Map,c=a.map(f=>{const p=l.get(f.clip)??0;return l.set(f.clip,p+1),{id:p===0?`take-${f.clip}`:`take-${f.clip}-${p}`,kind:"plain",layout:"full-bleed",startSec:f.start,endSec:f.end}});return[...r,...c].sort((f,p)=>f.startSec-p.startSec)}const F$=1.05;function _$(e,t){for(const r of e)if(t>=r.startSec&&t<r.endSec){const o=r.endSec-r.startSec,i=o>0?(t-r.startSec)/o:1,s=.5-.5*Math.cos(Math.PI*i);return r.from+(r.to-r.from)*s}const n=e[e.length-1];return n&&t===n.endSec?n.to:1}function M$(e,t,n){if(e.length===0)return{x:0,y:0,w:(n==null?void 0:n.width)??0,h:(n==null?void 0:n.height)??0,full:!0};if(t<e[0].startSec)return e[0].rect;for(const r of e)if(t>=r.startSec&&t<r.endSec)return r.rect;return e[e.length-1].rect}class Ju{constructor(t){Ae(this,"spans");Ae(this,"outputDuration");let n=-1/0;for(const i of t){if(i.srcOut<i.srcIn)throw new Error(`segment ends before it starts: ${i.srcIn}..${i.srcOut}`);if(i.srcIn<n)throw new Error(`cutlist segments overlap at ${i.srcIn}`);n=i.srcOut}const r=[];let o=0;for(const i of t){if(i.kind!=="keep"||i.srcOut<=i.srcIn)continue;const s=i.srcOut-i.srcIn;r.push({srcIn:i.srcIn,srcOut:i.srcOut,outIn:o,outOut:o+s}),o+=s}this.spans=r,this.outputDuration=o}toOutput(t){for(const i of this.spans)if(t>=i.srcIn&&t<=i.srcOut)return i.outIn+(t-i.srcIn);const n=1e-9;let r=null,o=1/0;for(const i of this.spans){const s=t<i.srcIn?i.srcIn-t:t-i.srcOut;s<o&&(o=s,r=i)}if(r&&o<=n){const i=Math.min(Math.max(t,r.srcIn),r.srcOut);return r.outIn+(i-r.srcIn)}return null}toOutputClamped(t){const n=this.toOutput(t);if(n!==null)return n;let r=0;for(const o of this.spans)if(o.srcOut<=t)r=o.outOut;else if(o.srcIn>=t)return o.outIn;return r}toSource(t){const n=this.spans;if(n.length===0)return 0;const r=n[0];if(t<=r.outIn)return r.srcIn;for(const o of n)if(t>=o.outIn&&t<=o.outOut)return o.srcIn+(t-o.outIn);return n[n.length-1].srcOut}mapWord(t){const n=(t.start+t.end)/2;if(this.toOutput(n)===null&&this.toOutput(t.start)===null&&this.toOutput(t.end)===null)return null;const r=this.toOutputClamped(t.start),o=this.toOutputClamped(t.end);return o<=r?null:{start:r,end:o}}}function Qu(e){return new Ju(e.map(t=>({srcIn:t.srcIn,srcOut:t.srcOut,kind:"keep"})))}function lb(e,t,n){return Math.abs(e.outputDuration-t.outputDuration)>n||e.spans.length!==t.spans.length?!1:e.spans.every((r,o)=>{const i=t.spans[o];return Math.abs(r.srcIn-i.srcIn)<=n&&Math.abs(r.srcOut-i.srcOut)<=n&&Math.abs(r.outIn-i.outIn)<=n&&Math.abs(r.outOut-i.outOut)<=n})}function ty(e,t){const n=o=>o.words;if(e.every(o=>n(o).every(i=>i.srcStart!==void 0)))return[...e];const r=Qu(t);return e.map(o=>({...o,words:n(o).map(i=>i.srcStart===void 0?{...i,srcStart:r.toSource(i.start)}:i)}))}const $$=/[\p{Script=Arabic}\p{Script=Hebrew}\p{Script=Syriac}\p{Script=Thaana}\p{Script=Nko}]/u,A$=new RegExp("\\p{L}","u");function gh(e){for(const t of e){if($$.test(t))return"rtl";if(A$.test(t))return"ltr"}return"ltr"}const Gs="Noto Nastaliq Urdu",ub="fonts/NotoNastaliqUrdu-Bold.ttf";function N$(e){return e.some(t=>gh(t.words.map(n=>n.text).join(" "))==="rtl")}const cb=9,L$=new Set(["a","an","and","as","at","but","by","for","from","in","is","it","of","on","or","the","to","with","that","this","my","your","so","had","has","have","was","were","will","can","should","i"]);function z$(e,t=cb){const n=e.trim().replace(/\s+/g," ");if(!n)return n;const r=a=>a.split(" ").filter(Boolean);if(r(n).length<=t)return n;const o=n.split(/\s*[—–:]\s*|\s+-\s+/)[0].trim(),i=r(o).length>=3?o:n,s=r(i).slice(0,t);for(;s.length>3&&L$.has(s[s.length-1].toLowerCase().replace(/\W/g,""));)s.pop();return s.join(" ").replace(/[,;:—–-]+$/,"")}function yh(e){return e!=="user"&&e!=="clip"}function db(e,t){if(!t)return[];const n=t.kept??[];return e.filter(r=>{var o;return r.kind==="remove"&&yh(r.reason)&&(r.reason!==void 0&&((o=t.reasons)==null?void 0:o[r.reason])===!1||n.some(i=>i.srcIn<r.srcOut&&i.srcOut>r.srcIn))})}function D$(e,t){const n=new Set(db(e,t));if(n.size===0)return[...e];const r=[];for(const o of e){const i=n.has(o)?{srcIn:o.srcIn,srcOut:o.srcOut,kind:"keep"}:o,s=r[r.length-1];if(s!==void 0&&s.kind==="keep"&&i.kind==="keep"){s.srcOut=i.srcOut;continue}r.push(i.kind==="keep"?{srcIn:i.srcIn,srcOut:i.srcOut,kind:"keep"}:i)}return r}function O$(e,t,n,r,o){const i=n.toSource(t),s=r.toOutput(i);if(s!==null)return s;const a=r.toOutputClamped(i);return o.push(`${e} at ${t.toFixed(3)}s fell inside the new cut — snapped to ${a.toFixed(3)}s`),a}function B$(e,t){const n=[...t].sort((o,i)=>o.start-i.start);if(n.length===0)return[...e];const r=[];for(const o of e){if(o.kind!=="keep"){r.push(o);continue}let i=o.srcIn;for(const s of n){const a=Math.max(i,s.start),l=Math.min(o.srcOut,s.end);a>=l||(a>i&&r.push({srcIn:i,srcOut:a,kind:"keep"}),r.push({srcIn:a,srcOut:l,kind:"remove",reason:"user",confidence:1}),i=l)}i<o.srcOut&&r.push({srcIn:i,srcOut:o.srcOut,kind:"keep"})}return r}const fb=1e-6;function W$(e,t,n,r){var i;if(!(Object.values((t==null?void 0:t.reasons)??{}).some(s=>s===!1)||(((i=t==null?void 0:t.kept)==null?void 0:i.length)??0)>0)||e.length===0||r.length===0)return null;try{const s=D$(e,t),a=n.flatMap(f=>f.src&&f.src.endSec>f.src.startSec?[{start:f.src.startSec,end:f.src.endSec}]:[]),l=new Ju(B$(s,a)),c=Qu(r);return lb(c,l,fb)?null:{oldMap:c,newMap:l}}catch{return null}}function V$(e){if(e===null){const r=o=>o;return{toLive:r,fromLive:r,hasOldClockPreimage:()=>!0}}const{oldMap:t,newMap:n}=e;return{toLive:r=>{const o=t.toSource(r);return n.toOutput(o)??n.toOutputClamped(o)},fromLive:r=>{const o=n.toSource(r);return t.toOutput(o)??t.toOutputClamped(o)},hasOldClockPreimage:r=>t.toOutput(n.toSource(r))!==null}}function pb(e,t,n){const r=e.fromLive(t),o=e.fromLive(n);return o-r<fb?{kind:"degenerate"}:e.hasOldClockPreimage(t)&&e.hasOldClockPreimage(n)?{kind:"exact",startSec:r,endSec:o}:{kind:"shrunk",startSec:r,endSec:o,report:`cut ${t.toFixed(3)}s–${n.toFixed(3)}s trimmed to the last render's ${r.toFixed(3)}s–${o.toFixed(3)}s — the revived material at its edge isn't in the last render yet`}}function H$(e,t,n){const r=[],o=(s,a)=>O$(s,a,t,n,r),i={spans:n.spans.map(s=>({...s})),outputDurationSec:n.outputDuration,captionLines:e.captionLines.map((s,a)=>({...s,start:o(`caption line ${a+1} start`,s.start),end:o(`caption line ${a+1} end`,s.end),words:s.words.map(l=>({...l,start:o(`caption word "${l.text}" start`,l.start),end:o(`caption word "${l.text}" end`,l.end)}))})),sceneCues:e.sceneCues.map(s=>({...s,startSec:o(`scene "${s.id}" start`,s.startSec),endSec:o(`scene "${s.id}" end`,s.endSec)})),punch:{scale:1,allowed:[]}};return e.zoomPlan&&(i.zoomPlan=e.zoomPlan.map((s,a)=>({...s,startSec:o(`zoom segment ${a+1} start`,s.startSec),endSec:o(`zoom segment ${a+1} end`,s.endSec)}))),e.ctaWindow&&(i.ctaWindow={startSec:o("CTA window start",e.ctaWindow.startSec),endSec:o("CTA window end",e.ctaWindow.endSec)}),e.sourceTextRegions&&(i.sourceTextRegions=e.sourceTextRegions.map((s,a)=>({...s,startSec:o(`source text region ${a+1} start`,s.startSec),endSec:o(`source text region ${a+1} end`,s.endSec)}))),{fields:i,reports:r}}const rn={width:1080,height:1920};rn.width;rn.height;const ma={centerYFrac:.38,sizeFrac:.22},U$=.35,Z$=.45,hb=1-1/F$,K$=.4*hb,Y$=.6*hb;function mb(e,t,n=rn){const r=e.w*n.width,o=e.h*n.height;return Math.max(o,r/(t.sourceAspect??n.width/n.height))}function G$(e,t,n=rn){if(t.subject==="screen")return .5;const r=e.h*n.height,o=mb(e,t,n),i=o-r;if(i<=1)return .5;const s=t.sizeFrac??ma.sizeFrac,a=(t.centerYFrac-s/2-U$*s)*o,l=(t.centerYFrac+s/2)*o,c=(a+l)/2-Z$*r,f=a-K$*r,p=l+Y$*r-r,m=p<=f?Math.min(Math.max(c,p),f):p;return Math.min(1,Math.max(0,m/i))}function X$(e,t,n,r,o=rn){if(r.length===0)return e;const i=t.h*o.height,s=mb(t,n,o);if(s-i<=1)return e;const l=i/s,c=1-l;if(c<=0)return e;let f=e*c;for(let p=0;p<r.length+1;p++){const m=r.find(v=>{const S=v.y,b=v.y+v.h,E=f+l,I=S<f&&f<b,T=S<E&&E<b;return I||T});if(!m)break;const g=[],w=m.y+m.h;w<=c&&g.push(w);const x=m.y-l;if(x>=0&&g.push(x),m.h<=l){const v=Math.max(0,m.y+m.h-l),S=Math.min(c,m.y);v<=S&&g.push(Math.min(Math.max(f,v),S))}const k=n.sizeFrac??ma.sizeFrac,h=n.centerYFrac+k/2,y=g.filter(v=>v+l>=h);if(y.length===0)return e;f=y.reduce((v,S)=>Math.abs(S-f)<Math.abs(v-f)?S:v)}return Math.min(1,Math.max(0,f/c))}function q$(e,t,n=rn){if(t.subject==="screen")return .5;const r=e.w*n.width,o=e.h*n.height,i=Math.max(r,o*(t.sourceAspect??n.width/n.height)),s=i-r;if(s<=1||t.centerXFrac===void 0)return .5;const a=t.centerXFrac*i-r/2;return Math.min(1,Math.max(0,a/s))}const J$={top:.12,bottom:.22,right:.16,left:.04},Q$={top:.06,bottom:.12,right:.05,left:.05};function Qn(e=rn){return e.width>e.height?Q$:J$}function e4(e=rn){const t=Qn(e);return{x:t.left,y:t.top,w:1-t.left-t.right,h:1-t.top-t.bottom}}const t4=.08,n4=.05;function nu(e,t=rn){const n=e4(t),r=1e-9,o=(c,f,p)=>c<f-r?f:c>p+r?p:c,i=o(e.w,t4,n.w),s=o(e.h,n4,n.h),a=o(e.x,n.x,n.x+n.w-i),l=o(e.y,n.y,n.y+n.h-s);return{x:a,y:l,w:i,h:s}}const ny=.045;function r4(e){return e.width>e.height?44:64}const fr={x:0,y:0,w:1,h:1},Xc=.3,Vo={x:.5-Xc/2,y:.66,w:Xc,h:Xc*1080/1920};function To(e,t=ma,n=[],r=rn){const o=a=>X$(G$(a,t,r),a,t,n,r),i=a=>q$(a,t,r),s=r.width>r.height;switch(e){case"full-bleed":return{video:{rect:fr,cornerRadius:0,blurPx:0,dim:0,opacity:1,objectPosY:o(fr),objectPosX:i(fr)},graphic:null,captionAnchor:s?.8:.7};case"lower-third":{const a=s?{x:.05,y:.7,w:.62,h:.18}:{x:.04,y:.56,w:.8,h:.22};return{video:{rect:fr,cornerRadius:0,blurPx:0,dim:0,opacity:1,objectPosY:o(fr),objectPosX:i(fr)},graphic:a,captionAnchor:s?.62:.49}}case"split-left":case"split-right":{if(s){const l=e==="split-left",c={x:l?0:.5,y:0,w:.5,h:1};return{video:{rect:c,cornerRadius:0,blurPx:0,dim:0,opacity:1,objectPosY:o(c),objectPosX:i(c)},graphic:l?{x:.55,y:.2,w:.4,h:.56}:{x:.05,y:.2,w:.4,h:.56},captionAnchor:.82}}const a={x:0,y:0,w:1,h:.5};return{video:{rect:a,cornerRadius:0,blurPx:0,dim:0,opacity:1,objectPosY:o(a),objectPosX:i(a)},graphic:{x:.04,y:.58,w:.8,h:.2},captionAnchor:.53}}case"video-top":{const a={x:0,y:0,w:1,h:.42};return{video:{rect:a,cornerRadius:0,blurPx:0,dim:0,opacity:1,objectPosY:o(a),objectPosX:i(a)},graphic:{x:.04,y:.54,w:.8,h:.24},captionAnchor:.48}}case"pip-bubble":return{video:{rect:Vo,cornerRadius:1,blurPx:0,dim:0,opacity:1,objectPosY:o(Vo),objectPosX:i(Vo)},graphic:{x:.06,y:.14,w:.78,h:.42},captionAnchor:s?.78:.61};case"graphic-only":return{video:{rect:Vo,cornerRadius:1,blurPx:0,dim:0,opacity:0,objectPosY:o(Vo),objectPosX:i(Vo)},graphic:{x:.04,y:.14,w:.8,h:.54},captionAnchor:s?.8:.73};case"blurred-behind":return{video:{rect:fr,cornerRadius:0,blurPx:22,dim:.55,opacity:1,objectPosY:o(fr),objectPosX:i(fr)},graphic:{x:.07,y:.24,w:.77,h:.36},captionAnchor:s?.8:.69}}}const o4={x:.07,y:.24,w:.77,h:.36};function gb(e,t=rn){return e.graphicRect?nu(e.graphicRect,t):To(e.layout,ma,[],t).graphic??o4}const yb=.35;function Xr(e,t){for(const n of e)if(t>=n.startSec&&t<n.endSec)return n;return null}function In(e,t,n){return e+(t-e)*n}function i4(e,t,n){return{x:In(e.x,t.x,n),y:In(e.y,t.y,n),w:In(e.w,t.w,n),h:In(e.h,t.h,n)}}function ry(e,t,n){return{rect:i4(e.rect,t.rect,n),cornerRadius:In(e.cornerRadius,t.cornerRadius,n),blurPx:In(e.blurPx,t.blurPx,n),dim:In(e.dim,t.dim,n),opacity:In(e.opacity,t.opacity,n),objectPosY:In(e.objectPosY,t.objectPosY,n),objectPosX:In(e.objectPosX,t.objectPosX,n)}}function ru(e){return e*e*(3-2*e)}function vb(e){return e.filter(t=>!(t.kind==="plain"&&t.layout==="full-bleed"))}function qc(e,t,n,r){const o=To(e.layout,t,n,r).video,i=e.layout==="pip-bubble"?e.pip:void 0;if(!i)return o;const s={...o.rect,x:Math.min(Math.max(i.x??o.rect.x,0),1-o.rect.w),y:Math.min(Math.max(i.y??o.rect.y,0),1-o.rect.h)};return{...o,rect:s,cornerRadius:i.cornerRadius??o.cornerRadius}}function s4(e,t,n=ma,r=[],o=rn){const i=vb(e),s=r.filter(h=>t>=h.startSec&&t<h.endSec),a=To("full-bleed",n,s,o).video,l=Xr(i,t);if(!l)return a;const c=qc(l,n,s,o),f=Math.min(yb,(l.endSec-l.startSec)/2),p=t-l.startSec,m=l.endSec-t,g=Xr(i,l.startSec-.001),w=Xr(i,l.endSec+.001),x=g?qc(g,n,s,o):a,k=w?qc(w,n,s,o):a;return p<f?ry(x,c,ru(p/f)):m<f?ry(c,k,ru(1-m/f)):c}function a4(e,t,n,r){return[n!==0||r!==0?`translate(${n}px, ${r}px)`:"",e*t!==1?`scale(${e*t})`:""].filter(Boolean).join(" ")||void 0}function Jc(e){return e==="pip-bubble"||e==="graphic-only"?1:0}function l4(e,t){const n=vb(e),r=Xr(n,t);if(!r)return 0;const o=Jc(r.layout),i=Math.min(yb,(r.endSec-r.startSec)/2),s=Xr(n,r.startSec-.001),a=Xr(n,r.endSec+.001),l=s?Jc(s.layout):0,c=a?Jc(a.layout):0,f=t-r.startSec,p=r.endSec-t;return f<i?In(l,o,ru(f/i)):p<i?In(o,c,ru(1-p/i)):o}function u4(e,t,n){return e.filter(r=>(r.startSec??Number.NEGATIVE_INFINITY)<n&&(r.endSec??Number.POSITIVE_INFINITY)>t)}function c4(e,t){let n=0;for(const r of t){const o=Math.max(e.y,r.y),i=Math.min(e.y+e.h,r.y+r.h);i>o&&(n+=i-o)}return Math.min(1,n/e.h)}function d4(e,t,n,r=rn){const o=To(e,void 0,[],r),i=Qn(r),s=o.captionAnchor,a=l=>{const c={y:l-ny,h:ny*2};if(c.y<i.top||c.y+c.h>1-i.bottom||c4(c,t)>0)return!1;const f=n??o.graphic;return!(f&&Math.min(c.y+c.h,f.y+f.h)-Math.max(c.y,f.y)>0)};if(a(s))return s;for(let l=.02;l<=.6;l+=.02)for(const c of[s-l,s+l])if(a(c))return c;return s}const f4=.3,p4=.3,h4=.133,vh=e=>e*(2-e);function wb(e,t=f4,n=p4){if(e<=0)return{enterSec:0,exitSec:0};const r=t+n;if(r<=e)return{enterSec:t,exitSec:n};const o=e/r;return{enterSec:t*o,exitSec:n*o}}const oy=.4;function m4(e,t){if(!t)return e;const n=e.replace(/^[^A-Za-z0-9]+|[^A-Za-z0-9]+$/g,"");return n.toLowerCase()!==t.toLowerCase()?e:e.replace(n,`"${n.toUpperCase()}"`)}function g4(e,t){return t?e>=t.startSec-oy&&e<=t.endSec+oy:!1}function y4(e,t){return e??r4(t)}function v4(e){return e*10/64}function w4(e){return{fontFamily:(e==null?void 0:e.fontDisplay)??"'Inter', 'Helvetica Neue', 'Arial Black', Arial, sans-serif",color:(e==null?void 0:e.fg)??"white"}}function x4(e,t){return e==="rtl"?`'${Gs}', ${t}`:t}function b4(e){return e==="rtl"?1.9:1.15}const S4=()=>{const[e]=le.useState(()=>oC(`load ${Gs}`));return le.useEffect(()=>{let t=!1;const n=()=>{t||(t=!0,iC(e))};return new FontFace(Gs,`url("${nh(ub)}") format("truetype")`,{weight:"900"}).load().then(o=>{document.fonts.add(o),n()},n),n},[e]),null},k4=({line:e,wordOffset:t,verticalAnchor:n,fontSizePx:r,activeColor:o,fontFamily:i,textColor:s,ctaKeyword:a,ctaWindow:l})=>{const c=Ft(),{fps:f,width:p,height:m}=ht(),g=Qn({width:p,height:m}),w=e.start+c/f,x=gh(e.words.map(k=>k.text).join(" "));return u.jsx(Hn,{style:{pointerEvents:"none"},children:u.jsx("div",{style:{position:"absolute",top:`${n*100}%`,left:0,right:0,transform:"translateY(-50%)",direction:x,display:"flex",justifyContent:"center",gap:"0.28em",flexWrap:"wrap",paddingLeft:`${g.left*100}%`,paddingRight:`${g.right*100}%`,fontFamily:x4(x,i),fontWeight:900,fontSize:r,lineHeight:b4(x),textAlign:"center",color:s,WebkitTextStroke:`${v4(r)}px rgba(0,0,0,0.85)`,paintOrder:"stroke fill",textShadow:`0 4px ${r*24/64}px rgba(0,0,0,0.55)`},children:e.words.map((k,h)=>{const y=Math.max(k.end,k.start+.12),v=w>=k.start&&w<=y,S=v?Math.min(1,(w-k.start)/h4):0,b=vh(S);return u.jsx("span",{"data-caption-word":t+h,"data-caption-text":k.text,"data-caption-src":Ze(k)===null?void 0:k.srcStart,style:{display:"inline-block",pointerEvents:"auto",transform:b>0?`scale(${1+.08*b})`:"scale(1)",color:v?o:s},children:m4(k.text,g4(k.start,l)?a:void 0)},h)})})})},E4=({lines:e,cues:t=[],verticalAnchor:n=.76,fontSizePx:r,activeColor:o="#FFE14D",theme:i,ctaKeyword:s,ctaWindow:a,sourceTextRegions:l=[]})=>{const{fps:c,width:f,height:p}=ht(),m={width:f,height:p},g=y4(r,m),{fontFamily:w,color:x}=w4(i),k=[];let h=0;for(const y of e)k.push(h),h+=y.words.length;return u.jsxs(Hn,{children:[N$(e)?u.jsx(S4,{}):null,e.map((y,v)=>{const S=t.length>0?Xr(t,y.start):null,b=(S==null?void 0:S.captionY)!==void 0?S.captionY:t.length>0||l.length>0?d4((S==null?void 0:S.layout)??"full-bleed",u4(l,y.start,y.end),S==null?void 0:S.graphicRect,m):n,{from:E,durationInFrames:I}=ah(y.start,y.end,c);return u.jsx(_t,{from:E,durationInFrames:I,children:u.jsx(k4,{line:y,wordOffset:k[v],verticalAnchor:b,fontSizePx:g*((S==null?void 0:S.captionScale)??1),activeColor:o,fontFamily:w,textColor:x,ctaKeyword:s,ctaWindow:a})},v)})]})};function xb(e,t,n,r=.5,o=.5){const i=Math.max(1,e.width),s=Math.max(1,e.height),a=Math.max(1,t.w),l=Math.max(1,t.h),c=Math.max(n.width/a,n.height/l),f=-t.x*c+(n.width-a*c)*iy(r),p=-t.y*c+(n.height-l*c)*iy(o);return{width:i*c,height:s*c,left:f,top:p}}function iy(e){return Number.isFinite(e)?Math.min(1,Math.max(0,e)):.5}function bb(e,t,n){const r=Math.max(1,e.width),o=Math.max(1,e.height),i=Math.max(1,t.w),s=Math.max(1,t.h),a=Math.min(n.width/i,n.height/s),l=-t.x*a+(n.width-i*a)/2,c=-t.y*a+(n.height-s*a)/2;return{width:r*a,height:o*a,left:l,top:c}}function C4(e,t){return bb(e,{x:0,y:0,w:e.width,h:e.height},t)}function Sb(e,t){if(e.length===0)return t;for(const o of e)if(t>=o.outIn&&t<o.outOut)return o.srcIn+(t-o.outIn);const n=e[0];return t<n.outIn?n.srcIn:e[e.length-1].srcOut}function I4(e,t,n,r,o,i){return e==="fit"?bb(t,n,r):xb(t,n,r,o,i)}function T4(e,t,n,r){return e.length===0?{x:0,y:0,w:r.width,h:r.height,full:!0}:M$(e,Sb(t,n),r)}function R4(e,t,n){if(e.length===0)return null;const r=Sb(t,n);if(r<e[0].startSec)return e[0];for(const o of e)if(r>=o.startSec&&r<o.endSec)return o;return e[e.length-1]}function j4(e,t,n,r,o,i,s,a,l){if(!o)return null;if(e&&e.length>0){const f=R4(e,n,r);if(f)return xb(o,f.window,s,f.bias.x,f.bias.y)}if(!t||t.length<2)return null;const c=T4(t,n,r,o);return c.full?null:I4(i,o,c,s,a,l)}const P4=({cues:e,theme:t,face:n,zoomPlan:r,sourceTextRegions:o,contentTimeline:i,framingTimeline:s,spans:a,sourceSize:l,contentCropMode:c="cover",sourceFit:f="cover",children:p})=>{const m=Ft(),{fps:g,width:w,height:x}=ht(),k=m/g,y=s4(e,k,n??void 0,o??[],{width:w,height:x}),v=l4(e,k),S=y.rect.w*w,b=y.rect.h*x,E=y.cornerRadius*Math.min(S,b)/2,I=Xr(e,k),T=I==null?void 0:I.video,j=r&&r.length>0?_$(r,k):1,_=Math.max(0,y.opacity*(1-.6*y.cornerRadius)),N=(T==null?void 0:T.autoZoom)!==!1,W=f==="contain"&&l!==void 0,M=N&&!W?1+(j-1)*_:1,$=(T==null?void 0:T.scale)??1,V=(T==null?void 0:T.dx)??0,L=(T==null?void 0:T.dy)??0,A=a4(M,$,V,L);return u.jsxs(Hn,{children:[u.jsx(Hn,{style:{background:t.bg,opacity:v}}),u.jsxs("div",{"data-edit-video":I==null?void 0:I.id,style:{position:"absolute",left:`${y.rect.x*100}%`,top:`${y.rect.y*100}%`,width:S,height:b,borderRadius:E,overflow:"hidden",opacity:y.opacity,backgroundColor:W?t.bg:void 0,boxShadow:y.cornerRadius>.5?"0 18px 60px rgba(0,0,0,0.55)":void 0},children:[u.jsx("div",{style:{position:"absolute",inset:0,filter:y.blurPx>.5?`blur(${y.blurPx}px)`:void 0,transform:A,transformOrigin:"50% 40%","--ossclip-obj-y":`${y.objectPosY*100}%`,"--ossclip-obj-x":`${y.objectPosX*100}%`},children:W?u.jsx(F4,{source:l,slot:{width:S,height:b},children:p}):u.jsx(_4,{timeline:i,framing:s,spans:a,sourceSize:l,mode:c,tSec:k,slot:{width:S,height:b},posX:y.objectPosX,posY:y.objectPosY,children:p})}),u.jsx("div",{style:{position:"absolute",inset:0,background:"black",opacity:y.dim}})]})]})},F4=({source:e,slot:t,children:n})=>{const r=C4(e,t);return u.jsx("div",{style:{position:"absolute",width:r.width,height:r.height,left:r.left,top:r.top},children:n})},_4=({timeline:e,framing:t,spans:n,sourceSize:r,mode:o,tSec:i,slot:s,posX:a,posY:l,children:c})=>{const f=j4(t,e,n??[],i,r,o,s,a,l);return f?u.jsx("div",{style:{position:"absolute",width:f.width,height:f.height,left:f.left,top:f.top},children:c}):u.jsx("div",{style:{position:"absolute",inset:0},children:c})},wh=.94,M4=new Set(["FlowDiagram","StrikethroughReveal","ChatMock","BulletList"]),sy=2.4,Ka=.45,ec=.58,Nt=.72,$4=.62;function Go(e,t,n,r,o){const i=Math.max(1,Math.floor(n/Math.max(1,o*t)));return Math.max(1,Math.ceil(e/i))*t*r}const Ye=e=>typeof e=="string"?e:"",Dr=e=>Array.isArray(e)?e:[];function A4(e,t,n,r=1/0){switch(e){case"TitleCard":{const o=n-80,i=Ye(t.emphasis),s=28;let a=0,l=0;Ye(t.eyebrow)&&(a+=34*1.2,l++),i&&(a+=210*.95,l++);const c=i?64:96;return a+=Go(Ye(t.title).length,c,o,1.05,Nt),l++,Ye(t.sub)&&(a+=Go(Ye(t.sub).length,40,o,1.2,ec),l++),a+s*Math.max(0,l-1)}case"StatCard":{const o=Go(Ye(t.label).length,42,n*.55,1.15,Nt);let i=88+Math.max(o,110*1.15)+4;return Ye(t.caption)&&(i+=30+(38*1.2+32+4)),i}case"RuleCard":{const o=n-60-96;let i=80;return i+=30*1.2+14,i+=Go(Ye(t.text).length,72,o,1.02,Nt),Ye(t.struck)&&(i+=26+Go(Ye(t.struck).length,44,o,1.2,Nt)),i}case"StrikethroughReveal":{const o=Dr(t.lines).map(a=>Ye(a==null?void 0:a.text)),i=Tb(o,n,r),s=o.reduce((a,l)=>a+Ib(l,i,n).length,0);return s*i*1.08+i*.2*Math.max(0,s-1)}case"FlowDiagram":{const o=Dr(t.nodes).map(l=>Ye(l)),i=Math.max(1,o.length),{mode:s,fontSize:a}=$b(o,n,r);return s==="row"?a*Cs+4:a*(Cs*i+Mb*(i-1))}case"TerminalMock":{const o=Dr(t.windows);let i=0;for(const s of o){const a=Dr(s==null?void 0:s.lines);i+=56.8+2,i+=Math.max(1,a.length)*27*1.2+8*Math.max(0,a.length-1)+36,i+=4}return i+=22*Math.max(0,o.length-1),Ye(t.fanOut)&&(i+=22+40*1.2),i}case"ChatMock":{const o=Fb(t).map(s=>s.text),i=_b(o,{widthPx:n,heightPx:r});return Pb(o,i,n)}case"ScreenshotFrame":{const o=n*.94;return(Ye(t.src)?o*9/16:480)+4}case"BulletList":{const o=Dr(t.items).map(s=>Ye(s)),i=Cb(o,n,r,!!Ye(t.title),Ye(t.title));return O4(o.length,i,!!Ye(t.title))}}}const _r=e=>Ye(e).split(/\s+/).reduce((t,n)=>Math.max(t,n.length),0);function N4(e,t){switch(e){case"RuleCard":{const n=_r(t.kicker)*30*(Nt+.28),r=_r(t.text)*72*Nt,o=_r(t.struck)*44*(Nt+.04),i=Math.max(n,r,o);return i>0?156+i:0}case"TitleCard":{const n=Ye(t.emphasis)?64:96,r=_r(t.eyebrow)*34*(Nt+.35),o=_r(t.emphasis)*210*Nt,i=_r(t.title)*n*(Nt+.02),s=_r(t.sub)*40*ec,a=Math.max(r,o,i,s);return a>0?80+a:0}case"TerminalMock":{let n=0;for(const r of Dr(t.windows))for(const o of Dr(r==null?void 0:r.lines))n=Math.max(n,Ye(o).length);return n>0?108+n*27*$4:0}case"StatCard":{const n=Ye(t.value).length*110*Nt;return n===0?0:164+_r(t.label)*42*Nt+40+n}default:return 0}}const ay=36,L4=120,kb=1.6,Eb=.88,z4=(Nt+.28)*.36,D4=1.1;function O4(e,t,n){return(Math.max(1,e)*kb+(n?Eb:0))*t}function Cb(e,t=831,n=1/0,r=!1,o=""){const i=e.reduce((l,c)=>Math.max(l,c.length),0);if(i===0)return ay;const s=Math.min(t/(i*Nt+D4),o?t/(o.length*z4):1/0),a=n*wh/(Math.max(1,e.length)*kb+(r?Eb:0));return Math.max(ay,Math.min(L4,Math.floor(Math.min(s,a))))}const B4=92,W4=44,V4=150,H4=[" → "," -> "," → "," > "];function Ib(e,t,n){const r=o=>o.length*t*Nt<=n;if(r(e))return[e];for(const o of H4){if(!e.includes(o))continue;const s=e.split(o).map((a,l)=>l===0?a:`${o.trim()} ${a}`.trim());if(s.every(r))return s}return[e]}function Tb(e,t=831,n=1/0){const r=e.reduce((s,a)=>Math.max(s,a.length),0);if(r===0)return B4;const o=t/(r*Nt),i=n/(Math.max(1,e.length)*1.28);return Math.max(W4,Math.min(V4,Math.floor(Math.min(o,i))))}const ly=22,uy=44,U4=96,cy=22,Rb=.85,jb=.82;function Pb(e,t,n){const o=(n-80)*jb-2*t*Rb;let i=0;for(const s of e)i+=Go(s.length,t,o,1.2,ec)+t*1.2+4;return i+t*.5*Math.max(0,e.length-1)}function Fb(e){const t=Ye(e.keyword);return t?[{from:"user",text:`"${t.toUpperCase()}"`}]:Dr(e.messages).map(n=>{const r=n??{};return{from:r.from==="agent"?"agent":"user",text:Ye(r.text)}})}function _b(e,t={}){const n=t.widthPx??831,r=t.heightPx??1/0,o=n-80,i=e.reduce((p,m)=>Math.max(p,m.length),0);if(i===0)return uy;const s=e.flatMap(p=>p.split(/\s+/)).reduce((p,m)=>Math.max(p,m.length),0),a=p=>o*jb/(p*ec+2*Rb),l=Math.min(i,cy),c=i>cy?uy:U4;let f=Math.floor(Math.min(a(l),a(s),c));for(;f>ly&&Pb(e,f,n)>r*wh;)f-=1;return Math.max(ly,f)}const dy=26,Z4=22,K4=76,Cs=2.1,Mb=2.05;function $b(e,t,n=1/0){const r=e.reduce((x,k)=>x+k.length,0),o=Math.max(1,e.length),i=.78,s=1.6,a=1.8,l=t-20,c=Math.floor(Math.min(l/(i*r+s*o+a*(o-1)),n/Cs)),f=Math.max(...e.map(x=>x.length),1),p=Cs*o+Mb*(o-1),m=Math.floor(Math.min(l/(i*f+s),n/p,K4)),g=c>=dy;return m>=Z4?g?c*Cs>=m*p?{mode:"row",fontSize:c}:{mode:"stack",fontSize:m}:{mode:"stack",fontSize:m}:{mode:"row",fontSize:Math.max(dy,c)}}function Y4(e,t,n){if(M4.has(e))return 1;const r=n.heightPx*wh,o=c=>A4(e,t,n.widthPx/c)*c<=r;if(!o(Ka))return Ka;const i=N4(e,t),s=i>0?n.widthPx/i:sy;let a=Ka,l=Math.max(Ka,Math.min(sy,s));if(l<=a)return a;for(let c=0;c<24;c++){const f=(a+l)/2;o(f)?a=f:l=f}return a}function Et(e=0){const t=Ft(),{fps:n}=ht();return mf({frame:t-e,fps:n,config:{damping:200,stiffness:130},durationInFrames:Math.round(n*.5)})}function nr(e,t=26){return{opacity:e,transform:`translateY(${(1-e)*t}px)`}}function Ro(e){return{opacity:e,transform:`scale(${.9+.1*e})`}}function G4(e,t){return!e||t===1?e:Object.fromEntries(Object.entries(e).map(([n,r])=>[n,{...r,...r.dx!==void 0?{dx:r.dx/t}:{},...r.dy!==void 0?{dy:r.dy/t}:{}}]))}function wt(e,t){const n=e==null?void 0:e[t];if(!n)return{};if(n.hidden)return{display:"none"};const r=[`translate(${n.dx??0}px, ${n.dy??0}px)`];return n.scale!==void 0&&n.scale!==1&&r.push(`scale(${n.scale})`),{transform:r.join(" ")}}const X4=({props:e,theme:t,edits:n})=>{var l;const r=Et(0),o=Et(5),i=Et(10),s=(l=e.emphasis)==null?void 0:l.trim(),a=!!s&&s.toLowerCase().includes(e.title.trim().toLowerCase());return u.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:28,textAlign:"center",fontFamily:t.fontDisplay,color:t.fg,padding:"0 40px"},children:[e.eyebrow?u.jsx("div",{"data-edit-id":"eyebrow",style:{...nr(r),fontSize:34,fontWeight:700,letterSpacing:"0.35em",color:t.muted,textTransform:"uppercase",...wt(n,"eyebrow")},children:e.eyebrow}):null,s?u.jsx("div",{"data-edit-id":"emphasis",style:{...nr(o,40),fontSize:210,fontWeight:900,lineHeight:.95,...wt(n,"emphasis")},children:s}):null,a?null:u.jsx("div",{"data-edit-id":"title",style:{...nr(s?i:o,34),fontSize:s?64:96,fontWeight:900,lineHeight:1.05,textTransform:"uppercase",letterSpacing:"0.02em",...wt(n,"title")},children:e.title}),e.sub?u.jsx("div",{"data-edit-id":"sub",style:{...nr(i),fontSize:40,fontWeight:600,color:t.muted,...wt(n,"sub")},children:e.sub}):null]})},q4=({props:e,theme:t,edits:n})=>{const r=Et(0),o=Et(6),i=e.inverted;return u.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:30,fontFamily:t.fontDisplay,width:"100%",padding:"0 30px"},children:[u.jsxs("div",{style:{...Ro(r),display:"flex",alignItems:"center",justifyContent:"space-between",gap:40,width:"100%",background:i?t.fg:t.cardBg,color:i?t.bg:t.fg,border:`2px solid ${i?t.fg:t.cardBorder}`,borderRadius:t.radiusPx,padding:"44px 52px"},children:[u.jsx("div",{"data-edit-id":"label",style:{fontSize:42,fontWeight:800,textTransform:"uppercase",letterSpacing:"0.06em",lineHeight:1.15,maxWidth:"55%",...wt(n,"label")},children:e.label}),u.jsx("div",{"data-edit-id":"value",style:{fontSize:110,fontWeight:900,whiteSpace:"nowrap",...wt(n,"value")},children:e.value})]}),e.caption?u.jsx("div",{"data-edit-id":"caption",style:{...nr(o),fontSize:38,fontWeight:800,color:t.fg,background:t.cardBg,border:`2px solid ${t.cardBorder}`,borderRadius:t.radiusPx/2,padding:"16px 30px",textTransform:"uppercase",letterSpacing:"0.08em",...wt(n,"caption")},children:e.caption}):null]})},J4=({props:e,theme:t,edits:n})=>{const r=Et(0),o=Et(8);return u.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:26,fontFamily:t.fontDisplay,width:"100%",padding:"0 30px"},children:[u.jsxs("div",{style:{...Ro(r),width:"100%",background:t.fg,color:t.bg,borderRadius:t.radiusPx,padding:"40px 48px",textAlign:"left"},children:[u.jsx("div",{"data-edit-id":"kicker",style:{fontSize:30,fontWeight:800,letterSpacing:"0.28em",textTransform:"uppercase",color:"#55555E",marginBottom:14,fontFamily:t.fontMono,...wt(n,"kicker")},children:e.kicker}),u.jsx("div",{"data-edit-id":"text",style:{fontSize:72,fontWeight:900,lineHeight:1.02,textTransform:"uppercase",...wt(n,"text")},children:e.text})]}),e.struck?u.jsx("div",{"data-edit-id":"struck",style:{...nr(o),fontSize:44,fontWeight:800,color:t.muted,textDecoration:"line-through",textDecorationThickness:6,textDecorationColor:t.danger,textTransform:"uppercase",letterSpacing:"0.04em",...wt(n,"struck")},children:e.struck}):null]})},Q4=({text:e,struck:t,mark:n,delay:r,fontSize:o,theme:i,editId:s,edits:a})=>{const l=Et(r),c=Et(r+8);return u.jsxs("div",{"data-edit-id":s,style:{...nr(l,30),position:"relative",display:"inline-block",...wt(a,s)},children:[u.jsxs("span",{style:{fontSize:o,fontWeight:900,textTransform:"uppercase",lineHeight:1.08,whiteSpace:"nowrap",color:t?i.muted:i.fg},children:[n!=="none"?u.jsx("span",{style:{color:n==="cross"?i.danger:i.success,marginRight:"0.3em"},children:n==="cross"?"✗":"✓"}):null,e]}),t?u.jsx("div",{style:{position:"absolute",left:"-2%",top:"50%",height:o*.11,width:`${c*104}%`,background:i.danger,borderRadius:o*.055,transform:"translateY(-50%) rotate(-2deg)"}}):null]})},eA=({props:e,theme:t,widthPx:n,heightPx:r,edits:o})=>{const i=e.lines.map(l=>(l.mark??"none")!=="none"?`✗ ${l.text}`:l.text),s=Tb(i,n,r),a=e.lines.flatMap((l,c)=>Ib(l.text,s,n??831).map((f,p)=>({text:f,struck:l.struck,mark:p===0?l.mark??"none":"none",lineIndex:c})));return u.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:s*.2,textAlign:"center",fontFamily:t.fontDisplay},children:a.map((l,c)=>u.jsx(Q4,{text:l.text,struck:l.struck,mark:l.mark,delay:c*6,fontSize:s,theme:t,editId:`line-${l.lineIndex}`,edits:o},c))})},tA=({text:e,emphasized:t,delay:n,fontSize:r,theme:o,editId:i,edits:s})=>{const a=Et(n);return u.jsx("div",{"data-edit-id":i,style:{...Ro(a),background:t?o.fg:o.cardBg,color:t?o.bg:o.fg,border:`2px solid ${t?o.fg:o.cardBorder}`,borderRadius:o.radiusPx/2,padding:`${r*.55}px ${r*.8}px`,fontSize:r,fontWeight:900,textTransform:"uppercase",letterSpacing:"0.04em",whiteSpace:"nowrap",fontFamily:o.fontDisplay,...wt(s,i)},children:e})},nA=({delay:e,fontSize:t,theme:n,down:r=!1})=>{const o=Et(e);return u.jsx("div",{style:{opacity:o,color:n.muted,fontSize:t*1.15,fontWeight:700,lineHeight:1,paddingLeft:r?0:t*.55},children:r?"↓":"→"})};function rA(e,t=oA,n){return $b(e,t,n)}const oA=864,iA=({props:e,theme:t,widthPx:n,heightPx:r,edits:o})=>{const{mode:i,fontSize:s}=rA(e.nodes,n,r),a=i==="row";return u.jsx("div",{style:{display:"flex",flexDirection:a?"row":"column",flexWrap:"nowrap",alignItems:"center",justifyContent:"center",gap:a?0:s*.45,padding:"0 10px"},children:e.nodes.map((l,c)=>u.jsxs("div",{style:{display:"flex",flexDirection:a?"row":"column",alignItems:"center",gap:a?s*.55:s*.45},children:[c>0?u.jsx(nA,{delay:c*6+3,fontSize:s,theme:t,down:!a}):null,u.jsx(tA,{text:l,emphasized:e.emphasizeLast&&c===e.nodes.length-1,delay:c*6,fontSize:s,theme:t,editId:`node-${c}`,edits:o})]},c))})},sA=({title:e,lines:t,delay:n,theme:r,editId:o,edits:i})=>{const s=Et(n);return u.jsxs("div",{"data-edit-id":o,style:{...Ro(s),background:r.cardBg,border:`2px solid ${r.cardBorder}`,borderRadius:r.radiusPx/2,overflow:"hidden",width:"100%",fontFamily:r.fontMono,...wt(i,o)},children:[u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"14px 20px",borderBottom:`2px solid ${r.cardBorder}`},children:[["#FF5F57","#FEBC2E","#28C840"].map(a=>u.jsx("div",{style:{width:16,height:16,borderRadius:8,background:a}},a)),u.jsx("div",{style:{marginLeft:10,fontSize:24,color:r.muted},children:e})]}),u.jsx("div",{style:{padding:"18px 22px",display:"flex",flexDirection:"column",gap:8},children:t.map((a,l)=>u.jsx("div",{style:{fontSize:27,color:r.fg,whiteSpace:"pre"},children:a},l))})]})},aA=({props:e,theme:t,edits:n})=>{const r=Et(e.windows.length*6+4);return u.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:22,width:"100%",padding:"0 30px"},children:[e.windows.map((o,i)=>u.jsx(sA,{title:o.title,lines:o.lines,delay:i*6,theme:t,editId:`window-${i}`,edits:n},i)),e.fanOut?u.jsxs("div",{"data-edit-id":"fanOut",style:{...nr(r),fontFamily:t.fontDisplay,fontSize:40,fontWeight:900,letterSpacing:"0.2em",color:t.fg,textTransform:"uppercase",...wt(n,"fanOut")},children:["⌄ ",e.fanOut]}):null]})},lA=({from:e,text:t,delay:n,fontSize:r,theme:o,editId:i,edits:s})=>{const a=Et(n),l=e==="user";return u.jsx("div",{"data-edit-id":i,style:{...Ro(a),alignSelf:l?"flex-end":"flex-start",background:l?o.fg:o.cardBg,color:l?o.bg:o.fg,border:`2px solid ${l?o.fg:o.cardBorder}`,borderRadius:28,[l?"borderBottomRightRadius":"borderBottomLeftRadius"]:8,padding:`${r*.6}px ${r*.85}px`,fontSize:r,fontWeight:700,maxWidth:"82%",fontFamily:o.fontDisplay,...wt(s,i)},children:t})},uA=({props:e,theme:t,widthPx:n,heightPx:r,edits:o})=>{const i=Fb(e),s=_b(i.map(a=>a.text),{widthPx:n,heightPx:r});return u.jsx("div",{style:{display:"flex",flexDirection:"column",gap:s*.5,width:"100%",padding:"0 40px"},children:i.map((a,l)=>u.jsx(lA,{from:a.from,text:a.text,delay:l*8,fontSize:s,theme:t,editId:`message-${l}`,edits:o},l))})},cA=({props:e,theme:t,edits:n})=>{const r=Et(0),o=Et(8),i=Ft(),{fps:s}=ht(),a=e.kenBurns?Di(i,[0,s*8],[1,1.08],{extrapolateRight:"clamp"}):1,l=e.src?/^https?:\/\//.test(e.src)?e.src:nh(e.src):null;return u.jsxs("div",{"data-edit-id":"src",style:{...Ro(r),position:"relative",width:"94%",...wt(n,"src")},children:[u.jsx("div",{style:{overflow:"hidden",borderRadius:t.radiusPx/2,border:`2px solid ${t.cardBorder}`,background:t.cardBg,boxShadow:"0 24px 80px rgba(0,0,0,0.5)"},children:l?u.jsx(qp,{src:l,style:{width:"100%",display:"block",transform:`scale(${a})`}}):u.jsx("div",{style:{height:420,display:"flex",flexDirection:"column",gap:14,padding:30,transform:`scale(${a})`},children:[.9,.75,.85,.6,.8,.5].map((c,f)=>u.jsx("div",{style:{height:22,width:`${c*100}%`,borderRadius:6,background:f%3===0?t.cardBorder:"#22222B"}},f))})}),e.label?u.jsx("div",{"data-edit-id":"label",style:{...Ro(o),position:"absolute",right:-8,bottom:-20,background:t.fg,color:t.bg,fontFamily:t.fontMono,fontSize:28,fontWeight:800,letterSpacing:"0.08em",padding:"12px 22px",borderRadius:10,textTransform:"uppercase",...wt(n,"label")},children:e.label}):null]})},dA=({text:e,index:t,fontSize:n,theme:r,edits:o})=>{const i=`item-${t}`,s=Et(t*7);return u.jsxs("div",{"data-edit-id":i,style:{...nr(s,26),display:"flex",alignItems:"baseline",gap:n*.35,...wt(o,i)},children:[u.jsx("span",{style:{fontSize:n*.75,color:r.accent,fontWeight:900},children:"▸"}),u.jsx("span",{style:{fontSize:n,fontWeight:900,textTransform:"uppercase",lineHeight:1.15,whiteSpace:"nowrap",color:r.fg},children:e})]})},fA=({props:e,theme:t,widthPx:n,heightPx:r,edits:o})=>{const i=Cb(e.items,n,r,!!e.title,e.title),s=Et(0);return u.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:i*.45,fontFamily:t.fontDisplay},children:[e.title?u.jsx("div",{"data-edit-id":"title",style:{...nr(s,20),fontSize:i*.36,fontWeight:700,letterSpacing:"0.28em",textTransform:"uppercase",color:t.muted,...wt(o,"title")},children:e.title}):null,e.items.map((a,l)=>u.jsx(dA,{text:a,index:l,fontSize:i,theme:t,edits:o},l))]})},pA={TitleCard:X4,StatCard:q4,RuleCard:J4,StrikethroughReveal:eA,FlowDiagram:iA,TerminalMock:aA,ChatMock:uA,ScreenshotFrame:cA,BulletList:fA},hA=new Set(["lower-third","full-bleed"]),mA=.55,gA=e=>{const t=/^#([0-9a-fA-F]{6})$/.exec(e.trim()),[n,r,o]=t?[0,2,4].map(i=>Number.parseInt(t[1].slice(i,i+2),16)):[0,0,0];return`rgba(${n}, ${r}, ${o}, ${mA})`},yA=e=>({width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",opacity:e,transform:e<1?`translateY(${(1-e)*18}px)`:void 0}),vA=({durationInFrames:e,children:t})=>{const n=Ft(),{fps:r}=ht(),{exitSec:o}=wb(e/r),i=(e-n)/r,s=o<=0?1:Math.min(1,Math.max(0,i/o));return u.jsx("div",{style:yA(vh(s)),children:t})},wA=({durationInFrames:e,themeBg:t,radiusPx:n})=>{const r=Ft(),{fps:o}=ht(),{enterSec:i}=wb(e/o),s=i<=0?1:Math.min(1,Math.max(0,r/o/i)),a=vh(s);return u.jsx("div",{style:{position:"absolute",inset:0,background:gA(t),backdropFilter:"blur(14px)",WebkitBackdropFilter:"blur(14px)",borderRadius:n,opacity:a,transform:a<1?`translateY(${(1-a)*18}px)`:void 0}})},xA=({cues:e,theme:t})=>{const{fps:n,width:r,height:o}=ht();return u.jsx(Hn,{style:{pointerEvents:"none"},children:e.map(i=>{if(i.kind==="plain"||!i.component||!i.props)return null;const s=gb(i,{width:r,height:o}),a=pA[i.component],{from:l,durationInFrames:c}=ah(i.startSec,i.endSec,n),f=s.w*r,p=s.h*o,m=hA.has(i.layout),g=m?Math.min(24,Math.round(p*.12)):0,w=f-g*2,x=p-g*2,k=Y4(i.component,i.props,{widthPx:w,heightPx:x});return u.jsx(_t,{from:l,durationInFrames:c,children:u.jsx("div",{"data-edit-scene":i.id,style:{position:"absolute",left:`${s.x*100}%`,top:`${s.y*100}%`,width:`${s.w*100}%`,height:`${s.h*100}%`,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"auto",overflow:"hidden"},children:u.jsxs(vA,{durationInFrames:c,children:[m?u.jsx(wA,{durationInFrames:c,themeBg:t.bg,radiusPx:t.radiusPx}):null,u.jsx("div",{style:{width:w/k,transform:`scale(${k})`,position:"relative"},children:u.jsx(a,{props:i.props,theme:t,widthPx:w/k,heightPx:x/k,edits:G4(i.elements,k)})})]})})},i.id)})})},bA="made with ossclip",SA=.45,kA=.024;function EA(e=rn){const t=Qn(e);return{xPx:Math.round(t.left*e.width),yPx:Math.round(t.top*e.height),fontPx:Math.round(Math.min(e.width,e.height)*kA),opacity:SA,text:bA}}function CA(e){return e===!0}const IA=({theme:e,frame:t})=>{const n=EA(t);return u.jsx("div",{style:{position:"absolute",left:n.xPx,top:n.yPx,fontFamily:e.fontDisplay,fontSize:n.fontPx,fontWeight:600,letterSpacing:"0.02em",color:e.fg,opacity:n.opacity,pointerEvents:"none",whiteSpace:"nowrap"},children:n.text})};function TA(e){return e!==!0}const RA=({videoFileName:e,spans:t,captionLines:n,sceneCues:r,theme:o,settings:i,face:s,zoomPlan:a,ctaKeyword:l,ctaWindow:c,sourceTextRegions:f,contentTimeline:p,framingTimeline:m,sourceSize:g,contentCropMode:w,sourceFit:x,watermark:k,captionsHidden:h,staticCamera:y,punch:v})=>{if(!e)return u.jsx(Hn,{style:{backgroundColor:"#111",color:"#888",alignItems:"center",justifyContent:"center",fontFamily:"monospace",fontSize:40},children:"no production loaded"});const S=/^https?:\/\//.test(e)?e:nh(e),b=x==="contain"||y===!0?null:Wj(v);return u.jsxs(Hn,{style:{backgroundColor:"black"},children:[u.jsx(P4,{cues:r,theme:o,face:s,zoomPlan:a,sourceTextRegions:f,contentTimeline:p,framingTimeline:m,spans:t,sourceSize:g,contentCropMode:w,sourceFit:x,children:u.jsx(Hj,{src:S,spans:t,...b?{punch:b}:{},...x==="contain"?{punchInScale:1,background:"transparent"}:{},...y===!0?{punchInScale:1}:{}})}),u.jsx(xA,{cues:r,theme:o}),TA(h)?u.jsx(E4,{lines:n,cues:r,activeColor:o.accent,theme:o,ctaKeyword:l,ctaWindow:c,sourceTextRegions:f}):null,CA(k)?u.jsx(IA,{theme:o,frame:{width:i.width,height:i.height}}):null]})},jA=600,PA=()=>({doc:u$(),past:[],future:[],dirty:!1,savedAt:0,lastCoalesce:null}),qn=(e,t)=>e.scenes[t]??{props:{},elements:{}};function FA(e,t){var r;const n=(o,i)=>{const s=Date.now(),a=i!==void 0&&e.lastCoalesce!==null&&e.lastCoalesce.key===i&&s-e.lastCoalesce.at<jA;return{doc:o,past:a?e.past:[...e.past,e.doc],future:[],dirty:!0,savedAt:e.savedAt,lastCoalesce:i!==void 0?{key:i,at:s}:null}};switch(t.type){case"load":return{doc:t.doc,past:[],future:[],dirty:!1,savedAt:0,lastCoalesce:null};case"patchProps":{const o=qn(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...o,props:{...o.props,...t.patch}}}},t.coalesce)}case"patchElement":return n(ey(e.doc,t.sceneId,t.elementId,t.patch),t.coalesce);case"clearElement":return n(E$(e.doc,t.sceneId,t.elementId));case"hideElement":return n(ey(e.doc,t.sceneId,t.elementId,{hidden:!0}));case"restoreElement":{const o=(r=e.doc.scenes[t.sceneId])==null?void 0:r.elements[t.elementId];return o!=null&&o.hidden?n(C$(e.doc,t.sceneId,t.elementId)):e}case"patchTiming":{const o=qn(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...o,timing:{startSec:t.startSec,endSec:t.endSec}}}})}case"clearTiming":return n(I$(e.doc,t.sceneId));case"patchVideo":{const o=qn(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...o,video:{...o.video,...t.patch}}}},t.coalesce)}case"clearVideo":{const o=e.doc.scenes[t.sceneId];if(!(o!=null&&o.video))return e;const{video:i,...s}=o;return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:s}})}case"patchPip":{const o=qn(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...o,pip:{...o.pip,...t.patch}}}},t.coalesce)}case"clearPip":{const o=e.doc.scenes[t.sceneId];if(!(o!=null&&o.pip))return e;const{pip:i,...s}=o;return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:s}})}case"patchCaptionY":{const o=qn(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...o,captionY:t.y}}},t.coalesce)}case"patchCaptionScale":{const o=qn(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...o,captionScale:t.scale}}},t.coalesce)}case"clearCaptionStyle":{const o=e.doc.scenes[t.sceneId];if((o==null?void 0:o.captionY)===void 0&&(o==null?void 0:o.captionScale)===void 0)return e;const{captionY:i,captionScale:s,...a}=o;return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:a}})}case"patchCaptionStyleAll":{const o={...e.doc.scenes};for(const i of t.sceneIds){const s=o[i]??{props:{},elements:{}};o[i]={...s,...t.y!==void 0?{captionY:t.y}:{},...t.scale!==void 0?{captionScale:t.scale}:{}}}return n({...e.doc,scenes:o})}case"addSplit":return e.doc.splits.some(o=>Math.abs(o.at-t.t)<.001)?e:n({...e.doc,splits:[...e.doc.splits,{at:t.t,id:a$(t.t,e.doc.splits)}].sort((o,i)=>o.at-i.at)});case"setCaptionsHidden":{if(t.hidden===(e.doc.captionsHidden===!0))return e;if(t.hidden)return n({...e.doc,captionsHidden:!0});const{captionsHidden:o,...i}=e.doc;return n(i)}case"hideScene":{const o=qn(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...o,hidden:!0}}})}case"restoreScene":{const o=e.doc.scenes[t.sceneId];if(!(o!=null&&o.hidden))return e;const{hidden:i,...s}=o;return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:s}})}case"cutChunk":{const o=e.doc.cuts.filter(i=>i.src!==void 0||i.startSec!==t.startSec||i.endSec!==t.endSec);return n({...e.doc,cuts:[...o,{startSec:t.startSec,endSec:t.endSec}]})}case"restoreChunk":{if(t.index<0||t.index>=e.doc.cuts.length)return e;const o=e.doc.cuts.filter((i,s)=>s!==t.index);return n({...e.doc,cuts:o})}case"patchComponent":{const o=qn(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...o,component:t.component}}})}case"patchLayout":{const{graphicRect:o,...i}=qn(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...i,layout:t.layout}}})}case"patchGraphicRect":{const o=qn(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...o,graphicRect:t.rect}}},t.coalesce)}case"clearGraphicRect":return n(T$(e.doc,t.sceneId));case"patchCaption":{const o=kn(t.srcStart),i=qg(e.doc.captions,o,t.was);if(t.text===i){const{[o]:s,...a}=e.doc.captions;return n({...e.doc,captions:a})}return n({...e.doc,captions:{...e.doc.captions,[o]:{text:t.text,was:i}}})}case"patchCaptionRange":{const o=kn(t.fromSrcStart),i=kn(t.toSrcStart),s=t.text.trim();if(!s)return e;const a=Jg(e.doc.captionRangeEdits,o,i,t.was);if(s===a){const x=e.doc.captionRangeEdits.filter(k=>k.fromKey!==o||k.toKey!==i);return x.length===e.doc.captionRangeEdits.length?e:n({...e.doc,captionRangeEdits:x})}const l=Math.min(Math.round(t.fromSrcStart*1e3),Math.round(t.toSrcStart*1e3)),c=Math.max(Math.round(t.fromSrcStart*1e3),Math.round(t.toSrcStart*1e3)),f=x=>{if(Ys(x))return!1;const k=Number(x.slice(1));return k>=l&&k<=c},p=Object.fromEntries(Object.entries(e.doc.captions).filter(([x])=>!f(x))),m=Object.fromEntries(Object.entries(e.doc.captionWordsHidden).filter(([x])=>!f(x))),g=Object.fromEntries(Object.entries(e.doc.captionLineTiming).filter(([x])=>!f(x))),w=[...e.doc.captionRangeEdits.filter(x=>{const k=Math.min(Number(x.fromKey.slice(1)),Number(x.toKey.slice(1)));return Math.max(Number(x.fromKey.slice(1)),Number(x.toKey.slice(1)))<l||k>c}),{fromKey:o,toKey:i,text:s,was:a}];return n({...e.doc,captions:p,captionWordsHidden:m,captionLineTiming:g,captionRangeEdits:w})}case"patchCaptionAllOccurrences":{let o=e.doc.captions,i=!1;for(const s of t.entries){const a=kn(s.srcStart),l=qg(o,a,s.was);if(t.text===l){if(!(a in o))continue;const{[a]:f,...p}=o;o=p,i=!0;continue}const c=o[a];c!==void 0&&c.text===t.text&&c.was===l||(o={...o,[a]:{text:t.text,was:l}},i=!0)}return i?n({...e.doc,captions:o}):e}case"patchCaptionRangeAllOccurrences":{const o=t.text.trim();if(!o)return e;let i=e.doc,s=!1;for(const a of t.entries){const l=kn(a.fromSrcStart),c=kn(a.toSrcStart),f=Jg(i.captionRangeEdits,l,c,a.was);if(o===f){const w=i.captionRangeEdits.filter(x=>x.fromKey!==l||x.toKey!==c);if(w.length===i.captionRangeEdits.length)continue;i={...i,captionRangeEdits:w},s=!0;continue}const p=Math.min(Math.round(a.fromSrcStart*1e3),Math.round(a.toSrcStart*1e3)),m=Math.max(Math.round(a.fromSrcStart*1e3),Math.round(a.toSrcStart*1e3)),g=w=>{if(Ys(w))return!1;const x=Number(w.slice(1));return x>=p&&x<=m};i={...i,captions:Object.fromEntries(Object.entries(i.captions).filter(([w])=>!g(w))),captionWordsHidden:Object.fromEntries(Object.entries(i.captionWordsHidden).filter(([w])=>!g(w))),captionLineTiming:Object.fromEntries(Object.entries(i.captionLineTiming).filter(([w])=>!g(w))),captionRangeEdits:[...i.captionRangeEdits.filter(w=>{const x=Math.min(Number(w.fromKey.slice(1)),Number(w.toKey.slice(1)));return Math.max(Number(w.fromKey.slice(1)),Number(w.toKey.slice(1)))<p||x>m}),{fromKey:l,toKey:c,text:o,was:f}]},s=!0}return s?n(i):e}case"patchCaptionLineTiming":{let o=e.doc.captionLineTiming,i=!1;for(const s of t.entries){const a=kn(s.srcStart);if(Math.abs(s.lead)<.001&&Math.abs(s.tail)<.001){if(!(a in o))continue;const{[a]:c,...f}=o;o=f,i=!0;continue}const l=o[a];l!==void 0&&l.lead===s.lead&&l.tail===s.tail||(o={...o,[a]:{lead:s.lead,tail:s.tail}},i=!0)}return i?n({...e.doc,captionLineTiming:o}):e}case"hideCaptionWords":{const o={...e.doc.captionWordsHidden};let i=!1;for(const s of t.words){const a=kn(s.srcStart);a in o||(o[a]={was:s.was},i=!0)}return i?n({...e.doc,captionWordsHidden:o}):e}case"restoreCaptionWords":{const o={...e.doc.captionWordsHidden};let i=!1;for(const s of t.srcStarts){const a=kn(s);a in o&&(delete o[a],i=!0)}return i?n({...e.doc,captionWordsHidden:o}):e}case"cutWords":{const o={...e.doc.captionWordsHidden};for(const s of t.words){const a=kn(s.srcStart);a in o||(o[a]={was:s.was})}const i=e.doc.cuts.filter(s=>s.src!==void 0||s.startSec!==t.startSec||s.endSec!==t.endSec);return n({...e.doc,captionWordsHidden:o,cuts:[...i,{startSec:t.startSec,endSec:t.endSec}]})}case"setReasonEnabled":{const{reasons:o}=e.doc.cleanup;if(t.enabled){if(!(t.reason in o))return e;const{[t.reason]:i,...s}=o;return n({...e.doc,cleanup:{...e.doc.cleanup,reasons:s}})}return o[t.reason]===!1?e:n({...e.doc,cleanup:{...e.doc.cleanup,reasons:{...o,[t.reason]:!1}}})}case"toggleKept":{if(!(t.srcOut>t.srcIn))return e;const{kept:o}=e.doc.cleanup,i=o.filter(a=>!(a.srcIn<t.srcOut&&a.srcOut>t.srcIn)),s=i.length<o.length?{...e.doc.cleanup,kept:i}:{...e.doc.cleanup,kept:[...o,{srcIn:t.srcIn,srcOut:t.srcOut}]};return n({...e.doc,cleanup:s})}case"patchTheme":return n({...e.doc,theme:{...e.doc.theme,...t.patch}});case"undo":{if(e.past.length===0)return e;const o=e.past[e.past.length-1],i=e.past.slice(0,-1);return{doc:o,past:i,future:[...e.future,e.doc],savedAt:e.savedAt,dirty:i.length!==e.savedAt,lastCoalesce:null}}case"redo":{if(e.future.length===0)return e;const o=e.future[e.future.length-1],i=[...e.past,e.doc];return{doc:o,past:i,future:e.future.slice(0,-1),savedAt:e.savedAt,dirty:i.length!==e.savedAt,lastCoalesce:null}}case"saved":return{...e,dirty:!1,savedAt:e.past.length}}}function _A(){const[e,t]=d.useReducer(FA,void 0,PA),n=d.useRef([]),r=async()=>{const o=p$(e.doc,n.current),i=await fetch("/api/overrides",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify(o)});if(!i.ok){const s=await i.json().catch(()=>({}));throw new Error(s.error??"save failed")}t({type:"saved"})};return{doc:e.doc,dirty:e.dirty,canUndo:e.past.length>0,canRedo:e.future.length>0,load:o=>t({type:"load",doc:o}),undo:()=>t({type:"undo"}),redo:()=>t({type:"redo"}),save:r,syncCues:o=>{n.current=o},patchProps:(o,i,s)=>t({type:"patchProps",sceneId:o,patch:i,coalesce:s}),patchElement:(o,i,s,a)=>t({type:"patchElement",sceneId:o,elementId:i,patch:s,coalesce:a}),clearElement:(o,i)=>t({type:"clearElement",sceneId:o,elementId:i}),hideElement:(o,i)=>t({type:"hideElement",sceneId:o,elementId:i}),restoreElement:(o,i)=>t({type:"restoreElement",sceneId:o,elementId:i}),patchTiming:(o,i,s)=>t({type:"patchTiming",sceneId:o,startSec:i,endSec:s}),clearTiming:o=>t({type:"clearTiming",sceneId:o}),patchVideo:(o,i,s)=>t({type:"patchVideo",sceneId:o,patch:i,coalesce:s}),clearVideo:o=>t({type:"clearVideo",sceneId:o}),patchPip:(o,i,s)=>t({type:"patchPip",sceneId:o,patch:i,coalesce:s}),clearPip:o=>t({type:"clearPip",sceneId:o}),patchCaptionY:(o,i,s)=>t({type:"patchCaptionY",sceneId:o,y:i,coalesce:s}),patchCaptionScale:(o,i,s)=>t({type:"patchCaptionScale",sceneId:o,scale:i,coalesce:s}),clearCaptionStyle:o=>t({type:"clearCaptionStyle",sceneId:o}),patchCaptionStyleAll:(o,i)=>t({type:"patchCaptionStyleAll",sceneIds:o,...i}),addSplit:o=>t({type:"addSplit",t:o}),setCaptionsHidden:o=>t({type:"setCaptionsHidden",hidden:o}),hideScene:o=>t({type:"hideScene",sceneId:o}),restoreScene:o=>t({type:"restoreScene",sceneId:o}),cutChunk:(o,i)=>t({type:"cutChunk",startSec:o,endSec:i}),restoreChunk:o=>t({type:"restoreChunk",index:o}),patchGraphicRect:(o,i,s)=>t({type:"patchGraphicRect",sceneId:o,rect:i,coalesce:s}),clearGraphicRect:o=>t({type:"clearGraphicRect",sceneId:o}),patchComponent:(o,i)=>t({type:"patchComponent",sceneId:o,component:i}),patchLayout:(o,i)=>t({type:"patchLayout",sceneId:o,layout:i}),patchCaption:(o,i,s)=>t({type:"patchCaption",srcStart:o,text:i,was:s}),patchCaptionRange:(o,i,s,a)=>t({type:"patchCaptionRange",fromSrcStart:o,toSrcStart:i,text:s,was:a}),patchCaptionAllOccurrences:(o,i)=>t({type:"patchCaptionAllOccurrences",entries:o,text:i}),patchCaptionRangeAllOccurrences:(o,i)=>t({type:"patchCaptionRangeAllOccurrences",entries:o,text:i}),patchCaptionLineTiming:o=>t({type:"patchCaptionLineTiming",entries:o}),hideCaptionWords:o=>t({type:"hideCaptionWords",words:o}),restoreCaptionWords:o=>t({type:"restoreCaptionWords",srcStarts:o}),cutWords:(o,i,s)=>t({type:"cutWords",words:o,startSec:i,endSec:s}),setReasonEnabled:(o,i)=>t({type:"setReasonEnabled",reason:o,enabled:i}),toggleKept:(o,i)=>t({type:"toggleKept",srcIn:o,srcOut:i}),patchTheme:o=>t({type:"patchTheme",patch:o})}}function fy(e){const t=e==null?void 0:e.closest("[data-edit-id]");if(!t)return null;const n=t.closest("[data-edit-scene]");return n?{sceneId:n.dataset.editScene,elementId:t.dataset.editId}:null}function py(e){const t=e==null?void 0:e.closest("[data-edit-video]");return(t==null?void 0:t.dataset.editVideo)||null}function hy(e,t,n){const r=e.querySelectorAll(`[data-edit-scene="${t}"] [data-edit-id="${n}"]`);if(r.length===0)return null;let o=1/0,i=1/0,s=-1/0,a=-1/0;return r.forEach(l=>{const c=l.getBoundingClientRect();o=Math.min(o,c.left),i=Math.min(i,c.top),s=Math.max(s,c.right),a=Math.max(a,c.bottom)}),new DOMRect(o,i,s-o,a-i)}const my=.015,MA=1e-9;function Ho(e,t){let n=null,r=1/0;for(const o of e){const i=Math.abs(o.feature-o.target);i<=t+MA&&i<r&&(n=o,r=i)}return n}function gy(e,t,n,r){const o={...e},i=[];if(t==="move"){const s=e.x+e.w/2,a=e.x+e.w,l=.5-e.w/2,c=l>=n.left&&l+e.w<=1-n.right,f=Ho([...c?[{target:.5,feature:s}]:[],{target:n.left,feature:e.x},{target:1-n.right,feature:a}],r);f&&(o.x=e.x+(f.target-f.feature),i.push({axis:"x",at:f.target}));const p=e.y+e.h/2,m=e.y+e.h,g=.5-e.h/2,w=g>=n.top&&g+e.h<=1-n.bottom,x=Ho([...w?[{target:.5,feature:p}]:[],{target:n.top,feature:e.y},{target:1-n.bottom,feature:m}],r);return x&&(o.y=e.y+(x.target-x.feature),i.push({axis:"y",at:x.target})),{rect:o,guides:i}}if(t.includes("w")){const s=Ho([{target:n.left,feature:e.x}],r);if(s){const a=e.x+e.w;o.x=s.target,o.w=a-s.target,i.push({axis:"x",at:s.target})}}else if(t.includes("e")){const s=1-n.right,a=Ho([{target:s,feature:e.x+e.w}],r);a&&(o.w=a.target-e.x,i.push({axis:"x",at:a.target}))}if(t.includes("n")){const s=Ho([{target:n.top,feature:e.y}],r);if(s){const a=e.y+e.h;o.y=s.target,o.h=a-s.target,i.push({axis:"y",at:s.target})}}else if(t.includes("s")){const s=1-n.bottom,a=Ho([{target:s,feature:e.y+e.h}],r);a&&(o.h=a.target-e.y,i.push({axis:"y",at:a.target}))}return{rect:o,guides:i}}function $A(e){const t=e.spans;if(t===void 0)return{};let n;try{n=Qu(t).spans.length}catch{return{}}if(n===0)return{};const r={};return e.captionLines&&(r.captionLines=ty(e.captionLines,t)),e.baseCaptionLines&&(r.baseCaptionLines=ty(e.baseCaptionLines,t)),r}function yy(e,t){const n=t.baseCaptionLines??t.captionLines??[],r=g$(e.captions,n);return{doc:{...e,captions:y$(e.captions,r)},unresolved:r.unresolved}}function AA(e){const t={};for(const[n,r]of Object.entries(e))Ys(n)||(t[n]=r);return t}function NA(e,t){const n=i=>JSON.stringify([i.text,i.was]),r=new Map;for(const i of Object.values(t))r.set(n(i),(r.get(n(i))??0)+1);const o=[];for(const i of Object.values(e)){const s=r.get(n(i))??0;s>0?r.set(n(i),s-1):o.push(i)}return o}function LA(e){return e.map(t=>`“${t.was}” was retyped as “${t.text}”, and the overrides this render wrote back no longer have it. Retype it if you still want it.`)}function Ab(e){return e.map(t=>{const n=`“${t.was}” was retyped in an older version of this project`;switch(t.reason){case"out-of-range":return`${n}, and the word is still here but too far from where the edit was stored to be sure it is the same one — it was left alone. It is still saved. Retype it here if that is the word you meant.`;case"ambiguous":return`${n}, and more than one word here says it — it was left alone rather than applied to the wrong one. Retype the one you meant.`;case"unanchorable":return`${n}, but this project's files carry no source timing for that word, so nothing can be anchored to it. Re-run produce, then retype it.`;case"collision":return`${n} twice, and both point at the same word — neither was applied. Retype the one you meant.`;case"superseded":return`${n} and again since; the newer edit was kept and the older one dropped.`;default:return`${n}, and no word here says it any more — the cut probably removed it. Retype it if you still want it.`}})}function zA(e){return e.map(t=>t.reason==="duplicate-anchor"?`“${t.expected}” shares its moment with another word — only the first was retyped.`:t.found===null?`“${t.expected}” was retyped, but no word in this cut sits at that moment any more.`:`“${t.expected}” was retyped, but the transcript says “${t.found}” there now.`)}function DA(e){return e.map(t=>t.reason==="duplicate-anchor"?`“${t.expected}” shares its moment with another word — only the first was hidden from the captions.`:t.found===null?`“${t.expected}” was hidden from the captions, but no word in this cut sits at that moment any more — the hidden word no longer exists.`:`“${t.expected}” was hidden from the captions, but the transcript says “${t.found}” there now — it was left visible rather than hiding a different word.`)}function OA(e){return e.map(t=>t.reason==="duplicate-anchor"?`“${t.expected}” was rewritten, but an earlier rewrite already claimed the word it starts on — only the first applied.`:t.found===null?`“${t.expected}” was rewritten, but its words no longer sit at those source moments — re-select and Edit if you still want it.`:`“${t.expected}” was rewritten, but the transcript says “${t.found}” there now — the whole rewrite was left unapplied rather than guessing at part of it.`)}function BA(e){return e.map(t=>t.reason==="duplicate-anchor"?`A re-timed caption (${t.key}) starts on the same moment as another — only the first was re-timed.`:`A re-timed caption (${t.key}) no longer exists — the cut removed it, so its timing nudge was dropped.`)}function WA(e){if(e===void 0||e.trim()==="")return null;const t=Number(e);return Ze({srcStart:t})===null?null:t}function VA(e,t){var i;if(!e)return null;const n=[];if(e.kind!=="plain"&&((i=t.scenes[e.id])==null?void 0:i.hidden)!==!0&&n.push("graphic"),t.cuts.some(s=>s.src===void 0&&s.startSec===e.startSec&&s.endSec===e.endSec)||n.push("take"),n.length===0)return null;const o=ab(e.id);return{sceneId:e.id,rootId:o,isSplitHalf:o!==e.id,startSec:e.startSec,endSec:e.endSec,targets:n}}function vy(e,t,n,r){const o={...e};return t==="move"?(o.x+=n,o.y+=r,o):(t.includes("w")&&(o.x+=n,o.w-=n),t.includes("e")&&(o.w+=n),t.includes("n")&&(o.y+=r,o.h-=r),t.includes("s")&&(o.h+=r),o)}const wy=64,Ya=9,Ga=e=>Math.round(e*10)/10,Uo=e=>Math.round(e*1e4)/1e4,Nb={position:"absolute",width:10,height:10,background:"#5b8cff",border:"1px solid #0B0B0E",borderRadius:2,pointerEvents:"auto",zIndex:6},xy={nw:{left:0,top:0,transform:"translate(-50%,-50%)",cursor:"nwse-resize"},n:{left:"50%",top:0,transform:"translate(-50%,-50%)",cursor:"ns-resize"},ne:{right:0,top:0,transform:"translate(50%,-50%)",cursor:"nesw-resize"},e:{right:0,top:"50%",transform:"translate(50%,-50%)",cursor:"ew-resize"},se:{right:0,bottom:0,transform:"translate(50%,50%)",cursor:"nwse-resize"},s:{left:"50%",bottom:0,transform:"translate(-50%,50%)",cursor:"ns-resize"},sw:{left:0,bottom:0,transform:"translate(-50%,50%)",cursor:"nesw-resize"},w:{left:0,top:"50%",transform:"translate(-50%,-50%)",cursor:"ew-resize"}},HA={...Nb,background:"#ffe14d"},UA={top:{top:0,left:14,right:14,height:10},bottom:{bottom:0,left:14,right:14,height:10},left:{left:0,top:14,bottom:14,width:10},right:{right:0,top:14,bottom:14,width:10}},ZA={position:"absolute",cursor:"move",pointerEvents:"auto",zIndex:5},Lb=/^(line|node|message|window|item)-(\d+)$/;function KA(e,t,n){const r=Lb.exec(e);if(!r)return null;const o=r[1],i=Number(r[2]);if(o==="message"&&i===0&&typeof t.keyword=="string"&&t.keyword){const f=n.trim().replace(/^"(.*)"$/,"$1").toLowerCase();return f?{keyword:f}:null}const s=o==="line"?"lines":o==="node"?"nodes":o==="item"?"items":o==="window"?"windows":"messages",a=t[s];if(!Array.isArray(a)||i<0||i>=a.length)return null;const l=a.slice(),c=l[i];if(o==="node"||o==="item")l[i]=n;else if(o==="window"){if(typeof c!="object"||c===null)return null;const f=n.split(`
162
+ `).slice(0,6).map(p=>p.slice(0,40));l[i]={...c,lines:f}}else{if(typeof c!="object"||c===null)return null;l[i]={...c,text:n}}return{[s]:l}}function YA(e,t){const n=Lb.exec(e);if(!n){const c=t[e];return typeof c=="string"?c:null}const r=n[1],o=Number(n[2]);if(r==="message"&&o===0&&typeof t.keyword=="string"&&t.keyword)return t.keyword;const s=t[r==="line"?"lines":r==="node"?"nodes":r==="item"?"items":r==="window"?"windows":"messages"];if(!Array.isArray(s)||o<0||o>=s.length)return null;const a=s[o];if(r==="node"||r==="item")return typeof a=="string"?a:null;if(r==="window"){const c=a==null?void 0:a.lines;return Array.isArray(c)&&c.every(f=>typeof f=="string")?c.join(`
163
+ `):null}const l=a==null?void 0:a.text;return typeof l=="string"?l:null}function zb(){const e=document.activeElement;(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&e.blur()}const GA=({stageRef:e,selection:t,onSelect:n,edits:r,onSave:o,settings:i,playerRef:s,onTransport:a,onVideoPreview:l,onGraphicPreview:c,cue:f,cues:p,onToggleHelp:m,onRequestDelete:g,fromLive:w=h=>h,hasOldClockPreimage:x=()=>!0,onClockRefused:k=()=>{}})=>{const[h,y]=d.useState(null),v=d.useRef(null),S=d.useRef(0),b=d.useRef(null),E=d.useRef(0),I=d.useRef(null),T=d.useRef(0),j=d.useRef(null),[_,N]=d.useState(!1),[W,M]=d.useState([]),$=d.useRef(null),[V,L]=d.useState(null),[A,R]=d.useState(null),C=d.useRef(null),[P,z]=d.useState({dx:0,dy:0}),O=d.useRef(null),D=d.useRef(t),Z=d.useCallback(B=>{D.current=B,n(B)},[n]);d.useEffect(()=>{D.current=t},[t]);const H=(B,X)=>{const ae=[];let oe=null;for(let Y=0;Y<25;Y++){const q=document.elementFromPoint(B,X);if(!q||q===document.documentElement||q===document.body){oe=q;break}if(oe=q,q.hasAttribute("data-edit-id")||q.hasAttribute("data-edit-scene")||q.hasAttribute("data-caption-word")||q.closest("[data-edit-video]")!==null||["BUTTON","INPUT","SELECT","TEXTAREA"].includes(q.tagName)||!(q instanceof HTMLElement))break;ae.push({el:q,prev:q.style.pointerEvents}),q.style.pointerEvents="none"}return ae.forEach(({el:Y,prev:q})=>{Y.style.pointerEvents=q}),oe},G=d.useCallback(()=>{var q,xe;const B=e.current,X=(q=s.current)==null?void 0:q.getScale(),ae=((xe=B==null?void 0:B.querySelector(".__remotion-player"))==null?void 0:xe.getBoundingClientRect())??(B==null?void 0:B.getBoundingClientRect());if(!ae||!X||X<=0)return null;const oe=i.width*X,Y=i.height*X;return{left:ae.left+(ae.width-oe)/2,top:ae.top+(ae.height-Y)/2,w:oe,h:Y}},[e,s,i]);return d.useEffect(()=>{if(!t){y(null);return}let B;const X=()=>{var oe;const ae=e.current;if(ae){const Y=t.elementId?hy(ae,t.sceneId,t.elementId):((oe=ae.querySelector(`[data-edit-scene="${t.sceneId}"]`))==null?void 0:oe.getBoundingClientRect())??null;y(Y)}B=requestAnimationFrame(X)};return B=requestAnimationFrame(X),()=>cancelAnimationFrame(B)},[e,t]),d.useEffect(()=>{const B=X=>{var Y,q;const ae=e.current;if(!ae||!ae.contains(X.target)||X.altKey||X.button!==0)return;(((Y=D.current)==null?void 0:Y.elementId)&&((q=O.current)==null?void 0:q.contains(X.target))||fy(H(X.clientX,X.clientY))!==null)&&X.stopPropagation()};return window.addEventListener("pointerdown",B,!0),()=>window.removeEventListener("pointerdown",B,!0)},[e]),d.useEffect(()=>{const B=X=>{var ee,ue,se,Re,Ie,De,Qe;const ae=e.current;if(!ae||!ae.contains(X.target))return;const oe=document.activeElement;if((oe instanceof HTMLInputElement||oe instanceof HTMLTextAreaElement)&&oe.contains(X.target)||(zb(),X.altKey||X.button!==0))return;const Y=X.target instanceof Element?X.target.closest("[data-el-handle]"):null,q=D.current;if(Y&&(q!=null&&q.elementId)){const ke=hy(ae,q.sceneId,q.elementId);if(ke){const Ee=ke.left+ke.width/2,je=ke.top+ke.height/2,Me=Math.hypot(X.clientX-Ee,X.clientY-je);if(Me>2){const Le=((ue=(ee=r.doc.scenes[q.sceneId])==null?void 0:ee.elements[q.elementId])==null?void 0:ue.scale)??1;$.current={sceneId:q.sceneId,elementId:q.elementId,cx:Ee,cy:je,startDist:Me,prior:Le,factor:1},L(1)}}return}if((se=D.current)!=null&&se.elementId&&((Re=O.current)!=null&&Re.contains(X.target))){C.current={x:X.clientX,y:X.clientY,dx:0,dy:0},z({dx:0,dy:0});return}const xe=X.target instanceof Element?X.target.closest("[data-box-handle]"):null,Se=D.current;if(xe&&Se&&!Se.elementId){const ke=ae.querySelector(`[data-edit-scene="${Se.sceneId}"]`),Ee=G();if(ke&&Ee){const je=ke.getBoundingClientRect();j.current=null,I.current={sceneId:Se.sceneId,handle:xe.dataset.boxHandle,x:X.clientX,y:X.clientY,dx:0,dy:0,start:{x:(je.left-Ee.left)/Ee.w,y:(je.top-Ee.top)/Ee.h,w:je.width/Ee.w,h:je.height/Ee.h}},N(!0)}return}const de=H(X.clientX,X.clientY),K=fy(de);if(!K){const ke=de==null?void 0:de.closest("[data-edit-scene]");if(ke){Z({sceneId:ke.dataset.editScene,elementId:null});return}const Ee=py(de),je=ae.getBoundingClientRect().bottom;if(Ee&&X.clientY<je-wy){Z({sceneId:Ee,elementId:null});const Me=p.find(dt=>dt.id===Ee);if((Me==null?void 0:Me.layout)==="pip-bubble"&&!X.altKey){const dt=To("pip-bubble",void 0,[],i).video.rect;b.current={sceneId:Ee,x:X.clientX,y:X.clientY,base:{x:((Ie=Me.pip)==null?void 0:Ie.x)??dt.x,y:((De=Me.pip)==null?void 0:De.y)??dt.y},slot:{w:dt.w,h:dt.h}};return}const Le=(Qe=r.doc.scenes[Ee])==null?void 0:Qe.video;v.current={sceneId:Ee,x:X.clientX,y:X.clientY,dx:0,dy:0,baseDx:(Le==null?void 0:Le.dx)??0,baseDy:(Le==null?void 0:Le.dy)??0};return}Z(null);return}Z({sceneId:K.sceneId,elementId:K.elementId}),C.current={x:X.clientX,y:X.clientY,dx:0,dy:0},z({dx:0,dy:0})};return window.addEventListener("mousedown",B),()=>window.removeEventListener("mousedown",B)},[e,Z,r,G,p,i]),d.useEffect(()=>{const B=()=>{var q,xe;const oe=(q=s.current)==null?void 0:q.getScale(),Y=(xe=e.current)==null?void 0:xe.getBoundingClientRect();return oe&&oe>0?1/oe:Y&&Y.width>0?i.width/Y.width:1},X=oe=>{const Y=e.current;if(Y&&!(I.current||$.current))if(b.current)Y.style.cursor="move";else if(v.current)Y.style.cursor="grabbing";else{const ee=oe.target instanceof Element?oe.target:null,ue=ee!==null&&Y.contains(ee)&&!ee.closest("button, input, select, textarea, [data-edit-id], [data-edit-scene], [data-caption-word]")&&oe.clientY<Y.getBoundingClientRect().bottom-wy,se=ue&&(()=>{var Ie;const Re=py(ee);return Re!==null&&((Ie=p.find(De=>De.id===Re))==null?void 0:Ie.layout)==="pip-bubble"})();Y.style.cursor=ue?se?"move":"grab":""}const q=$.current;if(q){const ue=Math.hypot(oe.clientX-q.cx,oe.clientY-q.cy)/q.startDist;q.factor=Math.min(4/q.prior,Math.max(.05/q.prior,ue)),L(q.factor);return}const xe=I.current;if(xe){xe.dx=oe.clientX-xe.x,xe.dy=oe.clientY-xe.y,j.current=oe.altKey,T.current||(T.current=requestAnimationFrame(()=>{T.current=0;const ee=I.current,ue=G();if(!ee||!ue)return;const se=nu(vy(ee.start,ee.handle,ee.dx/ue.w,ee.dy/ue.h),i);if(oe.altKey)M([]),c({sceneId:ee.sceneId,rect:se});else{const Re=gy(se,ee.handle,Qn(i),my);M(Re.guides),c({sceneId:ee.sceneId,rect:Re.rect})}}));return}if(b.current){E.current||(E.current=requestAnimationFrame(()=>{E.current=0;const ee=b.current,ue=G();if(!ee||!ue)return;const se=(oe.clientX-ee.x)/ue.w,Re=(oe.clientY-ee.y)/ue.h;r.patchPip(ee.sceneId,{x:Uo(Math.min(Math.max(ee.base.x+se,0),1-ee.slot.w)),y:Uo(Math.min(Math.max(ee.base.y+Re,0),1-ee.slot.h))},`pip:${ee.sceneId}:drag`)}));return}const de=v.current;if(de){de.dx=oe.clientX-de.x,de.dy=oe.clientY-de.y,S.current||(S.current=requestAnimationFrame(()=>{S.current=0;const ee=v.current;if(!ee)return;const ue=B();l({sceneId:ee.sceneId,patch:{dx:ee.baseDx+ee.dx*ue,dy:ee.baseDy+ee.dy*ue}})}));return}const K=C.current;K&&(K.dx=oe.clientX-K.x,K.dy=oe.clientY-K.y,z({dx:K.dx,dy:K.dy}))},ae=oe=>{const Y=$.current;if(Y){$.current=null,L(null),Math.abs(Y.factor-1)>.001&&r.patchElement(Y.sceneId,Y.elementId,{scale:Math.round(Y.prior*Y.factor*1e3)/1e3});return}const q=I.current;if(q){if(I.current=null,N(!1),M([]),T.current&&(cancelAnimationFrame(T.current),T.current=0),q.dx!==0||q.dy!==0){const ee=G();if(ee){let ue=nu(vy(q.start,q.handle,q.dx/ee.w,q.dy/ee.h),i);(j.current??oe.altKey)||(ue=gy(ue,q.handle,Qn(i),my).rect),r.patchGraphicRect(q.sceneId,{x:Uo(ue.x),y:Uo(ue.y),w:Uo(ue.w),h:Uo(ue.h)})}}j.current=null,c(null);return}if(b.current){b.current=null,E.current&&(cancelAnimationFrame(E.current),E.current=0);return}const Se=v.current;if(Se){if(v.current=null,S.current&&(cancelAnimationFrame(S.current),S.current=0),Se.dx!==0||Se.dy!==0){const ee=B();r.patchVideo(Se.sceneId,{dx:Ga(Se.baseDx+Se.dx*ee),dy:Ga(Se.baseDy+Se.dy*ee)})}l(null);return}const de=C.current,K=D.current;if(!de||!(K!=null&&K.elementId)){C.current=null;return}if(de.dx!==0||de.dy!==0){const ee=B(),ue=r.doc.scenes[K.sceneId],se=ue==null?void 0:ue.elements[K.elementId];r.patchElement(K.sceneId,K.elementId,{dx:Ga(((se==null?void 0:se.dx)??0)+de.dx*ee),dy:Ga(((se==null?void 0:se.dy)??0)+de.dy*ee)})}C.current=null,z({dx:0,dy:0})};return window.addEventListener("mousemove",X),window.addEventListener("mouseup",ae),()=>{window.removeEventListener("mousemove",X),window.removeEventListener("mouseup",ae)}},[r,e,i,s,l,c,G,p]),d.useEffect(()=>{const B=X=>{var xe;const ae=e.current;if(!ae||!ae.contains(X.target))return;const oe=(xe=H(X.clientX,X.clientY))==null?void 0:xe.closest("[data-caption-word]");if(!oe)return;X.preventDefault();const Y=WA(oe.dataset.captionSrc),q=oe.dataset.captionText??"";Y===null||!q||R({srcStart:Y,was:q,draft:q,rect:oe.getBoundingClientRect()})};return window.addEventListener("dblclick",B),()=>window.removeEventListener("dblclick",B)},[e]),d.useEffect(()=>{const B=()=>{const Y=document.activeElement;return Y instanceof HTMLInputElement||Y instanceof HTMLTextAreaElement||Y instanceof HTMLSelectElement||Y instanceof HTMLElement&&Y.isContentEditable},X=()=>{const Y=document.activeElement;return Y instanceof HTMLTextAreaElement||Y instanceof HTMLElement&&Y.isContentEditable?!0:Y instanceof HTMLInputElement&&!["range","checkbox","radio","button"].includes(Y.type)},ae=()=>{const Y=document.activeElement;Y instanceof HTMLElement&&!X()&&Y.blur()},oe=Y=>{var xe,Se,de;if(A!==null)return;const q=Y.metaKey||Y.ctrlKey;if(Y.key==="Escape"){if(B()){(xe=document.activeElement)==null||xe.blur();return}Z(null)}else if(q&&Y.key.toLowerCase()==="z")Y.preventDefault(),Y.shiftKey?r.redo():r.undo();else if(q&&Y.key.toLowerCase()==="y")Y.preventDefault(),r.redo();else if(q&&Y.key.toLowerCase()==="s")Y.preventDefault(),o();else if(Y.key===" "&&!q){if(X())return;const K=document.activeElement;if(K instanceof HTMLElement&&K.tagName==="BUTTON"&&((Se=e.current)!=null&&Se.contains(K)))return;ae(),Y.preventDefault(),(de=s.current)==null||de.toggle()}else if(!q&&["j","k","l"].includes(Y.key.toLowerCase())){if(X())return;ae(),Y.preventDefault(),a(Y.key.toUpperCase())}else if(!q&&!Y.altKey&&(Y.key==="ArrowLeft"||Y.key==="ArrowRight")){if(B())return;Y.preventDefault();const K=s.current;if(!K)return;K.seekTo(Math.max(0,K.getCurrentFrame()+(Y.key==="ArrowRight"?1:-1)))}else if(q&&Y.key.toLowerCase()==="b"){if(X())return;Y.preventDefault();const K=s.current;if(!K)return;const ee=K.getCurrentFrame()/i.fps;if(!p.find(se=>ee>=se.startSec+eu&&ee<=se.endSec-eu))return;if(!x(ee)){k("Can't split here: this moment isn't in the last render yet — render once (or re-remove the pause) to split here.");return}r.addSplit(Math.round(w(ee)*1e3)/1e3)}else if(!q&&Y.altKey&&(Y.key==="ArrowLeft"||Y.key==="ArrowRight")){if(X())return;const K=D.current,ee=K?(()=>{const ue=p.findIndex(se=>se.id===K.sceneId);return ue===-1?void 0:p[ue+(Y.key==="ArrowRight"?1:-1)]})():p[Y.key==="ArrowRight"?0:p.length-1];if(!ee)return;Y.preventDefault(),Z({sceneId:ee.id,elementId:null})}else if(q&&(Y.key==="ArrowLeft"||Y.key==="ArrowRight")){if(X())return;Y.preventDefault();const K=s.current;if(!K)return;const ee=K.getCurrentFrame()/i.fps,ue=p.findIndex(Re=>ee>=Re.startSec&&ee<Re.endSec),se=p[(ue===-1?0:ue)+(Y.key==="ArrowRight"?1:-1)];if(!se)return;K.seekTo(Math.round(se.startSec*i.fps)),Z({sceneId:se.id,elementId:null})}else if(!q&&!Y.altKey&&Y.key==="?"){if(B())return;Y.preventDefault(),m()}else if(!q&&(Y.key==="Delete"||Y.key==="Backspace")){if(B())return;const K=D.current;if(!K||K.elementId!==null||!f||f.id!==K.sceneId)return;const ee=VA(f,r.doc);if(!ee)return;Y.preventDefault(),g(ee)}};return window.addEventListener("keydown",oe),()=>window.removeEventListener("keydown",oe)},[Z,r,A,o,s,e,a,f,p,i,m,g,w,x,k]),u.jsxs("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},children:[P.dx!==0||P.dy!==0||_?u.jsx("div",{"data-testid":"safe-area-guide",style:{position:"absolute",left:`${Qn(i).left*100}%`,top:`${Qn(i).top*100}%`,right:`${Qn(i).right*100}%`,bottom:`${Qn(i).bottom*100}%`,border:"1px dashed rgba(255, 225, 77, 0.45)",boxShadow:"0 0 0 9999px rgba(0, 0, 0, 0.18)",pointerEvents:"none"}}):null,W.map(B=>u.jsx("div",{"data-testid":`guide-${B.axis}`,style:{position:"absolute",pointerEvents:"none",background:"#FFE14D",...B.axis==="x"?{left:`${B.at*100}%`,top:0,bottom:0,width:1}:{top:`${B.at*100}%`,left:0,right:0,height:1}}},B.axis)),h&&t?u.jsxs("div",{ref:O,"data-testid":"overlay-box",style:{position:"fixed",pointerEvents:"auto",left:h.left+P.dx-Ya/2+h.width*(1-(V??1))/2,top:h.top+P.dy-Ya/2+h.height*(1-(V??1))/2,width:h.width*(V??1)+Ya,height:h.height*(V??1)+Ya,border:t.elementId?"2px dashed #ffe14d":"2px dashed #5b8cff",borderRadius:4,boxShadow:"0 0 0 1px rgba(0,0,0,0.35)",cursor:t.elementId?"grab":"default"},children:[t.elementId?u.jsx("div",{style:{position:"absolute",bottom:"100%",left:0,marginBottom:4,fontSize:10,fontFamily:"ui-monospace, 'SF Mono', monospace",letterSpacing:"0.04em",textTransform:"uppercase",color:"#0B0B0E",background:"#ffe14d",padding:"2px 6px",borderRadius:3,whiteSpace:"nowrap"},children:t.elementId}):null,t.elementId?["nw","ne","se","sw"].map(B=>u.jsx("div",{"data-el-handle":B,"data-testid":`el-handle-${B}`,style:{...HA,...xy[B]}},B)):null,!t.elementId&&f&&f.kind!=="plain"?u.jsxs(u.Fragment,{children:[["top","bottom","left","right"].map(B=>u.jsx("div",{"data-box-handle":"move","data-testid":B==="top"?"box-handle-move":`box-handle-move-${B}`,style:{...ZA,...UA[B]}},B)),["nw","n","ne","e","se","s","sw","w"].map(B=>u.jsx("div",{"data-box-handle":B,"data-testid":`box-handle-${B}`,style:{...Nb,...xy[B]}},B))]}):null]}):null,A?u.jsx("input",{autoFocus:!0,"data-testid":"caption-edit",value:A.draft,onChange:B=>R({...A,draft:B.target.value}),onBlur:()=>{const B=A.draft.trim();B&&r.patchCaption(A.srcStart,B,A.was),R(null)},onKeyDown:B=>{B.key==="Enter"&&B.target.blur(),B.key==="Escape"&&R(null)},style:{position:"fixed",pointerEvents:"auto",left:A.rect.left-4,top:A.rect.top-4,width:Math.max(A.rect.width+40,90),height:A.rect.height+8,fontSize:Math.max(13,Math.min(A.rect.height*.7,28)),fontFamily:"'Inter', system-ui, sans-serif",fontWeight:800,border:"2px solid #FFE14D",borderRadius:4,padding:"0 4px",background:"#0B0B0E",color:"#fff",outline:"none",zIndex:11}}):null]})},ln={display:"flex",flexDirection:"column",gap:6},as={display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},We={fontSize:11,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"#9A9AA3"},di={fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",fontSize:13,background:"#0F0F14",border:"1px solid #2A2A33",borderRadius:6,color:"#fff",padding:"6px 8px",width:"100%"},Ff={...di,fontFamily:"'Inter', system-ui, sans-serif"},ot={display:"flex",flexDirection:"column",gap:14,padding:"16px 18px",borderBottom:"1px solid #22222a"},sn={fontSize:12,fontWeight:600,color:"#FF5C5C",background:"transparent",border:"1px solid #452626",borderRadius:6,padding:"7px 10px",cursor:"pointer"},an=()=>{var e,t;(t=(e=document.activeElement)==null?void 0:e.blur)==null||t.call(e)},XA=e=>String(Math.round(e*1e3)/1e3),Xt=({id:e,value:t,onCommit:n,min:r,max:o,dragStep:i})=>{const[s,a]=le.useState(null),[l,c]=le.useState(!1),f=le.useRef(null),p=le.useRef(null),m=r??-1/0,g=o??1/0,w=i??(r!==void 0&&o!==void 0?(o-r)/240:.5),x=s!==null;return u.jsxs("div",{style:ln,children:[u.jsx("span",{style:We,children:e}),u.jsx("input",{type:"text",inputMode:"decimal",ref:f,"data-testid":`field-${e}`,style:{...di,...x?{}:{cursor:"ew-resize",touchAction:"none"},...l?{borderColor:"#FFE14D",color:"#FFE14D"}:{}},value:s??(Number.isFinite(t)?XA(t):"0"),onFocus:k=>a(k.target.value),onBlur:()=>a(null),onPointerDown:k=>{x||(k.preventDefault(),p.current={x:k.clientX,v:Number.isFinite(t)?t:0,moved:!1},k.currentTarget.setPointerCapture(k.pointerId),c(!0))},onPointerMove:k=>{const h=p.current;if(!h)return;const y=k.clientX-h.x;if(!h.moved&&Math.abs(y)<=2)return;h.moved=!0;const v=Math.round(Math.min(g,Math.max(m,h.v+y*w))*1e3)/1e3;n(v)},onPointerUp:()=>{var h,y,v;const k=((h=p.current)==null?void 0:h.moved)===!0;p.current=null,c(!1),k||((y=f.current)==null||y.focus(),(v=f.current)==null||v.select())},onPointerCancel:()=>{p.current=null,c(!1)},onChange:k=>{a(k.target.value);const h=k.target.value.trim();if(h==="")return;const y=Number(h.replace(",","."));Number.isFinite(y)&&n(Math.min(g,Math.max(m,y)))}})]})},Xa=({id:e,value:t,isColor:n,onCommit:r})=>u.jsxs("div",{style:ln,children:[u.jsx("span",{style:We,children:e}),u.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[n?u.jsx("input",{type:"color",value:t,onChange:o=>r(o.target.value),style:{width:28,height:28,border:"1px solid #2A2A33",borderRadius:6,padding:0,background:"none"}}):null,u.jsx("input",{"data-testid":`theme-${e}`,style:{...Ff,flex:1},value:t,onChange:o=>r(o.target.value)})]})]}),qA=({selection:e,cue:t,frame:n,allSceneIds:r,edits:o,onSelect:i,resolvedTheme:s,anchorText:a,onVideoPreview:l,runInfo:c,captionsHiddenByFlag:f,fromLive:p=w=>w,hasOldClockPreimage:m=()=>!0,onClockRefused:g=()=>{}})=>{var S,b,E,I,T,j,_,N,W,M,$,V;if(e!=null&&e.elementId&&t){const L=e.elementId,A=((S=t.elements)==null?void 0:S[L])??{},R=t.props?YA(L,t.props):null,C=/^window-\d+$/.test(L);return u.jsxs("div",{children:[u.jsxs("div",{style:ot,children:[u.jsx("span",{style:We,children:"Selected"}),u.jsx("div",{style:{fontSize:15,fontWeight:700,fontFamily:"ui-monospace, monospace"},children:L})]}),(()=>{var H;const P=/^line-(\d+)$/.exec(L),z=(H=t.props)==null?void 0:H.lines;if(t.component!=="StrikethroughReveal"||!P||!Array.isArray(z))return null;const O=Number(P[1]),D=z[O];if(!D)return null;const Z=D.struck?"struck":(D.mark??"none")!=="none"?D.mark:"plain";return u.jsx("div",{style:ot,children:u.jsxs("div",{style:ln,children:[u.jsx("span",{style:We,children:"Line style"}),u.jsxs("select",{"data-testid":"line-style",style:di,value:Z,onChange:G=>{const B=G.target.value,X=z.slice();X[O]={...X[O],struck:B==="struck",mark:B==="cross"||B==="check"?B:"none"},o.patchProps(e.sceneId,{lines:X})},children:[u.jsx("option",{value:"plain",children:"plain"}),u.jsx("option",{value:"struck",children:"struck through"}),u.jsx("option",{value:"cross",children:"✗ wrong"}),u.jsx("option",{value:"check",children:"✓ right"})]})]})})})(),R!==null?u.jsx("div",{style:ot,children:u.jsxs("div",{style:ln,children:[u.jsx("span",{style:We,children:"Text"}),(()=>{const P=z=>{const O=t.props??{},D=/^(line|node|message|window|item)-\d+$/.test(L)?KA(L,O,z):{[L]:z};D&&o.patchProps(e.sceneId,D,`text:${e.sceneId}:${L}`)};return C?u.jsx("textarea",{style:{...Ff,resize:"vertical",fontFamily:"inherit"},"data-testid":"element-text",rows:Math.min(6,Math.max(2,R.split(`
164
+ `).length)),value:R,onChange:z=>P(z.target.value)}):u.jsx("input",{style:Ff,"data-testid":"element-text",value:R,onChange:z=>P(z.target.value)})})()]})}):null,u.jsxs("div",{style:ot,children:[u.jsxs("div",{style:ln,children:[u.jsxs("span",{style:We,children:["scale"," ",u.jsxs("span",{style:{color:"#EDEDF2"},children:[(A.scale??1).toFixed(2),"×"]})]}),u.jsx("input",{type:"range","data-testid":"el-scale-slider",min:.1,max:3,step:.01,value:A.scale??1,onChange:P=>o.patchElement(e.sceneId,L,{scale:Number(P.target.value)},`element:${e.sceneId}:${L}:scale`)})]}),u.jsxs("div",{style:as,children:[u.jsx(Xt,{id:"x",value:A.dx??0,dragStep:1,onCommit:P=>o.patchElement(e.sceneId,L,{dx:P},`element:${e.sceneId}:${L}:dx`)}),u.jsx(Xt,{id:"y",value:A.dy??0,dragStep:1,onCommit:P=>o.patchElement(e.sceneId,L,{dy:P},`element:${e.sceneId}:${L}:dy`)})]}),u.jsx(Xt,{id:"scale",value:A.scale??1,min:.05,max:4,dragStep:.01,onCommit:P=>o.patchElement(e.sceneId,L,{scale:P},`element:${e.sceneId}:${L}:scale`)})]}),u.jsxs("div",{style:ot,children:[u.jsx("button",{style:sn,onClick:()=>{an(),o.clearElement(e.sceneId,L)},children:"Reset element"}),u.jsx("button",{"data-testid":"delete-element",style:{...sn,marginTop:8},onClick:()=>{an(),o.hideElement(e.sceneId,L),i({sceneId:e.sceneId,elementId:null})},children:"Delete element"})]})]})}if(e&&t){const L=t.kind==="plain";if(((b=o.doc.scenes[e.sceneId])==null?void 0:b.hidden)===!0)return u.jsx("div",{children:u.jsxs("div",{style:ot,children:[u.jsx("span",{style:We,children:"Scene"}),u.jsxs("div",{style:{fontSize:15,fontWeight:700,fontFamily:"ui-monospace, monospace"},children:[e.sceneId," ",u.jsx("span",{style:{color:"#9A9AA3",fontWeight:400},children:"(deleted)"})]}),u.jsx("div",{style:{fontSize:12,color:"#9A9AA3"},children:"Its window plays as a plain take. Restore brings the graphic back."}),u.jsx("button",{"data-testid":"restore-scene",style:{...sn,color:"#5FBF77",border:"1px solid #24402c"},onClick:()=>{an(),o.restoreScene(e.sceneId)},children:"Restore scene"})]})});const A=o.doc.cuts.findIndex(C=>C.src===void 0&&C.startSec===t.startSec&&C.endSec===t.endSec);if(A!==-1)return u.jsx("div",{children:u.jsxs("div",{style:ot,children:[u.jsx("span",{style:We,children:L?"Take":"Scene"}),u.jsxs("div",{style:{fontSize:15,fontWeight:700,fontFamily:"ui-monospace, monospace"},children:[e.sceneId," ",u.jsx("span",{style:{color:"#9A9AA3",fontWeight:400},children:"(marked for removal)"})]}),u.jsx("div",{style:{fontSize:12,color:"#9A9AA3"},children:"Struck through on the timeline. It disappears from the output on the next produce/Render — this preview still plays it (the editor doesn't re-derive a second cut timeline just to show one early)."}),u.jsx("button",{"data-testid":"restore-chunk",style:{...sn,color:"#5FBF77",border:"1px solid #24402c"},onClick:()=>{an(),o.restoreChunk(A)},children:"Restore"})]})});const R=Object.entries(t.elements??{}).filter(([,C])=>C.hidden===!0).map(([C])=>{var O,D;const z=((D=(O=o.doc.scenes[e.sceneId])==null?void 0:O.elements[C])==null?void 0:D.hidden)===!0?e.sceneId:ab(e.sceneId);return{id:C,owningSceneId:z}});return u.jsxs("div",{children:[u.jsxs("div",{style:ot,children:[u.jsx("span",{style:We,children:L?"Take":"Scene"}),u.jsx("div",{style:{fontSize:15,fontWeight:700,fontFamily:"ui-monospace, monospace"},children:e.sceneId}),L?u.jsx("div",{style:{fontSize:12,color:"#9A9AA3"},children:"A continuous stretch of the talking head — no graphic. Frame it below; its window follows the cut."}):null]}),u.jsxs("div",{style:ot,children:[!L&&t.component?u.jsxs("div",{style:ln,children:[u.jsx("span",{style:We,children:"Component"}),u.jsx("select",{style:di,value:t.component,onChange:C=>o.patchComponent(e.sceneId,C.target.value),children:Xu.options.map(C=>u.jsx("option",{value:C,children:C},C))})]}):null,!L&&t.component?XM(t.component).map(C=>{var P,z,O;return C.kind==="boolean"?u.jsxs("div",{style:ln,children:[u.jsx("span",{style:We,children:C.key}),u.jsx("input",{type:"checkbox","data-testid":`prop-${C.key}`,checked:typeof((P=t.props)==null?void 0:P[C.key])=="boolean"?t.props[C.key]:C.fallback===!0,onChange:D=>o.patchProps(e.sceneId,{[C.key]:D.target.checked})})]},C.key):u.jsxs("div",{style:ln,children:[u.jsx("span",{style:We,children:C.key}),u.jsx("select",{style:di,"data-testid":`prop-${C.key}`,value:String(((z=t.props)==null?void 0:z[C.key])??((O=C.options)==null?void 0:O[0])??""),onChange:D=>o.patchProps(e.sceneId,{[C.key]:D.target.value}),children:(C.options??[]).map(D=>u.jsx("option",{value:D,children:D},D))})]},C.key)}):null,u.jsxs("div",{style:ln,children:[u.jsx("span",{style:We,children:"Layout"}),u.jsx("select",{style:di,"data-testid":"layout-select",value:t.layout,onChange:C=>o.patchLayout(e.sceneId,C.target.value),children:Gu.options.map(C=>u.jsx("option",{value:C,children:C},C))})]})]}),u.jsxs("div",{style:ot,children:[u.jsx("span",{style:We,children:"Video framing"}),u.jsxs("div",{style:ln,children:[u.jsxs("span",{style:We,children:["zoom"," ",u.jsxs("span",{style:{color:"#EDEDF2"},children:[(((E=t.video)==null?void 0:E.scale)??1).toFixed(2),"×"]})]}),u.jsx("input",{type:"range","data-testid":"zoom-slider",min:.5,max:3,step:.01,value:((I=t.video)==null?void 0:I.scale)??1,onChange:C=>l({sceneId:e.sceneId,patch:{scale:Number(C.target.value)}}),onPointerUp:C=>{const P=Number(C.target.value);o.patchVideo(e.sceneId,{scale:P},`video:${e.sceneId}:scale`),l(null)},onKeyUp:C=>{if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(C.key))return;const z=Number(C.target.value);o.patchVideo(e.sceneId,{scale:z},`video:${e.sceneId}:scale`),l(null)}})]}),u.jsxs("label",{style:{display:"flex",gap:8,alignItems:"center",fontSize:12,color:"#9A9AA3",cursor:"pointer"},children:[u.jsx("input",{type:"checkbox","data-testid":"auto-zoom",checked:((T=t.video)==null?void 0:T.autoZoom)!==!1,onChange:C=>o.patchVideo(e.sceneId,{autoZoom:C.target.checked})}),"auto zoom (the slow push composes on top of your zoom)"]}),u.jsx("div",{style:{fontSize:12,color:"#9A9AA3"},children:"Pan: drag the picture on the stage."}),u.jsx(Xt,{id:"scale",value:((j=t.video)==null?void 0:j.scale)??1,min:.05,max:4,dragStep:.01,onCommit:C=>o.patchVideo(e.sceneId,{scale:C},`video:${e.sceneId}:scale`)}),u.jsxs("div",{style:as,children:[u.jsx(Xt,{id:"dx",value:((_=t.video)==null?void 0:_.dx)??0,dragStep:1,onCommit:C=>o.patchVideo(e.sceneId,{dx:C},`video:${e.sceneId}:dx`)}),u.jsx(Xt,{id:"dy",value:((N=t.video)==null?void 0:N.dy)??0,dragStep:1,onCommit:C=>o.patchVideo(e.sceneId,{dy:C},`video:${e.sceneId}:dy`)})]}),t.video?u.jsx("button",{style:sn,onClick:()=>{an(),o.clearVideo(e.sceneId)},children:"Reset framing"}):null]}),t.layout==="pip-bubble"?(()=>{const C=To("pip-bubble",void 0,[],n).video,P=t.pip??{},z=P.cornerRadius??C.cornerRadius;return u.jsxs("div",{style:ot,children:[u.jsx("span",{style:We,children:"PiP bubble"}),u.jsxs("div",{style:ln,children:[u.jsxs("span",{style:We,children:["roundness"," ",u.jsx("span",{style:{color:"#EDEDF2"},children:z.toFixed(2)})]}),u.jsx("input",{type:"range","data-testid":"pip-roundness",min:0,max:1,step:.01,value:z,onChange:O=>o.patchPip(e.sceneId,{cornerRadius:Number(O.target.value)},`pip:${e.sceneId}:cornerRadius`)})]}),u.jsxs("div",{style:as,children:[u.jsx(Xt,{id:"pip-x",value:P.x??C.rect.x,min:0,max:1-C.rect.w,dragStep:.002,onCommit:O=>o.patchPip(e.sceneId,{x:O},`pip:${e.sceneId}:x`)}),u.jsx(Xt,{id:"pip-y",value:P.y??C.rect.y,min:0,max:1-C.rect.h,dragStep:.002,onCommit:O=>o.patchPip(e.sceneId,{y:O},`pip:${e.sceneId}:y`)})]}),t.pip?u.jsx("button",{"data-testid":"reset-pip",style:sn,onClick:()=>{an(),o.clearPip(e.sceneId)},children:"Reset bubble"}):null]})})():null,(()=>{var z;if(L)return null;const C=gb(t,n),P=O=>D=>o.patchGraphicRect(e.sceneId,nu({...C,[O]:D},n),`box:${e.sceneId}:${O}`);return u.jsxs("div",{style:ot,children:[u.jsx("span",{style:We,children:"Graphic box"}),u.jsx("div",{style:{fontSize:12,color:"#9A9AA3"},children:"Frame fractions — or drag the handles on the stage."}),u.jsxs("div",{style:as,children:[u.jsx(Xt,{id:"box-x",value:C.x,min:0,max:1,dragStep:.002,onCommit:P("x")}),u.jsx(Xt,{id:"box-y",value:C.y,min:0,max:1,dragStep:.002,onCommit:P("y")})]}),u.jsxs("div",{style:as,children:[u.jsx(Xt,{id:"box-w",value:C.w,min:.08,max:1,dragStep:.002,onCommit:P("w")}),u.jsx(Xt,{id:"box-h",value:C.h,min:.05,max:1,dragStep:.002,onCommit:P("h")})]}),(z=o.doc.scenes[e.sceneId])!=null&&z.graphicRect?u.jsx("button",{"data-testid":"reset-box",style:sn,onClick:()=>{an(),o.clearGraphicRect(e.sceneId)},children:"Reset box"}):null]})})(),(()=>{const C=To(t.layout,void 0,[],n).captionAnchor,P=t.captionY??C,z=t.captionScale??1,O=o.doc.scenes[e.sceneId];return u.jsxs("div",{style:ot,children:[u.jsx("span",{style:We,children:"Captions"}),o.doc.captionsHidden===!0||f===!0?u.jsxs("div",{"data-testid":"captions-hidden-hint",style:{fontSize:12,color:"#FFE14D"},children:["Captions are hidden globally",f===!0?" (--no-captions)":" (Theme panel)"," — these settings are kept and apply when captions are shown again."]}):null,u.jsxs("div",{style:ln,children:[u.jsxs("span",{style:We,children:["position"," ",u.jsx("span",{style:{color:"#EDEDF2"},children:P.toFixed(2)})]}),u.jsx("input",{type:"range","data-testid":"caption-y-slider",min:.05,max:.95,step:.01,value:P,onChange:D=>o.patchCaptionY(e.sceneId,Number(D.target.value),`captionY:${e.sceneId}`)})]}),u.jsxs("div",{style:ln,children:[u.jsxs("span",{style:We,children:["scale"," ",u.jsxs("span",{style:{color:"#EDEDF2"},children:[z.toFixed(2),"×"]})]}),u.jsx("input",{type:"range","data-testid":"caption-scale-slider",min:.2,max:3,step:.01,value:z,onChange:D=>o.patchCaptionScale(e.sceneId,Number(D.target.value),`captionScale:${e.sceneId}`)})]}),u.jsx(Xt,{id:"caption-scale",value:z,min:.2,max:3,dragStep:.01,onCommit:D=>o.patchCaptionScale(e.sceneId,D,`captionScale:${e.sceneId}`)}),u.jsx("button",{"data-testid":"caption-y-all",style:{...sn,color:"#EDEDF2",border:"1px solid #2A2A33"},title:"Write this scene's caption position and scale to every scene — one undo step",onClick:()=>{an(),o.patchCaptionStyleAll(r,{y:P,scale:z})},children:"Apply to all scenes"}),(O==null?void 0:O.captionY)!==void 0||(O==null?void 0:O.captionScale)!==void 0?u.jsx("button",{"data-testid":"reset-caption-y",style:sn,onClick:()=>{an(),o.clearCaptionStyle(e.sceneId)},children:"Reset captions"}):null]})})(),u.jsxs("div",{style:ot,children:[u.jsx("span",{style:We,children:"Timing"}),u.jsxs("div",{"data-testid":"timing-range",style:{fontSize:13,fontFamily:"ui-monospace, 'SF Mono', monospace"},children:[t.startSec.toFixed(2),"s – ",t.endSec.toFixed(2),"s",u.jsxs("span",{style:{color:"#9A9AA3"},children:[" ","(",(t.endSec-t.startSec).toFixed(2),"s)"]})]}),u.jsx("div",{style:{fontSize:12,color:t.pinned?"#FFE14D":"#9A9AA3"},children:L?"Derived from the cut — not movable":t.pinned?"Pinned to these times":"Tracking transcript"}),!t.pinned&&a?u.jsxs("div",{style:{fontSize:12,color:"#9A9AA3",fontStyle:"italic"},children:["“",a,"”"]}):null,t.pinned?u.jsx("button",{style:sn,onClick:()=>{an(),o.clearTiming(e.sceneId)},children:"Un-pin (re-anchor to words)"}):null]}),L?null:u.jsx("div",{style:ot,children:u.jsx("button",{"data-testid":"delete-scene",style:sn,onClick:()=>{an(),o.hideScene(e.sceneId)},children:"Delete scene"})}),R.length>0?u.jsxs("div",{style:ot,children:[u.jsx("span",{style:We,children:"Hidden elements"}),R.map(({id:C,owningSceneId:P})=>u.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[u.jsx("span",{style:{fontSize:13,fontFamily:"ui-monospace, monospace",color:"#C9C9D4"},children:C}),u.jsx("button",{"data-testid":`restore-element-${C}`,style:{...sn,color:"#5FBF77",border:"1px solid #24402c",padding:"4px 8px"},onClick:()=>{an(),o.restoreElement(P,C)},children:"Restore"})]},C))]}):null,u.jsxs("div",{style:ot,children:[u.jsx("div",{style:{fontSize:12,color:"#9A9AA3"},children:"Removes this window from the output on the next produce/Render. Struck through here until then — the preview keeps playing it."}),u.jsx("button",{"data-testid":"cut-chunk",style:sn,onClick:()=>{an();const C=pb({fromLive:p,hasOldClockPreimage:m},t.startSec,t.endSec);if(C.kind==="degenerate"){g("Can't cut this window: it isn't in the last render yet — render once (or re-remove the pause) to cut it.");return}C.kind==="shrunk"&&console.warn(`ossclip cut preview: ${C.report}`),o.cutChunk(C.startSec,C.endSec)},children:"Delete this chunk"})]})]})}const w=o.doc.theme,x=(L,A)=>o.patchTheme({[L]:A}),k=L=>`${Math.floor(L/60)}:${String(Math.floor(L%60)).padStart(2,"0")}`,h=((W=c==null?void 0:c.usage)==null?void 0:W.totals)??null,y=((M=c==null?void 0:c.production)==null?void 0:M.producer)??null,v=(($=c==null?void 0:c.production)==null?void 0:$.clip)??null;return u.jsxs("div",{children:[u.jsxs("div",{style:ot,children:[u.jsx("span",{style:We,children:"Theme"}),u.jsx("div",{style:{fontSize:12,color:"#9A9AA3"},children:"Nothing selected — global tokens."})]}),u.jsxs("div",{style:ot,children:[u.jsx(Xa,{id:"accent",value:w.accent??s.accent,isColor:!0,onCommit:L=>x("accent",L)}),u.jsx(Xa,{id:"bg",value:w.bg??s.bg,isColor:!0,onCommit:L=>x("bg",L)}),u.jsx(Xa,{id:"fg",value:w.fg??s.fg,isColor:!0,onCommit:L=>x("fg",L)}),u.jsx(Xt,{id:"radiusPx",value:w.radiusPx??s.radiusPx,min:0,dragStep:.5,onCommit:L=>x("radiusPx",L)}),u.jsx(Xa,{id:"fontDisplay",value:w.fontDisplay??s.fontDisplay,isColor:!1,onCommit:L=>x("fontDisplay",L)})]}),u.jsxs("div",{style:ot,children:[u.jsx("span",{style:We,children:"Captions"}),u.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,color:"#EDEDF2",cursor:"pointer"},children:[u.jsx("input",{type:"checkbox","data-testid":"captions-visible-toggle",checked:o.doc.captionsHidden!==!0&&f!==!0,disabled:f===!0&&o.doc.captionsHidden!==!0,onChange:L=>o.setCaptionsHidden(!L.target.checked)}),"Show captions"]}),o.doc.captionsHidden===!0?u.jsx("div",{style:{fontSize:12,color:"#9A9AA3"},children:"Hidden everywhere — the CTA keyword styling rides the caption track, so it is hidden too. Per-scene caption position/scale edits are kept."}):null,f===!0?u.jsx("div",{"data-testid":"captions-flag-note",style:{fontSize:12,color:"#FFE14D"},children:"This project was produced with --no-captions, which Render replays — the toggle can't bring captions back here; re-run produce without the flag."}):null]}),y||h?u.jsxs("div",{style:ot,"data-testid":"run-info",children:[u.jsx("span",{style:We,children:"This video"}),y?u.jsxs("div",{style:{fontSize:12,color:"#C9C9D4"},children:["planned by ",u.jsx("span",{style:{color:"#EDEDF2"},children:y.provider}),y.models.length>0?` (${y.models.join(", ")})`:"",y.cached?" · reused from cache":"",y.at?` · ${new Date(y.at).toLocaleString()}`:""]}):null,h?u.jsxs("div",{style:{fontSize:12,color:"#C9C9D4"},children:[h.calls," LLM call",h.calls===1?"":"s"," ·"," ",h.inputTokens.toLocaleString()," in / ",h.outputTokens.toLocaleString()," out tokens",h.anyEstimated?" (partly estimated)":""]}):null,h&&h.equivalentUsd!==null?u.jsx("div",{style:{fontSize:12,color:"#C9C9D4"},children:h.allUnbilled?`~$${h.equivalentUsd.toFixed(2)} of API-rate work, covered by the subscription`:h.billedUsd!==null?`~$${h.billedUsd.toFixed(2)} charged at API rates`:`~$${h.equivalentUsd.toFixed(2)} at API rates`}):null,v?u.jsxs("div",{style:{fontSize:12,color:"#C9C9D4"},children:["clip: ",k(v.startSec),"–",k(v.endSec),(V=c==null?void 0:c.production)!=null&&V.sourceDuration?` of ${k(c.production.sourceDuration)}`:""," ","(--clip ",v.targetSec,")"]}):null]}):null,u.jsx("div",{style:ot,children:u.jsx("div",{"data-testid":"ai-disclaimer",style:{fontSize:12,color:"#9A9AA3"},children:"AI can make mistakes. The cut, captions and graphics are generated — review them before publishing."})})]})},Qc=1.2,ou=.05;function JA(e,t,n,r){return n<=0||r<=0?0:Math.min(1,Math.max(0,(e-t)/n))*r}const QA=16,e3=e=>Math.min(QA,Math.max(1,e));function t3(e,t,n,r,o){if(e<=0||n<=0)return 0;const s=(r+o)*(t/e),a=Math.max(0,t*n-n);return Math.min(a,Math.max(0,s-o))}const xh=e=>e.filter(t=>t.kind!=="plain");function n3(e,t,n,r){const o=xh(e),i=o.findIndex(g=>g.id===t),s=o[i];if(!s)return null;const a=s.endSec-s.startSec,l=i>0?o[i-1]:void 0,c=i<o.length-1?o[i+1]:void 0,f=l?l.endSec+ou:0,p=c?c.startSec-ou:r,m=Math.min(Math.max(s.startSec+n,f),Math.max(f,p-a));return{startSec:m,endSec:m+a}}function r3(e,t,n,r,o){const i=xh(e),s=i.findIndex(g=>g.id===t),a=s>0?i[s-1]:void 0,l=s>=0&&s<i.length-1?i[s+1]:void 0,c=a?a.endSec+ou:0,f=l?l.startSec-ou:o;let p=Math.min(Math.max(n,c),Math.max(c,f-Qc)),m=Math.max(Math.min(r,f),p+Qc);return m>f&&(m=f,p=Math.max(c,m-Qc)),{startSec:p,endSec:m}}function by(e,t,n,r){const o=[0,r,n];for(const a of xh(e))a.id!==t&&o.push(a.startSec,a.endSec);o.sort((a,l)=>a-l);const i=[];let s;for(const a of o)(s===void 0||a-s>1e-6)&&(i.push(a),s=a);return i}function qa(e,t,n){if(n<=0||t.length===0)return{sec:e,snapped:null};let r=null,o=1/0;for(const i of t){const s=Math.abs(e-i);(s<o||s===o&&r!==null&&i<r)&&(r=i,o=s)}return r===null||o>n?{sec:e,snapped:null}:{sec:r,snapped:r}}function Db(e,t){if(e.length===0)return 0;for(const r of e)if(t>=r.srcIn&&t<=r.srcOut)return r.outIn+(t-r.srcIn);let n=0;for(const r of e)if(r.srcOut<=t)n=r.outOut;else if(r.srcIn>=t)return r.outIn;return n}function ed(e,t){const n=Math.max(0,e);if(t<=0)return`${n.toFixed(1)}s`;const r=Math.floor(n),o=Math.floor(r/60),i=r%60,s=Math.floor((n-r)*t),a=String(Math.max(1,Math.ceil(t)-1)).length;return`${o}:${String(i).padStart(2,"0")}:${String(s).padStart(a,"0")}`}const bh={silence:"#4DA3FF",pause:"#B78CFF",filler:"#FFB84D",retake:"#FF7AB8",user:"#6BDD8B",clip:"#4DDCD4"},o3="#8a8a95";function i3(e){const t=`${(e.srcOut-e.srcIn).toFixed(1)}s removed`;return e.reason?`${e.reason} · ${t}`:t}const s3=1e-6;function a3(e,t,n){if(t.length===0)return[];const r=new Set(db(e,n)),o=[];for(const i of e){if(i.kind!=="remove"||i.srcOut<=i.srcIn)continue;const s=Db(t,i.srcIn),a=o.filter(l=>Math.abs(l.outSec-s)<s3).length;o.push({srcIn:i.srcIn,srcOut:i.srcOut,reason:i.reason,outSec:s,label:i3(i),color:i.reason?bh[i.reason]:o3,stackIndex:a,vetoable:yh(i.reason),vetoed:r.has(i)})}return o}const l3={silence:"Silences",pause:"Pauses",filler:"Fillers",retake:"Retakes",user:"Your cuts",clip:"Clip window"};function u3(e){const t=new Map;for(const n of e){if(n.kind!=="remove"||n.reason===void 0||!yh(n.reason)||n.srcOut<=n.srcIn)continue;const r=t.get(n.reason)??{reason:n.reason,count:0,seconds:0};r.count+=1,r.seconds+=n.srcOut-n.srcIn,t.set(n.reason,r)}return Object.keys(bh).map(n=>t.get(n)).filter(n=>n!==void 0)}const c3=10,d3=4,Sy=8,ky=8,f3=300,p3=e=>{const t=Math.max(0,Math.round(e));return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`},h3=(e,t)=>{const[n,r]=le.useState({}),o=le.useRef({}),i=t.map(s=>s.toFixed(1)).join(",");return le.useEffect(()=>{if(!e||t.length===0)return;const s=[...new Set(t.map(p=>p.toFixed(1)))].filter(p=>o.current[p]===void 0);if(s.length===0)return;let a=!1;const l=document.createElement("video");l.src=e,l.muted=!0,l.preload="auto";const c=document.createElement("canvas");return(async()=>{await new Promise((m,g)=>{l.onloadedmetadata=()=>m(),l.onerror=()=>g(new Error("no video for thumbnails"))}),c.width=168,c.height=Math.max(1,Math.round(168*l.videoHeight/Math.max(1,l.videoWidth)));const p=c.getContext("2d");if(p){for(const m of s){if(a)return;await new Promise(g=>{l.onseeked=()=>g(),l.currentTime=Math.max(0,Number(m))}),p.drawImage(l,0,0,c.width,c.height),o.current[m]=c.toDataURL("image/jpeg",.6)}a||r({...o.current})}})().catch(()=>{}),()=>{a=!0,l.removeAttribute("src"),l.load()}},[e,i]),n},m3=({cues:e,ghosts:t,cuts:n=[],spans:r=[],cleanup:o=[],durationSec:i,fps:s,playerRef:a,selection:l,onSelect:c,edits:f,videoSrc:p,toSourceSec:m,toLive:g=w=>w})=>{const w=d.useRef(null),x=d.useRef(null),k=d.useRef(!1),h=d.useRef(null),[y,v]=d.useState(0),S=d.useRef(y);S.current=y;const[b,E]=d.useState(null),[I,T]=d.useState(1),j=le.useMemo(()=>m?e.filter(C=>C.kind==="plain").map(C=>m((C.startSec+C.endSec)/2)):[],[e,m]),_=h3(p,j),N=d.useRef(null),W=d.useRef(null),M=d.useCallback((C,P)=>{const z=N.current;T(O=>{const D=e3(C);if(D===O||!z)return D;const Z=z.getBoundingClientRect();return W.current={prevZoom:O,anchorX:P!==void 0?P-Z.left:Z.width/2},D})},[]);d.useLayoutEffect(()=>{const C=N.current,P=W.current;!C||!P||(W.current=null,C.scrollLeft=t3(P.prevZoom,I,C.clientWidth,C.scrollLeft,P.anchorX))},[I]);const $=d.useRef(I);$.current=I,d.useEffect(()=>{const C=N.current;if(!C)return;const P=z=>{z.ctrlKey||z.metaKey?(z.preventDefault(),M($.current*Math.exp(-z.deltaY*.01),z.clientX)):C.scrollWidth>C.clientWidth&&(z.preventDefault(),C.scrollLeft+=z.deltaY+z.deltaX)};return C.addEventListener("wheel",P,{passive:!1}),()=>C.removeEventListener("wheel",P)},[M]),d.useEffect(()=>{const C=a.current;if(!C)return;v(C.getCurrentFrame());const P=z=>v(z.detail.frame);return C.addEventListener("frameupdate",P),()=>C.removeEventListener("frameupdate",P)},[a]),d.useEffect(()=>{const C=N.current;if(!C||i<=0||C.scrollWidth<=C.clientWidth)return;const P=y/s/i*C.scrollWidth,{scrollLeft:z,clientWidth:O}=C;(P<z||P>z+O)&&(C.scrollLeft=Math.max(0,Math.min(C.scrollWidth-O,P-O*.1)))},[y,s,i]),d.useEffect(()=>{var P,z;if(!l)return;const C=(P=N.current)==null?void 0:P.querySelector(`[data-testid="timeline-block-${l.sceneId}"]`);(z=C==null?void 0:C.scrollIntoView)==null||z.call(C,{inline:"nearest",block:"nearest"})},[l]);const V=d.useCallback(C=>{var O;const P=w.current;if(!P||i<=0)return;const z=P.getBoundingClientRect();(O=a.current)==null||O.seekTo(Math.round(JA(C,z.left,z.width,i)*s))},[a,i,s]),L=d.useCallback((C,P)=>z=>{z.stopPropagation(),z.preventDefault();const O=w.current;O&&(x.current={sceneId:C.id,edge:P,startContentX:z.clientX-O.getBoundingClientRect().left,origStart:C.startSec,origEnd:C.endSec},E({sceneId:C.id,startSec:C.startSec,endSec:C.endSec,snapped:null}))},[]),A=d.useRef(0);d.useEffect(()=>{const C=O=>{const D=N.current;if(!D||D.scrollWidth<=D.clientWidth)return;const Z=Date.now();if(Z-A.current<f3)return;const H=D.getBoundingClientRect(),G=D.scrollWidth-D.clientWidth;O>=H.right-ky&&D.scrollLeft<G?(D.scrollLeft=Math.min(G,D.scrollLeft+D.clientWidth),A.current=Z):O<=H.left+ky&&D.scrollLeft>0&&(D.scrollLeft=Math.max(0,D.scrollLeft-D.clientWidth),A.current=Z)},P=O=>{var Se;if((k.current||((Se=h.current)==null?void 0:Se.moved)===!0||x.current!==null)&&C(O.clientX),k.current){V(O.clientX);return}const Z=h.current;if(Z&&i>0){if(!Z.moved&&Math.abs(O.clientX-Z.startX)<d3)return;if(Z.moved=!0,Z.scrub){V(O.clientX);return}const de=w.current,K=de==null?void 0:de.getBoundingClientRect(),ee=K?(O.clientX-K.left-Z.startContentX)/K.width*i:0;let ue=ee,se=null;const Re=K&&K.width>0&&!O.altKey?e.find(De=>De.id===Z.sceneId):void 0;if(Re&&K){const De=Sy/(K.width/i),Qe=by(e,Z.sceneId,S.current/s,i),ke=Re.startSec+ee,Ee=Re.endSec+ee,je=qa(ke,Qe,De),Me=qa(Ee,Qe,De),Le=je.snapped===null?1/0:Math.abs(je.sec-ke),dt=Me.snapped===null?1/0:Math.abs(Me.sec-Ee);Le<=dt&&je.snapped!==null?(ue=ee+(je.sec-ke),se=je.snapped):Me.snapped!==null&&(ue=ee+(Me.sec-Ee),se=Me.snapped)}const Ie=n3(e,Z.sceneId,ue,i);if(Ie){const De=se!==null&&(Math.abs(Ie.startSec-se)<1e-6||Math.abs(Ie.endSec-se)<1e-6)?se:null;E({sceneId:Z.sceneId,...Ie,snapped:De})}return}const H=x.current;if(!H||i<=0)return;const G=w.current;if(!G)return;const B=G.getBoundingClientRect(),X=(O.clientX-B.left-H.startContentX)/B.width*i;let ae=H.edge==="start"?H.origStart+X:H.origStart,oe=H.edge==="end"?H.origEnd+X:H.origEnd,Y=null;if(!O.altKey&&B.width>0){const de=Sy/(B.width/i),K=by(e,H.sceneId,S.current/s,i);if(H.edge==="start"){const ee=qa(ae,K,de);ae=ee.sec,Y=ee.snapped}else{const ee=qa(oe,K,de);oe=ee.sec,Y=ee.snapped}}const q=r3(e,H.sceneId,ae,oe,i),xe=Y!==null&&(Math.abs(q.startSec-Y)<1e-6||Math.abs(q.endSec-Y)<1e-6)?Y:null;E({sceneId:H.sceneId,...q,snapped:xe})},z=O=>{k.current=!1;const D=h.current;if(D){h.current=null,D.moved&&!D.scrub&&E(H=>(H&&H.sceneId===D.sceneId&&f.patchTiming(D.sceneId,H.startSec,H.endSec),null));return}const Z=x.current;Z&&(E(H=>(H&&H.sceneId===Z.sceneId&&(H.startSec!==Z.origStart||H.endSec!==Z.origEnd)&&f.patchTiming(Z.sceneId,H.startSec,H.endSec),null)),x.current=null)};return window.addEventListener("mousemove",P),window.addEventListener("mouseup",z),()=>{window.removeEventListener("mousemove",P),window.removeEventListener("mouseup",z)}},[e,i,f,V,s]);const R=i>0?Math.min(1,y/s/i)*100:0;return u.jsxs("div",{style:g3,onMouseDownCapture:zb,children:[u.jsxs("div",{style:y3,children:[u.jsx("span",{style:w3,children:"ctrl+scroll to zoom"}),u.jsx("button",{"data-testid":"zoom-out",style:td,onClick:()=>M(I/2),disabled:I<=1,title:"Zoom out (ctrl/cmd + scroll on the timeline)",children:"−"}),u.jsxs("span",{"data-testid":"zoom-level",style:v3,children:[Math.round(I*10)/10,"×"]}),u.jsx("button",{"data-testid":"zoom-in",style:td,onClick:()=>M(I*2),disabled:I>=16,title:"Zoom in (ctrl/cmd + scroll on the timeline)",children:"+"}),u.jsx("button",{"data-testid":"zoom-fit",style:{...td,width:"auto",padding:"0 8px"},onClick:()=>M(1),disabled:I<=1,title:"Fit the whole clip in view",children:"fit"})]}),u.jsx("div",{ref:N,"data-testid":"timeline-scroller",style:x3,children:u.jsxs("div",{style:{width:`${I*100}%`,minWidth:"100%",paddingBottom:6},children:[u.jsx("div",{"data-testid":"ruler",style:b3,onMouseDown:C=>{C.preventDefault(),V(C.clientX),k.current=!0},children:(()=>{var H;if(i<=0)return u.jsx("span",{style:nd,children:"0:00"});const P=(((H=N.current)==null?void 0:H.clientWidth)??1200)*I/i;let O=[.5,1,2,5,10,15,30,60,120,300,600].find(G=>G*P>=70)??600;for(;i/(O/5)>600;)O*=2;const D=O/5,Z=[];for(let G=0;G<=i+1e-6;G+=D){const B=Math.round(G/D)%5===0,X=`${G/i*100}%`;Z.push(u.jsx("div",{style:{position:"absolute",left:X,bottom:0,width:1,height:B?8:4,background:B?"#3A3A44":"#26262e",pointerEvents:"none"}},G.toFixed(3))),B&&G+D<=i&&Z.push(u.jsx("span",{style:{...nd,position:"absolute",left:X,top:0,transform:G===0?void 0:"translateX(-50%)",pointerEvents:"none"},children:p3(G)},`l${G.toFixed(3)}`))}return u.jsxs(u.Fragment,{children:[Z,u.jsx("span",{style:{...nd,position:"absolute",right:2,top:0,pointerEvents:"none"},children:ed(i,s)})]})})()}),u.jsxs("div",{ref:w,style:S3,onMouseDown:C=>{C.preventDefault(),V(C.clientX),k.current=!0},children:[e.map(C=>{const P=C.kind==="plain",z=(b==null?void 0:b.sceneId)===C.id,O=z?b.startSec:C.startSec,D=z?b.endSec:C.endSec,Z=i>0?O/i*100:0,H=i>0?Math.max(0,(D-O)/i*100):0,G=(l==null?void 0:l.sceneId)===C.id,B=P&&m?_[m((C.startSec+C.endSec)/2).toFixed(1)]:void 0;return u.jsxs("div",{"data-testid":`timeline-block-${C.id}`,onMouseDown:X=>{var ae;X.stopPropagation(),X.preventDefault(),c({sceneId:C.id,elementId:null}),h.current={sceneId:C.id,startX:X.clientX,startContentX:X.clientX-(((ae=w.current)==null?void 0:ae.getBoundingClientRect().left)??0),moved:!1,scrub:P}},style:{...Ey,left:`${Z}%`,width:`${H}%`,zIndex:z?4:G?3:1,border:G?"2px solid #5b8cff":P?"1px solid #22222a":"1px solid #2A2A33",backgroundColor:G?"#1c2333":P?"#131318":"#1A1A21",...B?{backgroundImage:`linear-gradient(rgba(10,10,14,0.35), rgba(10,10,14,0.6)), url(${B})`,backgroundSize:"auto 100%, auto 100%",backgroundRepeat:"repeat-x"}:{}},children:[u.jsx("span",{style:P?B?{...Ja,color:"#D8D8DE",textShadow:"0 1px 2px rgba(0,0,0,0.9)"}:{...Ja,color:"#55555f"}:Ja,children:C.id}),!P&&C.pinned?u.jsx("span",{style:k3,children:"PIN"}):null,P?null:u.jsxs(u.Fragment,{children:[u.jsx("div",{onMouseDown:L(C,"start"),style:{...Iy,left:0,cursor:"ew-resize"}}),u.jsx("div",{onMouseDown:L(C,"end"),style:{...Iy,right:0,cursor:"ew-resize"}})]})]},C.id)}),t.map(C=>{const P=i>0?C.startSec/i*100:0,z=i>0?Math.max(0,(C.endSec-C.startSec)/i*100):0,O=(l==null?void 0:l.sceneId)===C.id;return u.jsx("div",{"data-testid":`timeline-block-${C.id}`,onMouseDown:D=>{D.stopPropagation(),D.preventDefault(),c({sceneId:C.id,elementId:null})},style:{...Ey,left:`${P}%`,width:`${z}%`,zIndex:O?3:2,border:O?"2px dashed #5b8cff":"1px dashed #6a6a75",background:"transparent"},children:u.jsx("span",{style:{...Ja,color:"#6a6a75",textDecoration:"line-through"},children:C.id})},`ghost-${C.id}`)}),n.map((C,P)=>{const z=D=>i>0?Math.min(100,Math.max(0,D/i*100)):0;if(!C.src){const D=Math.min(Math.max(g(C.startSec),0),i),Z=Math.min(Math.max(g(C.endSec),0),i),H=z(D),G=i>0?Math.max(0,(Z-D)/i*100):0;return u.jsx("div",{"data-testid":`timeline-cut-${C.startSec}-${C.endSec}`,style:{...E3,left:`${H}%`,width:`${G}%`},children:u.jsx("div",{style:C3})},`cut-${P}-${C.startSec}-${C.endSec}`)}if(r.length===0)return null;const O=z(Db(r,C.src.startSec));return u.jsx("div",{"data-testid":`timeline-cut-seam-${C.startSec}-${C.endSec}`,title:"Restore cut — the material returns on the next produce/Render",onMouseDown:D=>{D.stopPropagation(),D.preventDefault(),f.restoreChunk(P)},style:{...I3,left:`${O}%`},children:u.jsx("div",{style:T3})},`cut-${P}-${C.startSec}-${C.endSec}`)}),a3(o,r,f.doc.cleanup).map(C=>{const P=i>0?Math.min(100,Math.max(0,C.outSec/i*100)):0,z=C.vetoed?`${C.label} — declined: kept, playing in the preview (click to re-remove)`:C.vetoable?`${C.label} — click to keep this; the preview updates immediately`:C.label;return u.jsx("div",{"data-testid":`timeline-removal-${C.srcIn}-${C.srcOut}`,...C.vetoed?{"data-vetoed":"true"}:{},title:z,...C.vetoable?{onMouseDown:O=>{O.stopPropagation(),O.preventDefault(),f.toggleKept(C.srcIn,C.srcOut)}}:{},style:{...R3,...C.vetoable?{cursor:"pointer"}:{},left:`${P}%`,marginLeft:-3+C.stackIndex*7},children:u.jsx("div",{style:C.vetoed?{...Cy,background:"transparent",border:`1px solid ${C.color}`,opacity:.55}:{...Cy,background:C.color}})},`removal-${C.srcIn}-${C.srcOut}`)}),b?u.jsxs("div",{"data-testid":"drag-readout",style:{...Ty,left:`${i>0?b.startSec/i*100:0}%`,transform:i>0&&b.startSec/i>.85?"translateX(-100%)":Ty.transform},children:[ed(b.startSec,s)," – ",ed(b.endSec,s)]}):null,(b==null?void 0:b.snapped)!==null&&(b==null?void 0:b.snapped)!==void 0?u.jsx("div",{"data-testid":"snap-tick",style:{...j3,left:`${i>0?b.snapped/i*100:0}%`}}):null,u.jsx("div",{"data-testid":"playhead",style:{...P3,left:`${R}%`},children:u.jsx("div",{"data-testid":"playhead-grab",onMouseDown:C=>{C.stopPropagation(),C.preventDefault(),k.current=!0},style:F3})})]})]})})]})},g3={flexShrink:0,borderTop:"1px solid #1E1E24",background:"#111116",padding:"6px 20px 8px"},y3={display:"flex",justifyContent:"flex-end",alignItems:"center",gap:6,marginBottom:4},td={width:22,height:18,fontSize:12,lineHeight:1,color:"#EDEDF2",background:"#1A1A21",border:"1px solid #2A2A33",borderRadius:4,cursor:"pointer",padding:0},v3={fontSize:10,fontFamily:"ui-monospace, 'SF Mono', monospace",color:"#9A9AA3",minWidth:26,textAlign:"center"},w3={fontSize:10,color:"#55555f",marginRight:4,userSelect:"none"},x3={overflowX:"auto",overflowY:"hidden"},b3={position:"relative",height:18,padding:"0 2px",marginBottom:4,borderBottom:"1px solid #1E1E24",cursor:"ew-resize",userSelect:"none"},nd={fontSize:10,fontFamily:"ui-monospace, 'SF Mono', monospace",color:"#9A9AA3"},S3={position:"relative",height:44,background:"#0F0F14",border:"1px solid #2A2A33",borderRadius:6,overflow:"visible",userSelect:"none"},Ey={position:"absolute",top:3,bottom:3,borderRadius:4,boxSizing:"border-box",cursor:"pointer",display:"flex",alignItems:"center",overflow:"hidden"},Ja={fontSize:10,fontFamily:"ui-monospace, 'SF Mono', monospace",textTransform:"uppercase",letterSpacing:"0.04em",color:"#9A9AA3",padding:"0 8px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",pointerEvents:"none"},k3={position:"absolute",top:3,right:3,fontSize:9,fontFamily:"ui-monospace, 'SF Mono', monospace",letterSpacing:"0.04em",textTransform:"uppercase",color:"#0B0B0E",background:"#ffe14d",padding:"1px 5px",borderRadius:3,pointerEvents:"none"},E3={position:"absolute",top:3,bottom:3,zIndex:3,pointerEvents:"none",borderRadius:4,border:"1px solid rgba(255,92,92,0.6)",background:"repeating-linear-gradient(135deg, rgba(255,92,92,0.22), rgba(255,92,92,0.22) 6px, transparent 6px, transparent 12px)"},C3={position:"absolute",left:0,right:0,top:"50%",height:2,background:"rgba(255,92,92,0.8)"},I3={position:"absolute",top:-4,bottom:-4,width:12,marginLeft:-6,zIndex:4,cursor:"pointer",pointerEvents:"auto"},T3={position:"absolute",left:"50%",top:0,bottom:0,width:2,background:"#FF5C5C",pointerEvents:"none"},R3={position:"absolute",top:-4,bottom:-4,width:6,marginLeft:-3,zIndex:3,pointerEvents:"auto"},Cy={position:"absolute",left:"50%",top:0,bottom:0,width:2,pointerEvents:"none"},Iy={position:"absolute",top:0,bottom:0,width:c3},j3={position:"absolute",top:-4,bottom:-4,width:1,zIndex:6,background:"#FFE14D",pointerEvents:"none"},Ty={position:"absolute",bottom:"100%",marginBottom:3,transform:"translateX(-4px)",whiteSpace:"nowrap",fontSize:10,fontFamily:"ui-monospace, 'SF Mono', monospace",color:"#0B0B0E",background:"#FFE14D",padding:"1px 5px",borderRadius:3,zIndex:6,pointerEvents:"none"},P3={position:"absolute",top:-26,bottom:-4,width:2,zIndex:5,background:"#FFE14D",pointerEvents:"none"},F3={position:"absolute",top:0,bottom:0,left:-4,width:10,pointerEvents:"auto",cursor:"ew-resize"};function _3(e,t,n){const r=e.filter(m=>Ze(m.word)!==null);if(r.length===0)return null;const o=e[0].word,i=e[e.length-1].word,s=Math.max(o.start,t??0),a=i.end;if(a<=s)return null;const l=[];e.every(m=>{const g=Ze(m.word);return g!==null&&g in n.captionWordsHidden})||l.push("caption");const f=n.cuts.some(m=>m.src===void 0&&m.startSec===s&&m.endSec===a),p=e.some(m=>m.synthetic);return!f&&!p&&l.push("caption-video"),l.length===0?null:{startSec:s,endSec:a,words:r.map(m=>({srcStart:m.word.srcStart,was:m.live})),targets:l}}function M3(e,t,n,r){const o=n-t+1;if(o<=0||t<0||n>=e.length)return[];const i=f=>f.map(p=>p.live).join(" ").normalize("NFC"),s=e.slice(t,n+1),a=i(s),l=o===1?Ze(s[0].word):null,c=[];for(let f=0;f+o<=e.length;){if(f>t-o&&f<=n){f=n+1;continue}const p=e.slice(f,f+o),m=p.every(w=>Ze(w.word)!==null&&r(w.word)===void 0),g=l!==null&&Ze(p[0].word)===l;if(m&&!g&&i(p)===a){c.push({fromSrcStart:p[0].word.srcStart,toSrcStart:p[o-1].word.srcStart,was:p.map(w=>w.base).join(" ").normalize("NFC"),rawWas:p.map(w=>w.base).join(" ")}),f+=o;continue}f++}return c}function $3(e,t,n,r,o){const i=Math.max(0,Math.floor(o)),s=new Float32Array(i);if(i===0||!(r>n)||!(t>0)||e.length===0)return{buckets:s,fromSec:n,toSec:r};const a=r-n;for(let l=0;l<i;l++){const c=Math.max(0,Math.ceil((n+a*l/i)*t)),f=Math.min(e.length,Math.ceil((n+a*(l+1)/i)*t));let p=0;for(let m=c;m<f;m++){const g=Math.abs(e[m]);g>p&&(p=g)}s[l]=p}return{buckets:s,fromSec:n,toSec:r}}const lo=280,un=48,Qa=1;let el=null;const A3=e=>((el===null||el.key!==e)&&(el={key:e,promise:(async()=>{if(typeof AudioContext>"u"||typeof fetch>"u")return null;const t=await fetch("/media/audio.wav");if(!t.ok)return null;const n=await t.arrayBuffer(),r=new AudioContext;try{const o=await r.decodeAudioData(n);return{channel:o.getChannelData(0).slice(),sampleRate:o.sampleRate}}finally{r.close()}})().catch(()=>null)}),el.promise),Ry=6,jy=8,N3=e=>{const t=e.anchorTop+e.anchorHeight+Ry,n=e.anchorTop-e.menuH-Ry,o=t+e.menuH<=e.scrollTop+e.clientHeight||n<e.scrollTop?t:n,i=e.anchorLeft+e.anchorWidth/2-e.menuW/2,s=Math.max(jy,Math.min(i,e.clientWidth-e.menuW-jy));return{top:o,left:s}},Py="transcript-word-",Fy=e=>{var o;if(e===null)return null;const t=e.nodeType===3?e.parentElement:e,n=((o=t==null?void 0:t.closest)==null?void 0:o.call(t,`[data-testid^="${Py}"]`))??null;if(n===null)return null;const r=Number(n.getAttribute("data-testid").slice(Py.length));return Number.isInteger(r)?r:null},L3=e=>({lo:e.prev===null?e.track.start:e.prev.end===e.span.start?e.prev.start+tu:e.prev.end,hi:e.next===null?e.track.end:e.next.start===e.span.end?e.next.end-tu:e.next.start}),z3=(e,t,n)=>{const r=Math.min(Math.max(e.start,t),n);return{start:r,end:Math.min(Math.max(e.end,r),n)}},D3=e=>{if(e.edge==="band"){const t=Math.min(Math.max(e.dSec,e.lo-e.span.start),e.hi-e.span.end);return{start:e.span.start+t,end:e.span.end+t}}return e.edge==="lead"?{start:Math.min(Math.max(e.span.start+e.dSec,e.lo),Math.min(e.hi,e.span.end)),end:e.span.end}:{start:e.span.start,end:Math.max(Math.min(e.span.end+e.dSec,e.hi),Math.max(e.lo,e.span.start))}},O3=e=>{const t=e.span.end-e.span.start,n=t>0?(e.newSpan.end-e.newSpan.start)/t:1,r=i=>e.newSpan.start+(i-e.span.start)*n,o=e.lines.map(i=>({srcStart:i.srcStart,lead:r(i.start)-i.start,tail:r(i.end)-i.end}));return e.prev!==null&&e.prev.end===e.span.start&&o.unshift({srcStart:e.prev.srcStart,lead:e.prev.lead,tail:e.newSpan.start-e.prev.end}),e.next!==null&&e.next.start===e.span.end&&o.push({srcStart:e.next.srcStart,lead:e.newSpan.end-e.next.start,tail:e.next.tail}),o},tl=(e,t)=>{const n=e[t],r=n==null?void 0:n.words[0],o=Ze(r);if(!n||!r||o===null)return null;const i=n.words[n.words.length-1];return{key:o,srcStart:r.srcStart,start:n.start,end:n.end,srcEnd:Number.isFinite(i.srcStart)?i.srcStart+(i.end-i.start):r.srcStart+(n.end-n.start)}},B3=(e,t)=>{const n=[];let r=0;for(const o of e){const i=new Set(o.words.map(l=>Ze(l)).filter(l=>l!==null)),s=t[r],a=l=>{const c=Ze(l);return c!==null&&i.has(c)};s!==void 0&&s.words.some(a)?(n.push(r),r++):n.push(null)}return n},W3=({baseLines:e,liveLines:t,timingLines:n,fps:r,playerRef:o,edits:i,onDeleteWords:s,width:a,workdir:l,toPlayerSec:c=p=>p,fromPlayerSec:f=p=>p})=>{const[p,m]=d.useState(""),[g,w]=d.useState(null),[x,k]=d.useState(null),[h,y]=d.useState(null),[v,S]=d.useState(null),[b,E]=d.useState(!1),I=d.useRef(null),[T,j]=d.useState(null),[_,N]=d.useState(null),[W,M]=d.useState(null),[$,V]=d.useState(!1),[L,A]=d.useState(null),[R,C]=d.useState(!1),P=d.useRef(null),z=d.useRef(null),O=d.useMemo(()=>{const F=new Map;for(const U of e)for(const re of U.words){const fe=Ze(re);if(fe===null)continue;const we=F.get(fe);we?we.push(re.text):F.set(fe,[re.text])}return F},[e]),D=d.useMemo(()=>{var fe;const F=[];let U=0;const re=new Map;for(let we=0;we<t.length;we++){const be=t[we];for(let Pe=0;Pe<be.words.length;Pe++){const $e=be.words[Pe],He=Ze($e);let ze;if(He!==null){const ge=re.get(He)??0;re.set(He,ge+1),ze=(fe=O.get(He))==null?void 0:fe[ge]}F.push({index:U,base:ze??$e.text,live:$e.text,synthetic:He!==null&&ze===void 0,start:$e.start,end:$e.end,lineIndex:we,word:$e}),U++}}return F},[O,t]);d.useEffect(()=>{k(null),y(null)},[D.length]);const Z=d.useMemo(()=>new Set(Object.keys(i.doc.captionWordsHidden)),[i.doc.captionWordsHidden]),H=F=>{const U=Ze(F.word);return U!==null&&Z.has(U)},G=d.useMemo(()=>gh(D.map(F=>F.live).join(" ")),[D]);d.useEffect(()=>{if(G!=="rtl"||typeof FontFace>"u"||!document.fonts)return;let F=!1;for(const U of document.fonts)U.family===Gs&&(F=!0);if(!F)try{new FontFace(Gs,`url("/media/${ub}") format("truetype")`).load().then(re=>document.fonts.add(re),()=>{})}catch{}},[G]),d.useEffect(()=>{const F=o.current;if(!F)return;const U=re=>{const fe=f(re.detail.frame/r),we=D.find(be=>fe>=be.start&&fe<be.end);M(be=>we?we.index===be?be:we.index:be)};return F.addEventListener("frameupdate",U),()=>F.removeEventListener("frameupdate",U)},[o,r,D,f]),d.useEffect(()=>{var F,U,re;W!==null&&((re=(U=(F=P.current)==null?void 0:F.querySelector(`[data-testid="transcript-word-${W}"]`))==null?void 0:U.scrollIntoView)==null||re.call(U,{block:"nearest"}))},[W]);const B=p.trim().normalize("NFC").toLowerCase(),X=d.useMemo(()=>B?D.filter(F=>F.live.normalize("NFC").toLowerCase().includes(B)).map(F=>F.index):[],[B,D]),ae=d.useMemo(()=>B?new Set(X):null,[B,X]),[oe,Y]=d.useState(0),q=F=>{var U,re,fe;(fe=(re=(U=P.current)==null?void 0:U.querySelector(`[data-testid="transcript-word-${F}"]`))==null?void 0:re.scrollIntoView)==null||fe.call(re,{block:"center"})};d.useEffect(()=>{Y(0),X.length>0&&q(X[0])},[X]);const xe=F=>{if(X.length===0)return;const U=(oe+F+X.length)%X.length;Y(U),q(X[U])},Se=F=>{const U=F.draft.trim();U&&i.patchCaption(F.srcStart,U,F.base),w(null)},de=F=>{Ze(F.word)!==null&&K(F.word)===void 0&&w({index:F.index,draft:F.live,srcStart:F.word.srcStart,base:F.base})},K=F=>{const U=Ze(F);if(U===null)return;const re=Number(U.slice(1));return i.doc.captionRangeEdits.find(fe=>{const we=Number(fe.fromKey.slice(1)),be=Number(fe.toKey.slice(1));return re>=Math.min(we,be)&&re<=Math.max(we,be)})},ee=x===null?null:Math.min(x.anchor,x.focus),ue=x===null?null:Math.max(x.anchor,x.focus),se=ee===null||ue===null?[]:D.slice(ee,ue+1),Re=se.length>0&&se.every(H),Ie=se.some(F=>Ze(F.word)===null),De=se.map(F=>K(F.word)).find(F=>F!==void 0),Qe=F=>{var He,ze,ge;if(g!==null||h!==null||v!==null)return;const U=P.current;if(!U)return;const re=(He=document.getSelection)==null?void 0:He.call(document);if(!re||re.isCollapsed)return;const{anchorNode:fe,focusNode:we}=re;if(!fe||!we||!U.contains(fe)||!U.contains(we))return;const be=we.nodeType===3?we.parentElement:we;if((ze=be==null?void 0:be.closest)!=null&&ze.call(be,"input, textarea"))return;const Pe=Fy(fe),$e=Fy(we);Pe===null||$e===null||F.detail>=2&&Pe===$e||(k({anchor:Math.min(Pe,$e),focus:Math.max(Pe,$e)}),(ge=re.removeAllRanges)==null||ge.call(re))};d.useLayoutEffect(()=>{if(ee===null||ue===null){A(null);return}const F=P.current,U=(F==null?void 0:F.querySelector(`[data-testid="transcript-word-${ee}"]`))??null,re=(F==null?void 0:F.querySelector(`[data-testid="transcript-word-${ue}"]`))??null;if(!F||re===null){A(null);return}const fe=U!==null&&U.offsetTop===re.offsetTop,we=fe?Math.min(U.offsetLeft,re.offsetLeft):re.offsetLeft,be=fe?Math.max(U.offsetLeft+U.offsetWidth,re.offsetLeft+re.offsetWidth):re.offsetLeft+re.offsetWidth,Pe=z.current,$e=N3({anchorTop:re.offsetTop,anchorHeight:re.offsetHeight,anchorLeft:we,anchorWidth:be-we,menuW:(Pe==null?void 0:Pe.offsetWidth)??0,menuH:(Pe==null?void 0:Pe.offsetHeight)??0,scrollTop:F.scrollTop,clientWidth:F.clientWidth,clientHeight:F.clientHeight});A(He=>He!==null&&He.top===$e.top&&He.left===$e.left?He:$e)},[ee,ue,a,g,h,v,L]),d.useEffect(()=>{C(!1),S(null)},[ee,ue]),d.useEffect(()=>{h!==null&&(ee!==h.selLo||ue!==h.selHi)&&y(null)},[h,ee,ue]);const ke=d.useMemo(()=>h!==null&&ee!==null&&ue!==null?M3(D,ee,ue,K):[],[h,ee,ue,D,i.doc.captionRangeEdits]),Ee=()=>{if(se.length===0||Ie)return;const F=_3(se.map(U=>({word:U.word,live:U.live,synthetic:U.synthetic})),ee!==null&&ee>0?D[ee-1].end:null,i.doc);F!==null&&(s(F),k(null))},je=()=>{if(se.length===0||Ie)return;const F=De;if(F!==void 0){const U=Math.min(Number(F.fromKey.slice(1)),Number(F.toKey.slice(1))),re=Math.max(Number(F.fromKey.slice(1)),Number(F.toKey.slice(1))),fe=D.filter(we=>{const be=Ze(we.word);if(be===null)return!1;const Pe=Number(be.slice(1));return Pe>=U&&Pe<=re});if(fe.length===0)return;k({anchor:fe[0].index,focus:fe[fe.length-1].index}),y({draft:fe.map(we=>we.live).join(" ").normalize("NFC"),fromSrcStart:Number(F.fromKey.slice(1))/1e3,toSrcStart:Number(F.toKey.slice(1))/1e3,was:fe.map(we=>we.base).join(" ").normalize("NFC"),rawWas:fe.map(we=>we.base).join(" "),covered:!0,selLo:fe[0].index,selHi:fe[fe.length-1].index});return}y({draft:se.map(U=>U.live).join(" ").normalize("NFC"),fromSrcStart:se[0].word.srcStart,toSrcStart:se[se.length-1].word.srcStart,was:se.map(U=>U.base).join(" ").normalize("NFC"),rawWas:se.map(U=>U.base).join(" "),covered:!1,selLo:ee,selHi:ue})},Me=F=>{const U=F.draft.trim();if(U){const re=U.split(/\s+/).filter(Boolean);!F.covered&&F.fromSrcStart===F.toSrcStart&&re.length===1?i.patchCaption(F.fromSrcStart,U,F.rawWas):i.patchCaptionRange(F.fromSrcStart,F.toSrcStart,U,F.was),k(null)}y(null)},Le=F=>{const U=F.draft.trim();if(U){const re=U.split(/\s+/).filter(Boolean);!F.covered&&F.fromSrcStart===F.toSrcStart&&re.length===1?i.patchCaptionAllOccurrences([{srcStart:F.fromSrcStart,was:F.rawWas},...ke.map(fe=>({srcStart:fe.fromSrcStart,was:fe.rawWas}))],U):i.patchCaptionRangeAllOccurrences([{fromSrcStart:F.fromSrcStart,toSrcStart:F.toSrcStart,was:F.was},...ke],U),k(null)}y(null)},dt=()=>{se.length===0||Ie||(i.hideCaptionWords(se.filter(F=>!H(F)).map(F=>({srcStart:F.word.srcStart,was:F.live}))),k(null))},Kt=()=>{se.length!==0&&(i.restoreCaptionWords(se.filter(H).map(F=>F.word.srcStart)),k(null))},gn=d.useMemo(()=>B3(t,n),[t,n]),Zn=F=>{var fe;const U=gn[F]??null;if(U===null)return;const re=Ze((fe=n[U])==null?void 0:fe.words[0]);return re===null?void 0:i.doc.captionLineTiming[re]},Mt=se.length===0?0:se[se.length-1].lineIndex-se[0].lineIndex+1,Kn=()=>{var He,ze;if(se.length===0||Ie)return;const F=n,U=gn[se[0].lineIndex]??null,re=gn[se[se.length-1].lineIndex]??null;if(U===null||re===null)return;const fe=[];for(let ge=U;ge<=re;ge++){const Ce=tl(F,ge);if(Ce===null)return;fe.push(Ce)}const we=fe[0],be=fe[fe.length-1],Pe={start:we.start,end:be.end},$e=L3({prev:U>0?F[U-1]:null,next:re<F.length-1?F[re+1]:null,span:Pe,track:{start:F[0].start,end:F[F.length-1].end}});S({track:F,from:U,to:re,span:Pe,bounds:$e,newSpan:z3({start:Pe.start+(((He=i.doc.captionLineTiming[we.key])==null?void 0:He.lead)??0),end:Pe.end+(((ze=i.doc.captionLineTiming[be.key])==null?void 0:ze.tail)??0)},$e.lo,$e.hi)})},Yt=d.useMemo(()=>{if(v===null)return null;const F=[];for(let U=v.from;U<=v.to;U++){const re=tl(v.track,U);if(re===null)return null;F.push(re)}return{lines:F,prev:v.from>0?tl(v.track,v.from-1):null,next:v.to<v.track.length-1?tl(v.track,v.to+1):null}},[v]),yn=d.useMemo(()=>{var we,be;if(v===null||Yt===null)return null;const{lines:F,prev:U,next:re}=Yt,fe=i.doc.captionLineTiming;return O3({lines:F,span:v.span,newSpan:v.newSpan,prev:U===null?null:{...U,lead:((we=fe[U.key])==null?void 0:we.lead)??0},next:re===null?null:{...re,tail:((be=fe[re.key])==null?void 0:be.tail)??0}})},[v,Yt,i.doc.captionLineTiming]),Gt=d.useMemo(()=>{if(v===null||yn===null)return null;const F={...i.doc.captionLineTiming};for(const U of yn)F[kn(U.srcStart)]={lead:U.lead,tail:U.tail};return sb(v.track,F).lines},[v,yn,i.doc.captionLineTiming]),ft=d.useMemo(()=>{if(v===null||Gt===null)return null;const F=Gt[v.from],U=Gt[v.to];return F&&U?{start:F.start,end:U.end}:null},[v,Gt]),vn=v===null?0:v.to-v.from+1,Ot=d.useMemo(()=>{if(v===null||Yt===null)return null;const F=Yt.prev??Yt.lines[0],U=Yt.next??Yt.lines[Yt.lines.length-1];return{srcStart:F.srcStart,srcEnd:U.srcEnd,outStart:F.start,dur:U.srcEnd-F.srcStart+2*Qa}},[v,Yt]);d.useEffect(()=>{N(null)},[l]),d.useEffect(()=>{if(v===null||_!==null)return;let F=!1;return A3(l).then(U=>{!F&&U!==null&&N(U)}),()=>{F=!0}},[v,_,l]);const _n=F=>Ot===null?0:(F-Ot.outStart+Qa)/Ot.dur*lo;d.useEffect(()=>{var He;if(v===null||ft===null||Gt===null||Ot===null)return;const F=I.current,U=((He=F==null?void 0:F.getContext)==null?void 0:He.call(F,"2d"))??null;if(!F||!U)return;const re=_n;U.fillStyle="#0F0F14",U.fillRect(0,0,lo,un);const fe=Math.floor(lo/2),we=_===null?new Float32Array(fe):$3(_.channel,_.sampleRate,Ot.srcStart-Qa,Ot.srcEnd+Qa,fe).buckets;U.fillStyle="#4a4a58";const be=lo/fe;for(let ze=0;ze<fe;ze++){const ge=Math.max(1,we[ze]*(un-4));U.fillRect(ze*be,(un-ge)/2,Math.max(1,be-1),ge)}U.fillStyle="rgba(255, 225, 77, 0.06)";for(const ze of[v.from-1,v.to+1]){const ge=Gt[ze];ge&&U.fillRect(re(ge.start),0,Math.max(1,re(ge.end)-re(ge.start)),un)}const Pe=re(ft.start),$e=re(ft.end);U.fillStyle="rgba(255, 225, 77, 0.18)",U.fillRect(Pe,0,Math.max(1,$e-Pe),un),U.fillStyle="#7a7a88";for(let ze=Math.max(0,v.from-1);ze<=v.to+1;ze++){const ge=Gt[ze];ge&&(ze!==v.from&&U.fillRect(re(ge.start),0,1,un),ze!==v.to&&U.fillRect(re(ge.end),0,1,un))}U.fillStyle="#FFE14D",U.fillRect(Pe-1,0,2,un),U.fillRect($e-1,0,2,un)},[v,ft,Gt,Ot,_]);const Yn=Ot===null?0:Ot.dur/lo,Mn=v===null||ft===null||Ot===null?null:{lead:_n(ft.start),tail:_n(ft.end)},Tr=F=>U=>{v!==null&&(U.preventDefault(),j({edge:F,startX:U.clientX,span:v.newSpan}))};d.useEffect(()=>{if(T===null||v===null)return;const F=re=>{S({...v,newSpan:D3({edge:T.edge,span:T.span,dSec:(re.clientX-T.startX)*Yn,lo:v.bounds.lo,hi:v.bounds.hi})})},U=()=>j(null);return window.addEventListener("pointermove",F),window.addEventListener("pointerup",U),window.addEventListener("pointercancel",U),window.addEventListener("blur",U),()=>{window.removeEventListener("pointermove",F),window.removeEventListener("pointerup",U),window.removeEventListener("pointercancel",U),window.removeEventListener("blur",U)}},[T,v,Yn]),d.useEffect(()=>{v===null&&T!==null&&j(null)},[v,T]);const ur=()=>{if(ft===null)return;const F=o.current;if(F){if(b){F.pause(),E(!1);return}F.seekTo(Math.ceil(c(ft.start)*r)),F.play(),E(!0)}};d.useEffect(()=>{if(!b||ft===null)return;const F=o.current;if(!F)return;const U=c(ft.end),re=fe=>{fe.detail.frame/r>=U&&(F.pause(),E(!1))};return F.addEventListener("frameupdate",re),()=>F.removeEventListener("frameupdate",re)},[b,ft,r,o,c]),d.useEffect(()=>{const F=o.current;if(!F)return;const U=()=>E(!1);return F.addEventListener("pause",U),()=>F.removeEventListener("pause",U)}),d.useEffect(()=>{var F;v!==null||!b||((F=o.current)==null||F.pause(),E(!1))},[v,b,o]);const cr=F=>{i.patchCaptionLineTiming(F),S(null)};return u.jsxs("div",{"data-testid":"transcript-panel",style:{...V3,width:a},children:[u.jsxs("div",{style:H3,children:[u.jsx("span",{style:U3,children:"Transcript"}),u.jsxs("div",{style:iN,children:[u.jsx("span",{style:My,children:"Click to jump · double-click to retype · drag to select"}),u.jsx("button",{"data-testid":"transcript-help-toggle",style:sN,onClick:()=>V(F=>!F),title:"What each gesture does","aria-label":"Transcript help","aria-expanded":$,children:"?"})]}),$?u.jsx("div",{"data-testid":"transcript-help",style:My,children:"Drag across words — or shift-click — to mark a run. Its toolbar offers Edit (rewrite freely — word count may change, captions only; works on a single word too, the way to split a merged one), Timing (whole CAPTIONS — drag the waveform handles to move when they come in and go out, or drag between them to shift them all, taking the time from the captions either side) and Delete — from the captions only (restorable — the word stays here and in the audio) or from the video too, on the next Render. Double-click retype stays 1:1 — word count and timing fixed, so scene anchors and the caption highlight keep working."}):null,u.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[u.jsx("input",{"data-testid":"transcript-search",style:{...Z3,flex:1},placeholder:"Find a word…",value:p,onChange:F=>m(F.target.value),onKeyDown:F=>{F.key==="Enter"&&(F.preventDefault(),xe(F.shiftKey?-1:1))}}),u.jsx("button",{"data-testid":"transcript-prev",style:$y,onClick:()=>xe(-1),disabled:X.length===0,title:"Previous match (⇧Enter)","aria-label":"Previous match",children:"‹"}),u.jsx("button",{"data-testid":"transcript-next",style:$y,onClick:()=>xe(1),disabled:X.length===0,title:"Next match (Enter)","aria-label":"Next match",children:"›"})]}),ae?u.jsx("div",{"data-testid":"transcript-match-count",style:{fontSize:11,color:"#9A9AA3"},children:X.length===0?"0 matches":`${oe+1}/${X.length} match${X.length===1?"":"es"}`}):null]}),u.jsxs("div",{style:K3,"data-testid":"transcript-body",dir:G,ref:P,onMouseUp:Qe,tabIndex:0,onKeyDown:F=>{if(!(g!==null||h!==null)){if(v!==null){F.key==="Escape"&&(F.stopPropagation(),S(null));return}if(F.key==="Escape"){if(x===null)return;F.stopPropagation(),k(null),y(null);return}(F.key==="Delete"||F.key==="Backspace")&&x!==null&&(F.preventDefault(),F.stopPropagation(),Re?Kt():Ee())}},children:[D.map((F,U)=>{const re=K(F.word),fe=Zn(F.lineIndex),we=H(F)?"hidden from captions — select and Restore":re!==void 0?`part of a rewritten range (was “${re.was}”) — select it and use Edit`:F.synthetic?`rewritten (was “${F.base}”) — select and Edit to change`:F.live!==F.base?`edited (was “${F.base}”) — double-click to retype`:"click to jump · double-click to retype";return u.jsxs(le.Fragment,{children:[U>0?" ":null,(g==null?void 0:g.index)===F.index?u.jsx("input",{autoFocus:!0,"data-testid":"transcript-edit",style:cN,value:g.draft,onChange:be=>w({...g,draft:be.target.value}),onBlur:()=>Se(g),onKeyDown:be=>{be.key==="Enter"&&be.target.blur(),be.key==="Escape"&&w(null)}}):u.jsx("span",{"data-testid":`transcript-word-${F.index}`,onClick:be=>{var Pe;if(h!==null&&y(null),v!==null&&S(null),be.shiftKey){k($e=>$e===null?{anchor:F.index,focus:F.index}:{...$e,focus:F.index});return}(Pe=o.current)==null||Pe.seekTo(Math.ceil(c(F.start)*r)),k({anchor:F.index,focus:F.index})},onDoubleClick:()=>de(F),title:fe===void 0?we:`${we} · caption timing adjusted (${Math.round(fe.lead*1e3)}ms in / ${Math.round(fe.tail*1e3)}ms out) — Timing to change`,style:{...Y3,...fe!==void 0?tN:{},...H(F)?eN:{},...F.live!==F.base||F.synthetic?q3:{},...ee!==null&&F.index>=ee&&F.index<=ue?Q3:{},...ae!=null&&ae.has(F.index)?G3:{},...X[oe]===F.index?X3:{},...W===F.index?J3:{}},children:F.live})]},F.index)}),x!==null&&L!==null&&g===null&&h===null&&v===null?u.jsxs("div",{"data-testid":"transcript-selection-menu",role:"menu",ref:z,dir:"ltr",style:{...xl,top:L.top,left:L.left},children:[u.jsx(Zo,{"data-testid":"transcript-edit-range",onClick:je,disabled:Ie,title:Ie?"A selected word has no source anchor (this project predates them) — re-run produce first":De!==void 0?"Re-edit the rewritten range this selection touches":se.length===1?"Retype this word (1:1 — same as double-click)":"Rewrite these words as free text — word count may change",children:"Edit"}),u.jsx(Zo,{"data-testid":"transcript-timing",onClick:Kn,disabled:se.length===0||Ie,title:Ie?"A selected word has no source anchor (this project predates them) — re-run produce first":Mt===1?"Adjust when this caption appears and leaves":`Adjust when these ${Mt} captions appear and leave`,children:"Timing"}),Re?u.jsx(Zo,{"data-testid":"transcript-restore",onClick:Kt,title:"Show these words in the captions again",children:"Restore"}):u.jsxs("span",{style:{position:"relative"},children:[u.jsx(Zo,{"data-testid":"transcript-delete-menu",onClick:()=>C(F=>!F),title:"Delete these words — from the captions only, or from the video too",children:"Delete ▾"}),R?u.jsxs("div",{"data-testid":"transcript-delete-flyout",dir:"ltr",style:aN,children:[u.jsx(Zo,{"data-testid":"transcript-hide",onClick:()=>{C(!1),dt()},disabled:Ie,title:Ie?"A selected word has no source anchor (this project predates them) — re-run produce first":"Hide these words from the captions — restorable, the words stay here and in the audio",children:"Delete captions"}),u.jsx(Zo,{"data-testid":"transcript-delete",onClick:()=>{C(!1),Ee()},disabled:Ie,title:Ie?"A selected word has no source anchor (this project predates them) — re-run produce first":"Delete these words — from the captions only, or from the video too",children:"Delete + video…"})]}):null]}),u.jsxs("span",{style:Ay,children:[se.length," word",se.length===1?"":"s"]})]}):null,h!==null&&L!==null?u.jsxs("div",{"data-testid":"transcript-range-popover",ref:z,dir:"ltr",style:{...xl,top:L.top,left:L.left,flexDirection:"column",alignItems:"stretch",gap:6},children:[u.jsx("textarea",{autoFocus:!0,"data-testid":"transcript-range-edit",rows:3,dir:"auto",style:uN,value:h.draft,onChange:F=>y({...h,draft:F.target.value}),onKeyDown:F=>{F.key==="Enter"&&!F.shiftKey&&(F.preventDefault(),Me(h)),F.key==="Escape"&&y(null)}}),u.jsxs("div",{style:{display:"flex",gap:6},children:[u.jsx("button",{"data-testid":"transcript-apply",style:Ko,onClick:()=>Me(h),title:"Rewrite this selection (Enter)",children:"Apply"}),ke.length>0?u.jsxs("button",{"data-testid":"transcript-apply-all",style:Ko,onClick:()=>Le(h),title:"Rewrite this selection AND every other place the same words occur — one undo step",children:["Apply to all (",ke.length,")"]}):null,u.jsx("button",{style:Ko,onClick:()=>y(null),title:"Discard the rewrite (Esc)",children:"Cancel"})]})]}):null,v!==null&&ft!==null&&L!==null?u.jsxs("div",{"data-testid":"transcript-timing-popover",ref:z,dir:"ltr",style:{...xl,top:L.top,left:L.left,flexDirection:"column",alignItems:"stretch",gap:6},children:[u.jsxs("div",{style:{position:"relative",width:lo,height:un},children:[u.jsx("canvas",{"data-testid":"transcript-timing-canvas",ref:I,width:lo,height:un,style:{display:"block",borderRadius:4}}),Mn!==null?u.jsxs(u.Fragment,{children:[u.jsx("div",{"data-testid":"transcript-timing-band",title:vn===1?"Drag to shift this caption, its duration intact":"Drag to shift these captions, every duration intact",onPointerDown:Tr("band"),style:{...rN,left:Mn.lead,width:Math.max(0,Mn.tail-Mn.lead),cursor:(T==null?void 0:T.edge)==="band"?"grabbing":"grab"}}),u.jsx(_y,{"data-testid":"transcript-timing-handle-lead",title:vn===1?"Drag to move when this caption comes in — the previous caption gives up the time":"Drag to move when the first caption comes in — the previous caption gives up the time",x:Mn.lead,active:(T==null?void 0:T.edge)==="lead",onPointerDown:Tr("lead")}),u.jsx(_y,{"data-testid":"transcript-timing-handle-tail",title:vn===1?"Drag to move when this caption goes out — the next caption gives up the time":"Drag to move when the last caption goes out — the next caption gives up the time",x:Mn.tail,active:(T==null?void 0:T.edge)==="tail",onPointerDown:Tr("tail")})]}):null]}),u.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[u.jsx("button",{"data-testid":"transcript-timing-play",style:Ko,onClick:ur,title:b?"Pause":vn===1?"Play just this caption's span":"Play just these captions' span",children:b?"Pause":"Play"}),u.jsxs("span",{"data-testid":"transcript-timing-span",style:Ay,children:[ft.start.toFixed(2),"s – ",ft.end.toFixed(2),"s",` · ${vn} caption${vn===1?"":"s"}`]}),u.jsx("button",{"data-testid":"transcript-timing-apply",style:Ko,onClick:()=>{yn!==null&&cr(yn)},title:vn===1?"Store this caption's timing — the neighbour's matching seam moves with it":"Store these captions' timing — one undo step for the whole gesture",children:"Apply"}),u.jsx("button",{"data-testid":"transcript-timing-cancel",style:Ko,onClick:()=>S(null),title:"Discard the nudge (Esc)",children:"Cancel"})]})]}):null]})]})},Zo=({children:e,...t})=>{const[n,r]=d.useState(!1);return u.jsx("button",{role:"menuitem",...t,style:{...lN,...n&&!t.disabled?{background:"#34343F"}:{},...t.disabled?{opacity:.5,cursor:"default"}:{}},onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:e})},_y=({x:e,active:t,...n})=>{const[r,o]=d.useState(!1);return u.jsx("div",{...n,style:{...nN,left:e-Ob/2},onPointerEnter:()=>o(!0),onPointerLeave:()=>o(!1),children:u.jsx("div",{style:{...oN,background:t?"#fff":r?"#FFF0A0":"#FFE14D",width:t?4:2}})})},V3={flexShrink:0,display:"flex",flexDirection:"column",background:"#111116",minHeight:0},H3={display:"flex",flexDirection:"column",gap:8,padding:"14px 14px 10px",borderBottom:"1px solid #1E1E24"},U3={fontSize:11,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"#9A9AA3"},My={fontSize:11,lineHeight:1.45,color:"#6a6a75"},Z3={fontFamily:"'Inter', system-ui, sans-serif",fontSize:13,background:"#0F0F14",border:"1px solid #2A2A33",borderRadius:6,color:"#fff",padding:"6px 8px"},K3={flex:1,position:"relative",fontFamily:"'Inter', 'Noto Nastaliq Urdu', 'Geeza Pro', 'Noto Naskh Arabic', system-ui, sans-serif",overflowY:"auto",overflowX:"hidden",overflowWrap:"break-word",padding:"10px 14px 16px",fontSize:13,lineHeight:2,color:"#C9C9D4"},Y3={cursor:"pointer",borderRadius:3,padding:"2px 4px",unicodeBidi:"isolate"},G3={background:"#2b2b1a",outline:"1px solid #6b6432"},X3={background:"#3d3a17",outline:"2px solid #FFE14D",color:"#fff"},$y={width:26,height:30,fontSize:16,lineHeight:1,color:"#EDEDF2",background:"#1A1A21",border:"1px solid #2A2A33",borderRadius:6,cursor:"pointer",padding:0},q3={color:"#FFE14D"},J3={textDecoration:"underline",textUnderlineOffset:4},Q3={background:"#FFE14D",color:"#111",borderRadius:0,boxShadow:"-4px 0 0 0 #FFE14D, 4px 0 0 0 #FFE14D"},eN={textDecoration:"line-through",color:"#6a6a75"},tN={borderBottom:"1px dotted #9A9AA3"},Ob=12,nN={position:"absolute",top:0,width:Ob,height:un,cursor:"ew-resize",touchAction:"none",display:"flex",justifyContent:"center"},rN={position:"absolute",top:0,height:un,touchAction:"none"},oN={height:"100%",borderRadius:1,pointerEvents:"none"},iN={display:"flex",gap:6,alignItems:"center",justifyContent:"space-between"},sN={width:20,height:20,fontSize:11,lineHeight:1,color:"#9A9AA3",background:"#1A1A21",border:"1px solid #2A2A33",borderRadius:6,cursor:"pointer",padding:0,flexShrink:0},xl={position:"absolute",zIndex:31,background:"#262630",border:"1px solid #3A3A47",borderRadius:10,padding:"4px 6px",boxShadow:"0 14px 34px rgba(0,0,0,0.66), 0 2px 6px rgba(0,0,0,0.4)",display:"flex",flexDirection:"row",alignItems:"center",gap:2},aN={...xl,top:"100%",left:0,marginTop:4,zIndex:32,minWidth:170,flexDirection:"column",alignItems:"stretch"},Ay={fontSize:11,color:"#9A9AA3",paddingInline:"6px 8px",whiteSpace:"nowrap"},lN={fontSize:12,fontWeight:600,color:"#EDEDF2",background:"transparent",border:"none",borderRadius:6,padding:"6px 10px",cursor:"pointer",textAlign:"left",whiteSpace:"nowrap"},uN={fontFamily:"'Inter', 'Noto Nastaliq Urdu', 'Geeza Pro', 'Noto Naskh Arabic', system-ui, sans-serif",fontSize:13,width:280,background:"#0F0F14",border:"1px solid #FFE14D",borderRadius:4,color:"#fff",padding:"4px 6px",resize:"vertical"},Ko={fontSize:11,color:"#EDEDF2",background:"#34343F",border:"1px solid #45454F",borderRadius:6,cursor:"pointer",padding:"4px 8px"},cN={fontFamily:"'Inter', 'Noto Nastaliq Urdu', 'Geeza Pro', 'Noto Naskh Arabic', system-ui, sans-serif",fontSize:13,width:110,background:"#0F0F14",border:"1px solid #FFE14D",borderRadius:4,color:"#fff",padding:"1px 4px"},dN=[{title:"transport",rows:[["space","play / pause"],["J / K / L","reverse · pause · forward (tap again to speed up)"],["← / →","step one frame back / forward"],["⌘/ctrl + ← / →","jump to and select the previous / next scene"]]},{title:"selection",rows:[["click","select scene or element"],["⌥ + ← / →","select previous / next scene"],["esc","clear selection · close dialogs"]]},{title:"editing",rows:[["⌘/ctrl + B","split the scene at the playhead"],["delete / backspace","delete the selected scene — asks graphic or whole take (§139)"],["enter (in that dialog)","confirm the highlighted option"],["⌘/ctrl + Z","undo"],["⌘/ctrl + ⇧ + Z","redo (⌘Y works too)"],["⌘/ctrl + S","save"],["double-click caption word","retype it in place"],["drag element / corner handles","move · resize"],["drag picture","pan the video framing"],["drag a scene block / edge on the timeline","snaps to scene edges + the playhead (hold ⌥ while dragging to disable)"],["drag a box on the stage","snaps to centre / safe-area guides (hold ⌥ mid-drag to disable)"]]},{title:"view",rows:[["⌘/ctrl + scroll on preview","zoom the view (never edits)"],["⌥-drag / middle-drag","pan the zoomed view"],["⌘/ctrl + scroll on timeline","zoom the timeline"],["?","this reference"]]}],fN=({onClose:e})=>(d.useEffect(()=>{const t=n=>{n.key==="Escape"&&(n.stopPropagation(),e())};return window.addEventListener("keydown",t,!0),()=>window.removeEventListener("keydown",t,!0)},[e]),u.jsx("div",{style:pN,onMouseDown:e,children:u.jsxs("div",{"data-testid":"shortcuts-modal",style:hN,onMouseDown:t=>t.stopPropagation(),children:[u.jsxs("div",{style:mN,children:[u.jsx("span",{style:gN,children:"keybinds"}),u.jsx("span",{style:yN,children:"esc close"})]}),u.jsx("div",{style:vN,children:"available commands and configured shortcuts"}),dN.map(t=>u.jsxs("div",{style:{marginTop:18},children:[u.jsx("div",{style:wN,children:t.title}),t.rows.map(([n,r])=>u.jsxs("div",{style:xN,children:[u.jsx("span",{style:bN,children:n}),u.jsx("span",{style:SN,children:r})]},n))]},t.title))]})})),pN={position:"fixed",inset:0,zIndex:30,background:"rgba(5,5,8,0.6)",display:"flex",alignItems:"center",justifyContent:"center"},hN={width:620,maxWidth:"90vw",maxHeight:"82vh",overflowY:"auto",background:"#12121A",border:"1px solid #3A3A48",borderRadius:8,padding:"20px 26px 26px",fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace"},mN={display:"flex",justifyContent:"space-between",alignItems:"center"},gN={fontSize:18,fontWeight:700,color:"#EDEDF2"},yN={fontSize:13,fontWeight:700,color:"#0B0B0E",background:"#a8c7fa",borderRadius:4,padding:"3px 10px"},vN={fontSize:13,color:"#6a6a75",marginTop:4},wN={fontSize:14,fontWeight:700,color:"#8ab4f8",marginBottom:6},xN={display:"flex",gap:16,padding:"3px 0"},bN={width:290,flexShrink:0,color:"#c5a3ff",fontWeight:600,fontSize:13},SN={color:"#C9C9D4",fontSize:13},Ny={graphic:{label:"just the graphic",detail:e=>e.isSplitHalf?"this half only — the take underneath keeps playing":"the take underneath keeps playing"},take:{label:"the whole take",detail:e=>`cuts ${(e.endSec-e.startSec).toFixed(1)}s out of the video`}},kN=({plan:e,onConfirm:t,onCancel:n})=>{const[r,o]=d.useState(e.targets[0]),i=d.useRef(null),s=d.useRef(null);return d.useEffect(()=>{const a=l=>{if(l.key==="Escape"){l.stopPropagation(),n();return}if(l.key!=="Tab")return;const c=i.current;if(!c)return;const f=c.querySelectorAll("input, button"),p=f[0],m=f[f.length-1];!p||!m||(l.shiftKey&&document.activeElement===p?(l.preventDefault(),m.focus()):!l.shiftKey&&document.activeElement===m&&(l.preventDefault(),p.focus()))};return window.addEventListener("keydown",a,!0),()=>window.removeEventListener("keydown",a,!0)},[n]),d.useEffect(()=>{var l;const a=document.activeElement;return(l=s.current)==null||l.focus(),()=>{var c;return(c=a==null?void 0:a.focus)==null?void 0:c.call(a)}},[]),u.jsx("div",{style:EN,onMouseDown:n,children:u.jsxs("form",{ref:i,"data-testid":"delete-scene-modal",role:"dialog","aria-modal":"true","aria-label":`Delete ${e.rootId}`,style:CN,onMouseDown:a=>a.stopPropagation(),onSubmit:a=>{a.preventDefault(),t(r)},children:[u.jsxs("div",{style:IN,children:[u.jsxs("span",{style:TN,children:["delete ",e.rootId,e.isSplitHalf?u.jsx("span",{style:RN,children:"half"}):null,"?"]}),u.jsx("span",{style:jN,children:"esc cancel"})]}),u.jsx("div",{style:PN,children:"undoable with ⌘Z, like every other edit"}),u.jsx("div",{style:{marginTop:16},children:e.targets.map(a=>u.jsxs("label",{style:FN,"data-testid":`delete-option-${a}`,children:[u.jsx("input",{type:"radio",name:"delete-target",value:a,checked:r===a,onChange:()=>o(a),style:_N}),u.jsxs("span",{children:[u.jsx("span",{style:MN,children:Ny[a].label}),u.jsx("span",{style:$N,children:Ny[a].detail(e)})]})]},a))}),u.jsxs("div",{style:AN,children:[u.jsx("button",{type:"button","data-testid":"delete-cancel",style:Bb,onClick:n,children:"Cancel"}),u.jsx("button",{ref:s,type:"submit","data-testid":"delete-confirm",style:NN,children:"Delete"})]})]})})},EN={position:"fixed",inset:0,zIndex:30,background:"rgba(5,5,8,0.6)",display:"flex",alignItems:"center",justifyContent:"center"},CN={width:420,maxWidth:"90vw",background:"#12121A",border:"1px solid #3A3A48",borderRadius:8,padding:"18px 22px 20px",fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace"},IN={display:"flex",justifyContent:"space-between",alignItems:"center",gap:12},TN={fontSize:16,fontWeight:700,color:"#EDEDF2"},RN={fontSize:11,fontWeight:700,color:"#0B0B0E",background:"#c5a3ff",borderRadius:4,padding:"2px 6px",marginLeft:6},jN={fontSize:12,fontWeight:700,color:"#0B0B0E",background:"#a8c7fa",borderRadius:4,padding:"3px 10px",whiteSpace:"nowrap"},PN={fontSize:12,color:"#6a6a75",marginTop:4},FN={display:"flex",alignItems:"flex-start",gap:10,padding:"8px 0",cursor:"pointer"},_N={accentColor:"#8ab4f8",marginTop:2,cursor:"pointer"},MN={display:"block",fontSize:13,fontWeight:600,color:"#EDEDF2"},$N={display:"block",fontSize:12,color:"#9A9AA3",marginTop:2},AN={display:"flex",justifyContent:"flex-end",gap:8,marginTop:14},Bb={fontSize:12,fontWeight:600,color:"#C9C9D4",background:"transparent",border:"1px solid #2A2A33",borderRadius:6,padding:"7px 12px",cursor:"pointer",fontFamily:"inherit"},NN={...Bb,color:"#FF5C5C",border:"1px solid #452626"},Ly={caption:{label:"Remove from captions only",detail:()=>"restorable — the words stay in the transcript and the audio"},"caption-video":{label:"Remove captions + video",detail:e=>`cuts ${(e.endSec-e.startSec).toFixed(1)}s out of the video on the next Render; captions disappear now`}},LN=({plan:e,onConfirm:t,onCancel:n})=>{const[r,o]=d.useState(e.targets[0]),i=d.useRef(null),s=d.useRef(null);d.useEffect(()=>{const l=c=>{if(c.key==="Escape"){c.stopPropagation(),n();return}if(c.key!=="Tab")return;const f=i.current;if(!f)return;const p=f.querySelectorAll("input, button"),m=p[0],g=p[p.length-1];!m||!g||(c.shiftKey&&document.activeElement===m?(c.preventDefault(),g.focus()):!c.shiftKey&&document.activeElement===g&&(c.preventDefault(),m.focus()))};return window.addEventListener("keydown",l,!0),()=>window.removeEventListener("keydown",l,!0)},[n]),d.useEffect(()=>{var c;const l=document.activeElement;return(c=s.current)==null||c.focus(),()=>{var f;return(f=l==null?void 0:l.focus)==null?void 0:f.call(l)}},[]);const a=e.words.length;return u.jsx("div",{style:zN,onMouseDown:n,children:u.jsxs("form",{ref:i,"data-testid":"delete-words-modal",role:"dialog","aria-modal":"true","aria-label":`Delete ${a} word${a===1?"":"s"}`,style:DN,onMouseDown:l=>l.stopPropagation(),onSubmit:l=>{l.preventDefault(),t(r)},children:[u.jsxs("div",{style:ON,children:[u.jsxs("span",{style:BN,children:["delete ",a," word",a===1?"":"s","?"]}),u.jsx("span",{style:WN,children:"esc cancel"})]}),u.jsx("div",{style:VN,children:"undoable with ⌘Z, like every other edit"}),u.jsx("div",{style:{marginTop:16},children:e.targets.map(l=>u.jsxs("label",{style:HN,"data-testid":`delete-words-option-${l}`,children:[u.jsx("input",{type:"radio",name:"delete-words-target",value:l,checked:r===l,onChange:()=>o(l),style:UN}),u.jsxs("span",{children:[u.jsx("span",{style:ZN,children:Ly[l].label}),u.jsx("span",{style:KN,children:Ly[l].detail(e)})]})]},l))}),u.jsxs("div",{style:YN,children:[u.jsx("button",{type:"button","data-testid":"delete-words-cancel",style:Wb,onClick:n,children:"Cancel"}),u.jsx("button",{ref:s,type:"submit","data-testid":"delete-words-confirm",style:GN,children:"Delete"})]})]})})},zN={position:"fixed",inset:0,zIndex:30,background:"rgba(5,5,8,0.6)",display:"flex",alignItems:"center",justifyContent:"center"},DN={width:420,maxWidth:"90vw",background:"#12121A",border:"1px solid #3A3A48",borderRadius:8,padding:"18px 22px 20px",fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace"},ON={display:"flex",justifyContent:"space-between",alignItems:"center",gap:12},BN={fontSize:16,fontWeight:700,color:"#EDEDF2"},WN={fontSize:12,fontWeight:700,color:"#0B0B0E",background:"#a8c7fa",borderRadius:4,padding:"3px 10px",whiteSpace:"nowrap"},VN={fontSize:12,color:"#6a6a75",marginTop:4},HN={display:"flex",alignItems:"flex-start",gap:10,padding:"8px 0",cursor:"pointer"},UN={accentColor:"#8ab4f8",marginTop:2,cursor:"pointer"},ZN={display:"block",fontSize:13,fontWeight:600,color:"#EDEDF2"},KN={display:"block",fontSize:12,color:"#9A9AA3",marginTop:2},YN={display:"flex",justifyContent:"flex-end",gap:8,marginTop:14},Wb={fontSize:12,fontWeight:600,color:"#C9C9D4",background:"transparent",border:"1px solid #2A2A33",borderRadius:6,padding:"7px 12px",cursor:"pointer",fontFamily:"inherit"},GN={...Wb,color:"#FF5C5C",border:"1px solid #452626"},XN=(e,t=3)=>{const n=e.split("/");if(n.length<=t)return{head:"",tail:e};const r=n.length-t;return{head:n.slice(0,r).join("/")||"/",tail:n.slice(r).join("/")}},zy=e=>e.scrollTop+e.clientHeight<e.scrollHeight-1,qN=(e,t,n)=>n<=0?-1:Math.max(0,Math.min(n-1,e+t)),Dy=({recent:e,required:t,onOpen:n,onClose:r})=>{const[o,i]=d.useState(null),[s,a]=d.useState(null),[l,c]=d.useState(!1),f=d.useRef(null),p=d.useRef(null),[m,g]=d.useState(!1),[w,x]=d.useState(!1),k=()=>{g(f.current?zy(f.current):!1)},h=()=>{x(p.current?zy(p.current):!1)},y=async b=>{try{const E=await fetch(`/api/fs${b?`?dir=${encodeURIComponent(b)}`:""}`),I=await E.json();if(!E.ok)throw new Error(I.error??`listing failed: ${E.status}`);i(I)}catch(E){a(E instanceof Error?E.message:String(E))}};d.useEffect(()=>{y()},[]),d.useEffect(()=>{const b=()=>{k(),h()};return b(),window.addEventListener("resize",b),()=>window.removeEventListener("resize",b)},[o,e]),d.useEffect(()=>{if(t)return;const b=E=>{E.key==="Escape"&&(E.stopPropagation(),r())};return window.addEventListener("keydown",b,!0),()=>window.removeEventListener("keydown",b,!0)},[t,r]);const v=b=>{var _;const E=b.key==="ArrowDown"?1:b.key==="ArrowUp"?-1:0;if(E===0&&b.key!=="Home"&&b.key!=="End")return;const I=Array.from(b.currentTarget.querySelectorAll("button"));if(I.length===0)return;const T=I.indexOf(document.activeElement),j=b.key==="Home"?0:b.key==="End"?I.length-1:qN(T,E,I.length);b.preventDefault(),(_=I[j])==null||_.focus()},S=b=>{c(!0),a(null),n(b).then(E=>{c(!1),E&&a(E)})};return u.jsx("div",{style:JN,onMouseDown:t?void 0:r,children:u.jsxs("div",{"data-testid":"project-picker",style:QN,onMouseDown:b=>b.stopPropagation(),children:[u.jsxs("div",{style:e5,children:[u.jsx("span",{style:t5,children:t?"open a project":"switch project"}),t?null:u.jsx("button",{"data-testid":"project-picker-close",style:n5,onClick:r,children:"esc close"})]}),u.jsx("div",{style:r5,children:"A project is a work directory a `ossclip produce` run wrote — the folder holding render-props.json."}),s?u.jsx("div",{"data-testid":"project-picker-error",style:o5,children:s}):null,e.length>0?u.jsxs("div",{style:{marginTop:16,flexShrink:0},children:[u.jsx("div",{style:Oy,children:"recent"}),u.jsx("div",{ref:p,className:"ossclip-scroll-list",style:w?{...By,...Vy}:By,onScroll:h,onKeyDown:v,"data-testid":"project-recent-list",children:e.map(b=>{const{head:E,tail:I}=XN(b);return u.jsxs("button",{"data-testid":"project-recent",className:"ossclip-picker-row",style:{...rd,...u5},disabled:l,onClick:()=>S(b),title:b,children:[u.jsx("span",{style:{color:"#FFE14D",flexShrink:0},children:"▸"}),u.jsxs("span",{style:c5,children:[u.jsx("span",{style:d5,children:I}),E?u.jsx("span",{style:f5,children:E}):null]})]},b)})})]}):null,u.jsxs("div",{style:l5,children:[u.jsx("div",{style:Oy,children:"browse"}),u.jsxs("div",{style:{color:"#6a6a75",fontSize:12,marginBottom:6},children:["Folders only — hidden ones are omitted, and any projects produced inside a folder show up directly as ",u.jsx("span",{style:{color:"#FFE14D"},children:"▸ .ossclip/…"})," entries."]}),o?u.jsxs(u.Fragment,{children:[u.jsxs("div",{style:i5,children:[u.jsx("span",{style:s5,title:o.dir,children:o.dir}),o.isWorkdir?u.jsx("button",{"data-testid":"project-open-current",style:a5,disabled:l,onClick:()=>S(o.dir),children:"open this project"}):null]}),u.jsxs("div",{ref:f,className:"ossclip-scroll-list",style:m?{...Wy,...Vy}:Wy,onScroll:k,onKeyDown:v,"data-testid":"project-fs-list",children:[o.parent?u.jsxs("button",{"data-testid":"project-fs-up",className:"ossclip-picker-row",style:rd,disabled:l,onClick:()=>void y(o.parent),children:[u.jsx("span",{style:{color:"#6a6a75",flexShrink:0},children:"↑"}),u.jsx("span",{style:Hy,children:".."})]}):null,o.entries.map(b=>u.jsxs("button",{"data-testid":b.isWorkdir?"project-fs-workdir":"project-fs-dir",className:`ossclip-picker-row${b.isWorkdir?" is-workdir":""}`,style:rd,disabled:l,onClick:()=>b.isWorkdir?S(b.path):void y(b.path),title:b.path,children:[u.jsx("span",{style:{flexShrink:0,color:b.isWorkdir?"#FFE14D":"#6a6a75"},children:b.isWorkdir?"▸":"▪"}),u.jsxs("span",{style:Hy,children:[b.name,b.isWorkdir?null:u.jsx("span",{style:{color:"#55555f"},children:"/"})]}),b.isWorkdir?u.jsx("span",{style:p5,children:"project"}):null]},b.path)),o.entries.length===0?u.jsx("div",{style:{color:"#6a6a75",fontSize:12,padding:"6px 8px"},children:"no folders here"}):null]})]}):u.jsx("div",{style:{color:"#6a6a75",fontSize:13},children:"loading…"})]})]})})},JN={position:"fixed",inset:0,zIndex:30,background:"rgba(5,5,8,0.6)",display:"flex",alignItems:"center",justifyContent:"center"},QN={width:620,maxWidth:"90vw",maxHeight:"82vh",boxSizing:"border-box",display:"flex",flexDirection:"column",background:"#12121A",border:"1px solid #3A3A48",borderRadius:8,padding:"20px 26px 26px",fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace"},e5={display:"flex",justifyContent:"space-between",alignItems:"center"},t5={fontSize:18,fontWeight:700,color:"#EDEDF2"},n5={fontSize:13,fontWeight:700,color:"#0B0B0E",background:"#a8c7fa",border:"none",borderRadius:4,padding:"3px 10px",cursor:"pointer"},r5={fontSize:13,color:"#6a6a75",marginTop:4},o5={marginTop:12,fontSize:13,color:"#FF5C5C"},Oy={fontSize:14,fontWeight:700,color:"#8ab4f8",marginBottom:6},i5={display:"flex",alignItems:"center",gap:10,marginBottom:6},s5={fontSize:12,color:"#9A9AA3",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},a5={flexShrink:0,fontSize:12,fontWeight:700,color:"#0B0B0E",background:"#FFE14D",border:"1px solid #FFE14D",borderRadius:6,padding:"4px 10px",cursor:"pointer"},l5={marginTop:16,display:"flex",flexDirection:"column",flex:1,minHeight:0},By={maxHeight:218,overflowY:"auto",overscrollBehavior:"contain",flexShrink:0,display:"flex",flexDirection:"column",gap:2},Wy={flex:1,minHeight:0,overflowY:"auto",overscrollBehavior:"contain",display:"flex",flexDirection:"column",gap:2},Vy={maskImage:"linear-gradient(to bottom, black calc(100% - 24px), transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black calc(100% - 24px), transparent 100%)"},rd={flexShrink:0,minHeight:34,display:"flex",alignItems:"center",gap:8,width:"100%",boxSizing:"border-box",textAlign:"left",fontFamily:"inherit",fontSize:13,lineHeight:1.4,borderRadius:6,padding:"6px 10px",cursor:"pointer",overflow:"hidden"},Hy={overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},u5={minHeight:46,alignItems:"center"},c5={display:"flex",flexDirection:"column",minWidth:0},d5={color:"#EDEDF2",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},f5={fontSize:11,color:"#6a6a75",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},p5={marginLeft:10,fontSize:11,fontWeight:700,color:"#FFE14D"},h5=({defaultOutPath:e,onCancel:t,onConfirm:n})=>{const[r,o]=d.useState(e??""),[i,s]=d.useState(!1);d.useEffect(()=>{const l=c=>{c.key==="Escape"?(c.stopPropagation(),t()):c.key==="Enter"&&!i&&(c.preventDefault(),n(r.trim()?r.trim():void 0))};return window.addEventListener("keydown",l,!0),()=>window.removeEventListener("keydown",l,!0)},[t,n,r,i]);const a=async()=>{s(!0);try{const l=await fetch("/api/pick-save-path",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({defaultPath:r||e})});if(l.ok){const c=await l.json();c.path&&o(c.path)}}catch{}finally{s(!1)}};return u.jsx("div",{style:m5,onMouseDown:t,children:u.jsxs("div",{"data-testid":"render-modal",style:g5,onMouseDown:l=>l.stopPropagation(),children:[u.jsxs("div",{style:y5,children:[u.jsx("div",{style:v5,children:"🎬 Render Master Video"}),u.jsx("button",{style:w5,onClick:t,children:"✕"})]}),u.jsx("div",{style:x5,children:"Choose where to export your rendered master cut, or keep the default location."}),u.jsxs("div",{style:{marginTop:20},children:[u.jsx("label",{style:b5,children:"Export File Destination"}),u.jsxs("div",{style:S5,children:[u.jsx("input",{"data-testid":"render-outpath-input",type:"text",value:r,onChange:l=>o(l.target.value),placeholder:"e.g. /Users/name/Movies/final-cut.mp4",style:k5,autoFocus:!0}),u.jsx("button",{"data-testid":"render-browse-btn",style:E5,onClick:a,disabled:i,title:"Open native file picker to choose destination",children:i?"Browsing…":"📁 Browse…"})]})]}),u.jsxs("div",{style:C5,children:[u.jsx("button",{style:I5,onClick:t,children:"Cancel"}),u.jsx("button",{"data-testid":"render-confirm-btn",style:T5,onClick:()=>n(r.trim()?r.trim():void 0),children:"Start Render ⚡"})]})]})})},m5={position:"fixed",inset:0,zIndex:40,background:"rgba(5,5,8,0.75)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center"},g5={width:560,maxWidth:"92vw",background:"#12121A",border:"1px solid #3A3A48",borderRadius:10,padding:"24px 28px",boxShadow:"0 20px 40px rgba(0,0,0,0.6)",fontFamily:"ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},y5={display:"flex",justifyContent:"space-between",alignItems:"center"},v5={fontSize:18,fontWeight:700,color:"#EDEDF2",letterSpacing:"-0.01em"},w5={background:"transparent",border:"none",color:"#8B8B9E",fontSize:16,cursor:"pointer",padding:"4px 8px",borderRadius:4},x5={fontSize:13,color:"#8B8B9E",marginTop:6,lineHeight:1.4},b5={display:"block",fontSize:12,fontWeight:600,color:"#C9C9D4",marginBottom:8,textTransform:"uppercase",letterSpacing:"0.04em"},S5={display:"flex",gap:8},k5={flex:1,background:"#09090D",border:"1px solid #2C2C38",borderRadius:6,padding:"10px 14px",color:"#EDEDF2",fontSize:13,fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",outline:"none"},E5={background:"#1E1E2A",border:"1px solid #3A3A48",borderRadius:6,color:"#EDEDF2",padding:"0 16px",fontSize:13,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap"},C5={display:"flex",justifyContent:"flex-end",gap:12,marginTop:24},I5={background:"transparent",border:"1px solid #2C2C38",borderRadius:6,color:"#C9C9D4",padding:"9px 18px",fontSize:13,fontWeight:600,cursor:"pointer"},T5={background:"#00E5A3",border:"none",borderRadius:6,color:"#051A13",padding:"9px 20px",fontSize:13,fontWeight:700,cursor:"pointer",boxShadow:"0 2px 10px rgba(0,229,163,0.3)"};function R5(e){switch(e){case"override":return"Project override";case"flag":case"config":return"Your default portrait"}}function j5(e){const t=/^data:([^;,]+);base64,(.+)$/s.exec(e);return t?{mimeType:t[1],data:t[2]}:null}function P5(e){switch(e){case"no-youtube":return'This project was produced without the YouTube pack. The AI thumbnail needs --youtube — run produce with it (or set "youtube": true in ~/.ossclip/config.json) and render once.';case"no-portrait":return'No portrait photo is configured — the thumbnail uses it as the likeness reference. Set "portrait" in ~/.ossclip/config.json or run produce with --portrait <path>.';case"no-key":return"GEMINI_API_KEY is not set in the environment the edit server runs in.";case"portrait-missing":return"The configured portrait photo no longer exists on disk.";default:return"The AI thumbnail is unavailable for this project."}}const Uy=60,F5=({onClose:e})=>{const[t,n]=d.useState(null),[r,o]=d.useState(null),[i,s]=d.useState(""),[a,l]=d.useState(""),[c,f]=d.useState(""),[p,m]=d.useState(null),[g,w]=d.useState(!1),[x,k]=d.useState(null),[h,y]=d.useState(null),v=d.useRef(null);d.useEffect(()=>{const j=_=>{_.key==="Escape"&&(_.stopPropagation(),e())};return window.addEventListener("keydown",j,!0),()=>window.removeEventListener("keydown",j,!0)},[e]),d.useEffect(()=>{(async()=>{try{const j=await fetch("/api/thumbnail"),_=await j.json();if(!j.ok)throw new Error(_.error??`GET /api/thumbnail failed: ${j.status}`);n(_),m(_.imageUrl),_.concept&&(s(_.concept.overlayText),l(_.concept.scene),f(_.concept.styleNotes))}catch(j){o(j instanceof Error?j.message:String(j))}})()},[]);const S=async()=>{w(!0),k(null);try{const j=await fetch("/api/thumbnail/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({concept:{scene:a,overlayText:i,styleNotes:c}})}),_=await j.json();if(!j.ok||_.ok!==!0){k(_.error??`regenerate failed: ${j.status}`);return}m(_.imageUrl??null)}catch(j){k(j instanceof Error?j.message:String(j))}finally{w(!1)}},b=j=>{n(_=>_&&{..._,portrait:j})},E=async j=>{y(null);try{const _=await new Promise(($,V)=>{const L=new FileReader;L.onload=()=>$(String(L.result)),L.onerror=()=>V(new Error("could not read the image file")),L.readAsDataURL(j)}),N=j5(_);if(N===null){y("could not read the image file");return}const W=await fetch("/api/thumbnail/portrait",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(N)}),M=await W.json();if(!W.ok||M.ok!==!0){y(M.error??`swap failed: ${W.status}`);return}b(M.portrait??null)}catch(_){y(_ instanceof Error?_.message:String(_))}},I=async()=>{y(null);try{const j=await fetch("/api/thumbnail/portrait",{method:"DELETE"}),_=await j.json();if(!j.ok||_.ok!==!0){y(_.error??`reset failed: ${j.status}`);return}b(_.portrait??null)}catch(j){y(j instanceof Error?j.message:String(j))}},T=(t==null?void 0:t.status)==="unavailable";return u.jsx("div",{style:_5,onMouseDown:e,children:u.jsxs("div",{"data-testid":"thumbnail-modal",style:M5,onMouseDown:j=>j.stopPropagation(),children:[u.jsxs("div",{style:$5,children:[u.jsx("div",{style:A5,children:"AI Thumbnail"}),u.jsx("button",{style:N5,onClick:e,"aria-label":"Close",children:"✕"})]}),r?u.jsxs("div",{"data-testid":"thumbnail-load-error",style:ad,children:["Couldn't load the thumbnail state: ",r]}):t===null?u.jsx("div",{style:od,children:"Loading…"}):T?u.jsx("div",{"data-testid":"thumbnail-unavailable",style:{...od,marginTop:12},children:P5(t.reason)}):u.jsxs(u.Fragment,{children:[t.status==="skipped"?u.jsx("div",{"data-testid":"thumbnail-skipped-note",style:{...od,marginTop:8},children:"Thumbnail was skipped at the concept approval prompt — regenerating replaces that decision."}):null,u.jsx("div",{style:L5,children:p?u.jsx("img",{"data-testid":"thumbnail-image",src:p,alt:"Current AI thumbnail",style:z5}):u.jsx("div",{"data-testid":"thumbnail-placeholder",style:D5,children:"No thumbnail generated yet — edit the concept and hit Regenerate."})}),t.portrait?u.jsxs("div",{"data-testid":"portrait-strip",style:O5,children:[u.jsx("img",{"data-testid":"portrait-preview",src:t.portrait.url,alt:"Portrait reference",style:B5}),u.jsxs("div",{style:{flex:1,minWidth:0},children:[u.jsx("div",{"data-testid":"portrait-source",style:W5,children:R5(t.portrait.source)}),u.jsx("div",{style:Ky,children:"The swap applies to this project only and is used by future renders too."})]}),u.jsx("button",{"data-testid":"portrait-swap-btn",style:Zy,onClick:()=>{var j;return(j=v.current)==null?void 0:j.click()},disabled:g,children:"Swap face…"}),t.portrait.source==="override"?u.jsx("button",{"data-testid":"portrait-reset-btn",style:Zy,onClick:()=>void I(),disabled:g,children:"Use default"}):null,u.jsx("input",{ref:v,"data-testid":"portrait-file-input",type:"file",accept:"image/png,image/jpeg,image/webp",style:{display:"none"},onChange:j=>{var N;const _=(N=j.target.files)==null?void 0:N[0];j.target.value="",_&&E(_)}})]}):null,h?u.jsx("div",{"data-testid":"portrait-error",style:ad,children:h}):null,u.jsxs("div",{style:{marginTop:16},children:[u.jsxs("label",{style:id,children:["Overlay text — the words ON the image (",Uy," chars, 4–9 words)"]}),u.jsx("input",{"data-testid":"thumbnail-overlay-input",type:"text",maxLength:Uy,value:i,onChange:j=>s(j.target.value),style:sd})]}),u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:id,children:"Scene — what the image shows"}),u.jsx("textarea",{"data-testid":"thumbnail-scene-input",value:a,onChange:j=>l(j.target.value),rows:3,style:{...sd,resize:"vertical"}})]}),u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:id,children:"Style notes — palette, lighting, mood"}),u.jsx("textarea",{"data-testid":"thumbnail-style-input",value:c,onChange:j=>f(j.target.value),rows:3,style:{...sd,resize:"vertical"}})]}),x?u.jsx("div",{"data-testid":"thumbnail-error",style:ad,children:x}):null,u.jsxs("div",{style:V5,children:[u.jsx("div",{style:Ky,children:"Regenerating replaces the video's .thumbnail.png and saves this concept for future renders."}),u.jsx("button",{"data-testid":"thumbnail-regenerate-btn",style:{...H5,...g?{opacity:.6,cursor:"default"}:{}},onClick:()=>void S(),disabled:g,children:g?"Generating…":"Regenerate"})]})]})]})})},_5={position:"fixed",inset:0,zIndex:40,background:"rgba(5,5,8,0.75)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center"},M5={width:560,maxWidth:"92vw",maxHeight:"90vh",overflowY:"auto",background:"#12121A",border:"1px solid #3A3A48",borderRadius:10,padding:"24px 28px",boxShadow:"0 20px 40px rgba(0,0,0,0.6)",fontFamily:"ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},$5={display:"flex",justifyContent:"space-between",alignItems:"center"},A5={fontSize:18,fontWeight:700,color:"#EDEDF2",letterSpacing:"-0.01em"},N5={background:"transparent",border:"none",color:"#8B8B9E",fontSize:16,cursor:"pointer",padding:"4px 8px",borderRadius:4},od={fontSize:13,color:"#8B8B9E",marginTop:6,lineHeight:1.4},L5={marginTop:16,border:"1px solid #2C2C38",borderRadius:6,background:"#09090D",aspectRatio:"16 / 9",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden"},z5={width:"100%",height:"100%",objectFit:"contain"},D5={color:"#8B8B9E",fontSize:13,padding:16,textAlign:"center"},O5={display:"flex",alignItems:"center",gap:12,marginTop:12,padding:"10px 12px",border:"1px solid #2C2C38",borderRadius:6,background:"#09090D"},B5={width:44,height:44,borderRadius:6,objectFit:"cover",flexShrink:0,border:"1px solid #2C2C38"},W5={fontSize:12,fontWeight:600,color:"#C9C9D4",marginBottom:2},Zy={background:"transparent",border:"1px solid #3A3A48",borderRadius:6,color:"#C9C9D4",padding:"7px 12px",fontSize:12,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap"},id={display:"block",fontSize:12,fontWeight:600,color:"#C9C9D4",marginBottom:8,textTransform:"uppercase",letterSpacing:"0.04em"},sd={width:"100%",boxSizing:"border-box",background:"#09090D",border:"1px solid #2C2C38",borderRadius:6,padding:"10px 14px",color:"#EDEDF2",fontSize:13,fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",outline:"none"},ad={marginTop:12,color:"#FF5C5C",fontSize:13,fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",whiteSpace:"pre-wrap"},V5={display:"flex",justifyContent:"space-between",alignItems:"center",gap:12,marginTop:20},Ky={fontSize:12,color:"#8B8B9E",lineHeight:1.4},H5={background:"#00E5A3",border:"none",borderRadius:6,color:"#051A13",padding:"9px 20px",fontSize:13,fontWeight:700,cursor:"pointer",whiteSpace:"nowrap",boxShadow:"0 2px 10px rgba(0,229,163,0.3)"},U5=({cutlist:e,edits:t,onClose:n})=>{d.useEffect(()=>{const i=s=>{s.key==="Escape"&&(s.stopPropagation(),n())};return window.addEventListener("keydown",i,!0),()=>window.removeEventListener("keydown",i,!0)},[n]);const r=u3(e),o=t.doc.cleanup.kept.length;return u.jsx("div",{style:Z5,onMouseDown:n,children:u.jsxs("div",{"data-testid":"cleanup-modal",style:K5,onMouseDown:i=>i.stopPropagation(),children:[u.jsxs("div",{style:Y5,children:[u.jsx("div",{style:G5,children:"Cleanup"}),u.jsx("button",{style:X5,onClick:n,"aria-label":"Close",children:"✕"})]}),u.jsx("div",{style:Yy,children:"What produce removed, by reason. Untick a category to keep it — the preview plays your choice immediately and the next render applies it. Individual removals can be kept by clicking their seam on the timeline."}),r.length===0?u.jsx("div",{"data-testid":"cleanup-empty",style:{...Yy,marginTop:16},children:"This run proposed no removals to review."}):u.jsx("div",{style:{marginTop:16},children:r.map(i=>{const s=t.doc.cleanup.reasons[i.reason]!==!1;return u.jsxs("label",{"data-testid":`cleanup-reason-${i.reason}`,style:q5,children:[u.jsx("input",{type:"checkbox","data-testid":`cleanup-checkbox-${i.reason}`,checked:s,onChange:a=>t.setReasonEnabled(i.reason,a.target.checked)}),u.jsx("span",{style:{...J5,background:bh[i.reason]}}),u.jsxs("span",{style:{...Q5,...s?{}:{color:"#8B8B9E"}},children:[l3[i.reason]," — ",i.count," removal",i.count===1?"":"s"," ","· ",i.seconds.toFixed(1),"s"]}),s?null:u.jsx("span",{"data-testid":`cleanup-declined-${i.reason}`,style:eL,children:"kept — live in the preview"})]},i.reason)})}),o>0?u.jsxs("div",{"data-testid":"cleanup-kept-note",style:{...tL,marginTop:12},children:[o," individual removal",o===1?"":"s"," kept via timeline seams."]}):null]})})},Z5={position:"fixed",inset:0,zIndex:40,background:"rgba(5,5,8,0.75)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center"},K5={width:460,maxWidth:"92vw",maxHeight:"90vh",overflowY:"auto",background:"#12121A",border:"1px solid #3A3A48",borderRadius:10,padding:"24px 28px",boxShadow:"0 20px 40px rgba(0,0,0,0.6)",fontFamily:"ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},Y5={display:"flex",justifyContent:"space-between",alignItems:"center"},G5={fontSize:18,fontWeight:700,color:"#EDEDF2",letterSpacing:"-0.01em"},X5={background:"transparent",border:"none",color:"#8B8B9E",fontSize:16,cursor:"pointer",padding:"4px 8px",borderRadius:4},Yy={fontSize:13,color:"#8B8B9E",marginTop:6,lineHeight:1.4},q5={display:"flex",alignItems:"center",gap:10,padding:"8px 10px",border:"1px solid #2C2C38",borderRadius:6,background:"#09090D",marginBottom:8,cursor:"pointer"},J5={width:10,height:10,borderRadius:2,flexShrink:0},Q5={fontSize:13,color:"#EDEDF2",flex:1,minWidth:0},eL={fontSize:11,color:"#FFE14D",whiteSpace:"nowrap"},tL={fontSize:12,color:"#8B8B9E",lineHeight:1.4},Gy=3,Xy=5,ld=500;function nL(e){return e.split(/\s+/).filter(t=>t.replace(/^#+/,"").length>0).map(t=>t.startsWith("#")?t:`#${t}`)}function rL(e){return e.map(t=>t.startsWith("#")?t:`#${t}`).join(" ")}function Vb(e){return e.split(",").map(t=>t.trim()).filter(t=>t.length>0)}function Hb(e){return e.join(", ")}function oL(e){return Hb(Vb(e)).length}function iL(e){const t=Math.max(0,Math.floor(e));return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`}function sL(e){return`[${{browse:"Browse",search:"Search",benefit:"Benefit",alt:"Alt"}[e]}]`}const aL="This run never generated YouTube metadata. Run produce with --youtube (and an LLM provider) once — the pack lands here afterwards.",lL=({onClose:e})=>{var W;const[t,n]=d.useState(null),[r,o]=d.useState(null),[i,s]=d.useState([]),[a,l]=d.useState(null),[c,f]=d.useState(""),[p,m]=d.useState(""),[g,w]=d.useState(""),[x,k]=d.useState(null),[h,y]=d.useState(null),[v,S]=d.useState(null),[b,E]=d.useState(!1),[I,T]=d.useState(null);d.useEffect(()=>{const M=$=>{$.key==="Escape"&&($.stopPropagation(),e())};return window.addEventListener("keydown",M,!0),()=>window.removeEventListener("keydown",M,!0)},[e]);const j=d.useCallback(async()=>{try{const M=await fetch("/api/youtube"),$=await M.json();if(!M.ok)throw new Error($.error??`GET /api/youtube failed: ${M.status}`);n($),$.pack&&(s($.pack.titles),l($.pack.titleAngles??null),f($.pack.description),m(rL($.pack.hashtags)),w(Hb($.pack.tags)),k($.pack.hook60??null),y($.pack.linkedinPost??null),S($.pack.communityPost??null))}catch(M){o(M instanceof Error?M.message:String(M))}},[]);d.useEffect(()=>{j()},[j]);const _=async()=>{var M;E(!0),T(null);try{const $=await fetch("/api/youtube",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({pack:{titles:i,...a!==null?{titleAngles:a}:{},description:c,hashtags:nL(p),tags:Vb(g),...(M=t==null?void 0:t.pack)!=null&&M.chapters?{chapters:t.pack.chapters}:{},...x!==null?{hook60:x}:{},...h!==null?{linkedinPost:h}:{},...v!==null?{communityPost:v}:{}}})}),V=await $.json();if(!$.ok||V.ok!==!0){T(V.error??`save failed: ${$.status}`);return}await j()}catch($){T($ instanceof Error?$.message:String($))}finally{E(!1)}},N=oL(g);return u.jsx("div",{style:uL,onMouseDown:e,children:u.jsxs("div",{"data-testid":"youtube-modal",style:cL,onMouseDown:M=>M.stopPropagation(),children:[u.jsxs("div",{style:dL,children:[u.jsx("div",{style:fL,children:"YouTube SEO metadata"}),u.jsx("button",{style:pL,onClick:e,"aria-label":"Close",children:"✕"})]}),r?u.jsxs("div",{"data-testid":"youtube-load-error",style:Qy,children:["Couldn't load the YouTube pack: ",r]}):t===null?u.jsx("div",{style:qy,children:"Loading…"}):t.available?u.jsxs(u.Fragment,{children:[u.jsxs("div",{style:{marginTop:16},children:[u.jsxs("label",{style:Mr,children:["Title options (",Gy,"–",Xy,", up to 100 chars each)"]}),i.map((M,$)=>u.jsxs("div",{style:hL,children:[(a==null?void 0:a[$])!==void 0?u.jsx("span",{"data-testid":`youtube-title-angle-${$}`,style:mL,children:sL(a[$])}):null,u.jsx("input",{"data-testid":`youtube-title-input-${$}`,type:"text",maxLength:100,value:M,onChange:V=>s(L=>L.map((A,R)=>R===$?V.target.value:A)),style:uo}),u.jsx("button",{"data-testid":`youtube-title-remove-${$}`,style:Jy,disabled:i.length<=Gy,onClick:()=>{s(V=>V.filter((L,A)=>A!==$)),l(V=>V&&V.filter((L,A)=>A!==$))},"aria-label":`Remove title ${$+1}`,children:"✕"})]},$)),u.jsx("button",{"data-testid":"youtube-title-add",style:Jy,disabled:i.length>=Xy,onClick:()=>{s(M=>[...M,""]),l(M=>M&&[...M,"alt"])},children:"+ Add title"})]}),u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:Mr,children:"Description"}),u.jsx("textarea",{"data-testid":"youtube-description-input",value:c,onChange:M=>f(M.target.value),rows:6,style:{...uo,resize:"vertical"}})]}),u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:Mr,children:"Hashtags — space-separated, # added if missing"}),u.jsx("input",{"data-testid":"youtube-hashtags-input",type:"text",value:p,onChange:M=>m(M.target.value),style:uo})]}),u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:Mr,children:"Tags — comma-separated"}),u.jsx("input",{"data-testid":"youtube-tags-input",type:"text",value:g,onChange:M=>w(M.target.value),style:uo}),u.jsxs("div",{"data-testid":"youtube-tags-counter",style:{...gL,...N>ld?{color:"#FFB84D"}:{}},children:[N," / ",ld,N>ld?" — tags past the budget are dropped on save":""]})]}),(W=t.pack)!=null&&W.chapters&&t.pack.chapters.length>0?u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:Mr,children:"Chapters (read-only — embedded in the description on save/render)"}),u.jsx("div",{"data-testid":"youtube-chapters",style:yL,children:t.pack.chapters.map((M,$)=>u.jsxs("div",{children:[iL(M.atSec)," ",M.title]},$))}),u.jsx("div",{style:ev,children:"Timestamps are measured from the actual edit, so they are not hand-editable here; the .youtube.md splices them into the description's Timestamps block for you."})]}):null,x!==null?u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:Mr,children:"First-60s hook strategy (for you — never uploaded)"}),u.jsx("textarea",{"data-testid":"youtube-hook60-input",value:x,onChange:M=>k(M.target.value),rows:3,style:{...uo,resize:"vertical"}})]}):null,h!==null?u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:Mr,children:"LinkedIn post"}),u.jsx("textarea",{"data-testid":"youtube-linkedin-input",value:h,onChange:M=>y(M.target.value),rows:6,style:{...uo,resize:"vertical"}})]}):null,v!==null?u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:Mr,children:"Community post"}),u.jsx("textarea",{"data-testid":"youtube-community-input",value:v,onChange:M=>S(M.target.value),rows:3,style:{...uo,resize:"vertical"}})]}):null,I?u.jsx("div",{"data-testid":"youtube-error",style:Qy,children:I}):null,u.jsxs("div",{style:vL,children:[u.jsx("div",{style:ev,children:"Saves for future renders and rewrites the .youtube.md file now. Delete youtube-pack-approved.json in the workdir to let the AI regenerate."}),u.jsx("button",{"data-testid":"youtube-save-btn",style:{...wL,...b?{opacity:.6,cursor:"default"}:{}},onClick:()=>void _(),disabled:b,children:b?"Saving…":"Save"})]})]}):u.jsx("div",{"data-testid":"youtube-unavailable",style:{...qy,marginTop:12},children:aL})]})})},uL={position:"fixed",inset:0,zIndex:40,background:"rgba(5,5,8,0.75)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center"},cL={width:620,maxWidth:"92vw",maxHeight:"90vh",overflowY:"auto",background:"#12121A",border:"1px solid #3A3A48",borderRadius:10,padding:"24px 28px",boxShadow:"0 20px 40px rgba(0,0,0,0.6)",fontFamily:"ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},dL={display:"flex",justifyContent:"space-between",alignItems:"center"},fL={fontSize:18,fontWeight:700,color:"#EDEDF2",letterSpacing:"-0.01em"},pL={background:"transparent",border:"none",color:"#8B8B9E",fontSize:16,cursor:"pointer",padding:"4px 8px",borderRadius:4},qy={fontSize:13,color:"#8B8B9E",marginTop:6,lineHeight:1.4},Mr={display:"block",fontSize:12,fontWeight:600,color:"#C9C9D4",marginBottom:8,textTransform:"uppercase",letterSpacing:"0.04em"},uo={width:"100%",boxSizing:"border-box",background:"#09090D",border:"1px solid #2C2C38",borderRadius:6,padding:"10px 14px",color:"#EDEDF2",fontSize:13,fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",outline:"none"},hL={display:"flex",gap:8,alignItems:"center",marginBottom:8},mL={fontSize:11,fontWeight:700,color:"#8B8B9E",fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",whiteSpace:"nowrap",minWidth:62},Jy={fontSize:12,fontWeight:600,color:"#C9C9D4",background:"#1A1A21",border:"1px solid #2A2A33",borderRadius:6,padding:"6px 10px",cursor:"pointer",whiteSpace:"nowrap"},gL={marginTop:6,fontSize:12,color:"#8B8B9E",fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace"},yL={border:"1px solid #2C2C38",borderRadius:6,background:"#09090D",padding:"10px 14px",color:"#C9C9D4",fontSize:13,fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",lineHeight:1.6},Qy={marginTop:12,color:"#FF5C5C",fontSize:13,fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",whiteSpace:"pre-wrap"},vL={display:"flex",justifyContent:"space-between",alignItems:"center",gap:12,marginTop:20},ev={fontSize:12,color:"#8B8B9E",lineHeight:1.4,marginTop:6},wL={background:"#00E5A3",border:"none",borderRadius:6,color:"#051A13",padding:"9px 20px",fontSize:13,fontWeight:700,cursor:"pointer",whiteSpace:"nowrap",boxShadow:"0 2px 10px rgba(0,229,163,0.3)"};function xL(e){switch(e){case"no-destination":return"This workdir has no cover.json and no recorded --out, so there is nowhere to write a cover. Run `ossclip produce` once with an output path, or `ossclip cover --out <path>` from a terminal.";default:return"The cover is unavailable for this project."}}function bL(e){const t=e.trim().replace(/\s+/g," "),n=z$(t);return{preview:n,trimmed:n!==t}}function Ub(e){if(e.trim()==="")return{ok:!0};const t=Number(e);return!Number.isFinite(t)||t<0?{ok:!1,message:`"${e}" is not a timestamp in seconds — 0 or more, please.`}:{ok:!0,atSec:t}}function tv(e){return e!==null&&e.frame.sourceVideo!==null?{enabled:!0}:{enabled:!1,note:"There is no record of the original take for this project, so only the finished video can be read. The next `ossclip produce` records one."}}function SL(e){return e==="final"?"A frame from the finished video carries the burned-in captions, graphics and watermark.":"The original take — clean, framed the way produce framed it. Needs a cover.json."}function nv(e){return{...e.typed===(e.persistedText??"")?{}:{text:e.typed},...e.atSec===void 0?{}:{atSec:e.atSec},from:e.from}}function kL(e){if(e.from==="final")return{atSec:e.playheadOutSec,note:null};const t=new Ju(e.cutlist);if(t.spans.length===0)return{atSec:e.playheadOutSec,note:`Couldn't convert to the original take's clock — this render recorded no cutlist, so ${e.playheadOutSec.toFixed(1)}s of the finished video is being used as-is.`};const n=t.toSource(e.playheadOutSec);return{atSec:n,note:`${e.playheadOutSec.toFixed(1)}s of the finished video is ${n.toFixed(1)}s of the original take.`}}function EL(e){if(e.prevFrom===e.nextFrom)return null;const t=Ub(e.atRaw);if(!t.ok||t.atSec===void 0)return null;const n=new Ju(e.cutlist);if(n.spans.length===0)return{atRaw:e.atRaw,note:"Couldn't convert between clocks — this render recorded no cutlist; the seconds are unchanged."};if(e.nextFrom==="source"){const i=n.toSource(t.atSec);return{atRaw:i.toFixed(2),note:`${t.atSec.toFixed(1)}s of the finished video is ${i.toFixed(1)}s of the original take.`}}const r=n.toOutput(t.atSec);if(r!==null)return{atRaw:r.toFixed(2),note:`${t.atSec.toFixed(1)}s of the original take is ${r.toFixed(1)}s of the finished video.`};const o=n.toOutputClamped(t.atSec);return{atRaw:o.toFixed(2),note:`${t.atSec.toFixed(1)}s of the original take was cut from the finished video — snapped to the nearest kept moment, ${o.toFixed(1)}s.`}}const CL=({onClose:e,playheadSec:t})=>{const[n,r]=d.useState(null),[o,i]=d.useState(null),[s,a]=d.useState(""),[l,c]=d.useState(""),[f,p]=d.useState("final"),[m,g]=d.useState(null),[w,x]=d.useState(!1),[k,h]=d.useState(null),[y,v]=d.useState([]),[S,b]=d.useState([]),[E,I]=d.useState(null),[T,j]=d.useState(null);d.useEffect(()=>{const L=A=>{A.key==="Escape"&&(A.stopPropagation(),e())};return window.addEventListener("keydown",L,!0),()=>window.removeEventListener("keydown",L,!0)},[e]),d.useEffect(()=>{(async()=>{try{const L=await fetch("/api/cover"),A=await L.json();if(!L.ok)throw new Error(A.error??`GET /api/cover failed: ${L.status}`);r(A),g(A.imageUrl),b(A.cutlist??[]),A.provenance&&(a(A.provenance.text),tv(A.provenance).enabled&&p(A.provenance.frame.source))}catch(L){i(L instanceof Error?L.message:String(L))}})()},[]);const _=Ub(l),N=bL(s),W=tv((n==null?void 0:n.provenance)??null),M=async()=>{var L;if(_.ok){x(!0),h(null),v([]);try{const A=await fetch("/api/cover/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(nv({typed:s,persistedText:((L=n==null?void 0:n.provenance)==null?void 0:L.text)??null,atSec:_.atSec,from:f}))}),R=await A.json();if(!A.ok||R.ok!==!0){h(R.error??`regenerate failed: ${A.status}`);return}if(g(R.imageUrl??null),j(null),v(R.notes??[]),R.provenance){const C=R.provenance;r(P=>P&&{...P,provenance:C,status:"ready"}),a(C.text)}}catch(A){h(A instanceof Error?A.message:String(A))}finally{x(!1)}}},$=async()=>{var L;if(_.ok){x(!0),h(null),v([]);try{const A=await fetch("/api/cover/preview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(nv({typed:s,persistedText:((L=n==null?void 0:n.provenance)==null?void 0:L.text)??null,atSec:_.atSec,from:f}))}),R=await A.json();if(!A.ok||R.ok!==!0){h(R.error??`preview failed: ${A.status}`);return}j(R.previewImageUrl??null),v(R.notes??[])}catch(A){h(A instanceof Error?A.message:String(A))}finally{x(!1)}}},V=(n==null?void 0:n.status)==="unavailable";return u.jsx("div",{style:IL,onMouseDown:e,children:u.jsxs("div",{"data-testid":"cover-modal",style:TL,onMouseDown:L=>L.stopPropagation(),children:[u.jsxs("div",{style:RL,children:[u.jsx("div",{style:jL,children:"Cover image"}),u.jsx("button",{style:PL,onClick:e,"aria-label":"Close",children:"✕"})]}),o?u.jsxs("div",{"data-testid":"cover-load-error",style:ud,children:["Couldn't load the cover state: ",o]}):n===null?u.jsx("div",{style:rv,children:"Loading…"}):V?u.jsx("div",{"data-testid":"cover-unavailable",style:{...rv,marginTop:12},children:xL(n.reason)}):u.jsxs(u.Fragment,{children:[u.jsx("div",{style:FL,children:T?u.jsx("img",{"data-testid":"cover-image",src:T,alt:"Cover preview",style:ov}):m?u.jsx("img",{"data-testid":"cover-image",src:m,alt:"Current cover",style:ov}):u.jsx("div",{"data-testid":"cover-placeholder",style:ML,children:"No cover on disk yet — set a headline and hit Apply."})}),T?u.jsx("div",{"data-testid":"cover-preview-badge",style:_L,children:"Preview — not saved. The cover on disk is unchanged; Apply writes it for real."}):null,u.jsxs("div",{style:{marginTop:16},children:[u.jsxs("label",{style:iv,children:["Headline — at most ",cb," words (§35)"]}),u.jsx("input",{"data-testid":"cover-text-input",type:"text",value:s,onChange:L=>a(L.target.value),style:sv}),N.trimmed?u.jsxs("div",{"data-testid":"cover-headline-preview",style:{...co,marginTop:6},children:["Will render as: “",N.preview,"”"]}):null]}),u.jsxs("div",{style:{marginTop:16},children:[u.jsx("label",{style:iv,children:"Frame"}),u.jsxs("div",{style:av,children:[u.jsx("button",{"data-testid":"cover-playhead-btn",style:nl,onClick:()=>{const L=kL({playheadOutSec:t(),from:f,cutlist:S});c(L.atSec.toFixed(2)),I(L.note)},disabled:w,children:"Use current playhead"}),u.jsx("input",{"data-testid":"cover-at-input",type:"text",inputMode:"decimal",placeholder:"seconds — blank keeps the current still",value:l,onChange:L=>{c(L.target.value),I(null)},style:{...sv,flex:1}})]}),_.ok?null:u.jsx("div",{"data-testid":"cover-at-error",style:ud,children:_.message}),E?u.jsx("div",{"data-testid":"cover-clock-note",style:{...co,marginTop:6},children:E}):null,u.jsx("div",{style:{...av,marginTop:10},children:["final","source"].map(L=>{const A=L==="source"&&!W.enabled;return u.jsx("button",{"data-testid":`cover-from-${L}`,style:{...nl,...f===L?$L:{},...A?{opacity:.5,cursor:"default"}:{}},onClick:()=>{const R=EL({atRaw:l,prevFrom:f,nextFrom:L,cutlist:S});R!==null&&(c(R.atRaw),I(R.note)),p(L)},disabled:w||A,"aria-pressed":f===L,children:L==="final"?"Finished video":"Original take"},L)})}),u.jsx("div",{"data-testid":"cover-from-note",style:{...co,marginTop:6},children:SL(f)}),W.note?u.jsx("div",{"data-testid":"cover-from-disabled-note",style:{...co,marginTop:4},children:W.note}):null,u.jsx("div",{style:{...co,marginTop:4},children:"Leave the seconds blank and the cover re-uses the still it already has — no frame extraction at all, and this choice does not apply."})]}),y.length>0?u.jsx("div",{"data-testid":"cover-notes",style:{...co,marginTop:12},children:y.map(L=>u.jsx("div",{children:L},L))}):null,k?u.jsx("div",{"data-testid":"cover-error",style:ud,children:k}):null,u.jsxs("div",{style:AL,children:[u.jsx("div",{style:co,children:n.outPath?`Writes ${n.outPath} — the video itself is untouched.`:"The video itself is untouched."}),u.jsxs("div",{style:{display:"flex",gap:8},children:[u.jsx("button",{"data-testid":"cover-cancel-btn",style:nl,onClick:e,children:"Cancel"}),u.jsx("button",{"data-testid":"cover-preview-btn",style:{...nl,...w||!_.ok?{opacity:.6,cursor:"default"}:{}},onClick:()=>void $(),disabled:w||!_.ok,children:"Preview"}),u.jsx("button",{"data-testid":"cover-apply-btn",style:{...NL,...w||!_.ok?{opacity:.6,cursor:"default"}:{}},onClick:()=>void M(),disabled:w||!_.ok,children:w?"Rebuilding…":"Apply"})]})]})]})]})})},IL={position:"fixed",inset:0,zIndex:40,background:"rgba(5,5,8,0.75)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center"},TL={width:560,maxWidth:"92vw",maxHeight:"90vh",overflowY:"auto",background:"#12121A",border:"1px solid #3A3A48",borderRadius:10,padding:"24px 28px",boxShadow:"0 20px 40px rgba(0,0,0,0.6)",fontFamily:"ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},RL={display:"flex",justifyContent:"space-between",alignItems:"center"},jL={fontSize:18,fontWeight:700,color:"#EDEDF2",letterSpacing:"-0.01em"},PL={background:"transparent",border:"none",color:"#8B8B9E",fontSize:16,cursor:"pointer",padding:"4px 8px",borderRadius:4},rv={fontSize:13,color:"#8B8B9E",marginTop:6,lineHeight:1.4},FL={marginTop:16,border:"1px solid #2C2C38",borderRadius:6,background:"#09090D",maxHeight:320,minHeight:180,display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden"},ov={maxWidth:"100%",maxHeight:320,objectFit:"contain"},_L={marginTop:8,padding:"6px 10px",borderRadius:6,border:"1px solid #8a6d1a",background:"rgba(255,196,0,0.08)",color:"#FFC400",fontSize:12,fontWeight:600,lineHeight:1.4},ML={color:"#8B8B9E",fontSize:13,padding:16,textAlign:"center"},iv={display:"block",fontSize:12,fontWeight:600,color:"#C9C9D4",marginBottom:8,textTransform:"uppercase",letterSpacing:"0.04em"},sv={width:"100%",boxSizing:"border-box",background:"#09090D",border:"1px solid #2C2C38",borderRadius:6,padding:"10px 14px",color:"#EDEDF2",fontSize:13,fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",outline:"none"},av={display:"flex",alignItems:"center",gap:8},nl={background:"transparent",border:"1px solid #3A3A48",borderRadius:6,color:"#C9C9D4",padding:"9px 12px",fontSize:12,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap"},$L={borderColor:"#5b8cff",color:"#EDEDF2"},ud={marginTop:12,color:"#FF5C5C",fontSize:13,fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",whiteSpace:"pre-wrap"},AL={display:"flex",justifyContent:"space-between",alignItems:"center",gap:12,marginTop:20},co={fontSize:12,color:"#8B8B9E",lineHeight:1.4,wordBreak:"break-all"},NL={background:"#00E5A3",border:"none",borderRadius:6,color:"#051A13",padding:"9px 20px",fontSize:13,fontWeight:700,cursor:"pointer",whiteSpace:"nowrap",boxShadow:"0 2px 10px rgba(0,229,163,0.3)"};function rl(e){for(let t=e.length-1;t>=0;t--){const n=/^\s*(\d{1,3})%\s*$/.exec(e[t]);if(n)return Math.min(100,Number(n[1]))}return null}function LL(e){const t=n=>{for(let r=e.length-1;r>=0;r--)if(n.test(e[r]))return e[r]};return[t(/^▸ producing scenes/),t(/^▸ llm:/)].filter(n=>n!==void 0)}function lv(e,t){const n=Math.max(0,Math.floor((t-e)/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,"0")}`}function zL(e,t){return e?{load:e,notifyDiscard:t}:{load:null,notifyDiscard:!1}}function DL(e,t){return e===null||e===t}function OL(e){const t=e.lines??[];return e.running?{running:!0,lines:t,startedAt:e.startedAt,resumed:!0}:e.exitCode===null||t.length===0?null:e.exitCode===0?{running:!1,lines:t,succeeded:!0,startedAt:e.startedAt,resumed:!0}:{running:!1,lines:t,failed:e.exitCode,cancelled:e.cancelled,startedAt:e.startedAt,resumed:!0}}function BL(e){if(e.dirty){if(e.renderRunning){e.onBlocked();return}e.save().catch(t=>e.onSaveError(t instanceof Error?t.message:String(t)))}}function WL(e,t,n=r=>r){const{cues:r}=Pf(e,t);return mh(r,t.splits).filter(i=>{var s;return((s=t.scenes[i.id])==null?void 0:s.hidden)===!0}).map(i=>({...i,startSec:n(i.startSec),endSec:n(i.endSec)}))}const uv=e=>({...e,...$A(e)}),cv=e=>{const t=Ab(e);e.forEach((n,r)=>{console.warn(`ossclip §137: dropped caption edit ${JSON.stringify(n)} — ${t[r]}`)})},VL=()=>{const e=_A(),t=d.useRef(e.dirty);t.current=e.dirty;const[n,r]=d.useState(!1),[o,i]=d.useState(!1),[s,a]=d.useState(null),[l,c]=d.useState(null),[f,p]=d.useState([]),[m,g]=d.useState([]),w=d.useRef(e.doc.captions);w.current=e.doc.captions;const[x,k]=d.useState(null),[h,y]=d.useState(null),[v,S]=d.useState(null),[b,E]=d.useState([]),[I,T]=d.useState(null),[j,_]=d.useState(null),[N,W]=d.useState(!1),[M,$]=d.useState(1),[V,L]=d.useState(null),[A,R]=d.useState(!1),[C,P]=d.useState([]),[z,O]=d.useState(null),D=d.useRef(null),[Z,H]=d.useState(!1),[G,B]=d.useState(null),[X,ae]=d.useState(!1),[oe,Y]=d.useState(),q=d.useRef(null);d.useEffect(()=>()=>{q.current!==null&&window.clearInterval(q.current)},[]);const[xe,Se]=d.useState(null),de=d.useRef(null),K=d.useRef(null),ee=d.useRef(null),ue=d.useRef(null),[se,Re]=d.useState(null),[Ie,De]=d.useState(null),Qe=d.useCallback(J=>{var Oe;if(ee.current=J,De(J),(Oe=ue.current)==null||Oe.disconnect(),ue.current=null,!J)return;const te=()=>Re({w:Math.max(0,J.clientWidth-dd*2),h:Math.max(0,J.clientHeight-dd*2)});te();const ce=new ResizeObserver(te);ce.observe(J),ue.current=ce},[]),[ke,Ee]=d.useState(1),je=d.useRef(ke);je.current=ke;const Me=d.useRef(null),Le=d.useCallback((J,te)=>{const ce=ee.current,Oe=Math.min(8,Math.max(.25,J)),mt=je.current;if(ce&&Oe!==mt){const It=ce.getBoundingClientRect();Me.current={prev:mt,ax:((te==null?void 0:te.x)??It.left+It.width/2)-It.left,ay:((te==null?void 0:te.y)??It.top+It.height/2)-It.top,sl:ce.scrollLeft,st:ce.scrollTop}}Ee(Oe)},[]);d.useLayoutEffect(()=>{const J=ee.current,te=Me.current;if(!J||!te)return;Me.current=null;const ce=ke/te.prev;J.scrollLeft=(te.sl+te.ax)*ce-te.ax,J.scrollTop=(te.st+te.ay)*ce-te.ay},[ke]),d.useEffect(()=>{const J=Ie;if(!J)return;const te=ce=>{(ce.ctrlKey||ce.metaKey)&&(ce.preventDefault(),Le(je.current*Math.exp(-ce.deltaY*.01),{x:ce.clientX,y:ce.clientY}))};return J.addEventListener("wheel",te,{passive:!1}),()=>J.removeEventListener("wheel",te)},[Ie,Le]);const dt=d.useRef(null);d.useEffect(()=>{const J=ce=>{const Oe=dt.current,mt=ee.current;!Oe||!mt||(mt.scrollLeft=Oe.sl-(ce.clientX-Oe.x),mt.scrollTop=Oe.st-(ce.clientY-Oe.y))},te=()=>{dt.current=null};return window.addEventListener("mousemove",J),window.addEventListener("mouseup",te),()=>{window.removeEventListener("mousemove",J),window.removeEventListener("mouseup",te)}},[]);const[Kt,gn]=d.useState(!1),[Zn,Mt]=d.useState(()=>{const J=Number(window.localStorage.getItem(fv));return Number.isFinite(J)&&J>0?pv(J):300}),Kn=d.useRef(null);d.useEffect(()=>{const J=ce=>{const Oe=Kn.current;Oe&&Mt(pv(Oe.startW+(ce.clientX-Oe.startX)))},te=()=>{Kn.current&&(Kn.current=null,Mt(ce=>(window.localStorage.setItem(fv,String(ce)),ce)))};return window.addEventListener("mousemove",J),window.addEventListener("mouseup",te),()=>{window.removeEventListener("mousemove",J),window.removeEventListener("mouseup",te)}},[]);const[Yt,yn]=d.useState(!1),[Gt,ft]=d.useState(!1),[vn,Ot]=d.useState(!1),[_n,Yn]=d.useState(!1),[Mn,Tr]=d.useState(!1),[ur,cr]=d.useState(!1);d.useEffect(()=>{if(!_n)return;const J=te=>{te.key==="Escape"&&(te.stopPropagation(),Yn(!1))};return window.addEventListener("keydown",J,!0),()=>window.removeEventListener("keydown",J,!0)},[_n]);const[F,U]=d.useState(null),[re,fe]=d.useState(null),[we,be]=d.useState(!0),Pe=d.useCallback(J=>{const te=Bj({rate:M,playing:N},J);$(te.rate);const ce=K.current;ce&&(te.playing&&!N&&ce.play(),!te.playing&&N&&ce.pause())},[M,N]);d.useEffect(()=>{const J=K.current;if(!J)return;const te=()=>W(!0),ce=()=>W(!1);return J.addEventListener("play",te),J.addEventListener("pause",ce),()=>{J.removeEventListener("play",te),J.removeEventListener("pause",ce)}});const $e=d.useCallback(()=>{if(q.current!==null)return;const J=window.setInterval(()=>{(async()=>{try{const ce=await(await fetch("/api/render/status")).json();if(ce.running||ce.exitCode===null){B(Oe=>({running:ce.running,lines:ce.lines??[],startedAt:ce.startedAt??(Oe==null?void 0:Oe.startedAt)}));return}if(q.current!==null&&(window.clearInterval(q.current),q.current=null),ce.exitCode===0){const mt=await(await fetch("/api/production")).json(),It=uv(mt.renderProps);y(It),H(!!mt.canRender);const zo=zL(mt.overrides,t.current);if(zo.load){const Gn=w.current,wn=yy(zo.load,It);e.load(wn.doc),cv(wn.unresolved),p(wn.unresolved);const xn=LA(NA(Gn,wn.doc.captions));for(const ac of xn)console.warn(`ossclip §137: ${ac}`);g(xn)}else p([]),g([]);zo.notifyDiscard&&r(!0),B(Gn=>({running:!1,lines:ce.lines??[],succeeded:!0,startedAt:ce.startedAt??(Gn==null?void 0:Gn.startedAt),finishedAt:Date.now()})),fetch("/api/reveal-output",{method:"POST"}).catch(()=>{})}else B({running:!1,lines:ce.lines??[],failed:ce.exitCode,cancelled:ce.cancelled})}catch{q.current===null&&$e()}})()},1e3);q.current=J},[]),He=d.useCallback(async()=>{const J=await fetch("/api/production");if(!J.ok)throw new Error(`GET /api/production failed: ${J.status}`);const te=await J.json();if(te.defaultOutPath&&Y(te.defaultOutPath),P(te.recent??[]),te.noWorkdir){p([]),g([]),R(!0);return}const ce=uv(te.renderProps);y(ce);const Oe=D.current,mt=te.workdir??null;D.current=mt,O(mt),H(!!te.canRender);const It=yy(te.overrides,ce);e.load(It.doc),cv(It.unresolved),p(It.unresolved),g([]),fetch("/api/usage").then(async xn=>S(xn.ok?await xn.json():null)).catch(()=>S(null)),fetch("/api/cleanup").then(async xn=>E(xn.ok?(await xn.json()).cutlist??[]:[])).catch(()=>E([]));const Gn=await(await fetch("/api/render/status")).json(),wn=DL(Oe,mt)?OL(Gn):null;wn&&(B(wn),wn.running?$e():be(!1))},[$e]);d.useEffect(()=>{He().catch(J=>T(J instanceof Error?J.message:String(J)))},[]);const ze=d.useCallback(async J=>{if(e.dirty&&!window.confirm("Unsaved edits will be lost — switch projects anyway?"))return null;try{const te=await fetch("/api/workdir",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:J})}),ce=await te.json().catch(()=>({}));return te.ok?(_(null),L(null),Se(null),B(null),Ee(1),y(null),R(!1),await He(),null):ce.error??`open failed: ${te.status}`}catch(te){return te instanceof Error?te.message:String(te)}},[e.dirty,He]),ge=d.useMemo(()=>{if(!h)return{lines:[],dropped:[]};const J=h.baseCaptionLines??h.captionLines??[];return v$(J,AA(e.doc.captions))},[h,e.doc.captions]),Ce=d.useMemo(()=>h?x$(ge.lines,e.doc.captionRangeEdits):{lines:[],dropped:[]},[h,ge,e.doc.captionRangeEdits]),Ct=d.useMemo(()=>h?b$(Ce.lines,e.doc.captionWordsHidden):{lines:[],dropped:[]},[h,Ce,e.doc.captionWordsHidden]),$n=d.useMemo(()=>h?sb(Ct.lines,e.doc.captionLineTiming):{lines:[],dropped:[]},[h,Ct,e.doc.captionLineTiming]),tc=d.useMemo(()=>Ab(f),[f]),Hi=d.useMemo(()=>[...zA(ge.dropped),...OA(Ce.dropped),...DA(Ct.dropped),...BA($n.dropped)],[ge,Ce,Ct,$n]),nc=Hi.join(`
165
+ `),Zb=Hi.length>0&&nc!==x;d.useEffect(()=>{if(Hi.length!==0)for(const J of Hi)console.warn(`ossclip §137: ${J}`)},[nc]);const dr=d.useMemo(()=>h?W$(b,e.doc.cleanup,e.doc.cuts,h.spans??[]):null,[h,b,e.doc.cleanup,e.doc.cuts]),An=d.useMemo(()=>V$(dr),[dr]),Rr=d.useMemo(()=>{if(!h)return null;const J=(h.baseSceneCues??h.sceneCues??[]).filter(bn=>bn.kind!=="plain"),te=h.baseTheme??h.theme??OM,{cues:ce}=Pf(J,e.doc),{cues:Oe}=f$(ce,e.doc),mt=P$(Oe,{outputDurationSec:h.outputDurationSec,clipStarts:(h.spans??[]).map(bn=>bn.outIn)}),It=mh(mt,e.doc.splits),{cues:zo}=Pf(It,e.doc),{cues:Gn}=ib(zo,e.doc);let wn=V?Gn.map(bn=>bn.id===V.sceneId?{...bn,video:{...bn.video,...V.patch}}:bn):Gn;xe&&(wn=wn.map(bn=>bn.id===xe.sceneId?{...bn,graphicRect:xe.rect}:bn));const xn={...h,sceneCues:wn,captionLines:$n.lines,theme:k$(te,e.doc),captionsHidden:h.captionsHiddenByFlag===!0||e.doc.captionsHidden===!0,videoFileName:`/media/${h.videoFileName}`};if(!dr)return{props:xn,reports:[]};const{fields:ac,reports:Jb}=H$(xn,dr.oldMap,dr.newMap);return{props:{...xn,...ac},reports:Jb}},[h,e.doc,V,xe,$n,dr]),Fe=Rr===null?null:Rr.props,rc=Fe==null?void 0:Fe.sceneCues;d.useEffect(()=>{rc&&e.syncCues(rc)},[rc]);const Kb=((Rr==null?void 0:Rr.reports)??[]).join(`
166
+ `);d.useEffect(()=>{if(!(!Rr||Rr.reports.length===0))for(const J of Rr.reports)console.warn(`ossclip cut preview: ${J}`)},[Kb]);const oc=d.useRef(null);d.useEffect(()=>{if(!h){oc.current=null;return}const J=dr?dr.newMap:Qu(h.spans??[]),te=oc.current;if(oc.current={props:h,map:J},!te||te.props!==h||lb(te.map,J,1e-6))return;const ce=K.current;if(!ce)return;const Oe=h.settings.fps,mt=te.map.toSource(ce.getCurrentFrame()/Oe),It=J.toOutput(mt)??J.toOutputClamped(mt);ce.seekTo(Math.round(It*Oe))},[dr,h]);const Sh=()=>{BL({dirty:e.dirty,renderRunning:(G==null?void 0:G.running)===!0,save:e.save,onBlocked:()=>i(!0),onSaveError:J=>T(J)})},kh=d.useCallback(async J=>{try{e.dirty&&await e.save();const te=await fetch("/api/render",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(J?{out:J}:{})});if(!te.ok){const ce=await te.json().catch(()=>({}));throw new Error(ce.error??`render failed to start: ${te.status}`)}B({running:!0,lines:[],startedAt:Date.now()}),be(!0),a(null),$e()}catch(te){a(te instanceof Error?te.message:String(te))}},[e,$e]),ic=d.useMemo(()=>{if(!h)return[];const J=(h.baseSceneCues??h.sceneCues??[]).filter(te=>te.kind!=="plain");return WL(J,e.doc,An.toLive)},[h,e.doc,An]),jr=d.useMemo(()=>j?(Fe==null?void 0:Fe.sceneCues.find(J=>J.id===j.sceneId))??ic.find(J=>J.id===j.sceneId)??null:null,[Fe,j,ic]),Yb=d.useMemo(()=>{if(!jr||!Fe)return;const J=Fe.captionLines.filter(ce=>ce.start<jr.endSec&&ce.end>jr.startSec).flatMap(ce=>ce.words).filter(ce=>ce.start<jr.endSec&&ce.end>jr.startSec).map(ce=>ce.text);if(J.length===0)return;const te=J.join(" ");return te.length>90?`${te.slice(0,90)}…`:te},[jr,Fe]);if(I)return u.jsx("div",{style:cd,children:u.jsxs("div",{style:{padding:24,color:"#FF5C5C",fontFamily:"ui-monospace, monospace"},children:["Couldn't load the production: ",I]})});if(!Fe)return u.jsx("div",{style:cd,children:A?u.jsx(Dy,{recent:C,required:!0,onOpen:ze,onClose:()=>{}}):u.jsx("div",{style:{padding:24,color:"#9A9AA3"},children:"Loading production…"})});const Gb=Fe.settings.width/Fe.settings.height,Xb=se?Math.max(220,Math.min(se.w,se.h*Gb)):380,qb=Math.round(Xb*ke),sc=u.jsx("button",{"data-testid":"render-logs-toggle",style:{...it,padding:"2px 8px"},onClick:()=>be(J=>!J),title:we?"Collapse the log":"Expand the log",children:we?"▾ logs":"▸ logs"});return u.jsxs("div",{style:cd,children:[u.jsxs("div",{style:KL,children:[u.jsx("span",{style:YL,children:"ossclip"}),z?u.jsx("span",{"data-testid":"workdir-label",style:GL,title:z,children:z.split("/").filter(Boolean).slice(-2).join("/")}):null,u.jsxs("div",{style:{display:"flex",gap:8},children:[u.jsx("button",{"data-testid":"open-button",style:it,onClick:()=>R(!0),title:z?`Open another project — currently ${z}`:"Open another project",children:"Open"}),u.jsx("button",{"data-testid":"undo-button",style:it,onClick:()=>e.undo(),disabled:!e.canUndo,title:"Undo (⌘Z)","aria-label":"Undo",children:u.jsx(UL,{})}),u.jsx("button",{"data-testid":"redo-button",style:it,onClick:()=>e.redo(),disabled:!e.canRedo,title:"Redo (⌘⇧Z)","aria-label":"Redo",children:u.jsx(ZL,{})}),u.jsx("button",{"data-testid":"transcript-toggle",style:{...it,...Kt?{borderColor:"#5b8cff"}:{}},onClick:()=>gn(J=>!J),title:"Find and retype caption words across the whole transcript",children:"Transcript"}),u.jsx("button",{"data-testid":"cover-button",style:{...it,...Mn?{borderColor:"#5b8cff"}:{}},onClick:()=>Tr(!0),title:"Retype the cover headline or re-cut its frame — seconds, no re-render",children:"Cover"}),u.jsx("button",{"data-testid":"cleanup-button",style:{...it,...ur?{borderColor:"#5b8cff"}:{}},onClick:()=>cr(!0),title:"Review what produce removed — keep whole categories; the preview plays your choices immediately",children:"Cleanup"}),u.jsxs("div",{style:{position:"relative"},children:[u.jsx("button",{"data-testid":"youtube-menu",style:{...it,..._n||Gt||vn?{borderColor:"#5b8cff"}:{}},onClick:()=>Yn(J=>!J),title:"AI thumbnail and SEO metadata for the YouTube upload","aria-haspopup":"menu","aria-expanded":_n,children:"YouTube ▾"}),_n?u.jsxs(u.Fragment,{children:[u.jsx("div",{style:JL,onMouseDown:()=>Yn(!1)}),u.jsxs("div",{style:QL,role:"menu",children:[u.jsx("button",{"data-testid":"youtube-menu-thumbnail",style:dv,role:"menuitem",onClick:()=>{Yn(!1),ft(!0)},children:"Thumbnail"}),u.jsx("button",{"data-testid":"youtube-menu-seo",style:dv,role:"menuitem",onClick:()=>{Yn(!1),Ot(!0)},children:"SEO metadata"})]})]}):null]}),u.jsx("button",{style:{...it,...e.dirty?qL:{}},onClick:Sh,disabled:!e.dirty||(G==null?void 0:G.running)===!0,title:(G==null?void 0:G.running)===!0?"Can't save while a render is running":void 0,children:"Save"}),u.jsxs("div",{style:{display:"inline-flex",alignItems:"center"},children:[u.jsx("button",{"data-testid":"render-button",style:{...it,borderTopRightRadius:0,borderBottomRightRadius:0,borderRight:"none"},onClick:()=>void kh(),disabled:!Z||(G==null?void 0:G.running)===!0,title:Z?"Saves if needed, then replays the last completed produce command — pipeline flags come from that run; your saved edits apply on top":"No command.json in this workdir — run `ossclip produce` once in a terminal; it records the invocation and Render replays it",children:G!=null&&G.running?"Rendering…":"Render"}),u.jsx("button",{"data-testid":"render-destination-button",style:{...it,borderTopLeftRadius:0,borderBottomLeftRadius:0,padding:"7px 8px"},onClick:()=>ae(!0),disabled:!Z||(G==null?void 0:G.running)===!0,title:"Choose export file destination (Browse…)",children:"▾"})]})]}),u.jsx("span",{style:{...XL,color:e.dirty?"#FFE14D":"#5FBF77"},...e.dirty?{"data-testid":"dirty"}:{},children:e.dirty?"● Unsaved changes":"✓ Saved"}),u.jsx("button",{"data-testid":"shortcuts-button",style:{...it,padding:"7px 10px"},onClick:()=>yn(J=>!J),title:"Keyboard shortcuts (?)",children:"?"})]}),Yt?u.jsx(fN,{onClose:()=>yn(!1)}):null,Gt?u.jsx(F5,{onClose:()=>ft(!1)}):null,ur?u.jsx(U5,{cutlist:b,edits:e,onClose:()=>cr(!1)}):null,vn?u.jsx(lL,{onClose:()=>Ot(!1)}):null,Mn?u.jsx(CL,{onClose:()=>Tr(!1),playheadSec:()=>{var J;return An.fromLive((((J=K.current)==null?void 0:J.getCurrentFrame())??0)/Fe.settings.fps)}}):null,X?u.jsx(h5,{defaultOutPath:oe,onCancel:()=>ae(!1),onConfirm:J=>{ae(!1),kh(J)}}):null,F?u.jsx(kN,{plan:F,onCancel:()=>U(null),onConfirm:J=>{if(J==="graphic")e.hideScene(F.sceneId);else{const te=pb(An,F.startSec,F.endSec);te.kind==="degenerate"?c("Can't cut this window: it isn't in the last render yet — render once (or re-remove the pause) to cut it."):(te.kind==="shrunk"&&console.warn(`ossclip cut preview: ${te.report}`),e.cutChunk(te.startSec,te.endSec))}U(null)}}):null,re?u.jsx(LN,{plan:re,onCancel:()=>fe(null),onConfirm:J=>{J==="caption"?e.hideCaptionWords(re.words):e.cutWords(re.words,re.startSec,re.endSec),fe(null)}}):null,A?u.jsx(Dy,{recent:C,required:!1,onOpen:ze,onClose:()=>R(!1)}):null,G?u.jsxs("div",{"data-testid":"render-log",style:{...lz,borderColor:G.failed!==void 0?"#FF5C5C":"#2A2A33"},children:[G.failed!==void 0?u.jsxs("div",{style:{color:G.cancelled?"#9A9AA3":"#FF5C5C",marginBottom:4},"data-testid":G.cancelled?"render-cancelled":"render-failed",children:[G.cancelled?"render cancelled":`render failed (exit ${G.failed})`,u.jsx("button",{style:{...it,marginLeft:10,padding:"2px 8px"},onClick:()=>B(null),children:"Dismiss"}),u.jsx("span",{style:{marginLeft:6},children:sc})]}):null,G.succeeded?u.jsxs("div",{"data-testid":"render-succeeded",style:hv,children:[u.jsxs("span",{style:{color:"#5FBF77"},children:["✓ done",G.startedAt!=null&&G.finishedAt!==void 0?` · ${lv(G.startedAt,G.finishedAt)}`:""]}),u.jsx("button",{"data-testid":"render-open-folder",style:{...it,padding:"2px 8px"},onClick:()=>void fetch("/api/reveal-output",{method:"POST"}).catch(()=>{}),title:"Reveal the rendered file in your file manager",children:"Open folder"}),u.jsx("button",{style:{...it,padding:"2px 8px"},onClick:()=>B(null),children:"Dismiss"}),sc]}):null,G.running?u.jsxs("div",{"data-testid":"render-status",style:hv,children:[u.jsx("style",{children:"@keyframes ossclip-spin { to { transform: rotate(360deg) } }"}),u.jsx("span",{style:uz,"aria-hidden":!0}),u.jsxs("span",{style:{color:"#EDEDF2"},children:["rendering",G.startedAt!=null?` · ${lv(G.startedAt,Date.now())}`:"",rl(G.lines)!==null?` · ${rl(G.lines)}%`:""]}),rl(G.lines)!==null?u.jsx("div",{style:cz,children:u.jsx("div",{"data-testid":"render-progress-bar",style:{...dz,width:`${rl(G.lines)}%`}})}):null,u.jsx("button",{"data-testid":"render-cancel",style:{...it,padding:"2px 8px"},onClick:()=>void fetch("/api/render/cancel",{method:"POST"}),children:"Cancel"}),sc]}):null,we?u.jsxs(u.Fragment,{children:[LL(G.lines).map(J=>u.jsx("div",{"data-testid":"render-pinned",style:{color:"#C9C9D4"},children:J},J)),u.jsx(HL,{lines:G.lines})]}):null]}):null,n?u.jsxs("div",{"data-testid":"reanchor-notice",style:Yo,children:["Render re-anchored your saved cuts and splits — edits made while it ran were dropped, not merged, to avoid overwriting that anchor.",u.jsx("button",{style:{...it,marginLeft:10,padding:"2px 8px"},onClick:()=>r(!1),children:"Dismiss"})]}):null,tc.length>0||m.length>0?u.jsxs("div",{"data-testid":"caption-migration-notice",style:Yo,children:[[...tc,...m].map((J,te)=>u.jsx("div",{children:J},te)),u.jsx("button",{style:{...it,marginLeft:10,padding:"2px 8px"},onClick:()=>{p([]),g([])},children:"Dismiss"})]}):null,Zb?u.jsxs("div",{"data-testid":"caption-dropped-notice",style:Yo,children:[Hi.map((J,te)=>u.jsx("div",{children:J},te)),u.jsx("button",{style:{...it,marginLeft:10,padding:"2px 8px"},onClick:()=>k(nc),children:"Dismiss"})]}):null,o?u.jsxs("div",{"data-testid":"save-blocked-notice",style:Yo,children:["Can't save while a render is running — it's writing its own overrides.json right now. Wait for it to finish (or cancel it) before saving.",u.jsx("button",{style:{...it,marginLeft:10,padding:"2px 8px"},onClick:()=>i(!1),children:"Dismiss"})]}):null,s!==null?u.jsxs("div",{"data-testid":"render-refused-notice",style:Yo,children:["Render didn't start: ",s,u.jsx("button",{style:{...it,marginLeft:10,padding:"2px 8px"},onClick:()=>a(null),children:"Dismiss"})]}):null,l!==null?u.jsxs("div",{"data-testid":"clock-refused-notice",style:Yo,children:[l,u.jsx("button",{style:{...it,marginLeft:10,padding:"2px 8px"},onClick:()=>c(null),children:"Dismiss"})]}):null,u.jsxs("div",{style:ez,children:[Kt?u.jsxs(u.Fragment,{children:[u.jsx(W3,{baseLines:(h==null?void 0:h.baseCaptionLines)??(h==null?void 0:h.captionLines)??[],liveLines:Ce.lines,timingLines:Ct.lines,fps:Fe.settings.fps,playerRef:K,edits:e,onDeleteWords:fe,width:Zn,workdir:z,toPlayerSec:An.toLive,fromPlayerSec:An.fromLive}),u.jsx("div",{"data-testid":"transcript-divider",style:tz,title:"Drag to resize the transcript pane",onMouseDown:J=>{J.preventDefault(),Kn.current={startX:J.clientX,startW:Zn}}})]}):null,u.jsxs("div",{style:nz,children:[u.jsx("div",{ref:Qe,style:rz,onMouseDown:J=>{if(J.altKey||J.button===1){J.preventDefault();const te=ee.current;te&&(dt.current={x:J.clientX,y:J.clientY,sl:te.scrollLeft,st:te.scrollTop})}},children:u.jsx("div",{style:{margin:"auto",padding:dd},children:u.jsxs("div",{ref:de,"data-testid":"stage","data-playing":N?"true":"false","data-rate":M,style:{position:"relative",display:"inline-block"},children:[u.jsx($j,{ref:K,component:RA,inputProps:Fe,durationInFrames:Math.max(1,Math.round(Fe.outputDurationSec*Fe.settings.fps)),fps:Fe.settings.fps,compositionWidth:Fe.settings.width,compositionHeight:Fe.settings.height,style:{width:qb},controls:!0,clickToPlay:!1,playbackRate:M}),u.jsx(GA,{stageRef:de,selection:j,onSelect:_,edits:e,onSave:Sh,settings:Fe.settings,cues:Fe.sceneCues,playerRef:K,cue:jr,onTransport:Pe,onVideoPreview:L,onGraphicPreview:Se,onToggleHelp:()=>yn(J=>!J),onRequestDelete:U,fromLive:An.fromLive,hasOldClockPreimage:An.hasOldClockPreimage,onClockRefused:c}),u.jsx("button",{"data-testid":"rate-chip",onClick:()=>Pe("L"),title:"Playback rate — click to speed up (J/K/L on the keyboard)",style:fz,children:M<0?`◂◂ ${Math.abs(M)}×`:`${M}×`})]})})}),u.jsxs("div",{style:oz,children:[u.jsx("button",{"data-testid":"view-zoom-out",style:fd,onClick:()=>Le(ke/2),disabled:ke<=.25,title:"Zoom the preview out — below 100% shrinks under the fitted size",children:"−"}),u.jsxs("span",{"data-testid":"view-zoom-level",style:iz,children:[Math.round(ke*100),"%"]}),u.jsx("button",{"data-testid":"view-zoom-in",style:fd,onClick:()=>Le(ke*2),disabled:ke>=8,title:"Zoom the preview in — a viewing magnifier, it never edits the video",children:"+"}),u.jsx("button",{"data-testid":"view-zoom-fit",style:{...fd,width:"auto",padding:"0 8px"},onClick:()=>Le(1),disabled:Math.abs(ke-1)<.001,title:"Fit the preview to the window",children:"fit"}),u.jsx("span",{style:sz,children:"⌥-drag pans"})]})]}),u.jsx("div",{style:az,children:u.jsx(qA,{selection:j,cue:jr,frame:{width:Fe.settings.width,height:Fe.settings.height},allSceneIds:Fe.sceneCues.map(J=>J.id),edits:e,onSelect:_,resolvedTheme:Fe.theme,anchorText:Yb,onVideoPreview:L,runInfo:v,captionsHiddenByFlag:(h==null?void 0:h.captionsHiddenByFlag)===!0,fromLive:An.fromLive,hasOldClockPreimage:An.hasOldClockPreimage,onClockRefused:c})})]}),u.jsx(m3,{cues:Fe.sceneCues,ghosts:ic,cuts:e.doc.cuts,spans:Fe.spans??[],cleanup:b,durationSec:Fe.outputDurationSec,fps:Fe.settings.fps,playerRef:K,selection:j,onSelect:_,edits:e,videoSrc:Fe.videoFileName,toLive:An.toLive,toSourceSec:J=>{var te;for(const ce of Fe.spans??[])if(J>=ce.outIn&&J<ce.outOut)return ce.srcIn+(J-ce.outIn);return((te=(Fe.spans??[])[0])==null?void 0:te.srcIn)??J}})]})},HL=({lines:e})=>{const t=d.useRef(null),n=d.useRef(!0);return d.useEffect(()=>{const r=t.current;r&&n.current&&(r.scrollTop=r.scrollHeight)},[e]),u.jsx("div",{ref:t,"data-testid":"render-tail",onScroll:r=>{const o=r.currentTarget;n.current=o.scrollTop+o.clientHeight>=o.scrollHeight-8},style:{maxHeight:220,overflowY:"auto"},children:e.map((r,o)=>u.jsx("div",{children:r},o))})},UL=()=>u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",style:{display:"block"},children:[u.jsx("path",{d:"M9 14 4 9l5-5"}),u.jsx("path",{d:"M4 9h10.5a5.5 5.5 0 0 1 0 11H11"})]}),ZL=()=>u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",style:{display:"block"},children:[u.jsx("path",{d:"m15 14 5-5-5-5"}),u.jsx("path",{d:"M20 9H9.5a5.5 5.5 0 0 0 0 11H13"})]}),cd={fontFamily:"'Inter', system-ui, sans-serif",background:"#0B0B0E",color:"#EDEDF2",height:"100vh",overflow:"hidden",display:"flex",flexDirection:"column"},KL={display:"flex",alignItems:"center",gap:14,padding:"10px 20px",borderBottom:"1px solid #1E1E24",background:"#111116"},YL={fontWeight:800,fontSize:14,letterSpacing:"0.02em",color:"#FFE14D",marginRight:8},GL={fontSize:12,fontFamily:"ui-monospace, 'SF Mono', monospace",color:"#6a6a75",maxWidth:260,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},XL={fontSize:12,fontFamily:"ui-monospace, 'SF Mono', monospace",marginLeft:"auto"},it={fontSize:12,fontWeight:600,color:"#EDEDF2",background:"#1A1A21",border:"1px solid #2A2A33",borderRadius:6,padding:"7px 12px",cursor:"pointer"},qL={background:"#FFE14D",color:"#0B0B0E",border:"1px solid #FFE14D"},JL={position:"fixed",inset:0,zIndex:30},QL={position:"absolute",top:"calc(100% + 4px)",left:0,zIndex:31,minWidth:150,background:"#1A1A21",border:"1px solid #2A2A33",borderRadius:6,padding:4,boxShadow:"0 10px 24px rgba(0,0,0,0.5)",display:"flex",flexDirection:"column"},dv={fontSize:12,fontWeight:600,color:"#EDEDF2",background:"transparent",border:"none",borderRadius:4,padding:"8px 10px",cursor:"pointer",textAlign:"left"},ez={display:"flex",flex:1,minHeight:0},dd=32,fv="ossclip.transcriptWidth",pv=e=>Math.min(640,Math.max(220,e)),tz={width:5,flexShrink:0,cursor:"col-resize",background:"#1E1E24",borderLeft:"1px solid #2A2A33"},nz={position:"relative",flex:1,minWidth:0},rz={position:"absolute",inset:0,display:"flex",overflow:"auto"},oz={position:"absolute",top:10,left:10,zIndex:6,display:"flex",alignItems:"center",gap:6,padding:"4px 6px",background:"rgba(17,17,22,0.85)",border:"1px solid #2A2A33",borderRadius:6},fd={width:22,height:18,fontSize:12,lineHeight:1,color:"#EDEDF2",background:"#1A1A21",border:"1px solid #2A2A33",borderRadius:4,cursor:"pointer",padding:0},iz={fontSize:10,fontFamily:"ui-monospace, 'SF Mono', monospace",color:"#9A9AA3",minWidth:34,textAlign:"center"},sz={fontSize:10,color:"#55555f",userSelect:"none"},az={width:260,flexShrink:0,borderLeft:"1px solid #1E1E24",background:"#111116",overflowY:"auto"},lz={fontSize:11,fontFamily:"ui-monospace, 'SF Mono', monospace",color:"#9A9AA3",background:"#0F0F14",borderBottom:"1px solid #2A2A33",padding:"6px 20px",whiteSpace:"pre-wrap",flexShrink:0},Yo={display:"flex",alignItems:"center",fontSize:12,fontFamily:"ui-monospace, 'SF Mono', monospace",color:"#FFE14D",background:"#0F0F14",borderBottom:"1px solid #2A2A33",padding:"6px 20px",flexShrink:0},hv={display:"flex",alignItems:"center",gap:10,marginBottom:4},uz={width:12,height:12,flexShrink:0,border:"2px solid #2A2A33",borderTopColor:"#FFE14D",borderRadius:"50%",animation:"ossclip-spin 0.8s linear infinite"},cz={flex:1,maxWidth:260,height:4,background:"#1E1E24",borderRadius:2,overflow:"hidden"},dz={height:"100%",background:"#FFE14D",borderRadius:2,transition:"width 0.6s ease"},fz={position:"absolute",top:8,right:8,zIndex:5,fontSize:11,fontWeight:700,fontFamily:"ui-monospace, 'SF Mono', monospace",color:"#FFE14D",background:"rgba(11,11,14,0.75)",border:"1px solid #2A2A33",borderRadius:6,padding:"3px 8px",cursor:"pointer"};pd.createRoot(document.getElementById("root")).render(u.jsx(le.StrictMode,{children:u.jsx(VL,{})}));