ossclip 0.1.26 → 0.1.27

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.
@@ -0,0 +1,163 @@
1
+ var mb=Object.defineProperty;var gb=(e,t,n)=>t in e?mb(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 vb(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Vv={exports:{}},Gl={},Hv={exports:{}},Se={};/**
2
+ * @license React
3
+ * react.production.min.js
4
+ *
5
+ * Copyright (c) Facebook, Inc. and its affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var Ws=Symbol.for("react.element"),yb=Symbol.for("react.portal"),wb=Symbol.for("react.fragment"),xb=Symbol.for("react.strict_mode"),bb=Symbol.for("react.profiler"),Sb=Symbol.for("react.provider"),kb=Symbol.for("react.context"),Eb=Symbol.for("react.forward_ref"),Cb=Symbol.for("react.suspense"),Ib=Symbol.for("react.memo"),Tb=Symbol.for("react.lazy"),oh=Symbol.iterator;function Rb(e){return e===null||typeof e!="object"?null:(e=oh&&e[oh]||e["@@iterator"],typeof e=="function"?e:null)}var Uv={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Zv=Object.assign,Kv={};function Si(e,t,n){this.props=e,this.context=t,this.refs=Kv,this.updater=n||Uv}Si.prototype.isReactComponent={};Si.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")};Si.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Yv(){}Yv.prototype=Si.prototype;function vf(e,t,n){this.props=e,this.context=t,this.refs=Kv,this.updater=n||Uv}var yf=vf.prototype=new Yv;yf.constructor=vf;Zv(yf,Si.prototype);yf.isPureReactComponent=!0;var ih=Array.isArray,Gv=Object.prototype.hasOwnProperty,wf={current:null},Xv={key:!0,ref:!0,__self:!0,__source:!0};function qv(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)&&!Xv.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),u=0;u<a;u++)l[u]=arguments[u+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:Ws,type:e,key:i,ref:s,props:o,_owner:wf.current}}function jb(e,t){return{$$typeof:Ws,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function xf(e){return typeof e=="object"&&e!==null&&e.$$typeof===Ws}function Pb(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var sh=/\/+/g;function Zu(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Pb(""+e.key):t.toString(36)}function Ya(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 Ws:case yb:s=!0}}if(s)return s=e,o=o(s),e=r===""?"."+Zu(s,0):r,ih(o)?(n="",e!=null&&(n=e.replace(sh,"$&/")+"/"),Ya(o,t,n,"",function(u){return u})):o!=null&&(xf(o)&&(o=jb(o,n+(!o.key||s&&s.key===o.key?"":(""+o.key).replace(sh,"$&/")+"/")+e)),t.push(o)),1;if(s=0,r=r===""?".":r+":",ih(e))for(var a=0;a<e.length;a++){i=e[a];var l=r+Zu(i,a);s+=Ya(i,t,n,l,o)}else if(l=Rb(e),typeof l=="function")for(e=l.call(e),a=0;!(i=e.next()).done;)i=i.value,l=r+Zu(i,a++),s+=Ya(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 aa(e,t,n){if(e==null)return e;var r=[],o=0;return Ya(e,r,"","",function(i){return t.call(n,i,o++)}),r}function Fb(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 Vt={current:null},Ga={transition:null},_b={ReactCurrentDispatcher:Vt,ReactCurrentBatchConfig:Ga,ReactCurrentOwner:wf};function Qv(){throw Error("act(...) is not supported in production builds of React.")}Se.Children={map:aa,forEach:function(e,t,n){aa(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return aa(e,function(){t++}),t},toArray:function(e){return aa(e,function(t){return t})||[]},only:function(e){if(!xf(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Se.Component=Si;Se.Fragment=wb;Se.Profiler=bb;Se.PureComponent=vf;Se.StrictMode=xb;Se.Suspense=Cb;Se.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=_b;Se.act=Qv;Se.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=Zv({},e.props),o=e.key,i=e.ref,s=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,s=wf.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)&&!Xv.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 u=0;u<l;u++)a[u]=arguments[u+2];r.children=a}return{$$typeof:Ws,type:e.type,key:o,ref:i,props:r,_owner:s}};Se.createContext=function(e){return e={$$typeof:kb,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:Sb,_context:e},e.Consumer=e};Se.createElement=qv;Se.createFactory=function(e){var t=qv.bind(null,e);return t.type=e,t};Se.createRef=function(){return{current:null}};Se.forwardRef=function(e){return{$$typeof:Eb,render:e}};Se.isValidElement=xf;Se.lazy=function(e){return{$$typeof:Tb,_payload:{_status:-1,_result:e},_init:Fb}};Se.memo=function(e,t){return{$$typeof:Ib,type:e,compare:t===void 0?null:t}};Se.startTransition=function(e){var t=Ga.transition;Ga.transition={};try{e()}finally{Ga.transition=t}};Se.unstable_act=Qv;Se.useCallback=function(e,t){return Vt.current.useCallback(e,t)};Se.useContext=function(e){return Vt.current.useContext(e)};Se.useDebugValue=function(){};Se.useDeferredValue=function(e){return Vt.current.useDeferredValue(e)};Se.useEffect=function(e,t){return Vt.current.useEffect(e,t)};Se.useId=function(){return Vt.current.useId()};Se.useImperativeHandle=function(e,t,n){return Vt.current.useImperativeHandle(e,t,n)};Se.useInsertionEffect=function(e,t){return Vt.current.useInsertionEffect(e,t)};Se.useLayoutEffect=function(e,t){return Vt.current.useLayoutEffect(e,t)};Se.useMemo=function(e,t){return Vt.current.useMemo(e,t)};Se.useReducer=function(e,t,n){return Vt.current.useReducer(e,t,n)};Se.useRef=function(e){return Vt.current.useRef(e)};Se.useState=function(e){return Vt.current.useState(e)};Se.useSyncExternalStore=function(e,t,n){return Vt.current.useSyncExternalStore(e,t,n)};Se.useTransition=function(){return Vt.current.useTransition()};Se.version="18.3.1";Hv.exports=Se;var d=Hv.exports;const oe=vb(d);/**
10
+ * @license React
11
+ * react-jsx-runtime.production.min.js
12
+ *
13
+ * Copyright (c) Facebook, Inc. and its affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var Mb=d,$b=Symbol.for("react.element"),Ab=Symbol.for("react.fragment"),Nb=Object.prototype.hasOwnProperty,Lb=Mb.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,zb={key:!0,ref:!0,__self:!0,__source:!0};function Jv(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)Nb.call(t,r)&&!zb.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:$b,type:e,key:i,ref:s,props:o,_owner:Lb.current}}Gl.Fragment=Ab;Gl.jsx=Jv;Gl.jsxs=Jv;Vv.exports=Gl;var c=Vv.exports,Qc={},ey={exports:{}},dn={},ty={exports:{}},ny={};/**
18
+ * @license React
19
+ * scheduler.production.min.js
20
+ *
21
+ * Copyright (c) Facebook, Inc. and its affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */(function(e){function t(C,N){var $=C.length;C.push(N);e:for(;0<$;){var D=$-1>>>1,B=C[D];if(0<o(B,N))C[D]=N,C[$]=B,$=D;else break e}}function n(C){return C.length===0?null:C[0]}function r(C){if(C.length===0)return null;var N=C[0],$=C.pop();if($!==N){C[0]=$;e:for(var D=0,B=C.length,Z=B>>>1;D<Z;){var L=2*(D+1)-1,z=C[L],Q=L+1,G=C[Q];if(0>o(z,$))Q<B&&0>o(G,z)?(C[D]=G,C[Q]=$,D=Q):(C[D]=z,C[L]=$,D=L);else if(Q<B&&0>o(G,$))C[D]=G,C[Q]=$,D=Q;else break e}}return N}function o(C,N){var $=C.sortIndex-N.sortIndex;return $!==0?$:C.id-N.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=[],u=[],f=1,p=null,h=3,m=!1,w=!1,g=!1,k=typeof setTimeout=="function"?setTimeout:null,v=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 x(C){for(var N=n(u);N!==null;){if(N.callback===null)r(u);else if(N.startTime<=C)r(u),N.sortIndex=N.expirationTime,t(l,N);else break;N=n(u)}}function b(C){if(g=!1,x(C),!w)if(n(l)!==null)w=!0,O(S);else{var N=n(u);N!==null&&T(b,N.startTime-C)}}function S(C,N){w=!1,g&&(g=!1,v(j),j=-1),m=!0;var $=h;try{for(x(N),p=n(l);p!==null&&(!(p.expirationTime>N)||C&&!A());){var D=p.callback;if(typeof D=="function"){p.callback=null,h=p.priorityLevel;var B=D(p.expirationTime<=N);N=e.unstable_now(),typeof B=="function"?p.callback=B:p===n(l)&&r(l),x(N)}else r(l);p=n(l)}if(p!==null)var Z=!0;else{var L=n(u);L!==null&&T(b,L.startTime-N),Z=!1}return Z}finally{p=null,h=$,m=!1}}var E=!1,R=null,j=-1,I=5,_=-1;function A(){return!(e.unstable_now()-_<I)}function W(){if(R!==null){var C=e.unstable_now();_=C;var N=!0;try{N=R(!0,C)}finally{N?P():(E=!1,R=null)}}else E=!1}var P;if(typeof y=="function")P=function(){y(W)};else if(typeof MessageChannel<"u"){var F=new MessageChannel,H=F.port2;F.port1.onmessage=W,P=function(){H.postMessage(null)}}else P=function(){k(W,0)};function O(C){R=C,E||(E=!0,P())}function T(C,N){j=k(function(){C(e.unstable_now())},N)}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(C){C.callback=null},e.unstable_continueExecution=function(){w||m||(w=!0,O(S))},e.unstable_forceFrameRate=function(C){0>C||125<C?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<C?Math.floor(1e3/C):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_getFirstCallbackNode=function(){return n(l)},e.unstable_next=function(C){switch(h){case 1:case 2:case 3:var N=3;break;default:N=h}var $=h;h=N;try{return C()}finally{h=$}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(C,N){switch(C){case 1:case 2:case 3:case 4:case 5:break;default:C=3}var $=h;h=C;try{return N()}finally{h=$}},e.unstable_scheduleCallback=function(C,N,$){var D=e.unstable_now();switch(typeof $=="object"&&$!==null?($=$.delay,$=typeof $=="number"&&0<$?D+$:D):$=D,C){case 1:var B=-1;break;case 2:B=250;break;case 5:B=1073741823;break;case 4:B=1e4;break;default:B=5e3}return B=$+B,C={id:f++,callback:N,priorityLevel:C,startTime:$,expirationTime:B,sortIndex:-1},$>D?(C.sortIndex=$,t(u,C),n(l)===null&&C===n(u)&&(g?(v(j),j=-1):g=!0,T(b,$-D))):(C.sortIndex=B,t(l,C),w||m||(w=!0,O(S))),C},e.unstable_shouldYield=A,e.unstable_wrapCallback=function(C){var N=h;return function(){var $=h;h=N;try{return C.apply(this,arguments)}finally{h=$}}}})(ny);ty.exports=ny;var Db=ty.exports;/**
26
+ * @license React
27
+ * react-dom.production.min.js
28
+ *
29
+ * Copyright (c) Facebook, Inc. and its affiliates.
30
+ *
31
+ * This source code is licensed under the MIT license found in the
32
+ * LICENSE file in the root directory of this source tree.
33
+ */var Ob=d,cn=Db;function te(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 ry=new Set,ys={};function bo(e,t){pi(e,t),pi(e+"Capture",t)}function pi(e,t){for(ys[e]=t,e=0;e<t.length;e++)ry.add(t[e])}var fr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Jc=Object.prototype.hasOwnProperty,Bb=/^[: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]*$/,ah={},lh={};function Wb(e){return Jc.call(lh,e)?!0:Jc.call(ah,e)?!1:Bb.test(e)?lh[e]=!0:(ah[e]=!0,!1)}function Vb(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 Hb(e,t,n,r){if(t===null||typeof t>"u"||Vb(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 Ht(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 It={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){It[e]=new Ht(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];It[t]=new Ht(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){It[e]=new Ht(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){It[e]=new Ht(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){It[e]=new Ht(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){It[e]=new Ht(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){It[e]=new Ht(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){It[e]=new Ht(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){It[e]=new Ht(e,5,!1,e.toLowerCase(),null,!1,!1)});var bf=/[\-:]([a-z])/g;function Sf(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(bf,Sf);It[t]=new Ht(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(bf,Sf);It[t]=new Ht(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(bf,Sf);It[t]=new Ht(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){It[e]=new Ht(e,1,!1,e.toLowerCase(),null,!1,!1)});It.xlinkHref=new Ht("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){It[e]=new Ht(e,1,!1,e.toLowerCase(),null,!0,!0)});function kf(e,t,n,r){var o=It.hasOwnProperty(t)?It[t]:null;(o!==null?o.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(Hb(t,n,o,r)&&(n=null),r||o===null?Wb(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 gr=Ob.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,la=Symbol.for("react.element"),Vo=Symbol.for("react.portal"),Ho=Symbol.for("react.fragment"),Ef=Symbol.for("react.strict_mode"),ed=Symbol.for("react.profiler"),oy=Symbol.for("react.provider"),iy=Symbol.for("react.context"),Cf=Symbol.for("react.forward_ref"),td=Symbol.for("react.suspense"),nd=Symbol.for("react.suspense_list"),If=Symbol.for("react.memo"),Ir=Symbol.for("react.lazy"),sy=Symbol.for("react.offscreen"),uh=Symbol.iterator;function Ni(e){return e===null||typeof e!="object"?null:(e=uh&&e[uh]||e["@@iterator"],typeof e=="function"?e:null)}var tt=Object.assign,Ku;function es(e){if(Ku===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Ku=t&&t[1]||""}return`
34
+ `+Ku+e}var Yu=!1;function Gu(e,t){if(!e||Yu)return"";Yu=!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(u){var r=u}Reflect.construct(e,[],t)}else{try{t.call()}catch(u){r=u}e.call(t.prototype)}else{try{throw Error()}catch(u){r=u}e()}}catch(u){if(u&&r&&typeof u.stack=="string"){for(var o=u.stack.split(`
35
+ `),i=r.stack.split(`
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{Yu=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?es(e):""}function Ub(e){switch(e.tag){case 5:return es(e.type);case 16:return es("Lazy");case 13:return es("Suspense");case 19:return es("SuspenseList");case 0:case 2:case 15:return e=Gu(e.type,!1),e;case 11:return e=Gu(e.type.render,!1),e;case 1:return e=Gu(e.type,!0),e;default:return""}}function rd(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 Ho:return"Fragment";case Vo:return"Portal";case ed:return"Profiler";case Ef:return"StrictMode";case td:return"Suspense";case nd:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case iy:return(e.displayName||"Context")+".Consumer";case oy:return(e._context.displayName||"Context")+".Provider";case Cf:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case If:return t=e.displayName||null,t!==null?t:rd(e.type)||"Memo";case Ir:t=e._payload,e=e._init;try{return rd(e(t))}catch{}}return null}function Zb(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 rd(t);case 8:return t===Ef?"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 Wr(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function ay(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Kb(e){var t=ay(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 ua(e){e._valueTracker||(e._valueTracker=Kb(e))}function ly(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=ay(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function dl(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 od(e,t){var n=t.checked;return tt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function ch(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Wr(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 uy(e,t){t=t.checked,t!=null&&kf(e,"checked",t,!1)}function id(e,t){uy(e,t);var n=Wr(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")?sd(e,t.type,n):t.hasOwnProperty("defaultValue")&&sd(e,t.type,Wr(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function dh(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 sd(e,t,n){(t!=="number"||dl(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var ts=Array.isArray;function oi(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=""+Wr(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 ad(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(te(91));return tt({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function fh(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(te(92));if(ts(n)){if(1<n.length)throw Error(te(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:Wr(n)}}function cy(e,t){var n=Wr(t.value),r=Wr(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 dy(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 ld(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?dy(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var ca,fy=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(ca=ca||document.createElement("div"),ca.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=ca.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function ws(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var ss={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},Yb=["Webkit","ms","Moz","O"];Object.keys(ss).forEach(function(e){Yb.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),ss[t]=ss[e]})});function py(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||ss.hasOwnProperty(e)&&ss[e]?(""+t).trim():t+"px"}function hy(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=py(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}var Gb=tt({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 ud(e,t){if(t){if(Gb[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(te(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(te(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(te(61))}if(t.style!=null&&typeof t.style!="object")throw Error(te(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 dd=null;function Tf(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var fd=null,ii=null,si=null;function hh(e){if(e=Us(e)){if(typeof fd!="function")throw Error(te(280));var t=e.stateNode;t&&(t=eu(t),fd(e.stateNode,e.type,t))}}function my(e){ii?si?si.push(e):si=[e]:ii=e}function gy(){if(ii){var e=ii,t=si;if(si=ii=null,hh(e),t)for(e=0;e<t.length;e++)hh(t[e])}}function vy(e,t){return e(t)}function yy(){}var Xu=!1;function wy(e,t,n){if(Xu)return e(t,n);Xu=!0;try{return vy(e,t,n)}finally{Xu=!1,(ii!==null||si!==null)&&(yy(),gy())}}function xs(e,t){var n=e.stateNode;if(n===null)return null;var r=eu(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(te(231,t,typeof n));return n}var pd=!1;if(fr)try{var Li={};Object.defineProperty(Li,"passive",{get:function(){pd=!0}}),window.addEventListener("test",Li,Li),window.removeEventListener("test",Li,Li)}catch{pd=!1}function Xb(e,t,n,r,o,i,s,a,l){var u=Array.prototype.slice.call(arguments,3);try{t.apply(n,u)}catch(f){this.onError(f)}}var as=!1,fl=null,pl=!1,hd=null,qb={onError:function(e){as=!0,fl=e}};function Qb(e,t,n,r,o,i,s,a,l){as=!1,fl=null,Xb.apply(qb,arguments)}function Jb(e,t,n,r,o,i,s,a,l){if(Qb.apply(this,arguments),as){if(as){var u=fl;as=!1,fl=null}else throw Error(te(198));pl||(pl=!0,hd=u)}}function So(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 xy(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 mh(e){if(So(e)!==e)throw Error(te(188))}function eS(e){var t=e.alternate;if(!t){if(t=So(e),t===null)throw Error(te(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 mh(o),e;if(i===r)return mh(o),t;i=i.sibling}throw Error(te(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(te(189))}}if(n.alternate!==r)throw Error(te(190))}if(n.tag!==3)throw Error(te(188));return n.stateNode.current===n?e:t}function by(e){return e=eS(e),e!==null?Sy(e):null}function Sy(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Sy(e);if(t!==null)return t;e=e.sibling}return null}var ky=cn.unstable_scheduleCallback,gh=cn.unstable_cancelCallback,tS=cn.unstable_shouldYield,nS=cn.unstable_requestPaint,at=cn.unstable_now,rS=cn.unstable_getCurrentPriorityLevel,Rf=cn.unstable_ImmediatePriority,Ey=cn.unstable_UserBlockingPriority,hl=cn.unstable_NormalPriority,oS=cn.unstable_LowPriority,Cy=cn.unstable_IdlePriority,Xl=null,Xn=null;function iS(e){if(Xn&&typeof Xn.onCommitFiberRoot=="function")try{Xn.onCommitFiberRoot(Xl,e,void 0,(e.current.flags&128)===128)}catch{}}var An=Math.clz32?Math.clz32:lS,sS=Math.log,aS=Math.LN2;function lS(e){return e>>>=0,e===0?32:31-(sS(e)/aS|0)|0}var da=64,fa=4194304;function ns(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 ml(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=ns(a):(i&=s,i!==0&&(r=ns(i)))}else s=n&~o,s!==0?r=ns(s):i!==0&&(r=ns(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-An(t),o=1<<n,r|=e[n],t&=~o;return r}function uS(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 cS(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,o=e.expirationTimes,i=e.pendingLanes;0<i;){var s=31-An(i),a=1<<s,l=o[s];l===-1?(!(a&n)||a&r)&&(o[s]=uS(a,t)):l<=t&&(e.expiredLanes|=a),i&=~a}}function md(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Iy(){var e=da;return da<<=1,!(da&4194240)&&(da=64),e}function qu(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Vs(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-An(t),e[t]=n}function dS(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-An(n),i=1<<o;t[o]=0,r[o]=-1,e[o]=-1,n&=~i}}function jf(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-An(n),o=1<<r;o&t|e[r]&t&&(e[r]|=t),n&=~o}}var Ne=0;function Ty(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Ry,Pf,jy,Py,Fy,gd=!1,pa=[],Mr=null,$r=null,Ar=null,bs=new Map,Ss=new Map,Rr=[],fS="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 vh(e,t){switch(e){case"focusin":case"focusout":Mr=null;break;case"dragenter":case"dragleave":$r=null;break;case"mouseover":case"mouseout":Ar=null;break;case"pointerover":case"pointerout":bs.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ss.delete(t.pointerId)}}function zi(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=Us(t),t!==null&&Pf(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function pS(e,t,n,r,o){switch(t){case"focusin":return Mr=zi(Mr,e,t,n,r,o),!0;case"dragenter":return $r=zi($r,e,t,n,r,o),!0;case"mouseover":return Ar=zi(Ar,e,t,n,r,o),!0;case"pointerover":var i=o.pointerId;return bs.set(i,zi(bs.get(i)||null,e,t,n,r,o)),!0;case"gotpointercapture":return i=o.pointerId,Ss.set(i,zi(Ss.get(i)||null,e,t,n,r,o)),!0}return!1}function _y(e){var t=io(e.target);if(t!==null){var n=So(t);if(n!==null){if(t=n.tag,t===13){if(t=xy(n),t!==null){e.blockedOn=t,Fy(e.priority,function(){jy(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 Xa(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=vd(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);dd=r,n.target.dispatchEvent(r),dd=null}else return t=Us(n),t!==null&&Pf(t),e.blockedOn=n,!1;t.shift()}return!0}function yh(e,t,n){Xa(e)&&n.delete(t)}function hS(){gd=!1,Mr!==null&&Xa(Mr)&&(Mr=null),$r!==null&&Xa($r)&&($r=null),Ar!==null&&Xa(Ar)&&(Ar=null),bs.forEach(yh),Ss.forEach(yh)}function Di(e,t){e.blockedOn===t&&(e.blockedOn=null,gd||(gd=!0,cn.unstable_scheduleCallback(cn.unstable_NormalPriority,hS)))}function ks(e){function t(o){return Di(o,e)}if(0<pa.length){Di(pa[0],e);for(var n=1;n<pa.length;n++){var r=pa[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Mr!==null&&Di(Mr,e),$r!==null&&Di($r,e),Ar!==null&&Di(Ar,e),bs.forEach(t),Ss.forEach(t),n=0;n<Rr.length;n++)r=Rr[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Rr.length&&(n=Rr[0],n.blockedOn===null);)_y(n),n.blockedOn===null&&Rr.shift()}var ai=gr.ReactCurrentBatchConfig,gl=!0;function mS(e,t,n,r){var o=Ne,i=ai.transition;ai.transition=null;try{Ne=1,Ff(e,t,n,r)}finally{Ne=o,ai.transition=i}}function gS(e,t,n,r){var o=Ne,i=ai.transition;ai.transition=null;try{Ne=4,Ff(e,t,n,r)}finally{Ne=o,ai.transition=i}}function Ff(e,t,n,r){if(gl){var o=vd(e,t,n,r);if(o===null)ac(e,t,r,vl,n),vh(e,r);else if(pS(o,e,t,n,r))r.stopPropagation();else if(vh(e,r),t&4&&-1<fS.indexOf(e)){for(;o!==null;){var i=Us(o);if(i!==null&&Ry(i),i=vd(e,t,n,r),i===null&&ac(e,t,r,vl,n),i===o)break;o=i}o!==null&&r.stopPropagation()}else ac(e,t,r,null,n)}}var vl=null;function vd(e,t,n,r){if(vl=null,e=Tf(r),e=io(e),e!==null)if(t=So(e),t===null)e=null;else if(n=t.tag,n===13){if(e=xy(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 vl=e,null}function My(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(rS()){case Rf:return 1;case Ey:return 4;case hl:case oS:return 16;case Cy:return 536870912;default:return 16}default:return 16}}var Fr=null,_f=null,qa=null;function $y(){if(qa)return qa;var e,t=_f,n=t.length,r,o="value"in Fr?Fr.value:Fr.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 qa=o.slice(e,1<r?1-r:void 0)}function Qa(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 ha(){return!0}function wh(){return!1}function fn(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)?ha:wh,this.isPropagationStopped=wh,this}return tt(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=ha)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=ha)},persist:function(){},isPersistent:ha}),t}var ki={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Mf=fn(ki),Hs=tt({},ki,{view:0,detail:0}),vS=fn(Hs),Qu,Ju,Oi,ql=tt({},Hs,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:$f,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!==Oi&&(Oi&&e.type==="mousemove"?(Qu=e.screenX-Oi.screenX,Ju=e.screenY-Oi.screenY):Ju=Qu=0,Oi=e),Qu)},movementY:function(e){return"movementY"in e?e.movementY:Ju}}),xh=fn(ql),yS=tt({},ql,{dataTransfer:0}),wS=fn(yS),xS=tt({},Hs,{relatedTarget:0}),ec=fn(xS),bS=tt({},ki,{animationName:0,elapsedTime:0,pseudoElement:0}),SS=fn(bS),kS=tt({},ki,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),ES=fn(kS),CS=tt({},ki,{data:0}),bh=fn(CS),IS={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},TS={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"},RS={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function jS(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=RS[e])?!!t[e]:!1}function $f(){return jS}var PS=tt({},Hs,{key:function(e){if(e.key){var t=IS[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Qa(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?TS[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:$f,charCode:function(e){return e.type==="keypress"?Qa(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Qa(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),FS=fn(PS),_S=tt({},ql,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Sh=fn(_S),MS=tt({},Hs,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:$f}),$S=fn(MS),AS=tt({},ki,{propertyName:0,elapsedTime:0,pseudoElement:0}),NS=fn(AS),LS=tt({},ql,{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}),zS=fn(LS),DS=[9,13,27,32],Af=fr&&"CompositionEvent"in window,ls=null;fr&&"documentMode"in document&&(ls=document.documentMode);var OS=fr&&"TextEvent"in window&&!ls,Ay=fr&&(!Af||ls&&8<ls&&11>=ls),kh=" ",Eh=!1;function Ny(e,t){switch(e){case"keyup":return DS.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ly(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Uo=!1;function BS(e,t){switch(e){case"compositionend":return Ly(t);case"keypress":return t.which!==32?null:(Eh=!0,kh);case"textInput":return e=t.data,e===kh&&Eh?null:e;default:return null}}function WS(e,t){if(Uo)return e==="compositionend"||!Af&&Ny(e,t)?(e=$y(),qa=_f=Fr=null,Uo=!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 Ay&&t.locale!=="ko"?null:t.data;default:return null}}var VS={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 Ch(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!VS[e.type]:t==="textarea"}function zy(e,t,n,r){my(r),t=yl(t,"onChange"),0<t.length&&(n=new Mf("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var us=null,Es=null;function HS(e){Gy(e,0)}function Ql(e){var t=Yo(e);if(ly(t))return e}function US(e,t){if(e==="change")return t}var Dy=!1;if(fr){var tc;if(fr){var nc="oninput"in document;if(!nc){var Ih=document.createElement("div");Ih.setAttribute("oninput","return;"),nc=typeof Ih.oninput=="function"}tc=nc}else tc=!1;Dy=tc&&(!document.documentMode||9<document.documentMode)}function Th(){us&&(us.detachEvent("onpropertychange",Oy),Es=us=null)}function Oy(e){if(e.propertyName==="value"&&Ql(Es)){var t=[];zy(t,Es,e,Tf(e)),wy(HS,t)}}function ZS(e,t,n){e==="focusin"?(Th(),us=t,Es=n,us.attachEvent("onpropertychange",Oy)):e==="focusout"&&Th()}function KS(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Ql(Es)}function YS(e,t){if(e==="click")return Ql(t)}function GS(e,t){if(e==="input"||e==="change")return Ql(t)}function XS(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var zn=typeof Object.is=="function"?Object.is:XS;function Cs(e,t){if(zn(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(!Jc.call(t,o)||!zn(e[o],t[o]))return!1}return!0}function Rh(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function jh(e,t){var n=Rh(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=Rh(n)}}function By(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?By(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Wy(){for(var e=window,t=dl();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=dl(e.document)}return t}function Nf(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 qS(e){var t=Wy(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&By(n.ownerDocument.documentElement,n)){if(r!==null&&Nf(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=jh(n,i);var s=jh(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 QS=fr&&"documentMode"in document&&11>=document.documentMode,Zo=null,yd=null,cs=null,wd=!1;function Ph(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;wd||Zo==null||Zo!==dl(r)||(r=Zo,"selectionStart"in r&&Nf(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}),cs&&Cs(cs,r)||(cs=r,r=yl(yd,"onSelect"),0<r.length&&(t=new Mf("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Zo)))}function ma(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Ko={animationend:ma("Animation","AnimationEnd"),animationiteration:ma("Animation","AnimationIteration"),animationstart:ma("Animation","AnimationStart"),transitionend:ma("Transition","TransitionEnd")},rc={},Vy={};fr&&(Vy=document.createElement("div").style,"AnimationEvent"in window||(delete Ko.animationend.animation,delete Ko.animationiteration.animation,delete Ko.animationstart.animation),"TransitionEvent"in window||delete Ko.transitionend.transition);function Jl(e){if(rc[e])return rc[e];if(!Ko[e])return e;var t=Ko[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Vy)return rc[e]=t[n];return e}var Hy=Jl("animationend"),Uy=Jl("animationiteration"),Zy=Jl("animationstart"),Ky=Jl("transitionend"),Yy=new Map,Fh="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 Zr(e,t){Yy.set(e,t),bo(t,[e])}for(var oc=0;oc<Fh.length;oc++){var ic=Fh[oc],JS=ic.toLowerCase(),ek=ic[0].toUpperCase()+ic.slice(1);Zr(JS,"on"+ek)}Zr(Hy,"onAnimationEnd");Zr(Uy,"onAnimationIteration");Zr(Zy,"onAnimationStart");Zr("dblclick","onDoubleClick");Zr("focusin","onFocus");Zr("focusout","onBlur");Zr(Ky,"onTransitionEnd");pi("onMouseEnter",["mouseout","mouseover"]);pi("onMouseLeave",["mouseout","mouseover"]);pi("onPointerEnter",["pointerout","pointerover"]);pi("onPointerLeave",["pointerout","pointerover"]);bo("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));bo("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));bo("onBeforeInput",["compositionend","keypress","textInput","paste"]);bo("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));bo("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));bo("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var rs="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(" "),tk=new Set("cancel close invalid load scroll toggle".split(" ").concat(rs));function _h(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,Jb(r,t,void 0,e),e.currentTarget=null}function Gy(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,u=a.currentTarget;if(a=a.listener,l!==i&&o.isPropagationStopped())break e;_h(o,a,u),i=l}else for(s=0;s<r.length;s++){if(a=r[s],l=a.instance,u=a.currentTarget,a=a.listener,l!==i&&o.isPropagationStopped())break e;_h(o,a,u),i=l}}}if(pl)throw e=hd,pl=!1,hd=null,e}function Ve(e,t){var n=t[Ed];n===void 0&&(n=t[Ed]=new Set);var r=e+"__bubble";n.has(r)||(Xy(t,e,2,!1),n.add(r))}function sc(e,t,n){var r=0;t&&(r|=4),Xy(n,e,r,t)}var ga="_reactListening"+Math.random().toString(36).slice(2);function Is(e){if(!e[ga]){e[ga]=!0,ry.forEach(function(n){n!=="selectionchange"&&(tk.has(n)||sc(n,!1,e),sc(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[ga]||(t[ga]=!0,sc("selectionchange",!1,t))}}function Xy(e,t,n,r){switch(My(t)){case 1:var o=mS;break;case 4:o=gS;break;default:o=Ff}n=o.bind(null,t,n,e),o=void 0,!pd||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 ac(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=io(a),s===null)return;if(l=s.tag,l===5||l===6){r=i=s;continue e}a=a.parentNode}}r=r.return}wy(function(){var u=i,f=Tf(n),p=[];e:{var h=Yy.get(e);if(h!==void 0){var m=Mf,w=e;switch(e){case"keypress":if(Qa(n)===0)break e;case"keydown":case"keyup":m=FS;break;case"focusin":w="focus",m=ec;break;case"focusout":w="blur",m=ec;break;case"beforeblur":case"afterblur":m=ec;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":m=xh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":m=wS;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":m=$S;break;case Hy:case Uy:case Zy:m=SS;break;case Ky:m=NS;break;case"scroll":m=vS;break;case"wheel":m=zS;break;case"copy":case"cut":case"paste":m=ES;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":m=Sh}var g=(t&4)!==0,k=!g&&e==="scroll",v=g?h!==null?h+"Capture":null:h;g=[];for(var y=u,x;y!==null;){x=y;var b=x.stateNode;if(x.tag===5&&b!==null&&(x=b,v!==null&&(b=xs(y,v),b!=null&&g.push(Ts(y,b,x)))),k)break;y=y.return}0<g.length&&(h=new m(h,w,null,n,f),p.push({event:h,listeners:g}))}}if(!(t&7)){e:{if(h=e==="mouseover"||e==="pointerover",m=e==="mouseout"||e==="pointerout",h&&n!==dd&&(w=n.relatedTarget||n.fromElement)&&(io(w)||w[pr]))break e;if((m||h)&&(h=f.window===f?f:(h=f.ownerDocument)?h.defaultView||h.parentWindow:window,m?(w=n.relatedTarget||n.toElement,m=u,w=w?io(w):null,w!==null&&(k=So(w),w!==k||w.tag!==5&&w.tag!==6)&&(w=null)):(m=null,w=u),m!==w)){if(g=xh,b="onMouseLeave",v="onMouseEnter",y="mouse",(e==="pointerout"||e==="pointerover")&&(g=Sh,b="onPointerLeave",v="onPointerEnter",y="pointer"),k=m==null?h:Yo(m),x=w==null?h:Yo(w),h=new g(b,y+"leave",m,n,f),h.target=k,h.relatedTarget=x,b=null,io(f)===u&&(g=new g(v,y+"enter",w,n,f),g.target=x,g.relatedTarget=k,b=g),k=b,m&&w)t:{for(g=m,v=w,y=0,x=g;x;x=_o(x))y++;for(x=0,b=v;b;b=_o(b))x++;for(;0<y-x;)g=_o(g),y--;for(;0<x-y;)v=_o(v),x--;for(;y--;){if(g===v||v!==null&&g===v.alternate)break t;g=_o(g),v=_o(v)}g=null}else g=null;m!==null&&Mh(p,h,m,g,!1),w!==null&&k!==null&&Mh(p,k,w,g,!0)}}e:{if(h=u?Yo(u):window,m=h.nodeName&&h.nodeName.toLowerCase(),m==="select"||m==="input"&&h.type==="file")var S=US;else if(Ch(h))if(Dy)S=GS;else{S=KS;var E=ZS}else(m=h.nodeName)&&m.toLowerCase()==="input"&&(h.type==="checkbox"||h.type==="radio")&&(S=YS);if(S&&(S=S(e,u))){zy(p,S,n,f);break e}E&&E(e,h,u),e==="focusout"&&(E=h._wrapperState)&&E.controlled&&h.type==="number"&&sd(h,"number",h.value)}switch(E=u?Yo(u):window,e){case"focusin":(Ch(E)||E.contentEditable==="true")&&(Zo=E,yd=u,cs=null);break;case"focusout":cs=yd=Zo=null;break;case"mousedown":wd=!0;break;case"contextmenu":case"mouseup":case"dragend":wd=!1,Ph(p,n,f);break;case"selectionchange":if(QS)break;case"keydown":case"keyup":Ph(p,n,f)}var R;if(Af)e:{switch(e){case"compositionstart":var j="onCompositionStart";break e;case"compositionend":j="onCompositionEnd";break e;case"compositionupdate":j="onCompositionUpdate";break e}j=void 0}else Uo?Ny(e,n)&&(j="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(j="onCompositionStart");j&&(Ay&&n.locale!=="ko"&&(Uo||j!=="onCompositionStart"?j==="onCompositionEnd"&&Uo&&(R=$y()):(Fr=f,_f="value"in Fr?Fr.value:Fr.textContent,Uo=!0)),E=yl(u,j),0<E.length&&(j=new bh(j,e,null,n,f),p.push({event:j,listeners:E}),R?j.data=R:(R=Ly(n),R!==null&&(j.data=R)))),(R=OS?BS(e,n):WS(e,n))&&(u=yl(u,"onBeforeInput"),0<u.length&&(f=new bh("onBeforeInput","beforeinput",null,n,f),p.push({event:f,listeners:u}),f.data=R))}Gy(p,t)})}function Ts(e,t,n){return{instance:e,listener:t,currentTarget:n}}function yl(e,t){for(var n=t+"Capture",r=[];e!==null;){var o=e,i=o.stateNode;o.tag===5&&i!==null&&(o=i,i=xs(e,n),i!=null&&r.unshift(Ts(e,i,o)),i=xs(e,t),i!=null&&r.push(Ts(e,i,o))),e=e.return}return r}function _o(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Mh(e,t,n,r,o){for(var i=t._reactName,s=[];n!==null&&n!==r;){var a=n,l=a.alternate,u=a.stateNode;if(l!==null&&l===r)break;a.tag===5&&u!==null&&(a=u,o?(l=xs(n,i),l!=null&&s.unshift(Ts(n,l,a))):o||(l=xs(n,i),l!=null&&s.push(Ts(n,l,a)))),n=n.return}s.length!==0&&e.push({event:t,listeners:s})}var nk=/\r\n?/g,rk=/\u0000|\uFFFD/g;function $h(e){return(typeof e=="string"?e:""+e).replace(nk,`
38
+ `).replace(rk,"")}function va(e,t,n){if(t=$h(t),$h(e)!==t&&n)throw Error(te(425))}function wl(){}var xd=null,bd=null;function Sd(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 kd=typeof setTimeout=="function"?setTimeout:void 0,ok=typeof clearTimeout=="function"?clearTimeout:void 0,Ah=typeof Promise=="function"?Promise:void 0,ik=typeof queueMicrotask=="function"?queueMicrotask:typeof Ah<"u"?function(e){return Ah.resolve(null).then(e).catch(sk)}:kd;function sk(e){setTimeout(function(){throw e})}function lc(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),ks(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=o}while(n);ks(t)}function Nr(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 Nh(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 Ei=Math.random().toString(36).slice(2),Kn="__reactFiber$"+Ei,Rs="__reactProps$"+Ei,pr="__reactContainer$"+Ei,Ed="__reactEvents$"+Ei,ak="__reactListeners$"+Ei,lk="__reactHandles$"+Ei;function io(e){var t=e[Kn];if(t)return t;for(var n=e.parentNode;n;){if(t=n[pr]||n[Kn]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Nh(e);e!==null;){if(n=e[Kn])return n;e=Nh(e)}return t}e=n,n=e.parentNode}return null}function Us(e){return e=e[Kn]||e[pr],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Yo(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(te(33))}function eu(e){return e[Rs]||null}var Cd=[],Go=-1;function Kr(e){return{current:e}}function Ue(e){0>Go||(e.current=Cd[Go],Cd[Go]=null,Go--)}function We(e,t){Go++,Cd[Go]=e.current,e.current=t}var Vr={},Lt=Kr(Vr),Xt=Kr(!1),po=Vr;function hi(e,t){var n=e.type.contextTypes;if(!n)return Vr;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 qt(e){return e=e.childContextTypes,e!=null}function xl(){Ue(Xt),Ue(Lt)}function Lh(e,t,n){if(Lt.current!==Vr)throw Error(te(168));We(Lt,t),We(Xt,n)}function qy(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(te(108,Zb(e)||"Unknown",o));return tt({},n,r)}function bl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Vr,po=Lt.current,We(Lt,e),We(Xt,Xt.current),!0}function zh(e,t,n){var r=e.stateNode;if(!r)throw Error(te(169));n?(e=qy(e,t,po),r.__reactInternalMemoizedMergedChildContext=e,Ue(Xt),Ue(Lt),We(Lt,e)):Ue(Xt),We(Xt,n)}var sr=null,tu=!1,uc=!1;function Qy(e){sr===null?sr=[e]:sr.push(e)}function uk(e){tu=!0,Qy(e)}function Yr(){if(!uc&&sr!==null){uc=!0;var e=0,t=Ne;try{var n=sr;for(Ne=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}sr=null,tu=!1}catch(o){throw sr!==null&&(sr=sr.slice(e+1)),ky(Rf,Yr),o}finally{Ne=t,uc=!1}}return null}var Xo=[],qo=0,Sl=null,kl=0,yn=[],wn=0,ho=null,lr=1,ur="";function ro(e,t){Xo[qo++]=kl,Xo[qo++]=Sl,Sl=e,kl=t}function Jy(e,t,n){yn[wn++]=lr,yn[wn++]=ur,yn[wn++]=ho,ho=e;var r=lr;e=ur;var o=32-An(r)-1;r&=~(1<<o),n+=1;var i=32-An(t)+o;if(30<i){var s=o-o%5;i=(r&(1<<s)-1).toString(32),r>>=s,o-=s,lr=1<<32-An(t)+o|n<<o|r,ur=i+e}else lr=1<<i|n<<o|r,ur=e}function Lf(e){e.return!==null&&(ro(e,1),Jy(e,1,0))}function zf(e){for(;e===Sl;)Sl=Xo[--qo],Xo[qo]=null,kl=Xo[--qo],Xo[qo]=null;for(;e===ho;)ho=yn[--wn],yn[wn]=null,ur=yn[--wn],yn[wn]=null,lr=yn[--wn],yn[wn]=null}var un=null,ln=null,Xe=!1,$n=null;function e0(e,t){var n=bn(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 Dh(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,un=e,ln=Nr(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,un=e,ln=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=ho!==null?{id:lr,overflow:ur}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=bn(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,un=e,ln=null,!0):!1;default:return!1}}function Id(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Td(e){if(Xe){var t=ln;if(t){var n=t;if(!Dh(e,t)){if(Id(e))throw Error(te(418));t=Nr(n.nextSibling);var r=un;t&&Dh(e,t)?e0(r,n):(e.flags=e.flags&-4097|2,Xe=!1,un=e)}}else{if(Id(e))throw Error(te(418));e.flags=e.flags&-4097|2,Xe=!1,un=e}}}function Oh(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;un=e}function ya(e){if(e!==un)return!1;if(!Xe)return Oh(e),Xe=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Sd(e.type,e.memoizedProps)),t&&(t=ln)){if(Id(e))throw t0(),Error(te(418));for(;t;)e0(e,t),t=Nr(t.nextSibling)}if(Oh(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(te(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){ln=Nr(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}ln=null}}else ln=un?Nr(e.stateNode.nextSibling):null;return!0}function t0(){for(var e=ln;e;)e=Nr(e.nextSibling)}function mi(){ln=un=null,Xe=!1}function Df(e){$n===null?$n=[e]:$n.push(e)}var ck=gr.ReactCurrentBatchConfig;function Bi(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(te(309));var r=n.stateNode}if(!r)throw Error(te(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(te(284));if(!n._owner)throw Error(te(290,e))}return e}function wa(e,t){throw e=Object.prototype.toString.call(t),Error(te(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Bh(e){var t=e._init;return t(e._payload)}function n0(e){function t(v,y){if(e){var x=v.deletions;x===null?(v.deletions=[y],v.flags|=16):x.push(y)}}function n(v,y){if(!e)return null;for(;y!==null;)t(v,y),y=y.sibling;return null}function r(v,y){for(v=new Map;y!==null;)y.key!==null?v.set(y.key,y):v.set(y.index,y),y=y.sibling;return v}function o(v,y){return v=Or(v,y),v.index=0,v.sibling=null,v}function i(v,y,x){return v.index=x,e?(x=v.alternate,x!==null?(x=x.index,x<y?(v.flags|=2,y):x):(v.flags|=2,y)):(v.flags|=1048576,y)}function s(v){return e&&v.alternate===null&&(v.flags|=2),v}function a(v,y,x,b){return y===null||y.tag!==6?(y=gc(x,v.mode,b),y.return=v,y):(y=o(y,x),y.return=v,y)}function l(v,y,x,b){var S=x.type;return S===Ho?f(v,y,x.props.children,b,x.key):y!==null&&(y.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===Ir&&Bh(S)===y.type)?(b=o(y,x.props),b.ref=Bi(v,y,x),b.return=v,b):(b=il(x.type,x.key,x.props,null,v.mode,b),b.ref=Bi(v,y,x),b.return=v,b)}function u(v,y,x,b){return y===null||y.tag!==4||y.stateNode.containerInfo!==x.containerInfo||y.stateNode.implementation!==x.implementation?(y=vc(x,v.mode,b),y.return=v,y):(y=o(y,x.children||[]),y.return=v,y)}function f(v,y,x,b,S){return y===null||y.tag!==7?(y=fo(x,v.mode,b,S),y.return=v,y):(y=o(y,x),y.return=v,y)}function p(v,y,x){if(typeof y=="string"&&y!==""||typeof y=="number")return y=gc(""+y,v.mode,x),y.return=v,y;if(typeof y=="object"&&y!==null){switch(y.$$typeof){case la:return x=il(y.type,y.key,y.props,null,v.mode,x),x.ref=Bi(v,null,y),x.return=v,x;case Vo:return y=vc(y,v.mode,x),y.return=v,y;case Ir:var b=y._init;return p(v,b(y._payload),x)}if(ts(y)||Ni(y))return y=fo(y,v.mode,x,null),y.return=v,y;wa(v,y)}return null}function h(v,y,x,b){var S=y!==null?y.key:null;if(typeof x=="string"&&x!==""||typeof x=="number")return S!==null?null:a(v,y,""+x,b);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case la:return x.key===S?l(v,y,x,b):null;case Vo:return x.key===S?u(v,y,x,b):null;case Ir:return S=x._init,h(v,y,S(x._payload),b)}if(ts(x)||Ni(x))return S!==null?null:f(v,y,x,b,null);wa(v,x)}return null}function m(v,y,x,b,S){if(typeof b=="string"&&b!==""||typeof b=="number")return v=v.get(x)||null,a(y,v,""+b,S);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case la:return v=v.get(b.key===null?x:b.key)||null,l(y,v,b,S);case Vo:return v=v.get(b.key===null?x:b.key)||null,u(y,v,b,S);case Ir:var E=b._init;return m(v,y,x,E(b._payload),S)}if(ts(b)||Ni(b))return v=v.get(x)||null,f(y,v,b,S,null);wa(y,b)}return null}function w(v,y,x,b){for(var S=null,E=null,R=y,j=y=0,I=null;R!==null&&j<x.length;j++){R.index>j?(I=R,R=null):I=R.sibling;var _=h(v,R,x[j],b);if(_===null){R===null&&(R=I);break}e&&R&&_.alternate===null&&t(v,R),y=i(_,y,j),E===null?S=_:E.sibling=_,E=_,R=I}if(j===x.length)return n(v,R),Xe&&ro(v,j),S;if(R===null){for(;j<x.length;j++)R=p(v,x[j],b),R!==null&&(y=i(R,y,j),E===null?S=R:E.sibling=R,E=R);return Xe&&ro(v,j),S}for(R=r(v,R);j<x.length;j++)I=m(R,v,j,x[j],b),I!==null&&(e&&I.alternate!==null&&R.delete(I.key===null?j:I.key),y=i(I,y,j),E===null?S=I:E.sibling=I,E=I);return e&&R.forEach(function(A){return t(v,A)}),Xe&&ro(v,j),S}function g(v,y,x,b){var S=Ni(x);if(typeof S!="function")throw Error(te(150));if(x=S.call(x),x==null)throw Error(te(151));for(var E=S=null,R=y,j=y=0,I=null,_=x.next();R!==null&&!_.done;j++,_=x.next()){R.index>j?(I=R,R=null):I=R.sibling;var A=h(v,R,_.value,b);if(A===null){R===null&&(R=I);break}e&&R&&A.alternate===null&&t(v,R),y=i(A,y,j),E===null?S=A:E.sibling=A,E=A,R=I}if(_.done)return n(v,R),Xe&&ro(v,j),S;if(R===null){for(;!_.done;j++,_=x.next())_=p(v,_.value,b),_!==null&&(y=i(_,y,j),E===null?S=_:E.sibling=_,E=_);return Xe&&ro(v,j),S}for(R=r(v,R);!_.done;j++,_=x.next())_=m(R,v,j,_.value,b),_!==null&&(e&&_.alternate!==null&&R.delete(_.key===null?j:_.key),y=i(_,y,j),E===null?S=_:E.sibling=_,E=_);return e&&R.forEach(function(W){return t(v,W)}),Xe&&ro(v,j),S}function k(v,y,x,b){if(typeof x=="object"&&x!==null&&x.type===Ho&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case la:e:{for(var S=x.key,E=y;E!==null;){if(E.key===S){if(S=x.type,S===Ho){if(E.tag===7){n(v,E.sibling),y=o(E,x.props.children),y.return=v,v=y;break e}}else if(E.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===Ir&&Bh(S)===E.type){n(v,E.sibling),y=o(E,x.props),y.ref=Bi(v,E,x),y.return=v,v=y;break e}n(v,E);break}else t(v,E);E=E.sibling}x.type===Ho?(y=fo(x.props.children,v.mode,b,x.key),y.return=v,v=y):(b=il(x.type,x.key,x.props,null,v.mode,b),b.ref=Bi(v,y,x),b.return=v,v=b)}return s(v);case Vo:e:{for(E=x.key;y!==null;){if(y.key===E)if(y.tag===4&&y.stateNode.containerInfo===x.containerInfo&&y.stateNode.implementation===x.implementation){n(v,y.sibling),y=o(y,x.children||[]),y.return=v,v=y;break e}else{n(v,y);break}else t(v,y);y=y.sibling}y=vc(x,v.mode,b),y.return=v,v=y}return s(v);case Ir:return E=x._init,k(v,y,E(x._payload),b)}if(ts(x))return w(v,y,x,b);if(Ni(x))return g(v,y,x,b);wa(v,x)}return typeof x=="string"&&x!==""||typeof x=="number"?(x=""+x,y!==null&&y.tag===6?(n(v,y.sibling),y=o(y,x),y.return=v,v=y):(n(v,y),y=gc(x,v.mode,b),y.return=v,v=y),s(v)):n(v,y)}return k}var gi=n0(!0),r0=n0(!1),El=Kr(null),Cl=null,Qo=null,Of=null;function Bf(){Of=Qo=Cl=null}function Wf(e){var t=El.current;Ue(El),e._currentValue=t}function Rd(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 li(e,t){Cl=e,Of=Qo=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Gt=!0),e.firstContext=null)}function En(e){var t=e._currentValue;if(Of!==e)if(e={context:e,memoizedValue:t,next:null},Qo===null){if(Cl===null)throw Error(te(308));Qo=e,Cl.dependencies={lanes:0,firstContext:e}}else Qo=Qo.next=e;return t}var so=null;function Vf(e){so===null?so=[e]:so.push(e)}function o0(e,t,n,r){var o=t.interleaved;return o===null?(n.next=n,Vf(t)):(n.next=o.next,o.next=n),t.interleaved=n,hr(e,r)}function hr(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 Tr=!1;function Hf(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 dr(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Lr(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,je&2){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,hr(e,n)}return o=r.interleaved,o===null?(t.next=t,Vf(r)):(t.next=o.next,o.next=t),r.interleaved=t,hr(e,n)}function Ja(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,jf(e,n)}}function Wh(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 Il(e,t,n,r){var o=e.updateQueue;Tr=!1;var i=o.firstBaseUpdate,s=o.lastBaseUpdate,a=o.shared.pending;if(a!==null){o.shared.pending=null;var l=a,u=l.next;l.next=null,s===null?i=u:s.next=u,s=l;var f=e.alternate;f!==null&&(f=f.updateQueue,a=f.lastBaseUpdate,a!==s&&(a===null?f.firstBaseUpdate=u:a.next=u,f.lastBaseUpdate=l))}if(i!==null){var p=o.baseState;s=0,f=u=l=null,a=i;do{var h=a.lane,m=a.eventTime;if((r&h)===h){f!==null&&(f=f.next={eventTime:m,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var w=e,g=a;switch(h=t,m=n,g.tag){case 1:if(w=g.payload,typeof w=="function"){p=w.call(m,p,h);break e}p=w;break e;case 3:w.flags=w.flags&-65537|128;case 0:if(w=g.payload,h=typeof w=="function"?w.call(m,p,h):w,h==null)break e;p=tt({},p,h);break e;case 2:Tr=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,h=o.effects,h===null?o.effects=[a]:h.push(a))}else m={eventTime:m,lane:h,tag:a.tag,payload:a.payload,callback:a.callback,next:null},f===null?(u=f=m,l=p):f=f.next=m,s|=h;if(a=a.next,a===null){if(a=o.shared.pending,a===null)break;h=a,a=h.next,h.next=null,o.lastBaseUpdate=h,o.shared.pending=null}}while(!0);if(f===null&&(l=p),o.baseState=l,o.firstBaseUpdate=u,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);go|=s,e.lanes=s,e.memoizedState=p}}function Vh(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(te(191,o));o.call(r)}}}var Zs={},qn=Kr(Zs),js=Kr(Zs),Ps=Kr(Zs);function ao(e){if(e===Zs)throw Error(te(174));return e}function Uf(e,t){switch(We(Ps,t),We(js,e),We(qn,Zs),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:ld(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=ld(t,e)}Ue(qn),We(qn,t)}function vi(){Ue(qn),Ue(js),Ue(Ps)}function s0(e){ao(Ps.current);var t=ao(qn.current),n=ld(t,e.type);t!==n&&(We(js,e),We(qn,n))}function Zf(e){js.current===e&&(Ue(qn),Ue(js))}var Je=Kr(0);function Tl(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 cc=[];function Kf(){for(var e=0;e<cc.length;e++)cc[e]._workInProgressVersionPrimary=null;cc.length=0}var el=gr.ReactCurrentDispatcher,dc=gr.ReactCurrentBatchConfig,mo=0,et=null,pt=null,wt=null,Rl=!1,ds=!1,Fs=0,dk=0;function _t(){throw Error(te(321))}function Yf(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!zn(e[n],t[n]))return!1;return!0}function Gf(e,t,n,r,o,i){if(mo=i,et=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,el.current=e===null||e.memoizedState===null?mk:gk,e=n(r,o),ds){i=0;do{if(ds=!1,Fs=0,25<=i)throw Error(te(301));i+=1,wt=pt=null,t.updateQueue=null,el.current=vk,e=n(r,o)}while(ds)}if(el.current=jl,t=pt!==null&&pt.next!==null,mo=0,wt=pt=et=null,Rl=!1,t)throw Error(te(300));return e}function Xf(){var e=Fs!==0;return Fs=0,e}function Un(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return wt===null?et.memoizedState=wt=e:wt=wt.next=e,wt}function Cn(){if(pt===null){var e=et.alternate;e=e!==null?e.memoizedState:null}else e=pt.next;var t=wt===null?et.memoizedState:wt.next;if(t!==null)wt=t,pt=e;else{if(e===null)throw Error(te(310));pt=e,e={memoizedState:pt.memoizedState,baseState:pt.baseState,baseQueue:pt.baseQueue,queue:pt.queue,next:null},wt===null?et.memoizedState=wt=e:wt=wt.next=e}return wt}function _s(e,t){return typeof t=="function"?t(e):t}function fc(e){var t=Cn(),n=t.queue;if(n===null)throw Error(te(311));n.lastRenderedReducer=e;var r=pt,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,u=i;do{var f=u.lane;if((mo&f)===f)l!==null&&(l=l.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:e(r,u.action);else{var p={lane:f,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};l===null?(a=l=p,s=r):l=l.next=p,et.lanes|=f,go|=f}u=u.next}while(u!==null&&u!==i);l===null?s=r:l.next=a,zn(r,t.memoizedState)||(Gt=!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,et.lanes|=i,go|=i,o=o.next;while(o!==e)}else o===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function pc(e){var t=Cn(),n=t.queue;if(n===null)throw Error(te(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);zn(i,t.memoizedState)||(Gt=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function a0(){}function l0(e,t){var n=et,r=Cn(),o=t(),i=!zn(r.memoizedState,o);if(i&&(r.memoizedState=o,Gt=!0),r=r.queue,qf(d0.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||wt!==null&&wt.memoizedState.tag&1){if(n.flags|=2048,Ms(9,c0.bind(null,n,r,o,t),void 0,null),xt===null)throw Error(te(349));mo&30||u0(n,t,o)}return o}function u0(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=et.updateQueue,t===null?(t={lastEffect:null,stores:null},et.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function c0(e,t,n,r){t.value=n,t.getSnapshot=r,f0(t)&&p0(e)}function d0(e,t,n){return n(function(){f0(t)&&p0(e)})}function f0(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!zn(e,n)}catch{return!0}}function p0(e){var t=hr(e,1);t!==null&&Nn(t,e,1,-1)}function Hh(e){var t=Un();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:_s,lastRenderedState:e},t.queue=e,e=e.dispatch=hk.bind(null,et,e),[t.memoizedState,e]}function Ms(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=et.updateQueue,t===null?(t={lastEffect:null,stores:null},et.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 h0(){return Cn().memoizedState}function tl(e,t,n,r){var o=Un();et.flags|=e,o.memoizedState=Ms(1|t,n,void 0,r===void 0?null:r)}function nu(e,t,n,r){var o=Cn();r=r===void 0?null:r;var i=void 0;if(pt!==null){var s=pt.memoizedState;if(i=s.destroy,r!==null&&Yf(r,s.deps)){o.memoizedState=Ms(t,n,i,r);return}}et.flags|=e,o.memoizedState=Ms(1|t,n,i,r)}function Uh(e,t){return tl(8390656,8,e,t)}function qf(e,t){return nu(2048,8,e,t)}function m0(e,t){return nu(4,2,e,t)}function g0(e,t){return nu(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 y0(e,t,n){return n=n!=null?n.concat([e]):null,nu(4,4,v0.bind(null,t,e),n)}function Qf(){}function w0(e,t){var n=Cn();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Yf(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function x0(e,t){var n=Cn();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Yf(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function b0(e,t,n){return mo&21?(zn(n,t)||(n=Iy(),et.lanes|=n,go|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Gt=!0),e.memoizedState=n)}function fk(e,t){var n=Ne;Ne=n!==0&&4>n?n:4,e(!0);var r=dc.transition;dc.transition={};try{e(!1),t()}finally{Ne=n,dc.transition=r}}function S0(){return Cn().memoizedState}function pk(e,t,n){var r=Dr(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},k0(e))E0(t,n);else if(n=o0(e,t,n,r),n!==null){var o=Wt();Nn(n,e,r,o),C0(n,t,r)}}function hk(e,t,n){var r=Dr(e),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(k0(e))E0(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,zn(a,s)){var l=t.interleaved;l===null?(o.next=o,Vf(t)):(o.next=l.next,l.next=o),t.interleaved=o;return}}catch{}finally{}n=o0(e,t,o,r),n!==null&&(o=Wt(),Nn(n,e,r,o),C0(n,t,r))}}function k0(e){var t=e.alternate;return e===et||t!==null&&t===et}function E0(e,t){ds=Rl=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function C0(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,jf(e,n)}}var jl={readContext:En,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},mk={readContext:En,useCallback:function(e,t){return Un().memoizedState=[e,t===void 0?null:t],e},useContext:En,useEffect:Uh,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,tl(4194308,4,v0.bind(null,t,e),n)},useLayoutEffect:function(e,t){return tl(4194308,4,e,t)},useInsertionEffect:function(e,t){return tl(4,2,e,t)},useMemo:function(e,t){var n=Un();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Un();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=pk.bind(null,et,e),[r.memoizedState,e]},useRef:function(e){var t=Un();return e={current:e},t.memoizedState=e},useState:Hh,useDebugValue:Qf,useDeferredValue:function(e){return Un().memoizedState=e},useTransition:function(){var e=Hh(!1),t=e[0];return e=fk.bind(null,e[1]),Un().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=et,o=Un();if(Xe){if(n===void 0)throw Error(te(407));n=n()}else{if(n=t(),xt===null)throw Error(te(349));mo&30||u0(r,t,n)}o.memoizedState=n;var i={value:n,getSnapshot:t};return o.queue=i,Uh(d0.bind(null,r,i,e),[e]),r.flags|=2048,Ms(9,c0.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Un(),t=xt.identifierPrefix;if(Xe){var n=ur,r=lr;n=(r&~(1<<32-An(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Fs++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=dk++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},gk={readContext:En,useCallback:w0,useContext:En,useEffect:qf,useImperativeHandle:y0,useInsertionEffect:m0,useLayoutEffect:g0,useMemo:x0,useReducer:fc,useRef:h0,useState:function(){return fc(_s)},useDebugValue:Qf,useDeferredValue:function(e){var t=Cn();return b0(t,pt.memoizedState,e)},useTransition:function(){var e=fc(_s)[0],t=Cn().memoizedState;return[e,t]},useMutableSource:a0,useSyncExternalStore:l0,useId:S0,unstable_isNewReconciler:!1},vk={readContext:En,useCallback:w0,useContext:En,useEffect:qf,useImperativeHandle:y0,useInsertionEffect:m0,useLayoutEffect:g0,useMemo:x0,useReducer:pc,useRef:h0,useState:function(){return pc(_s)},useDebugValue:Qf,useDeferredValue:function(e){var t=Cn();return pt===null?t.memoizedState=e:b0(t,pt.memoizedState,e)},useTransition:function(){var e=pc(_s)[0],t=Cn().memoizedState;return[e,t]},useMutableSource:a0,useSyncExternalStore:l0,useId:S0,unstable_isNewReconciler:!1};function _n(e,t){if(e&&e.defaultProps){t=tt({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function jd(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:tt({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var ru={isMounted:function(e){return(e=e._reactInternals)?So(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Wt(),o=Dr(e),i=dr(r,o);i.payload=t,n!=null&&(i.callback=n),t=Lr(e,i,o),t!==null&&(Nn(t,e,o,r),Ja(t,e,o))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Wt(),o=Dr(e),i=dr(r,o);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Lr(e,i,o),t!==null&&(Nn(t,e,o,r),Ja(t,e,o))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Wt(),r=Dr(e),o=dr(n,r);o.tag=2,t!=null&&(o.callback=t),t=Lr(e,o,r),t!==null&&(Nn(t,e,r,n),Ja(t,e,r))}};function Zh(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?!Cs(n,r)||!Cs(o,i):!0}function I0(e,t,n){var r=!1,o=Vr,i=t.contextType;return typeof i=="object"&&i!==null?i=En(i):(o=qt(t)?po:Lt.current,r=t.contextTypes,i=(r=r!=null)?hi(e,o):Vr),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=ru,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=o,e.__reactInternalMemoizedMaskedChildContext=i),t}function Kh(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&&ru.enqueueReplaceState(t,t.state,null)}function Pd(e,t,n,r){var o=e.stateNode;o.props=n,o.state=e.memoizedState,o.refs={},Hf(e);var i=t.contextType;typeof i=="object"&&i!==null?o.context=En(i):(i=qt(t)?po:Lt.current,o.context=hi(e,i)),o.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(jd(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&&ru.enqueueReplaceState(o,o.state,null),Il(e,n,o,r),o.state=e.memoizedState),typeof o.componentDidMount=="function"&&(e.flags|=4194308)}function yi(e,t){try{var n="",r=t;do n+=Ub(r),r=r.return;while(r);var o=n}catch(i){o=`
39
+ Error generating stack: `+i.message+`
40
+ `+i.stack}return{value:e,source:t,stack:o,digest:null}}function hc(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Fd(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var yk=typeof WeakMap=="function"?WeakMap:Map;function T0(e,t,n){n=dr(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Fl||(Fl=!0,Bd=r),Fd(e,t)},n}function R0(e,t,n){n=dr(-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(){Fd(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){Fd(e,t),typeof r!="function"&&(zr===null?zr=new Set([this]):zr.add(this));var s=t.stack;this.componentDidCatch(t.value,{componentStack:s!==null?s:""})}),n}function Yh(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new yk;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=_k.bind(null,e,t,n),t.then(e,e))}function Gh(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 Xh(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=dr(-1,1),t.tag=2,Lr(n,t,1))),n.lanes|=1),e)}var wk=gr.ReactCurrentOwner,Gt=!1;function Bt(e,t,n,r){t.child=e===null?r0(t,null,n,r):gi(t,e.child,n,r)}function qh(e,t,n,r,o){n=n.render;var i=t.ref;return li(t,o),r=Gf(e,t,n,r,i,o),n=Xf(),e!==null&&!Gt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,mr(e,t,o)):(Xe&&n&&Lf(t),t.flags|=1,Bt(e,t,r,o),t.child)}function Qh(e,t,n,r,o){if(e===null){var i=n.type;return typeof i=="function"&&!sp(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,j0(e,t,i,r,o)):(e=il(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:Cs,n(s,r)&&e.ref===t.ref)return mr(e,t,o)}return t.flags|=1,e=Or(i,r),e.ref=t.ref,e.return=t,t.child=e}function j0(e,t,n,r,o){if(e!==null){var i=e.memoizedProps;if(Cs(i,r)&&e.ref===t.ref)if(Gt=!1,t.pendingProps=r=i,(e.lanes&o)!==0)e.flags&131072&&(Gt=!0);else return t.lanes=e.lanes,mr(e,t,o)}return _d(e,t,n,r,o)}function P0(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},We(ei,an),an|=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,We(ei,an),an|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,We(ei,an),an|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,We(ei,an),an|=r;return Bt(e,t,o,n),t.child}function F0(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function _d(e,t,n,r,o){var i=qt(n)?po:Lt.current;return i=hi(t,i),li(t,o),n=Gf(e,t,n,r,i,o),r=Xf(),e!==null&&!Gt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,mr(e,t,o)):(Xe&&r&&Lf(t),t.flags|=1,Bt(e,t,n,o),t.child)}function Jh(e,t,n,r,o){if(qt(n)){var i=!0;bl(t)}else i=!1;if(li(t,o),t.stateNode===null)nl(e,t),I0(t,n,r),Pd(t,n,r,o),r=!0;else if(e===null){var s=t.stateNode,a=t.memoizedProps;s.props=a;var l=s.context,u=n.contextType;typeof u=="object"&&u!==null?u=En(u):(u=qt(n)?po:Lt.current,u=hi(t,u));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!==u)&&Kh(t,s,r,u),Tr=!1;var h=t.memoizedState;s.state=h,Il(t,r,s,o),l=t.memoizedState,a!==r||h!==l||Xt.current||Tr?(typeof f=="function"&&(jd(t,n,f,r),l=t.memoizedState),(a=Tr||Zh(t,n,a,r,h,l,u))?(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=u,r=a):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{s=t.stateNode,i0(e,t),a=t.memoizedProps,u=t.type===t.elementType?a:_n(t.type,a),s.props=u,p=t.pendingProps,h=s.context,l=n.contextType,typeof l=="object"&&l!==null?l=En(l):(l=qt(n)?po:Lt.current,l=hi(t,l));var m=n.getDerivedStateFromProps;(f=typeof m=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(a!==p||h!==l)&&Kh(t,s,r,l),Tr=!1,h=t.memoizedState,s.state=h,Il(t,r,s,o);var w=t.memoizedState;a!==p||h!==w||Xt.current||Tr?(typeof m=="function"&&(jd(t,n,m,r),w=t.memoizedState),(u=Tr||Zh(t,n,u,r,h,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&&h===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=w),s.props=r,s.state=w,s.context=l,r=u):(typeof s.componentDidUpdate!="function"||a===e.memoizedProps&&h===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&h===e.memoizedState||(t.flags|=1024),r=!1)}return Md(e,t,n,r,i,o)}function Md(e,t,n,r,o,i){F0(e,t);var s=(t.flags&128)!==0;if(!r&&!s)return o&&zh(t,n,!1),mr(e,t,i);r=t.stateNode,wk.current=t;var a=s&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&s?(t.child=gi(t,e.child,null,i),t.child=gi(t,null,a,i)):Bt(e,t,a,i),t.memoizedState=r.state,o&&zh(t,n,!0),t.child}function _0(e){var t=e.stateNode;t.pendingContext?Lh(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Lh(e,t.context,!1),Uf(e,t.containerInfo)}function em(e,t,n,r,o){return mi(),Df(o),t.flags|=256,Bt(e,t,n,r),t.child}var $d={dehydrated:null,treeContext:null,retryLane:0};function Ad(e){return{baseLanes:e,cachePool:null,transitions:null}}function M0(e,t,n){var r=t.pendingProps,o=Je.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),We(Je,o&1),e===null)return Td(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=su(s,r,0,null),e=fo(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=Ad(n),t.memoizedState=$d,e):Jf(t,s));if(o=e.memoizedState,o!==null&&(a=o.dehydrated,a!==null))return xk(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=Or(o,l),r.subtreeFlags=o.subtreeFlags&14680064),a!==null?i=Or(a,i):(i=fo(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?Ad(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},i.memoizedState=s,i.childLanes=e.childLanes&~n,t.memoizedState=$d,r}return i=e.child,e=i.sibling,r=Or(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 Jf(e,t){return t=su({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function xa(e,t,n,r){return r!==null&&Df(r),gi(t,e.child,null,n),e=Jf(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function xk(e,t,n,r,o,i,s){if(n)return t.flags&256?(t.flags&=-257,r=hc(Error(te(422))),xa(e,t,s,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,o=t.mode,r=su({mode:"visible",children:r.children},o,0,null),i=fo(i,o,s,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&gi(t,e.child,null,s),t.child.memoizedState=Ad(s),t.memoizedState=$d,i);if(!(t.mode&1))return xa(e,t,s,null);if(o.data==="$!"){if(r=o.nextSibling&&o.nextSibling.dataset,r)var a=r.dgst;return r=a,i=Error(te(419)),r=hc(i,r,void 0),xa(e,t,s,r)}if(a=(s&e.childLanes)!==0,Gt||a){if(r=xt,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,hr(e,o),Nn(r,e,o,-1))}return ip(),r=hc(Error(te(421))),xa(e,t,s,r)}return o.data==="$?"?(t.flags|=128,t.child=e.child,t=Mk.bind(null,e),o._reactRetry=t,null):(e=i.treeContext,ln=Nr(o.nextSibling),un=t,Xe=!0,$n=null,e!==null&&(yn[wn++]=lr,yn[wn++]=ur,yn[wn++]=ho,lr=e.id,ur=e.overflow,ho=t),t=Jf(t,r.children),t.flags|=4096,t)}function tm(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Rd(e.return,t,n)}function mc(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 $0(e,t,n){var r=t.pendingProps,o=r.revealOrder,i=r.tail;if(Bt(e,t,r.children,n),r=Je.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&&tm(e,n,t);else if(e.tag===19)tm(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(We(Je,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&&Tl(e)===null&&(o=n),n=n.sibling;n=o,n===null?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),mc(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&&Tl(e)===null){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}mc(t,!0,n,null,i);break;case"together":mc(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function nl(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function mr(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),go|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(te(153));if(t.child!==null){for(e=t.child,n=Or(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Or(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function bk(e,t,n){switch(t.tag){case 3:_0(t),mi();break;case 5:s0(t);break;case 1:qt(t.type)&&bl(t);break;case 4:Uf(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,o=t.memoizedProps.value;We(El,r._currentValue),r._currentValue=o;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(We(Je,Je.current&1),t.flags|=128,null):n&t.child.childLanes?M0(e,t,n):(We(Je,Je.current&1),e=mr(e,t,n),e!==null?e.sibling:null);We(Je,Je.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return $0(e,t,n);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),We(Je,Je.current),r)break;return null;case 22:case 23:return t.lanes=0,P0(e,t,n)}return mr(e,t,n)}var A0,Nd,N0,L0;A0=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}};Nd=function(){};N0=function(e,t,n,r){var o=e.memoizedProps;if(o!==r){e=t.stateNode,ao(qn.current);var i=null;switch(n){case"input":o=od(e,o),r=od(e,r),i=[];break;case"select":o=tt({},o,{value:void 0}),r=tt({},r,{value:void 0}),i=[];break;case"textarea":o=ad(e,o),r=ad(e,r),i=[];break;default:typeof o.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=wl)}ud(n,r);var s;n=null;for(u in o)if(!r.hasOwnProperty(u)&&o.hasOwnProperty(u)&&o[u]!=null)if(u==="style"){var a=o[u];for(s in a)a.hasOwnProperty(s)&&(n||(n={}),n[s]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(ys.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in r){var l=r[u];if(a=o!=null?o[u]:void 0,r.hasOwnProperty(u)&&l!==a&&(l!=null||a!=null))if(u==="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(u,n)),n=l;else u==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(i=i||[]).push(u,l)):u==="children"?typeof l!="string"&&typeof l!="number"||(i=i||[]).push(u,""+l):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(ys.hasOwnProperty(u)?(l!=null&&u==="onScroll"&&Ve("scroll",e),i||a===l||(i=[])):(i=i||[]).push(u,l))}n&&(i=i||[]).push("style",n);var u=i;(t.updateQueue=u)&&(t.flags|=4)}};L0=function(e,t,n,r){n!==r&&(t.flags|=4)};function Wi(e,t){if(!Xe)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 Mt(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 Sk(e,t,n){var r=t.pendingProps;switch(zf(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Mt(t),null;case 1:return qt(t.type)&&xl(),Mt(t),null;case 3:return r=t.stateNode,vi(),Ue(Xt),Ue(Lt),Kf(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(ya(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,$n!==null&&(Hd($n),$n=null))),Nd(e,t),Mt(t),null;case 5:Zf(t);var o=ao(Ps.current);if(n=t.type,e!==null&&t.stateNode!=null)N0(e,t,n,r,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(te(166));return Mt(t),null}if(e=ao(qn.current),ya(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[Kn]=t,r[Rs]=i,e=(t.mode&1)!==0,n){case"dialog":Ve("cancel",r),Ve("close",r);break;case"iframe":case"object":case"embed":Ve("load",r);break;case"video":case"audio":for(o=0;o<rs.length;o++)Ve(rs[o],r);break;case"source":Ve("error",r);break;case"img":case"image":case"link":Ve("error",r),Ve("load",r);break;case"details":Ve("toggle",r);break;case"input":ch(r,i),Ve("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},Ve("invalid",r);break;case"textarea":fh(r,i),Ve("invalid",r)}ud(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&&va(r.textContent,a,e),o=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(i.suppressHydrationWarning!==!0&&va(r.textContent,a,e),o=["children",""+a]):ys.hasOwnProperty(s)&&a!=null&&s==="onScroll"&&Ve("scroll",r)}switch(n){case"input":ua(r),dh(r,i,!0);break;case"textarea":ua(r),ph(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=wl)}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=dy(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[Kn]=t,e[Rs]=r,A0(e,t,!1,!1),t.stateNode=e;e:{switch(s=cd(n,r),n){case"dialog":Ve("cancel",e),Ve("close",e),o=r;break;case"iframe":case"object":case"embed":Ve("load",e),o=r;break;case"video":case"audio":for(o=0;o<rs.length;o++)Ve(rs[o],e);o=r;break;case"source":Ve("error",e),o=r;break;case"img":case"image":case"link":Ve("error",e),Ve("load",e),o=r;break;case"details":Ve("toggle",e),o=r;break;case"input":ch(e,r),o=od(e,r),Ve("invalid",e);break;case"option":o=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},o=tt({},r,{value:void 0}),Ve("invalid",e);break;case"textarea":fh(e,r),o=ad(e,r),Ve("invalid",e);break;default:o=r}ud(n,o),a=o;for(i in a)if(a.hasOwnProperty(i)){var l=a[i];i==="style"?hy(e,l):i==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&fy(e,l)):i==="children"?typeof l=="string"?(n!=="textarea"||l!=="")&&ws(e,l):typeof l=="number"&&ws(e,""+l):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(ys.hasOwnProperty(i)?l!=null&&i==="onScroll"&&Ve("scroll",e):l!=null&&kf(e,i,l,s))}switch(n){case"input":ua(e),dh(e,r,!1);break;case"textarea":ua(e),ph(e);break;case"option":r.value!=null&&e.setAttribute("value",""+Wr(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?oi(e,!!r.multiple,i,!1):r.defaultValue!=null&&oi(e,!!r.multiple,r.defaultValue,!0);break;default:typeof o.onClick=="function"&&(e.onclick=wl)}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 Mt(t),null;case 6:if(e&&t.stateNode!=null)L0(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(te(166));if(n=ao(Ps.current),ao(qn.current),ya(t)){if(r=t.stateNode,n=t.memoizedProps,r[Kn]=t,(i=r.nodeValue!==n)&&(e=un,e!==null))switch(e.tag){case 3:va(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&va(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Kn]=t,t.stateNode=r}return Mt(t),null;case 13:if(Ue(Je),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Xe&&ln!==null&&t.mode&1&&!(t.flags&128))t0(),mi(),t.flags|=98560,i=!1;else if(i=ya(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(te(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(te(317));i[Kn]=t}else mi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Mt(t),i=!1}else $n!==null&&(Hd($n),$n=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||Je.current&1?ht===0&&(ht=3):ip())),t.updateQueue!==null&&(t.flags|=4),Mt(t),null);case 4:return vi(),Nd(e,t),e===null&&Is(t.stateNode.containerInfo),Mt(t),null;case 10:return Wf(t.type._context),Mt(t),null;case 17:return qt(t.type)&&xl(),Mt(t),null;case 19:if(Ue(Je),i=t.memoizedState,i===null)return Mt(t),null;if(r=(t.flags&128)!==0,s=i.rendering,s===null)if(r)Wi(i,!1);else{if(ht!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(s=Tl(e),s!==null){for(t.flags|=128,Wi(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 We(Je,Je.current&1|2),t.child}e=e.sibling}i.tail!==null&&at()>wi&&(t.flags|=128,r=!0,Wi(i,!1),t.lanes=4194304)}else{if(!r)if(e=Tl(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Wi(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!Xe)return Mt(t),null}else 2*at()-i.renderingStartTime>wi&&n!==1073741824&&(t.flags|=128,r=!0,Wi(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=at(),t.sibling=null,n=Je.current,We(Je,r?n&1|2:n&1),t):(Mt(t),null);case 22:case 23:return op(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?an&1073741824&&(Mt(t),t.subtreeFlags&6&&(t.flags|=8192)):Mt(t),null;case 24:return null;case 25:return null}throw Error(te(156,t.tag))}function kk(e,t){switch(zf(t),t.tag){case 1:return qt(t.type)&&xl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return vi(),Ue(Xt),Ue(Lt),Kf(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Zf(t),null;case 13:if(Ue(Je),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(te(340));mi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ue(Je),null;case 4:return vi(),null;case 10:return Wf(t.type._context),null;case 22:case 23:return op(),null;case 24:return null;default:return null}}var ba=!1,At=!1,Ek=typeof WeakSet=="function"?WeakSet:Set,ue=null;function Jo(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){it(e,t,r)}else n.current=null}function Ld(e,t,n){try{n()}catch(r){it(e,t,r)}}var nm=!1;function Ck(e,t){if(xd=gl,e=Wy(),Nf(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,u=0,f=0,p=e,h=null;t:for(;;){for(var m;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),(m=p.firstChild)!==null;)h=p,p=m;for(;;){if(p===e)break t;if(h===n&&++u===o&&(a=s),h===i&&++f===r&&(l=s),(m=p.nextSibling)!==null)break;p=h,h=p.parentNode}p=m}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(bd={focusedElem:e,selectionRange:n},gl=!1,ue=t;ue!==null;)if(t=ue,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ue=e;else for(;ue!==null;){t=ue;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 g=w.memoizedProps,k=w.memoizedState,v=t.stateNode,y=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:_n(t.type,g),k);v.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var x=t.stateNode.containerInfo;x.nodeType===1?x.textContent="":x.nodeType===9&&x.documentElement&&x.removeChild(x.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(te(163))}}catch(b){it(t,t.return,b)}if(e=t.sibling,e!==null){e.return=t.return,ue=e;break}ue=t.return}return w=nm,nm=!1,w}function fs(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&&Ld(t,n,i)}o=o.next}while(o!==r)}}function ou(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 zd(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 z0(e){var t=e.alternate;t!==null&&(e.alternate=null,z0(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Kn],delete t[Rs],delete t[Ed],delete t[ak],delete t[lk])),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 D0(e){return e.tag===5||e.tag===3||e.tag===4}function rm(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||D0(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 Dd(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=wl));else if(r!==4&&(e=e.child,e!==null))for(Dd(e,t,n),e=e.sibling;e!==null;)Dd(e,t,n),e=e.sibling}function Od(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(Od(e,t,n),e=e.sibling;e!==null;)Od(e,t,n),e=e.sibling}var kt=null,Mn=!1;function br(e,t,n){for(n=n.child;n!==null;)O0(e,t,n),n=n.sibling}function O0(e,t,n){if(Xn&&typeof Xn.onCommitFiberUnmount=="function")try{Xn.onCommitFiberUnmount(Xl,n)}catch{}switch(n.tag){case 5:At||Jo(n,t);case 6:var r=kt,o=Mn;kt=null,br(e,t,n),kt=r,Mn=o,kt!==null&&(Mn?(e=kt,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):kt.removeChild(n.stateNode));break;case 18:kt!==null&&(Mn?(e=kt,n=n.stateNode,e.nodeType===8?lc(e.parentNode,n):e.nodeType===1&&lc(e,n),ks(e)):lc(kt,n.stateNode));break;case 4:r=kt,o=Mn,kt=n.stateNode.containerInfo,Mn=!0,br(e,t,n),kt=r,Mn=o;break;case 0:case 11:case 14:case 15:if(!At&&(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)&&Ld(n,t,s),o=o.next}while(o!==r)}br(e,t,n);break;case 1:if(!At&&(Jo(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){it(n,t,a)}br(e,t,n);break;case 21:br(e,t,n);break;case 22:n.mode&1?(At=(r=At)||n.memoizedState!==null,br(e,t,n),At=r):br(e,t,n);break;default:br(e,t,n)}}function om(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Ek),t.forEach(function(r){var o=$k.bind(null,e,r);n.has(r)||(n.add(r),r.then(o,o))})}}function jn(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:kt=a.stateNode,Mn=!1;break e;case 3:kt=a.stateNode.containerInfo,Mn=!0;break e;case 4:kt=a.stateNode.containerInfo,Mn=!0;break e}a=a.return}if(kt===null)throw Error(te(160));O0(i,s,o),kt=null,Mn=!1;var l=o.alternate;l!==null&&(l.return=null),o.return=null}catch(u){it(o,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)B0(t,e),t=t.sibling}function B0(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(jn(t,e),Vn(e),r&4){try{fs(3,e,e.return),ou(3,e)}catch(g){it(e,e.return,g)}try{fs(5,e,e.return)}catch(g){it(e,e.return,g)}}break;case 1:jn(t,e),Vn(e),r&512&&n!==null&&Jo(n,n.return);break;case 5:if(jn(t,e),Vn(e),r&512&&n!==null&&Jo(n,n.return),e.flags&32){var o=e.stateNode;try{ws(o,"")}catch(g){it(e,e.return,g)}}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&&uy(o,i),cd(a,s);var u=cd(a,i);for(s=0;s<l.length;s+=2){var f=l[s],p=l[s+1];f==="style"?hy(o,p):f==="dangerouslySetInnerHTML"?fy(o,p):f==="children"?ws(o,p):kf(o,f,p,u)}switch(a){case"input":id(o,i);break;case"textarea":cy(o,i);break;case"select":var h=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!i.multiple;var m=i.value;m!=null?oi(o,!!i.multiple,m,!1):h!==!!i.multiple&&(i.defaultValue!=null?oi(o,!!i.multiple,i.defaultValue,!0):oi(o,!!i.multiple,i.multiple?[]:"",!1))}o[Rs]=i}catch(g){it(e,e.return,g)}}break;case 6:if(jn(t,e),Vn(e),r&4){if(e.stateNode===null)throw Error(te(162));o=e.stateNode,i=e.memoizedProps;try{o.nodeValue=i}catch(g){it(e,e.return,g)}}break;case 3:if(jn(t,e),Vn(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{ks(t.containerInfo)}catch(g){it(e,e.return,g)}break;case 4:jn(t,e),Vn(e);break;case 13:jn(t,e),Vn(e),o=e.child,o.flags&8192&&(i=o.memoizedState!==null,o.stateNode.isHidden=i,!i||o.alternate!==null&&o.alternate.memoizedState!==null||(np=at())),r&4&&om(e);break;case 22:if(f=n!==null&&n.memoizedState!==null,e.mode&1?(At=(u=At)||f,jn(t,e),At=u):jn(t,e),Vn(e),r&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!f&&e.mode&1)for(ue=e,f=e.child;f!==null;){for(p=ue=f;ue!==null;){switch(h=ue,m=h.child,h.tag){case 0:case 11:case 14:case 15:fs(4,h,h.return);break;case 1:Jo(h,h.return);var w=h.stateNode;if(typeof w.componentWillUnmount=="function"){r=h,n=h.return;try{t=r,w.props=t.memoizedProps,w.state=t.memoizedState,w.componentWillUnmount()}catch(g){it(r,n,g)}}break;case 5:Jo(h,h.return);break;case 22:if(h.memoizedState!==null){sm(p);continue}}m!==null?(m.return=h,ue=m):sm(p)}f=f.sibling}e:for(f=null,p=e;;){if(p.tag===5){if(f===null){f=p;try{o=p.stateNode,u?(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=py("display",s))}catch(g){it(e,e.return,g)}}}else if(p.tag===6){if(f===null)try{p.stateNode.nodeValue=u?"":p.memoizedProps}catch(g){it(e,e.return,g)}}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:jn(t,e),Vn(e),r&4&&om(e);break;case 21:break;default:jn(t,e),Vn(e)}}function Vn(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(D0(n)){var r=n;break e}n=n.return}throw Error(te(160))}switch(r.tag){case 5:var o=r.stateNode;r.flags&32&&(ws(o,""),r.flags&=-33);var i=rm(e);Od(e,i,o);break;case 3:case 4:var s=r.stateNode.containerInfo,a=rm(e);Dd(e,a,s);break;default:throw Error(te(161))}}catch(l){it(e,e.return,l)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Ik(e,t,n){ue=e,W0(e)}function W0(e,t,n){for(var r=(e.mode&1)!==0;ue!==null;){var o=ue,i=o.child;if(o.tag===22&&r){var s=o.memoizedState!==null||ba;if(!s){var a=o.alternate,l=a!==null&&a.memoizedState!==null||At;a=ba;var u=At;if(ba=s,(At=l)&&!u)for(ue=o;ue!==null;)s=ue,l=s.child,s.tag===22&&s.memoizedState!==null?am(o):l!==null?(l.return=s,ue=l):am(o);for(;i!==null;)ue=i,W0(i),i=i.sibling;ue=o,ba=a,At=u}im(e)}else o.subtreeFlags&8772&&i!==null?(i.return=o,ue=i):im(e)}}function im(e){for(;ue!==null;){var t=ue;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:At||ou(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!At)if(n===null)r.componentDidMount();else{var o=t.elementType===t.type?n.memoizedProps:_n(t.type,n.memoizedProps);r.componentDidUpdate(o,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&Vh(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}Vh(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 u=t.alternate;if(u!==null){var f=u.memoizedState;if(f!==null){var p=f.dehydrated;p!==null&&ks(p)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(te(163))}At||t.flags&512&&zd(t)}catch(h){it(t,t.return,h)}}if(t===e){ue=null;break}if(n=t.sibling,n!==null){n.return=t.return,ue=n;break}ue=t.return}}function sm(e){for(;ue!==null;){var t=ue;if(t===e){ue=null;break}var n=t.sibling;if(n!==null){n.return=t.return,ue=n;break}ue=t.return}}function am(e){for(;ue!==null;){var t=ue;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{ou(4,t)}catch(l){it(t,n,l)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var o=t.return;try{r.componentDidMount()}catch(l){it(t,o,l)}}var i=t.return;try{zd(t)}catch(l){it(t,i,l)}break;case 5:var s=t.return;try{zd(t)}catch(l){it(t,s,l)}}}catch(l){it(t,t.return,l)}if(t===e){ue=null;break}var a=t.sibling;if(a!==null){a.return=t.return,ue=a;break}ue=t.return}}var Tk=Math.ceil,Pl=gr.ReactCurrentDispatcher,ep=gr.ReactCurrentOwner,kn=gr.ReactCurrentBatchConfig,je=0,xt=null,dt=null,Et=0,an=0,ei=Kr(0),ht=0,$s=null,go=0,iu=0,tp=0,ps=null,Yt=null,np=0,wi=1/0,ir=null,Fl=!1,Bd=null,zr=null,Sa=!1,_r=null,_l=0,hs=0,Wd=null,rl=-1,ol=0;function Wt(){return je&6?at():rl!==-1?rl:rl=at()}function Dr(e){return e.mode&1?je&2&&Et!==0?Et&-Et:ck.transition!==null?(ol===0&&(ol=Iy()),ol):(e=Ne,e!==0||(e=window.event,e=e===void 0?16:My(e.type)),e):1}function Nn(e,t,n,r){if(50<hs)throw hs=0,Wd=null,Error(te(185));Vs(e,n,r),(!(je&2)||e!==xt)&&(e===xt&&(!(je&2)&&(iu|=n),ht===4&&jr(e,Et)),Qt(e,r),n===1&&je===0&&!(t.mode&1)&&(wi=at()+500,tu&&Yr()))}function Qt(e,t){var n=e.callbackNode;cS(e,t);var r=ml(e,e===xt?Et:0);if(r===0)n!==null&&gh(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&gh(n),t===1)e.tag===0?uk(lm.bind(null,e)):Qy(lm.bind(null,e)),ik(function(){!(je&6)&&Yr()}),n=null;else{switch(Ty(r)){case 1:n=Rf;break;case 4:n=Ey;break;case 16:n=hl;break;case 536870912:n=Cy;break;default:n=hl}n=X0(n,V0.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function V0(e,t){if(rl=-1,ol=0,je&6)throw Error(te(327));var n=e.callbackNode;if(ui()&&e.callbackNode!==n)return null;var r=ml(e,e===xt?Et:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=Ml(e,r);else{t=r;var o=je;je|=2;var i=U0();(xt!==e||Et!==t)&&(ir=null,wi=at()+500,co(e,t));do try{Pk();break}catch(a){H0(e,a)}while(!0);Bf(),Pl.current=i,je=o,dt!==null?t=0:(xt=null,Et=0,t=ht)}if(t!==0){if(t===2&&(o=md(e),o!==0&&(r=o,t=Vd(e,o))),t===1)throw n=$s,co(e,0),jr(e,r),Qt(e,at()),n;if(t===6)jr(e,r);else{if(o=e.current.alternate,!(r&30)&&!Rk(o)&&(t=Ml(e,r),t===2&&(i=md(e),i!==0&&(r=i,t=Vd(e,i))),t===1))throw n=$s,co(e,0),jr(e,r),Qt(e,at()),n;switch(e.finishedWork=o,e.finishedLanes=r,t){case 0:case 1:throw Error(te(345));case 2:oo(e,Yt,ir);break;case 3:if(jr(e,r),(r&130023424)===r&&(t=np+500-at(),10<t)){if(ml(e,0)!==0)break;if(o=e.suspendedLanes,(o&r)!==r){Wt(),e.pingedLanes|=e.suspendedLanes&o;break}e.timeoutHandle=kd(oo.bind(null,e,Yt,ir),t);break}oo(e,Yt,ir);break;case 4:if(jr(e,r),(r&4194240)===r)break;for(t=e.eventTimes,o=-1;0<r;){var s=31-An(r);i=1<<s,s=t[s],s>o&&(o=s),r&=~i}if(r=o,r=at()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Tk(r/1960))-r,10<r){e.timeoutHandle=kd(oo.bind(null,e,Yt,ir),r);break}oo(e,Yt,ir);break;case 5:oo(e,Yt,ir);break;default:throw Error(te(329))}}}return Qt(e,at()),e.callbackNode===n?V0.bind(null,e):null}function Vd(e,t){var n=ps;return e.current.memoizedState.isDehydrated&&(co(e,t).flags|=256),e=Ml(e,t),e!==2&&(t=Yt,Yt=n,t!==null&&Hd(t)),e}function Hd(e){Yt===null?Yt=e:Yt.push.apply(Yt,e)}function Rk(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(!zn(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 jr(e,t){for(t&=~tp,t&=~iu,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-An(t),r=1<<n;e[n]=-1,t&=~r}}function lm(e){if(je&6)throw Error(te(327));ui();var t=ml(e,0);if(!(t&1))return Qt(e,at()),null;var n=Ml(e,t);if(e.tag!==0&&n===2){var r=md(e);r!==0&&(t=r,n=Vd(e,r))}if(n===1)throw n=$s,co(e,0),jr(e,t),Qt(e,at()),n;if(n===6)throw Error(te(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,oo(e,Yt,ir),Qt(e,at()),null}function rp(e,t){var n=je;je|=1;try{return e(t)}finally{je=n,je===0&&(wi=at()+500,tu&&Yr())}}function vo(e){_r!==null&&_r.tag===0&&!(je&6)&&ui();var t=je;je|=1;var n=kn.transition,r=Ne;try{if(kn.transition=null,Ne=1,e)return e()}finally{Ne=r,kn.transition=n,je=t,!(je&6)&&Yr()}}function op(){an=ei.current,Ue(ei)}function co(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,ok(n)),dt!==null)for(n=dt.return;n!==null;){var r=n;switch(zf(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&xl();break;case 3:vi(),Ue(Xt),Ue(Lt),Kf();break;case 5:Zf(r);break;case 4:vi();break;case 13:Ue(Je);break;case 19:Ue(Je);break;case 10:Wf(r.type._context);break;case 22:case 23:op()}n=n.return}if(xt=e,dt=e=Or(e.current,null),Et=an=t,ht=0,$s=null,tp=iu=go=0,Yt=ps=null,so!==null){for(t=0;t<so.length;t++)if(n=so[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}so=null}return e}function H0(e,t){do{var n=dt;try{if(Bf(),el.current=jl,Rl){for(var r=et.memoizedState;r!==null;){var o=r.queue;o!==null&&(o.pending=null),r=r.next}Rl=!1}if(mo=0,wt=pt=et=null,ds=!1,Fs=0,ep.current=null,n===null||n.return===null){ht=1,$s=t,dt=null;break}e:{var i=e,s=n.return,a=n,l=t;if(t=Et,a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var u=l,f=a,p=f.tag;if(!(f.mode&1)&&(p===0||p===11||p===15)){var h=f.alternate;h?(f.updateQueue=h.updateQueue,f.memoizedState=h.memoizedState,f.lanes=h.lanes):(f.updateQueue=null,f.memoizedState=null)}var m=Gh(s);if(m!==null){m.flags&=-257,Xh(m,s,a,i,t),m.mode&1&&Yh(i,u,t),t=m,l=u;var w=t.updateQueue;if(w===null){var g=new Set;g.add(l),t.updateQueue=g}else w.add(l);break e}else{if(!(t&1)){Yh(i,u,t),ip();break e}l=Error(te(426))}}else if(Xe&&a.mode&1){var k=Gh(s);if(k!==null){!(k.flags&65536)&&(k.flags|=256),Xh(k,s,a,i,t),Df(yi(l,a));break e}}i=l=yi(l,a),ht!==4&&(ht=2),ps===null?ps=[i]:ps.push(i),i=s;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var v=T0(i,l,t);Wh(i,v);break e;case 1:a=l;var y=i.type,x=i.stateNode;if(!(i.flags&128)&&(typeof y.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(zr===null||!zr.has(x)))){i.flags|=65536,t&=-t,i.lanes|=t;var b=R0(i,a,t);Wh(i,b);break e}}i=i.return}while(i!==null)}K0(n)}catch(S){t=S,dt===n&&n!==null&&(dt=n=n.return);continue}break}while(!0)}function U0(){var e=Pl.current;return Pl.current=jl,e===null?jl:e}function ip(){(ht===0||ht===3||ht===2)&&(ht=4),xt===null||!(go&268435455)&&!(iu&268435455)||jr(xt,Et)}function Ml(e,t){var n=je;je|=2;var r=U0();(xt!==e||Et!==t)&&(ir=null,co(e,t));do try{jk();break}catch(o){H0(e,o)}while(!0);if(Bf(),je=n,Pl.current=r,dt!==null)throw Error(te(261));return xt=null,Et=0,ht}function jk(){for(;dt!==null;)Z0(dt)}function Pk(){for(;dt!==null&&!tS();)Z0(dt)}function Z0(e){var t=G0(e.alternate,e,an);e.memoizedProps=e.pendingProps,t===null?K0(e):dt=t,ep.current=null}function K0(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=kk(n,t),n!==null){n.flags&=32767,dt=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{ht=6,dt=null;return}}else if(n=Sk(n,t,an),n!==null){dt=n;return}if(t=t.sibling,t!==null){dt=t;return}dt=t=e}while(t!==null);ht===0&&(ht=5)}function oo(e,t,n){var r=Ne,o=kn.transition;try{kn.transition=null,Ne=1,Fk(e,t,n,r)}finally{kn.transition=o,Ne=r}return null}function Fk(e,t,n,r){do ui();while(_r!==null);if(je&6)throw Error(te(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(te(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(dS(e,i),e===xt&&(dt=xt=null,Et=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Sa||(Sa=!0,X0(hl,function(){return ui(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=kn.transition,kn.transition=null;var s=Ne;Ne=1;var a=je;je|=4,ep.current=null,Ck(e,n),B0(n,e),qS(bd),gl=!!xd,bd=xd=null,e.current=n,Ik(n),nS(),je=a,Ne=s,kn.transition=i}else e.current=n;if(Sa&&(Sa=!1,_r=e,_l=o),i=e.pendingLanes,i===0&&(zr=null),iS(n.stateNode),Qt(e,at()),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(Fl)throw Fl=!1,e=Bd,Bd=null,e;return _l&1&&e.tag!==0&&ui(),i=e.pendingLanes,i&1?e===Wd?hs++:(hs=0,Wd=e):hs=0,Yr(),null}function ui(){if(_r!==null){var e=Ty(_l),t=kn.transition,n=Ne;try{if(kn.transition=null,Ne=16>e?16:e,_r===null)var r=!1;else{if(e=_r,_r=null,_l=0,je&6)throw Error(te(331));var o=je;for(je|=4,ue=e.current;ue!==null;){var i=ue,s=i.child;if(ue.flags&16){var a=i.deletions;if(a!==null){for(var l=0;l<a.length;l++){var u=a[l];for(ue=u;ue!==null;){var f=ue;switch(f.tag){case 0:case 11:case 15:fs(8,f,i)}var p=f.child;if(p!==null)p.return=f,ue=p;else for(;ue!==null;){f=ue;var h=f.sibling,m=f.return;if(z0(f),f===u){ue=null;break}if(h!==null){h.return=m,ue=h;break}ue=m}}}var w=i.alternate;if(w!==null){var g=w.child;if(g!==null){w.child=null;do{var k=g.sibling;g.sibling=null,g=k}while(g!==null)}}ue=i}}if(i.subtreeFlags&2064&&s!==null)s.return=i,ue=s;else e:for(;ue!==null;){if(i=ue,i.flags&2048)switch(i.tag){case 0:case 11:case 15:fs(9,i,i.return)}var v=i.sibling;if(v!==null){v.return=i.return,ue=v;break e}ue=i.return}}var y=e.current;for(ue=y;ue!==null;){s=ue;var x=s.child;if(s.subtreeFlags&2064&&x!==null)x.return=s,ue=x;else e:for(s=y;ue!==null;){if(a=ue,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:ou(9,a)}}catch(S){it(a,a.return,S)}if(a===s){ue=null;break e}var b=a.sibling;if(b!==null){b.return=a.return,ue=b;break e}ue=a.return}}if(je=o,Yr(),Xn&&typeof Xn.onPostCommitFiberRoot=="function")try{Xn.onPostCommitFiberRoot(Xl,e)}catch{}r=!0}return r}finally{Ne=n,kn.transition=t}}return!1}function um(e,t,n){t=yi(n,t),t=T0(e,t,1),e=Lr(e,t,1),t=Wt(),e!==null&&(Vs(e,1,t),Qt(e,t))}function it(e,t,n){if(e.tag===3)um(e,e,n);else for(;t!==null;){if(t.tag===3){um(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(zr===null||!zr.has(r))){e=yi(n,e),e=R0(t,e,1),t=Lr(t,e,1),e=Wt(),t!==null&&(Vs(t,1,e),Qt(t,e));break}}t=t.return}}function _k(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Wt(),e.pingedLanes|=e.suspendedLanes&n,xt===e&&(Et&n)===n&&(ht===4||ht===3&&(Et&130023424)===Et&&500>at()-np?co(e,0):tp|=n),Qt(e,t)}function Y0(e,t){t===0&&(e.mode&1?(t=fa,fa<<=1,!(fa&130023424)&&(fa=4194304)):t=1);var n=Wt();e=hr(e,t),e!==null&&(Vs(e,t,n),Qt(e,n))}function Mk(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Y0(e,n)}function $k(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(te(314))}r!==null&&r.delete(t),Y0(e,n)}var G0;G0=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Xt.current)Gt=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Gt=!1,bk(e,t,n);Gt=!!(e.flags&131072)}else Gt=!1,Xe&&t.flags&1048576&&Jy(t,kl,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;nl(e,t),e=t.pendingProps;var o=hi(t,Lt.current);li(t,n),o=Gf(null,t,r,e,o,n);var i=Xf();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,qt(r)?(i=!0,bl(t)):i=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,Hf(t),o.updater=ru,t.stateNode=o,o._reactInternals=t,Pd(t,r,e,n),t=Md(null,t,r,!0,i,n)):(t.tag=0,Xe&&i&&Lf(t),Bt(null,t,o,n),t=t.child),t;case 16:r=t.elementType;e:{switch(nl(e,t),e=t.pendingProps,o=r._init,r=o(r._payload),t.type=r,o=t.tag=Nk(r),e=_n(r,e),o){case 0:t=_d(null,t,r,e,n);break e;case 1:t=Jh(null,t,r,e,n);break e;case 11:t=qh(null,t,r,e,n);break e;case 14:t=Qh(null,t,r,_n(r.type,e),n);break e}throw Error(te(306,r,""))}return t;case 0:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:_n(r,o),_d(e,t,r,o,n);case 1:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:_n(r,o),Jh(e,t,r,o,n);case 3:e:{if(_0(t),e===null)throw Error(te(387));r=t.pendingProps,i=t.memoizedState,o=i.element,i0(e,t),Il(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=yi(Error(te(423)),t),t=em(e,t,r,n,o);break e}else if(r!==o){o=yi(Error(te(424)),t),t=em(e,t,r,n,o);break e}else for(ln=Nr(t.stateNode.containerInfo.firstChild),un=t,Xe=!0,$n=null,n=r0(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(mi(),r===o){t=mr(e,t,n);break e}Bt(e,t,r,n)}t=t.child}return t;case 5:return s0(t),e===null&&Td(t),r=t.type,o=t.pendingProps,i=e!==null?e.memoizedProps:null,s=o.children,Sd(r,o)?s=null:i!==null&&Sd(r,i)&&(t.flags|=32),F0(e,t),Bt(e,t,s,n),t.child;case 6:return e===null&&Td(t),null;case 13:return M0(e,t,n);case 4:return Uf(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=gi(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:_n(r,o),qh(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,We(El,r._currentValue),r._currentValue=s,i!==null)if(zn(i.value,s)){if(i.children===o.children&&!Xt.current){t=mr(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=dr(-1,n&-n),l.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var f=u.pending;f===null?l.next=l:(l.next=f.next,f.next=l),u.pending=l}}i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),Rd(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(te(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),Rd(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,li(t,n),o=En(o),r=r(o),t.flags|=1,Bt(e,t,r,n),t.child;case 14:return r=t.type,o=_n(r,t.pendingProps),o=_n(r.type,o),Qh(e,t,r,o,n);case 15:return j0(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:_n(r,o),nl(e,t),t.tag=1,qt(r)?(e=!0,bl(t)):e=!1,li(t,n),I0(t,r,o),Pd(t,r,o,n),Md(null,t,r,!0,e,n);case 19:return $0(e,t,n);case 22:return P0(e,t,n)}throw Error(te(156,t.tag))};function X0(e,t){return ky(e,t)}function Ak(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 bn(e,t,n,r){return new Ak(e,t,n,r)}function sp(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Nk(e){if(typeof e=="function")return sp(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Cf)return 11;if(e===If)return 14}return 2}function Or(e,t){var n=e.alternate;return n===null?(n=bn(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 il(e,t,n,r,o,i){var s=2;if(r=e,typeof e=="function")sp(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case Ho:return fo(n.children,o,i,t);case Ef:s=8,o|=8;break;case ed:return e=bn(12,n,t,o|2),e.elementType=ed,e.lanes=i,e;case td:return e=bn(13,n,t,o),e.elementType=td,e.lanes=i,e;case nd:return e=bn(19,n,t,o),e.elementType=nd,e.lanes=i,e;case sy:return su(n,o,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case oy:s=10;break e;case iy:s=9;break e;case Cf:s=11;break e;case If:s=14;break e;case Ir:s=16,r=null;break e}throw Error(te(130,e==null?e:typeof e,""))}return t=bn(s,n,t,o),t.elementType=e,t.type=r,t.lanes=i,t}function fo(e,t,n,r){return e=bn(7,e,r,t),e.lanes=n,e}function su(e,t,n,r){return e=bn(22,e,r,t),e.elementType=sy,e.lanes=n,e.stateNode={isHidden:!1},e}function gc(e,t,n){return e=bn(6,e,null,t),e.lanes=n,e}function vc(e,t,n){return t=bn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Lk(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=qu(0),this.expirationTimes=qu(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=qu(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function ap(e,t,n,r,o,i,s,a,l){return e=new Lk(e,t,n,a,l),t===1?(t=1,i===!0&&(t|=8)):t=0,i=bn(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Hf(i),e}function zk(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Vo,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function q0(e){if(!e)return Vr;e=e._reactInternals;e:{if(So(e)!==e||e.tag!==1)throw Error(te(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(qt(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(te(171))}if(e.tag===1){var n=e.type;if(qt(n))return qy(e,n,t)}return t}function Q0(e,t,n,r,o,i,s,a,l){return e=ap(n,r,!0,e,o,i,s,a,l),e.context=q0(null),n=e.current,r=Wt(),o=Dr(n),i=dr(r,o),i.callback=t??null,Lr(n,i,o),e.current.lanes=o,Vs(e,o,r),Qt(e,r),e}function au(e,t,n,r){var o=t.current,i=Wt(),s=Dr(o);return n=q0(n),t.context===null?t.context=n:t.pendingContext=n,t=dr(i,s),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Lr(o,t,s),e!==null&&(Nn(e,o,s,i),Ja(e,o,s)),s}function $l(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 cm(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function lp(e,t){cm(e,t),(e=e.alternate)&&cm(e,t)}function Dk(){return null}var J0=typeof reportError=="function"?reportError:function(e){console.error(e)};function up(e){this._internalRoot=e}lu.prototype.render=up.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(te(409));au(e,t,null,null)};lu.prototype.unmount=up.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;vo(function(){au(null,e,null,null)}),t[pr]=null}};function lu(e){this._internalRoot=e}lu.prototype.unstable_scheduleHydration=function(e){if(e){var t=Py();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Rr.length&&t!==0&&t<Rr[n].priority;n++);Rr.splice(n,0,e),n===0&&_y(e)}};function cp(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function uu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function dm(){}function Ok(e,t,n,r,o){if(o){if(typeof r=="function"){var i=r;r=function(){var u=$l(s);i.call(u)}}var s=Q0(t,r,e,0,null,!1,!1,"",dm);return e._reactRootContainer=s,e[pr]=s.current,Is(e.nodeType===8?e.parentNode:e),vo(),s}for(;o=e.lastChild;)e.removeChild(o);if(typeof r=="function"){var a=r;r=function(){var u=$l(l);a.call(u)}}var l=ap(e,0,!1,null,null,!1,!1,"",dm);return e._reactRootContainer=l,e[pr]=l.current,Is(e.nodeType===8?e.parentNode:e),vo(function(){au(t,l,n,r)}),l}function cu(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=$l(s);a.call(l)}}au(t,s,e,o)}else s=Ok(n,t,e,o,r);return $l(s)}Ry=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=ns(t.pendingLanes);n!==0&&(jf(t,n|1),Qt(t,at()),!(je&6)&&(wi=at()+500,Yr()))}break;case 13:vo(function(){var r=hr(e,1);if(r!==null){var o=Wt();Nn(r,e,1,o)}}),lp(e,1)}};Pf=function(e){if(e.tag===13){var t=hr(e,134217728);if(t!==null){var n=Wt();Nn(t,e,134217728,n)}lp(e,134217728)}};jy=function(e){if(e.tag===13){var t=Dr(e),n=hr(e,t);if(n!==null){var r=Wt();Nn(n,e,t,r)}lp(e,t)}};Py=function(){return Ne};Fy=function(e,t){var n=Ne;try{return Ne=e,t()}finally{Ne=n}};fd=function(e,t,n){switch(t){case"input":if(id(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=eu(r);if(!o)throw Error(te(90));ly(r),id(r,o)}}}break;case"textarea":cy(e,n);break;case"select":t=n.value,t!=null&&oi(e,!!n.multiple,t,!1)}};vy=rp;yy=vo;var Bk={usingClientEntryPoint:!1,Events:[Us,Yo,eu,my,gy,rp]},Vi={findFiberByHostInstance:io,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Wk={bundleType:Vi.bundleType,version:Vi.version,rendererPackageName:Vi.rendererPackageName,rendererConfig:Vi.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:gr.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=by(e),e===null?null:e.stateNode},findFiberByHostInstance:Vi.findFiberByHostInstance||Dk,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 ka=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ka.isDisabled&&ka.supportsFiber)try{Xl=ka.inject(Wk),Xn=ka}catch{}}dn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Bk;dn.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!cp(t))throw Error(te(200));return zk(e,t,null,n)};dn.createRoot=function(e,t){if(!cp(e))throw Error(te(299));var n=!1,r="",o=J0;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=ap(e,1,!1,null,null,n,!1,r,o),e[pr]=t.current,Is(e.nodeType===8?e.parentNode:e),new up(t)};dn.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(te(188)):(e=Object.keys(e).join(","),Error(te(268,e)));return e=by(t),e=e===null?null:e.stateNode,e};dn.flushSync=function(e){return vo(e)};dn.hydrate=function(e,t,n){if(!uu(t))throw Error(te(200));return cu(null,e,t,!0,n)};dn.hydrateRoot=function(e,t,n){if(!cp(e))throw Error(te(405));var r=n!=null&&n.hydratedSources||null,o=!1,i="",s=J0;if(n!=null&&(n.unstable_strictMode===!0&&(o=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=Q0(t,null,e,1,n??null,o,!1,i,s),e[pr]=t.current,Is(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 lu(t)};dn.render=function(e,t,n){if(!uu(t))throw Error(te(200));return cu(null,e,t,!1,n)};dn.unmountComponentAtNode=function(e){if(!uu(e))throw Error(te(40));return e._reactRootContainer?(vo(function(){cu(null,null,e,!1,function(){e._reactRootContainer=null,e[pr]=null})}),!0):!1};dn.unstable_batchedUpdates=rp;dn.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!uu(n))throw Error(te(200));if(e==null||e._reactInternals===void 0)throw Error(te(38));return cu(e,t,n,!1,r)};dn.version="18.3.1-next-f1338f8080-20240426";function ew(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(ew)}catch(e){console.error(e)}}ew(),ey.exports=dn;var Ud=ey.exports,fm=Ud;Qc.createRoot=fm.createRoot,Qc.hydrateRoot=fm.hydrateRoot;var Vk=Object.defineProperty,tw=(e,t)=>{for(var n in t)Vk(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 ko=d.createContext(!1),Zd=({children:e})=>c.jsx(ko.Provider,{value:!0,children:e}),nw=d.createContext({setError:()=>{},clearError:()=>{}}),pm=()=>{try{return typeof __webpack_module__>"u"?null:__webpack_module__.hot??null}catch{return null}};class Hk extends oe.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 Ci=d.createContext({compositions:[],folders:[],currentCompositionMetadata:null,canvasContent:null}),Ks=d.createContext({registerComposition:()=>{},unregisterComposition:()=>{},registerFolder:()=>{},unregisterFolder:()=>{},setCanvasContent:()=>{},onlyRenderComposition:null}),Ys=d.createContext({getNonce:()=>0}),sl=0;try{typeof __webpack_module__<"u"&&__webpack_module__.hot&&__webpack_module__.hot.addStatusHandler(e=>{e==="idle"&&sl++})}catch{}var du=()=>{const t=d.useContext(Ys).getNonce(),n=d.useRef(t);n.current=t;const r=d.useRef([[sl,t]]),o=d.useCallback(()=>(sl!==r.current[r.current.length-1][0]&&(r.current=[...r.current,[sl,n.current]]),r.current),[r]);return d.useMemo(()=>({get:o}),[o])};function Ii(e){return!!e}var rw=()=>/^([a-zA-Z0-9-\u4E00-\u9FFF])+$/g,ow=e=>e.match(rw()),Uk=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(!ow(e))throw new Error(`Folder name can only contain a-z, A-Z, 0-9 and -. You passed ${e}`)},Zk=`Folder name must match ${String(rw())}`,Kd=d.createContext({folderName:null,parentName:null}),Kk=e=>{const{name:t,children:n}=e,r=d.useContext(Kd),{registerFolder:o,unregisterFolder:i}=d.useContext(Ks),s=du(),a=e.stack??null;Uk(t);const l=[r.parentName,r.folderName].filter(Ii),u=l.length===0?null:l.join("/"),f=d.useMemo(()=>({folderName:t,parentName:u}),[t,u]);return d.useEffect(()=>(o(t,u,s.get(),a),()=>{i(t,u)}),[t,r.folderName,u,o,i,s,a]),c.jsx(Kd.Provider,{value:f,children:n})};function hm(){return["NOD","E_EN","V"].join("")}var mm=()=>["e","nv"].join(""),Sn=()=>{const e=typeof window<"u"&&window.remotion_isPlayer,t=typeof window<"u"&&typeof window.process<"u"&&typeof window.process.env<"u"&&(window.process[mm()][hm()]==="test"||window.process[mm()][hm()]==="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}},Yd="remotion-date:",As="remotion-file:",Yk=({data:e,indent:t,staticBase:n})=>{let r=!1,o=!1,i=!1,s=!1;try{return{serializedString:JSON.stringify(e,function(l,u){const f=this[l];return f instanceof Date?(r=!0,`${Yd}${f.toISOString()}`):f instanceof Map?(i=!0,u):f instanceof Set?(s=!0,u):typeof f=="string"&&n!==null&&f.startsWith(n)?(o=!0,`${As}${f.replace(n+"/","")}`):u},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(Yd)?new Date(n.replace(Yd,"")):typeof n=="string"&&n.startsWith(As)?`${window.remotion_staticBase}/${n.replace(As,"")}`:n),Gk=e=>iw(Yk({data:e,indent:2,staticBase:window.remotion_staticBase}).serializedString),Gd=e=>Sn().isStudio?Gk(e):e,sw=d.createContext(!1),Xk=({children:e})=>c.jsx(sw.Provider,{value:!0,children:e}),dp=()=>d.useContext(sw),Sr=({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}`))},qk=(e,t)=>{const{style:n,...r}=e,o=d.useMemo(()=>({position:"absolute",top:Sr({className:r.className,classPrefix:["top-","inset-"],type:"prefix"})?void 0:0,left:Sr({className:r.className,classPrefix:["left-","inset-"],type:"prefix"})?void 0:0,right:Sr({className:r.className,classPrefix:["right-","inset-"],type:"prefix"})?void 0:0,bottom:Sr({className:r.className,classPrefix:["bottom-","inset-"],type:"prefix"})?void 0:0,width:Sr({className:r.className,classPrefix:["w-"],type:"prefix"})?void 0:"100%",height:Sr({className:r.className,classPrefix:["h-"],type:"prefix"})?void 0:"100%",display:Sr({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:Sr({className:r.className,classPrefix:["flex-row","flex-col","flex-row-reverse","flex-col-reverse"],type:"exact"})?void 0:"column",...n}),[r.className,n]);return c.jsx("div",{ref:t,style:o,...r})},Dn=d.forwardRef(qk),Qk={transform:"rotate(90deg)"},gm=40,Jk={color:"white",fontSize:14,fontFamily:"sans-serif"},eE={justifyContent:"center",alignItems:"center"},tE=()=>c.jsxs(Dn,{style:eE,id:"remotion-comp-loading",children:[c.jsx("style",{type:"text/css",children:`
42
+ @keyframes anim {
43
+ from {
44
+ opacity: 0
45
+ }
46
+ to {
47
+ opacity: 1
48
+ }
49
+ }
50
+ #remotion-comp-loading {
51
+ animation: anim 2s;
52
+ animation-fill-mode: forwards;
53
+ }
54
+ `}),c.jsx("svg",{width:gm,height:gm,viewBox:"-100 -100 400 400",style:Qk,children:c.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"})}),c.jsxs("p",{style:Jk,children:["Resolving ","<Suspense>","..."]})]}),nn=null,Xd=()=>{if(!nn){if(typeof document>"u")throw new Error("Tried to call an API that only works in the browser from outside the browser");nn=document.createElement("div"),nn.style.position="absolute",nn.style.top="0px",nn.style.left="0px",nn.style.right="0px",nn.style.bottom="0px",nn.style.width="100%",nn.style.height="100%",nn.style.display="flex",nn.style.flexDirection="column";const e=document.createElement("div");e.style.position="fixed",e.style.top="-999999px",e.appendChild(nn),document.body.appendChild(e)}return nn},qd=()=>"remotion_inputPropsOverride"+window.location.origin,aw=()=>{if(typeof localStorage>"u")return null;const e=localStorage.getItem(qd());return e?JSON.parse(e):null},nE=e=>{if(!(typeof localStorage>"u")){if(e===null){localStorage.removeItem(qd());return}localStorage.setItem(qd(),JSON.stringify(e))}},vm=!1,rE=()=>{vm||(vm=!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()"))},oE=()=>{if(typeof window>"u")return rE(),{};if(Sn().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=aw();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):{}},fp=d.createContext({props:{},updateProps:()=>{throw new Error("Not implemented")}}),iE=oe.createRef(),lw=({children:e})=>{const[t,n]=oe.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 c.jsx(fp.Provider,{value:o,children:e})},uw=oe.createContext(null),lt=()=>{const e=d.useContext(uw),[t]=d.useState(()=>Sn());return e??t};function Al(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 fu(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 pu(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 hu=d.createContext(null),sE=d.createRef(),aE=e=>!!e.calculateMetadata,pp=e=>{const t=d.useContext(hu),{props:n}=d.useContext(fp),{compositions:r,canvasContent:o,currentCompositionMetadata:i}=d.useContext(Ci),s=(o==null?void 0:o.type)==="composition"?o.compositionId:null,a=e??s,l=r.find(p=>p.id===a),u=d.useMemo(()=>l?n[l.id]??{}:{},[n,l]),f=lt();return d.useMemo(()=>l?i?{type:"success",metadataSource:null,result:{...i,id:l.id,defaultProps:l.defaultProps??{}}}:aE(l)?!t||!t[l.id]?null:t[l.id]:(fu(l.durationInFrames,{allowFloats:!1,component:`in <Composition id="${l.id}">`}),pu(l.fps,`in <Composition id="${l.id}">`),Al(l.width,"width",`in <Composition id="${l.id}">`),Al(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??{},...u??{},...typeof window>"u"||f.isPlayer||!window.remotion_inputProps?{}:oE()??{}},defaultCodec:null,defaultOutName:null,defaultVideoImageFormat:null,defaultPixelFormat:null,defaultProResProfile:null,defaultSampleRate:null}}):null,[l,t,i,u,f.isPlayer])},cw=e=>{const t=e.stack??"";return t.startsWith("Error:")?t:`${e.message}
55
+ ${t}`},lE=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 hp(e,t){let n;throw lE(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=cw(n)),n}function Ns(e){return hp(typeof window<"u"?window:void 0,e)}var uE=["trace","verbose","info","warn","error"],ym=e=>uE.indexOf(e),mu=(e,t)=>ym(e)<=ym(t),Gs=({args:e,logLevel:t,tag:n})=>{const r=[...e];return Sn().isRendering&&!Sn().isClientSideRendering&&r.unshift(Symbol.for(`__remotion_level_${t}`)),n&&Sn().isRendering&&!Sn().isClientSideRendering&&r.unshift(Symbol.for(`__remotion_tag_${n}`)),r},cE=(e,...t)=>{if(mu(e.logLevel,"verbose"))return console.debug(...Gs({args:t,logLevel:"verbose",tag:e.tag}))},dE=(e,...t)=>{if(mu(e.logLevel,"trace"))return console.debug(...Gs({args:t,logLevel:"trace",tag:e.tag}))},fE=(e,...t)=>{if(mu(e.logLevel,"info"))return console.log(...Gs({args:t,logLevel:"info",tag:e.tag}))},pE=(e,...t)=>{if(mu(e.logLevel,"warn"))return console.warn(...Gs({args:t,logLevel:"warn",tag:e.tag}))},hE=(e,...t)=>console.error(...Gs({args:t,logLevel:"error",tag:e.tag})),bt={trace:dE,verbose:cE,info:fE,warn:pE,error:hE};typeof window<"u"&&(window.remotion_renderReady=!1,window.remotion_delayRenderTimeouts||(window.remotion_delayRenderTimeouts={}),window.remotion_delayRenderHandles=[]);var mE="The delayRender was called:",gE="Retries left: ",vE="- Rendering the frame will be retried.",yE="handle was cleared after",wE=3e4,dw=({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??wE)-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 u=["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?vE:null,mE,i].filter(Ii).join(" ");t.isClientSideRendering?e.remotion_cancelledError=cw(Error(u)):hp(e,Error(u))},a)}}return e.remotion_renderReady=!1,o},xE=(e,t)=>typeof window>"u"?Math.random():dw({scope:window,environment:Sn(),label:e??null,options:{}}),fw=({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 u=[s?`"${s}"`:"A handle",yE,`${Date.now()-a}ms`].filter(Ii).join(" ");bt.verbose({logLevel:r,tag:"delayRender()"},u),delete e.remotion_delayRenderTimeouts[t]}e.remotion_delayRenderHandles=e.remotion_delayRenderHandles.filter(s=>s!==t),e.remotion_delayRenderHandles.length===0&&(e.remotion_renderReady=!0)},bE=e=>{typeof window>"u"||fw({scope:window,handle:e,environment:Sn(),logLevel:window.remotion_logLevel??"info"})},Eo=d.createContext({logLevel:"info",mountTime:0}),er=()=>{const{logLevel:e}=d.useContext(Eo);if(e===null)throw new Error("useLogLevel must be used within a LogLevelProvider");return e},Xs=()=>{const{mountTime:e}=d.useContext(Eo);if(e===null)throw new Error("useMountTime must be used within a LogLevelProvider");return e},pw=d.createContext(null),On=()=>{const e=lt(),t=d.useContext(pw)??(typeof window<"u"?window:void 0),n=er(),r=d.useCallback((s,a)=>t?dw({scope:t,environment:e,label:s??null,options:a??{}}):Math.random(),[e,t]),o=d.useCallback(s=>{t&&fw({scope:t,handle:s,environment:e,logLevel:n})},[e,n,t]),i=d.useCallback(s=>hp(t??(typeof window<"u"?window:void 0),s),[t]);return{delayRender:r,continueRender:o,cancelRender:i}},hw=({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 oe.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 oe.lazy(e.lazyComponent)}throw new Error("You must pass either 'component' or 'lazyComponent'")},[e.lazyComponent])},gu=()=>{const{canvasContent:e,compositions:t,currentCompositionMetadata:n}=d.useContext(Ci),r=t.find(i=>(e==null?void 0:e.type)==="composition"&&i.id===e.compositionId),o=pp((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])},mw=()=>/^([a-zA-Z0-9-\u4E00-\u9FFF])+$/g,gw=e=>e.match(mw()),SE=e=>{if(!gw(e))throw new Error(`Composition id can only contain a-z, A-Z, 0-9, CJK characters and -. You passed ${e}`)},kE=`Composition ID must match ${String(mw())}`,EE=(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}"`:""}`)}},CE=()=>{const{continueRender:e,delayRender:t}=On();return d.useEffect(()=>{const n=t("Waiting for Root component to unsuspend");return()=>e(n)},[e,t]),null},IE=({width:e,height:t,fps:n,durationInFrames:r,id:o,defaultProps:i,schema:s,...a})=>{const l=d.useContext(Ks),{registerComposition:u,unregisterComposition:f}=l,p=gu(),h=hw({compProps:a,componentName:"Composition",noSuspense:!1}),m=du(),w=dp(),g=lt(),k=d.useContext(ko);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:v,parentName:y}=d.useContext(Kd),x=a.stack??null,b="component"in a?a.component:null;d.useEffect(()=>{if(!o)throw new Error("No id for composition passed.");return SE(o),EE(i,"defaultProps",o),u({durationInFrames:r??void 0,fps:n??void 0,height:t??void 0,width:e??void 0,id:o,folderName:v,component:h,defaultProps:Gd(i??{}),nonce:m.get(),parentFolderName:y,componentFromProps:b,schema:s??null,calculateMetadata:a.calculateMetadata??null,stack:x}),()=>{f(o)}},[r,n,t,h,o,v,i,e,m,y,b,s,a.calculateMetadata,x,u,f]);const S=pp(o),{setError:E,clearError:R}=d.useContext(nw),j=d.useCallback(_=>{E(_)},[E]),I=d.useCallback(()=>{R()},[R]);if(g.isStudio&&p&&p.component===h&&p.id===o){const _=h;return S===null||S.type!=="success"&&S.type!=="success-and-refreshing"?null:Ud.createPortal(c.jsx(Zd,{children:c.jsx(Hk,{onError:j,onClear:I,children:c.jsx(d.Suspense,{fallback:c.jsx(tE,{}),children:c.jsx(_,{...S.result.props??{}})})})}),Xd())}if(g.isRendering&&p&&p.component===h&&p.id===o){const _=h;return S===null||S.type!=="success"&&S.type!=="success-and-refreshing"?null:Ud.createPortal(c.jsx(Zd,{children:c.jsx(d.Suspense,{fallback:c.jsx(CE,{}),children:c.jsx(_,{...S.result.props??{}})})}),Xd())}return null},Nl=e=>{const{onlyRenderComposition:t}=d.useContext(Ks);return t&&t!==e.id?null:c.jsx(IE,{...e})},vw=[],yw=null,TE=()=>vw,Ut=e=>{vw.push(e)},RE=e=>{yw=e},jE=()=>yw,PE=e=>{const t=oe.Children.toArray(e);if(t.length!==1)return null;const n=t[0];return!oe.isValidElement(n)||typeof n.type!="function"&&typeof n.type!="object"?null:n.type},os="4.0.499",FE=()=>{if(typeof globalThis>"u")return;const e=()=>{globalThis.remotion_imported=os,typeof window<"u"&&(window.remotion_imported=os)},t=globalThis.remotion_imported||typeof window<"u"&&window.remotion_imported;if(t){if(t===os)return;if(typeof t=="string"&&t.includes("webcodecs")){e();return}throw new TypeError(`🚨 Multiple versions of Remotion detected: ${[os,typeof t=="string"?t:"an older version"].filter(Ii).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()},gt=d.createContext(null),Qd={};tw(Qd,{useTimelineSetFrame:()=>Cw,useTimelinePosition:()=>Xr,useTimelineContext:()=>Gr,usePlayingState:()=>Iw,usePlaybackRate:()=>yp,useAbsoluteTimelinePosition:()=>Ew,persistCurrentFrame:()=>ww,getInitialFrameState:()=>xw,getFrameForComposition:()=>bw,clampFrameToCompositionRange:()=>Sw});function wm(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 _E(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 Co=(e,t)=>{if(e===null)return Math.random();if(typeof e=="string")return wm(_E(e));if(typeof e=="number")return wm(e*1e10);throw new Error("random() argument must be a number or a string")},Ti=d.createContext({setFrame:()=>{throw new Error("default")},setPlaying:()=>{throw new Error("default")}}),Ri=d.createContext(null),mp=d.createContext(null),gp=d.createContext(null),ME=({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(Co(null))),[u,f]=d.useState(()=>xw()),p=t??u,{delayRender:h,continueRender:m}=On();typeof window<"u"&&d.useLayoutEffect(()=>{window.remotion_setFrame=(v,y,x)=>{window.remotion_attempt=x;const b=h(`Setting the current frame to ${v}`);let S=!0;f(E=>(E[y]??window.remotion_initialFrame)===v?(S=!1,E):{...E,[y]:v}),S?requestAnimationFrame(()=>m(b)):m(b)},window.remotion_isPlayer=!1},[m,h]);const w=d.useMemo(()=>({frame:p,playing:n,imperativePlaying:o,rootId:l,audioAndVideoTags:a}),[p,n,l]),g=d.useMemo(()=>({playbackRate:i,setPlaybackRate:s}),[i]),k=d.useMemo(()=>({setFrame:f,setPlaying:r}),[]);return c.jsx(gp.Provider,{value:w,children:c.jsx(mp.Provider,{value:g,children:c.jsx(Ri.Provider,{value:w,children:c.jsx(Ti.Provider,{value:k,children:e})})})})},vp=()=>"remotion.time-all",ww=e=>{localStorage.setItem(vp(),JSON.stringify(e))},xw=()=>{const e=localStorage.getItem(vp())??"{}";return JSON.parse(e)},bw=e=>{const t=localStorage.getItem(vp())??"{}",n=JSON.parse(t);return n[e]!==void 0?Number(n[e]):typeof window>"u"?0:window.remotion_initialFrame??0},Sw=(e,t)=>Math.max(0,Math.min(Math.max(0,t-1),e)),kw=e=>{const t=gu(),n=lt();if(!t)return typeof window>"u"?0:window.remotion_initialFrame??0;const r=e.frame[t.id]??(n.isPlayer?0:bw(t.id));return Sw(r,t.durationInFrames)},Gr=()=>{const e=d.useContext(Ri);if(e===null)throw new Error("TimelineContext is not available. This hook must be used inside a <Player> or the Remotion Studio.");return e},yp=()=>{const e=d.useContext(mp);if(e===null)throw new Error("PlaybackRateContext is not available. This hook must be used inside a <Player> or the Remotion Studio.");return e},Xr=()=>{const e=Gr();return kw(e)},Ew=()=>{const e=d.useContext(gp);if(e===null)throw new Error("AbsoluteTimeContext is not available. This hook must be used inside a <Player> or the Remotion Studio.");return kw(e)},Cw=()=>{const{setFrame:e}=d.useContext(Ti);return e},Iw=()=>{const{playing:e,imperativePlaying:t}=Gr(),{setPlaying:n}=d.useContext(Ti);return d.useMemo(()=>[e,n,t],[t,e,n])},Tt=()=>{const e=d.useContext(ko),t=lt();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=Xr(),r=d.useContext(gt),o=r?r.cumulatedFrom+r.relativeFrom:0;return n-o},vu=()=>{const e=d.useContext(gt),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=gu();return d.useMemo(()=>{if(!o)return null;const{id:i,durationInFrames:s,fps:a,height:l,width:u,defaultProps:f,props:p,defaultCodec:h,defaultOutName:m,defaultVideoImageFormat:w,defaultPixelFormat:g,defaultProResProfile:k,defaultSampleRate:v}=o;return{id:i,width:t??u,height:n??l,fps:a,durationInFrames:r??s,defaultProps:f,props:p,defaultCodec:h,defaultOutName:m,defaultVideoImageFormat:w,defaultPixelFormat:g,defaultProResProfile:k,defaultSampleRate:v}},[r,n,t,o])},ft=()=>{const e=vu(),t=d.useContext(ko),n=dp();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},qs=({frame:e,children:t,active:n=!0})=>{const r=Tt(),o=ft();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=Gr(),a=d.useContext(gt),l=(a==null?void 0:a.relativeFrom)??0,u=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 c.jsx(Ri.Provider,{value:u,children:c.jsx(gt.Provider,{value:f,children:t})})},tr={"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}},$E=tr,yu={"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}},qr={"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"}},Qr={"style.backgroundColor":{type:"color",default:"transparent",description:"Color"}},Tw={children:{type:"text-content",default:"",description:"Text",keyframable:!1}},ji={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}},Rw={...ji},jw={...tr,...Qr,...qr,...Rw},wp={type:"boolean",default:!1,description:"Hidden"},Pw={type:"hidden"},xp={type:"hidden"},AE=e=>({name:xp,...e}),bp={type:"number",default:void 0,min:1,step:1,hiddenFromList:!0},Fw={type:"number",default:0,step:1,hiddenFromList:!0},_w={type:"number",default:0,min:0,step:1,hiddenFromList:!0},Sp={type:"number",default:null,step:1,hiddenFromList:!0},vr={durationInFrames:bp,from:Fw,trimBefore:_w,freeze:Sp,hidden:wp,name:xp,showInTimeline:Pw},xi={...vr,layout:{type:"enum",default:"absolute-fill",description:"Layout",variants:{"absolute-fill":jw,none:{}}}},NE={durationInFrames:bp,trimBefore:_w,freeze:Sp,hidden:wp,name:xp,showInTimeline:Pw},LE={...NE,layout:xi.layout},zE={...xi,layout:{...xi.layout,default:"none"}},Pi=oe.createContext({registerSequence:()=>{throw new Error("SequenceManagerContext not initialized")},unregisterSequence:()=>{throw new Error("SequenceManagerContext not initialized")},sequences:[]}),wu=oe.createContext({current:[]}),ar=e=>`${e.absolutePath}\0${e.nodePath.join(".")}\0${e.sequenceKeys.join(".")}\0${e.effectKeys.map(t=>t.join(".")).join(".")}`,xu=oe.createContext({propStatuses:{}}),bu=oe.createContext({current:{}}),Su=oe.createContext({getDragOverrides:()=>{throw new Error("VisualModeDragOverridesContext not initialized")},getEffectDragOverrides:()=>{throw new Error("VisualModeDragOverridesContext not initialized")}}),Mw=oe.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")}}),yc=(e,t)=>`${ar(e)}.effects.${t}`,DE=({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({}),[u,f]=d.useState({}),p=d.useRef(u);p.current=u;const h=d.useCallback((I,_,A)=>{i(W=>({...W,[ar(I)]:{...W[ar(I)],[_]:A}}))},[]),m=d.useCallback(I=>{i(_=>{const A=ar(I);if(!_[A])return _;const W={..._};return delete W[A],W})},[]),w=d.useCallback((I,_,A,W)=>{l(P=>{const F=yc(I,_);return{...P,[F]:{...P[F],[A]:W}}})},[]),g=d.useCallback((I,_)=>{l(A=>{const W=yc(I,_);if(!A[W])return A;const P={...A};return delete P[W],P})},[]),k=d.useCallback((I,_)=>{f(A=>{const W=ar(I),P=A[W],F=_(P);return P===F?A:{...A,[W]:F}})},[]),v=d.useCallback(I=>{n(_=>[..._,I])},[]),y=d.useCallback(I=>{n(_=>_.filter(A=>A.id!==I))},[]),x=d.useMemo(()=>({registerSequence:v,sequences:t,unregisterSequence:y}),[v,t,y]),b=d.useCallback(I=>o[ar(I)]??{},[o]),S=d.useCallback((I,_)=>a[yc(I,_)]??{},[a]),E=d.useMemo(()=>({propStatuses:u}),[u]),R=d.useMemo(()=>({getDragOverrides:b,getEffectDragOverrides:S}),[b,S]),j=d.useMemo(()=>({setDragOverrides:h,clearDragOverrides:m,setEffectDragOverrides:w,clearEffectDragOverrides:g,setPropStatuses:k}),[h,m,w,g,k]);return c.jsx(wu.Provider,{value:r,children:c.jsx(Pi.Provider,{value:x,children:c.jsx(bu.Provider,{value:p,children:c.jsx(xu.Provider,{value:E,children:c.jsx(Su.Provider,{value:R,children:c.jsx(Mw.Provider,{value:j,children:e})})})})})})},ku=d.createContext(!1),OE=({children:e})=>c.jsx(ku.Provider,{value:!0,children:e}),$w=({children:e})=>c.jsx(ku.Provider,{value:!1,children:e}),BE=()=>{if(!oe.useContext(ku))throw new Error("This component must be inside a <Series /> component.")},Aw=d.createContext({premountFramesRemaining:0}),WE=!1,Qs=e=>e??WE,Js=({from:e,durationInFrames:t,premountFor:n,postmountFor:r,style:o,styleWhilePremounted:i,styleWhilePostmounted:s,hideWhilePremounted:a})=>{const l=d.useContext(Aw),u=Tt()-l.premountFramesRemaining,f=lt(),{fps:p}=ft(),h=n??0,m=r??0,w=Math.ceil(e+t-1),g=!f.isRendering&&u<e&&u>=e-h,k=!f.isRendering&&u>w&&u<=w+m,v=g||k,y=g?e:k?e+t-1:0,x=d.useMemo(()=>v?{...o,...a==="opacity"?{opacity:0}:{display:"none"},pointerEvents:"none",...g?i:{},...k?s:{}}:o,[v,a,k,g,o,s,i]);return{effectivePremountFor:h,effectivePostmountFor:m,premountingActive:g,postmountingActive:k,isPremountingOrPostmounting:v,freezeFrame:y,premountingStyle:x}},VE=(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},HE=4,UE=.001,ZE=1e-7,KE=10,is=11,Ea=1/(is-1),YE=typeof Float32Array=="function";function Nw(e,t){return 1-3*t+3*e}function Lw(e,t){return 3*t-6*e}function zw(e){return 3*e}function Ll(e,t,n){return((Nw(t,n)*e+Lw(t,n))*e+zw(t))*e}function Dw(e,t,n){return 3*Nw(t,n)*e*e+2*Lw(t,n)*e+zw(t)}function GE({aX:e,_aA:t,_aB:n,mX1:r,mX2:o}){let i,s,a=0,l=t,u=n;do s=l+(u-l)/2,i=Ll(s,r,o)-e,i>0?u=s:l=s;while(Math.abs(i)>ZE&&++a<KE);return s}function XE(e,t,n,r){let o=t;for(let i=0;i<HE;++i){const s=Dw(o,n,r);if(s===0)return o;const a=Ll(o,n,r)-e;o-=a/s}return o}function Ow(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=YE?new Float32Array(is):new Array(is);if(e!==t||n!==r)for(let s=0;s<is;++s)o[s]=Ll(s*Ea,e,n);function i(s){let a=0,l=1;const u=is-1;for(;l!==u&&o[l]<=s;++l)a+=Ea;--l;const f=(s-o[l])/(o[l+1]-o[l]),p=a+f*Ea,h=Dw(p,e,n);return h>=UE?XE(s,p,e,n):h===0?p:GE({aX:s,_aA:a,_aB:a+Ea,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:Ll(i(a),t,r)}}var qE=e=>Math.round(e*1e6)/1e6,QE=new Set(["deg","rad","grad","turn"]),Bw=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"]),Ww=/^([+-]?(?:\d+\.?\d*|\.\d+))([a-zA-Z%]+)?$/,Vw=new Set(["left","center","right","top","bottom"]),ti=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:"%"}}],Hi={value:50,unit:"%"},xm=e=>String(qE(e)),JE=(e,t)=>{const n=Ww.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(QE.has(r))return{kind:"rotate",value:o,unit:r};if(Bw.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`)},Hw=({component:e,value:t,allowPercentage:n})=>{const r=Ww.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||!Bw.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}},wc=(e,t)=>{const n=e.toLowerCase();return Vw.has(n)?{type:"keyword",keyword:n}:{type:"length-percentage",parsed:Hw({component:e,value:t,allowPercentage:!0})}},eC=(e,t,n)=>{const r=[];for(const o of ti(e))for(const i of ti(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]},tC=(e,t)=>{if(e.length===1){const a=wc(e[0],t);return a.type==="length-percentage"?[a.parsed,Hi]:a.keyword==="top"||a.keyword==="bottom"?[Hi,ti(a.keyword)[0].value]:[ti(a.keyword)[0].value,Hi]}const n=wc(e[0],t),r=wc(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 eC(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[ti(o.keyword)[0].value,i]}return o.keyword==="top"||o.keyword==="bottom"?[i,ti(o.keyword)[0].value]:s?[Hi,i]:[i,Hi]},nC=(e,t)=>{const[n,r]=tC(t.slice(0,2),e),o=t[2]===void 0?{value:0,unit:null}:Hw({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}},rC=e=>{var o,i,s,a,l,u;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=>Vw.has(f.toLowerCase())))return nC(e,t);const n=t.map(f=>JE(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,h=((i=n[2])==null?void 0:i.value)??1;return{kind:r,values:[f,p,h],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,((u=n[2])==null?void 0:u.unit)??null],dimensions:n.length}},oC=({kind:e,values:t,units:n,dimensions:r})=>e==="scale"?t.slice(0,r).map(o=>xm(o)).join(" "):t.slice(0,r).map((o,i)=>`${xm(o)}${n[i]}`).join(" "),bm=e=>e===0?0:Math.sign(e)*e*e,iC=e=>e===0?0:Math.sign(e)*Math.sqrt(Math.abs(e));function sC(e,t,n,r){const{extrapolateLeft:o,extrapolateRight:i,easing:s,output:a}=r;let l=e;const[u,f]=t,[p,h]=n;if(l<u){if(o==="identity")return l;if(o==="clamp")l=u;else if(o==="wrap"){const m=f-u;l=((l-u)%m+m)%m+u}}if(l>f){if(i==="identity")return l;if(i==="clamp")l=f;else if(i==="wrap"){const m=f-u;l=((l-u)%m+m)%m+u}}if(p===h)return p;if(l=(l-u)/(f-u),l=s(l),a==="perceptual-scale"){const m=bm(p),w=bm(h);l=iC(l*(w-m)+m)}else l=l*(h-p)+p;return l}function aC(e,t){let n;for(n=1;n<t.length-1&&!(t[n]>=e);++n);return n-1}var lC=e=>e,uC=e=>e??"linear",Uw=e=>e.remotionShouldExtendRight===!0,Sm=({easing:e,segmentIndex:t})=>e===void 0?lC:typeof e=="function"?e:e[t],km=({input:e,inputRange:t,outputRange:n,easing:r,extrapolateLeft:o,extrapolateRight:i,output:s})=>sC(e,t,n,{easing:r,extrapolateLeft:o,extrapolateRight:e>t[1]&&i==="clamp"&&Uw(r)?"extend":i,output:s}),kp=({input:e,inputRange:t,outputRange:n,options:r})=>{const o=uC(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,u=aC(l,t),f=Sm({easing:i,segmentIndex:u});let p=km({input:l,inputRange:[t[u],t[u+1]],outputRange:[n[u],n[u+1]],easing:f,extrapolateLeft:s,extrapolateRight:a,output:o});for(let h=0;h<u;h++){const m=Sm({easing:i,segmentIndex:h});if(!Uw(m))continue;const w=t[h+1];if(l<=w)continue;const g=km({input:l,inputRange:[t[h],w],outputRange:[n[h],n[h+1]],easing:m,extrapolateLeft:s,extrapolateRight:"extend",output:o});p+=g-n[h+1]}return p},cC=({input:e,inputRange:t,outputRange:n,options:r})=>{var u;const o=n.map(rC),i=(u=o[0])==null?void 0:u.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 h=p.units[f];if(h!==null){if(a[f]===null){a[f]=h;continue}if(a[f]!==h)throw new TypeError(`Cannot interpolate ${i} values with different units on axis ${f+1}: ${a[f]} and ${h}`)}}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]=kp({input:e,inputRange:t,outputRange:o.map(p=>p.values[f]),options:r});return oC({kind:i,values:l,units:a,dimensions:s})},dC=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},fC=({input:e,inputRange:t,outputRange:n,options:r})=>{const o=dC(n);return new Array(o).fill(!0).map((i,s)=>kp({input:e,inputRange:t,outputRange:n.map(a=>a[s]),options:r}))};function pC(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 Em(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 hC(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 mC(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 Fi(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(Em("inputRange",t),pC(t),hC(r==null?void 0:r.easing,t.length),mC(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 cC({input:e,inputRange:t,outputRange:n,options:r})}if(n.every(i=>Array.isArray(i)))return fC({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 Em("outputRange",n),kp({input:e,inputRange:t,outputRange:n,options:r})}var vC=({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}`)},yC=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)}},wC={damping:10,mass:1,stiffness:100,overshootClamping:!1},xc={};function xC({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,u=n.mass,f=n.stiffness,p=[r,o,i,s,l,u,f,t].join("-");if(xc[p])return xc[p];const h=-s,m=r-i,w=l/(2*Math.sqrt(f*u)),g=Math.sqrt(f/u),k=g*Math.sqrt(1-w**2),v=a/1e3,y=Math.sin(k*v),x=Math.cos(k*v),b=Math.exp(-w*g*v),S=b*(y*((h+w*g*m)/k)+m*x),E=r-S,R=w*g*S-b*(x*(h+w*g*m)-k*m*y),j=Math.exp(-g*v),I=r-j*(m+(h+g*m)*v),_=j*(h*(v*g-1)+v*m*g*g),A={toValue:r,prevPosition:i,lastTimestamp:t,current:w<1?E:I,velocity:w<1?R:_};return xc[p]=A,A}var bc={};function Zw({frame:e,fps:t,config:n={}}){const i=[e,t,n.damping,n.mass,n.overshootClamping,n.stiffness].join("-");if(bc[i])return bc[i];let s={lastTimestamp:0,current:0,toValue:1,velocity:0,prevPosition:0};const a=Math.max(0,e),l=a%1;for(let u=0;u<=Math.floor(a);u++){u===Math.floor(a)&&(u+=l);const f=u/t*1e3;s=xC({animation:s,now:f,config:{...wC,...n}})}return bc[i]=s,s}var Sc=new Map;function Kw({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(Sc.has(r))return Sc.get(r);pu(e,"to the measureSpring() function");let o=0,i=0;const s=()=>Zw({fps:e,frame:o,config:t});let a=s();const l=()=>Math.abs(a.current-a.toValue);let u=l();for(;u>=n;)o++,a=s(),u=l();i=o;for(let f=0;f<20;f++)o++,a=s(),u=l(),u>=n&&(f=0,i=o+1);return Sc.set(r,i),i}function Jd({frame:e,fps:t,config:n={},from:r=0,to:o=1,durationInFrames:i,durationRestThreshold:s,delay:a=0,reverse:l=!1}){yC(i),vC({frame:e,durationInFrames:1/0,allowFloats:!0}),pu(t,"to spring()");const u=l||typeof i<"u",f=u?Kw({fps:t,config:n,threshold:s}):void 0,p=u?{get:()=>f}:{get:()=>{throw new Error("did not calculate natural duration, this is an error with Remotion. Please report")}},m=(l?(i??p.get())-e:e)+(l?a:-a),w=i===void 0?m:m/(i/p.get());if(i&&m>i)return o;const g=Zw({fps:t,frame:w,config:n}),k=n.overshootClamping?o>=r?Math.min(g.current,o):Math.max(g.current,o):g.current;return r===0&&o===1?k:Fi(k,[0,1],[r,o])}var Cm=e=>Math.min(1,Math.max(0,e)),Ui=30;class zl{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 zl.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=Cm(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:Jd(t?{fps:Ui,frame:i*Kw({fps:Ui,config:r,threshold:n}),config:r}:{fps:Ui,frame:i*Ui,config:r,durationInFrames:Ui,durationRestThreshold:n}),{remotionShouldExtendRight:t})}static bounce(t){const n=Cm(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 Ow(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 Pn="[-+]?\\d*\\.?\\d+",Ca=Pn+"%";function Ia(...e){return"\\(\\s*("+e.join(")\\s*,\\s*(")+")\\s*\\)"}var Ta="(?:none|[-+]?\\d*\\.?\\d+(?:%|deg|rad|grad|turn)?)";function Zi(e){return new RegExp(e+"\\(\\s*("+Ta+")\\s+("+Ta+")\\s+("+Ta+")(?:\\s*\\/\\s*("+Ta+"))?\\s*\\)")}function bC(){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"+Ia(Pn,Pn,Pn)),e.rgba=new RegExp("rgba"+Ia(Pn,Pn,Pn,Pn)),e.hsl=new RegExp("hsl"+Ia(Pn,Ca,Ca)),e.hsla=new RegExp("hsla"+Ia(Pn,Ca,Ca,Pn)),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=Zi("oklch"),e.oklab=Zi("oklab"),e.lab=Zi("lab"),e.lch=Zi("lch"),e.hwb=Zi("hwb")),e}function ci(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 Im(e,t,n){const r=n<.5?n*(1+t):n+t-n*t,o=2*n-r,i=ci(o,r,e+1/3),s=ci(o,r,e),a=ci(o,r,e-1/3);return Math.round(i*255)<<24|Math.round(s*255)<<16|Math.round(a*255)<<8}function Mo(e){const t=Number.parseInt(e,10);return t<0?0:t>255?255:t}function Tm(e){return(Number.parseFloat(e)%360+360)%360/360}function Rm(e){const t=Number.parseFloat(e);return t<0?0:t>1?255:Math.round(t*255)}function Ra(e){const t=Number.parseFloat(e);return t<0?0:t>100?1:t/100}function gn(e,t){return e==="none"?0:e.endsWith("%")?Number.parseFloat(e)/100*t:Number.parseFloat(e)}function kc(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 Ki(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 di(e){return e<=.0031308?12.92*e:1.055*e**(1/2.4)-.055}function ja(e){return Math.max(0,Math.min(1,e))}function Yi(e,t,n,r){const o=Math.round(ja(e)*255),i=Math.round(ja(t)*255),s=Math.round(ja(n)*255),a=Math.round(ja(r)*255);return(o<<24|i<<16|s<<8|a)>>>0}function jm(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,u=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[di(u),di(f),di(p)]}function Pm(e,t,n){const r=.008856451679035631,o=24389/27,i=.95047,s=1,a=1.08883,l=(e+16)/116,u=t/500+l,f=l-n/200,p=u*u*u,h=f*f*f,m=p>r?p:(116*u-16)/o,w=e>o*r?((e+16)/116)**3:e/o,g=h>r?h:(116*f-16)/o,k=m*i,v=w*s,y=g*a,x=3.2404542*k-1.5371385*v-.4985314*y,b=-.969266*k+1.8760108*v+.041556*y,S=.0556434*k-.2040259*v+1.0572252*y;return[di(x),di(b),di(S)]}function SC(e,t,n){if(t+n>=1){const u=t/(t+n);return[u,u,u]}const r=1,o=0,i=ci(o,r,e+1/3),s=ci(o,r,e),a=ci(o,r,e-1/3),l=1-t-n;return[i*l+t,s*l+t,a*l+t]}var Fm={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 kC(e){const t=bC();let n;if(t.hex6&&(n=t.hex6.exec(e)))return Number.parseInt(n[1]+"ff",16)>>>0;if(Fm[e]!==void 0)return Fm[e];if(t.rgb&&(n=t.rgb.exec(e)))return(Mo(n[1])<<24|Mo(n[2])<<16|Mo(n[3])<<8|255)>>>0;if(t.rgba&&(n=t.rgba.exec(e)))return(Mo(n[1])<<24|Mo(n[2])<<16|Mo(n[3])<<8|Rm(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(Im(Tm(n[1]),Ra(n[2]),Ra(n[3]))|255)>>>0;if(t.hsla&&(n=t.hsla.exec(e)))return(Im(Tm(n[1]),Ra(n[2]),Ra(n[3]))|Rm(n[4]))>>>0;if(t.oklch&&(n=t.oklch.exec(e))){const r=gn(n[1],1),o=gn(n[2],.4),i=kc(n[3]),s=Ki(n[4]),a=i*Math.PI/180,[l,u,f]=jm(r,o*Math.cos(a),o*Math.sin(a));return Yi(l,u,f,s)}if(t.oklab&&(n=t.oklab.exec(e))){const r=gn(n[1],1),o=gn(n[2],.4),i=gn(n[3],.4),s=Ki(n[4]),[a,l,u]=jm(r,o,i);return Yi(a,l,u,s)}if(t.lab&&(n=t.lab.exec(e))){const r=gn(n[1],100),o=gn(n[2],125),i=gn(n[3],125),s=Ki(n[4]),[a,l,u]=Pm(r,o,i);return Yi(a,l,u,s)}if(t.lch&&(n=t.lch.exec(e))){const r=gn(n[1],100),o=gn(n[2],150),i=kc(n[3]),s=Ki(n[4]),a=i*Math.PI/180,[l,u,f]=Pm(r,o*Math.cos(a),o*Math.sin(a));return Yi(l,u,f,s)}if(t.hwb&&(n=t.hwb.exec(e))){const r=kc(n[1]),o=gn(n[2],1),i=gn(n[3],1),s=Ki(n[4]),[a,l,u]=SC(r/360,o,i);return Yi(a,l,u,s)}throw new Error(`invalid color string ${e} provided`)}var _m=e=>(e>>24&255)/255,EC=e=>e>>16&255,CC=e=>e>>8&255,IC=e=>e&255,TC=(e,t,n,r)=>`rgba(${e}, ${t}, ${n}, ${r})`;function RC(e){const t=kC(e);return(t<<24|t>>>8)>>>0}var jC=(e,t,n,r)=>{const[o,i,s,a]=[EC,CC,IC,_m].map(l=>{const u=Fi(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===_m?Number(u.toFixed(3)):Math.round(u)});return TC(o,i,s,a)},PC=(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=>RC(i));return jC(e,t,o,r)},Mm=({easing:e,forceSpringAllowTail:t})=>{switch(e.type){case"linear":return zl.linear;case"spring":return zl.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 Ow(e.x1,e.y1,e.x2,e.y2);default:throw new TypeError(`Unsupported easing: ${JSON.stringify(e)}`)}},ea=({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),u=a.map(f=>f.value);if(s==="interpolateColors"){if(!u.every(f=>typeof f=="string"))return null;if(r.length===1)return u[0];try{return PC(e,l,u,{easing:o.map(f=>Mm({easing:f,forceSpringAllowTail:t})),posterize:n.posterize})}catch{return null}}if(s!=="interpolate")return null;try{return Fi(e,l,u,{easing:o.map(f=>Mm({easing:f,forceSpringAllowTail:t})),extrapolateLeft:i.left,extrapolateRight:i.right,output:n.output,posterize:n.posterize})}catch{return null}},Eu=({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=ea({forceSpringAllowTail:null,frame:t,status:e.status});return n===null?{type:"none"}:{type:"resolved",value:n}},Yw=({propStatus:e,dragOverrideValue:t,defaultValue:n,frame:r=null,shouldResortToDefaultValueIfUndefined:o=!1})=>{const i=Eu({dragOverrideValue:t,frame:r});return i.type==="resolved"&&i.value!==void 0?i.value:e.status==="keyframed"?r!==null?ea({forceSpringAllowTail:null,frame:r,status:e}):o?n:void 0:e.codeValue===void 0&&o?n:e.codeValue},Ep=d.createContext({overrideIdToNodePathMappings:{}}),FC=d.createContext({setOverrideIdToNodePath:()=>{throw new Error("OverrideIdsToNodePathsSettersContext not initialized")}}),_C=({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=Eu({dragOverrideValue:s,frame:r});a.type==="resolved"&&(o[i]=a.value)}return{params:o,effectKey:e.definition.calculateKey(o)}},MC=(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=ea({forceSpringAllowTail:null,frame:t,status:i});s!==null&&(n[o]=s,r=!0)}}return r?n:null},ta=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)},Gw=({propStatuses:e,nodePath:t,effectIndex:n})=>{const r=e[ar(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"}},Xw=(e,t)=>{const n=e[ar(t)];if(n&&n.canUpdate)return n.props},na=({effects:e,overrideId:t})=>{const n=d.useRef(null),{propStatuses:r}=d.useContext(xu),{getEffectDragOverrides:o}=d.useContext(Su),i=Tt(),{overrideIdToNodePathMappings:s}=d.useContext(Ep),a=n.current,l=t?s[t]??null:null,u=e.map((h,m)=>{if(l===null)return{descriptor:h,params:h.params,effectKey:h.effectKey};const w=Gw({propStatuses:r,nodePath:l,effectIndex:m}),g=w.type==="can-update-effect"?MC(w.props,i):null,k=o(l,m),v=Object.keys(k).length===0?null:k,{params:y,effectKey:x}=_C({descriptor:h,propStatusOverrides:g,dragOverrides:v,frame:i});return{descriptor:h,params:y,effectKey:x}});if(a!==null&&a.length===u.length&&a.every((h,m)=>h.definition===u[m].descriptor.definition&&h.effectKey===u[m].effectKey))return a;const p=u.map(({descriptor:h,params:m,effectKey:w})=>({definition:h.definition,effectKey:w,params:m,memoized:!0}));return n.current=p,p},Cp=(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,Cp(s,t))}else n[r]=o}return n},Ip=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=Ip(i);for(const a of Object.keys(s))n(a,s[a])}}return t},qw=({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],u=Object.keys(l);for(const f of u)s.add(f)}return[...s]},$m={type:"linear"},$C=({insertedKeyframeIndex:e,easingLength:t,keyframeCount:n})=>!(e>0&&e<n-1)||t===0?null:Math.min(e-1,t-1),AC=e=>({type:"static",value:e}),NC=({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(u=>u.frame===t),a=$C({insertedKeyframeIndex:s,easingLength:i.length,keyframeCount:o.length}),l=a===null?$m:i[a];i.splice(s,0,l)}for(;i.length<o.length-1;)i.push($m);return i.length>o.length-1&&(i.length=o.length-1),{type:"keyframed",status:{...e,keyframes:o,easing:i}}},LC=e=>{if((e==null?void 0:e.type)==="static")return e.value},zC=e=>e!==null&&e.status==="keyframed",Qw=(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=Qw(r,t);if(o)return o}},Jw=({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 u=(r==null?void 0:r[l])??null,f=Qw(e,l);if((f==null?void 0:f.type)==="hidden")continue;let p;if(u===null)p=t[l];else if(zC(u))if((f==null?void 0:f.type)==="array"||(f==null?void 0:f.keyframable)===!1)p=t[l];else{const h=Eu({dragOverrideValue:n[l],frame:o});h.type==="resolved"?p=h.value:o!==null?p=ea({forceSpringAllowTail:null,frame:o,status:u})??t[l]:p=t[l]}else u.status==="computed"?p=t[l]:p=Yw({propStatus:u,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(As)&&(p=`${window.remotion_staticBase}/${p.slice(As.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 u=qw({schema:e,key:l,value:i[l]});for(const f of u)s.add(f)}return{merged:i,propsToDelete:s}},ex=(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=ex(n,t);if(!(((o=e[t])==null?void 0:o.type)==="text-content"&&typeof r!="string"))return r},DC=(e,t,n)=>{const r={};for(const o of t)r[o]=n?tx({flatSchema:n,key:o,props:e}):ex(e,o);return r},OC=(e,t)=>Object.keys(Cp(e,n=>t[n])),BC=({flatSchema:e,props:t,valuesDotNotation:n,schemaKeys:r,propsToDelete:o})=>{var a;const i={...t};for(const l of r){const u=n[l];if(((a=e[l])==null?void 0:a.type)==="text-content"&&u===void 0)continue;const f=l.split(".");if(f.length===1){i[l]=u;continue}let p=i;for(let h=0;h<f.length-1;h++){const m=f[h];typeof p[m]=="object"&&p[m]!==null?p[m]={...p[m]}:p[m]={},p=p[m]}p[f[f.length-1]]=u}const s=new Set([...o].filter(l=>{var u;return!(((u=e[l])==null?void 0:u.type)==="text-content"&&n[l]===void 0)}));return VE(i,s),i},Am={},yr=({Component:e,componentName:t,componentIdentity:n,schema:r,supportsEffects:o})=>{const i=AE(r),s=Ip(i),a=Object.keys(s),l=d.forwardRef((u,f)=>{const p=lt();if(!p.isStudio||p.isReadOnlyStudio||p.isRendering)return oe.createElement(e,{...u,controls:null,ref:f});const{propStatuses:h}=d.useContext(xu),{getDragOverrides:m}=d.useContext(Su),w=d.useContext(Ep),g=Tt();if(u.controls)return oe.createElement(e,{...u,ref:f});const[k]=d.useState(()=>{const{stack:I}=u;if(!I)return String(Math.random());const _=Am[I];if(_)return _;const A=String(Math.random());return Am[I]=A,A}),v=w.overrideIdToNodePathMappings[k]??null,y=a.map(I=>tx({flatSchema:s,key:I,props:u})),x=d.useMemo(()=>DC(u,a,s),y),b=d.useMemo(()=>({schema:i,currentRuntimeValueDotNotation:x,overrideId:k,supportsEffects:o,componentIdentity:n,componentName:t}),[x,k]),{merged:S,propsToDelete:E}=d.useMemo(()=>Jw({schema:i,currentValue:x,overrideValues:v===null?{}:m(v),propStatus:v===null?void 0:Xw(h,v),frame:g}),[x,m,v,h,g]),R=OC(i,S),j=BC({flatSchema:s,props:u,valuesDotNotation:S,schemaKeys:R,propsToDelete:E});return oe.createElement(e,{...j,controls:b,ref:f})});return l.displayName=`withInteractivitySchema(${e.displayName||e.name||"Component"})`,l},Ec=[],WC=({from:e=0,trimBefore:t=0,freeze:n,durationInFrames:r=1/0,children:o,name:i,height:s,width:a,showInTimeline:l=!0,hidden:u=!1,controls:f,_remotionInternalEffects:p,_remotionInternalLoopDisplay:h,_remotionInternalStack:m,_remotionInternalDocumentationLink:w,_remotionInternalSingleChildComponent:g,_remotionInternalPremountDisplay:k,_remotionInternalPostmountDisplay:v,_remotionInternalIsMedia:y,outlineRef:x,...b},S)=>{const{layout:E="absolute-fill"}=b,[R]=d.useState(()=>String(Math.random())),j=d.useContext(gt),{rootId:I}=Gr(),_=j?j.cumulatedFrom+j.relativeFrom:0,A=du();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 b.style<"u")throw new TypeError('If layout="none", you may not pass a style. Passed: '+JSON.stringify(b.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=Xr(),P=ft(),F=e-t,H=((j==null?void 0:j.absoluteFrom)??0)+F,O=j?Math.min(j.durationInFrames-F,r):r,T=Math.max(0,Math.min(P.durationInFrames-e,O)),{registerSequence:C,unregisterSequence:N}=d.useContext(Pi),$=d.useRef(null),D=b.layout==="none"?x??null:x??$,B=d.useMemo(()=>(j==null?void 0:j.premounting)||!!b._remotionInternalIsPremounting,[b._remotionInternalIsPremounting,j==null?void 0:j.premounting]),Z=d.useMemo(()=>(j==null?void 0:j.postmounting)||!!b._remotionInternalIsPostmounting,[b._remotionInternalIsPostmounting,j==null?void 0:j.postmounting]),L=_+F,z=j?j.cumulatedFrom+j.relativeFrom:0,Q=j?z-j.cumulatedNegativeFrom:0,G=Math.max(0,Q,L),V=L-G,K=d.useMemo(()=>({absoluteFrom:H,cumulatedFrom:_,relativeFrom:F,cumulatedNegativeFrom:V,durationInFrames:T,parentFrom:(j==null?void 0:j.relativeFrom)??0,id:R,height:s??(j==null?void 0:j.height)??null,width:a??(j==null?void 0:j.width)??null,premounting:B,postmounting:Z,premountDisplay:k??null,postmountDisplay:v??null}),[_,H,F,T,j,R,s,a,B,Z,k,v,V]),de=d.useMemo(()=>i??"",[i]),ge=w??"https://www.remotion.dev/docs/sequence",ce=lt(),se=d.useContext(ku),ee=(b==null?void 0:b.stack)??null,q=d.useRef(null);q.current=m??ee;const J=typeof n=="number"?n:null,ie=t===0?null:t,Me=(j==null?void 0:j.cumulatedNegativeFrom)??0,ke=y&&y.type!=="image"?y.data.startMediaFrom+Me-V:null,be=y&&y.type!=="image"?y.data.startMediaFrom+Me:null,$e=y&&y.type!=="image"&&be!==null?J===null?null:be+(h?J%h.durationInFrames:J)*y.data.playbackRate:null;d.useEffect(()=>{if(ce.isStudio)return y?(y.type==="image"?C({type:"image",controls:f??null,effects:p??Ec,displayName:de,documentationLink:ge,duration:T,from:e,trimBefore:ie,id:R,loopDisplay:h,nonce:A.get(),parent:(j==null?void 0:j.id)??null,postmountDisplay:v??null,premountDisplay:k??null,rootId:I,showInTimeline:l,src:y.src,getStack:()=>q.current,refForOutline:D??null,isInsideSeries:se,frozenFrame:J,singleChildComponent:g??null}):C({type:y.type,controls:f??null,effects:p??Ec,displayName:de,documentationLink:ge,doesVolumeChange:y.data.doesVolumeChange,duration:T,from:e,trimBefore:ie,id:R,loopDisplay:h,nonce:A.get(),parent:(j==null?void 0:j.id)??null,playbackRate:y.data.playbackRate,postmountDisplay:v??null,premountDisplay:k??null,rootId:I,showInTimeline:l,src:y.data.src,getStack:()=>q.current,startMediaFrom:ke??y.data.startMediaFrom,mediaFrameAtSequenceZero:be,volume:y.data.volumes,refForOutline:D??null,isInsideSeries:se,frozenFrame:J,frozenMediaFrame:$e,singleChildComponent:g??null}),()=>{N(R)}):(C({from:e,trimBefore:ie,duration:T,id:R,displayName:de,documentationLink:ge,parent:(j==null?void 0:j.id)??null,type:"sequence",rootId:I,showInTimeline:l,nonce:A.get(),loopDisplay:h,getStack:()=>q.current,premountDisplay:k??null,postmountDisplay:v??null,controls:f??null,effects:p??Ec,refForOutline:D??null,isInsideSeries:se,frozenFrame:J,singleChildComponent:g??null}),()=>{N(R)})},[r,R,i,C,de,N,j==null?void 0:j.id,T,I,e,t,ie,l,A,h,k,v,ce.isStudio,f,p,y,ge,D,se,J,ke,be,$e,g]);const xe=Math.ceil(_+e+r-1),Te=W<_+e||W>xe?null:o,Pe=Te===null||typeof n>"u"||n===null?Te:c.jsx(qs,{frame:n,children:Te}),Ee=b.layout==="none"?void 0:b.style,Le=d.useCallback(zt=>{$.current=zt,typeof S=="function"?S(zt):S&&(S.current=zt)},[S]),jt=d.useMemo(()=>({flexDirection:void 0,...a?{width:a}:{},...s?{height:s}:{},...Ee??{}}),[s,Ee,a]);if(S!==null&&E==="none")throw new TypeError('It is not supported to pass both a `ref` and `layout="none"` to <Sequence />.');return u?null:c.jsx(gt.Provider,{value:K,children:Pe===null?null:b.layout==="none"?Pe:c.jsx(Dn,{ref:Le,style:jt,className:b.className,children:Pe})})},VC=d.forwardRef(WC),HC=(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,...u}=e,{freezeFrame:f,isPremountingOrPostmounting:p,postmountingActive:h,premountingActive:m,premountingStyle:w}=Js({from:r,durationInFrames:o,premountFor:i,postmountFor:s,style:n??null,styleWhilePremounted:a??null,styleWhilePostmounted:l??null,hideWhilePremounted:"opacity"});return c.jsx(qs,{frame:f,active:p,children:c.jsx(Cu,{ref:t,from:r,durationInFrames:o,style:w??void 0,_remotionInternalPremountDisplay:i,_remotionInternalPostmountDisplay:s,_remotionInternalIsPremounting:m,_remotionInternalIsPostmounting:h,...u})})},UC=d.forwardRef(HC),ZC=(e,t)=>{const n=lt(),{fps:r}=ft();if(e.layout!=="none"&&!n.isRendering){const o=e.premountFor;if(o||e.postmountFor)return c.jsx(UC,{ref:t,...e,premountFor:o})}return c.jsx(VC,{...e,ref:t})},Cu=d.forwardRef(ZC),nx=Cu,Rt=yr({Component:Cu,componentName:"<Sequence>",componentIdentity:"dev.remotion.remotion.Sequence",schema:xi,supportsEffects:!1});yr({Component:Cu,componentName:"<Sequence>",componentIdentity:null,schema:LE,supportsEffects:!1});var rx=(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)}},KC="https://remotion.dev/docs/troubleshooting/webgl2-context",ox=(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 ${KC}`,YC=e=>new Error(ox("WebGL",e)),ix=e=>new Error(ox("WebGL2",e));class GC{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 XC=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},Pa=null,qC=()=>Pa||(Pa=(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()})(),Pa),sx=(e,t)=>({pool:new GC(e,t),setupCache:new WeakMap,cleanupRegistry:[],currentRunId:0}),ef=e=>{e.currentRunId++;for(const t of e.cleanupRegistry)t.definition.cleanup(t.state)},QC=(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},ra=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),u=XC(l);let f=t,p=null;if(u.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 h=!1;for(const k of u)if(k.backend==="webgpu"){h=!0;break}const m=h?await qC():null;if(a())return!1;let w=!0;for(let k=0;k<u.length;k++){const v=u[k],[y,x]=e.pool.getPair(v.backend);let b=y;for(const E of v.effects){const R=E.definition,j=QC(e,R,b);R.apply({source:f,target:b,state:j,params:E.params,width:o,height:i,gpuDevice:m,flipSourceY:v.backend==="webgl2"?w:!1}),v.backend==="webgl2"&&(w=!0,e.pool.assertContextNotLost(b)),f=b,b=b===y?x:y}p=f??p;const S=u[k+1];if(S&&S.backend!==v.backend&&p)if(v.backend==="2d"&&S.backend==="webgl2")f=p,w=!0;else{const E=await createImageBitmap(p);if(a())return E.close(),!1;f=E,S.backend==="webgl2"&&(w=!1)}}if(!p)return!0;const g=r.getContext("2d");if(!g)throw new Error("Failed to acquire 2D context for output canvas");return g.clearRect(0,0,o,i),g.drawImage(p,0,0,o,i),!0},oa=()=>{const e=d.useRef(null),t=d.useRef(null);return d.useEffect(()=>()=>{e.current&&ef(e.current)},[]),d.useMemo(()=>({get:(n,r)=>((!t.current||t.current.width!==n||t.current.height!==r)&&(e.current&&ef(e.current),e.current=sx(n,r),t.current={width:n,height:r}),e.current)}),[])},JC=({width:e,height:t,fit:n,className:r,style:o,effects:i,...s},a)=>{const l=d.useRef(null),u=oa(),f=d.useMemo(()=>typeof document>"u"?null:document.createElement("canvas"),[]),p=d.useCallback(h=>{const m=l.current,w=e??h.displayWidth,g=t??h.displayHeight;if(!m)throw new Error("Canvas ref is not set");if(!f)throw new Error("Source canvas is not available");f.width=w,f.height=g;const k=f.getContext("2d");if(!k)throw new Error("Could not get 2d context for source canvas");return k.drawImage(h,...rx(n,{height:h.displayHeight,width:h.displayWidth},{width:w,height:g})),m.width=w,m.height=g,ra({state:u.get(w,g),source:f,effects:i,output:m,width:w,height:g})},[u,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 m;const h=(m=l.current)==null?void 0:m.getContext("2d");if(!h)throw new Error("Could not get 2d context");h.clearRect(0,0,l.current.width,l.current.height)}}),[p]),c.jsx("canvas",{ref:l,className:r,style:o,...s})},e2=oe.forwardRef(JC),ax=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}},t2=5,Nm=({loopBehavior:e,durationFound:t,timeInSec:n})=>e==="loop"?t?n%t:n:Math.min(n,t||1/0),n2=async({resolvedSrc:e,signal:t,requestInit:n,currentTime:r,initialLoopBehavior:o})=>{const{decoder:i,selectedTrack:s}=await ax({resolvedSrc:e,signal:t,requestInit:n,contentType:null}),a=[];let l=null;const u=async m=>{const w=a.find(k=>k.frameIndex===m);if(w&&w.frame)return w;const g=await i.decode({frameIndex:m,completeFramesOnly:!0});return w?w.frame=g.image:a.push({frame:g.image,frameIndex:m,timeInSeconds:g.image.timestamp/1e6}),{frame:g.image,frameIndex:m,timeInSeconds:g.image.timestamp/1e6}},f=m=>{const g=a.filter(k=>k.frame).sort((k,v)=>{const y=Math.abs(k.timeInSeconds-m),x=Math.abs(v.timeInSeconds-m);return y-x});for(let k=0;k<g.length;k++){if(k<t2)continue;const v=g[k];v.frame=null}},p=async({timeInSec:m,loopBehavior:w})=>{const g=Nm({durationFound:l,loopBehavior:w,timeInSec:m}),v=a.filter(x=>x.timeInSeconds<=g).map(x=>x.frameIndex).reduce((x,b)=>Math.max(x,b),0);let y=v;for(;;){const x=await u(y);if(y++,!x.frame)throw new Error("No frame found");if(!x.frame.duration||(y===s.frameCount&&l===null&&(l=(x.frame.timestamp+x.frame.duration)/1e6),x.timeInSeconds>g||y===s.frameCount))break}s.frameCount-v<3&&w==="loop"&&await u(0),f(g)};return await p({timeInSec:r,loopBehavior:o}),await p({timeInSec:r,loopBehavior:o}),{close:()=>{var m;for(const w of a)(m=w.frame)==null||m.close(),w.frame=null;i.close()},getFrame:async(m,w)=>{if(l!==null&&m>l&&w==="clear-after-finish")return null;const g=Nm({loopBehavior:w,durationFound:l,timeInSec:m});await p({timeInSec:g,loopBehavior:w});const v=a.filter(y=>y.frame).reduce((y,x)=>{const b=Math.abs(y.timeInSeconds-g),S=Math.abs(x.timeInSeconds-g);return b<S?y:x});if(!v.frame)throw new Error("No frame found");return v},frameCount:s.frameCount}},r2=({frame:e,playbackRate:t,fps:n})=>e*t/n,o2=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})},i2=e=>typeof window>"u"?e:new URL(e,window.origin).href,s2={src:{type:"asset",default:void 0,description:"Source",keyframable:!1},...vr,...ji,playbackRate:{type:"number",min:0,max:10,step:.1,default:1,description:"Playback rate",hiddenFromList:!1,keyframable:!1},...tr,...Qr,...qr},a2=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},lx=d.forwardRef(({src:e,width:t,height:n,onError:r,loopBehavior:o="loop",playbackRate:i=1,fit:s="fill",requestInit:a,effects:l,controls:u,...f},p)=>{const h=i2(e),[m,w]=d.useState(null),{delayRender:g,continueRender:k}=On(),[v]=d.useState(()=>g(`Rendering <AnimatedImage/> with src="${h}"`)),y=Tt(),{fps:x}=ft(),b=r2({frame:y,playbackRate:i,fps:x}),S=d.useRef(b);S.current=b;const E=o2(a),R=d.useRef(a);R.current=a;const j=d.useRef(null),I=na({effects:l,overrideId:(u==null?void 0:u.overrideId)??null});d.useImperativeHandle(p,()=>{var W;const A=(W=j.current)==null?void 0:W.getCanvas();if(!A)throw new Error("Canvas ref is not set");return A},[]);const[_]=d.useState(()=>o);return d.useEffect(()=>{const A=new AbortController;let W=!1,P=!1;const F=()=>{P||(P=!0,k(v))};return n2({resolvedSrc:h,signal:A.signal,requestInit:R.current,currentTime:S.current,initialLoopBehavior:_}).then(H=>{if(W){H.close();return}w(H),F()}).catch(H=>{if(!W){if(H.name==="AbortError"){F();return}r?(r==null||r(H),F()):Ns(H)}}),()=>{W=!0,A.abort(),F()}},[h,v,r,E,_,k]),d.useEffect(()=>()=>{m==null||m.close()},[m]),d.useLayoutEffect(()=>{if(!m)return;const A=g(`Rendering frame at ${b} of <AnimatedImage src="${e}"/>`);let W=!1;return m.getFrame(b,o).then(async P=>{var H,O;if(W)return;if(P===null){(H=j.current)==null||H.clear(),k(A);return}await((O=j.current)==null?void 0:O.draw(P.frame))&&!W&&k(A)}).catch(P=>{W||(r?(r(P),k(A)):Ns(P))}),()=>{W=!0,k(A)}},[b,m,o,r,e,k,g,I,s,t,n]),c.jsx(e2,{ref:j,width:t,height:n,fit:s,effects:I,...f})});lx.displayName="AnimatedImageContent";var l2=({src:e,width:t,height:n,onError:r,fit:o,playbackRate:i,loopBehavior:s,id:a,className:l,style:u,durationInFrames:f,from:p,premountFor:h,postmountFor:m,styleWhilePremounted:w,styleWhilePostmounted:g,requestInit:k,effects:v=[],controls:y,ref:x,...b})=>{const S=d.useRef(null),E=ta(v);d.useImperativeHandle(x,()=>S.current,[]);const{effectivePostmountFor:R,effectivePremountFor:j,freezeFrame:I,isPremountingOrPostmounting:_,postmountingActive:A,premountingActive:W,premountingStyle:P}=Js({from:p??0,durationInFrames:f??1/0,premountFor:h??null,postmountFor:m??null,style:u??null,styleWhilePremounted:w??null,styleWhilePostmounted:g??null,hideWhilePremounted:"display-none"}),F=a2(b),H={src:e,width:t,height:n,onError:r,fit:o,playbackRate:i,loopBehavior:s,id:a,className:l,style:P??void 0,requestInit:k,...F};return c.jsx(qs,{frame:I,active:_,children:c.jsx(Rt,{layout:"none",from:p??0,durationInFrames:f??1/0,name:"<AnimatedImage>",_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/animatedimage",controls:y,_remotionInternalEffects:E,_remotionInternalPremountDisplay:j||null,_remotionInternalPostmountDisplay:R||null,_remotionInternalIsPremounting:W,_remotionInternalIsPostmounting:A,...b,outlineRef:S,children:c.jsx(lx,{...H,ref:S,effects:v,controls:y})})})},ux=yr({Component:l2,componentName:"<AnimatedImage>",componentIdentity:"dev.remotion.remotion.AnimatedImage",schema:s2,supportsEffects:!0});ux.displayName="AnimatedImage";Ut(ux);var u2={type:"boolean",default:!1,description:"Disabled"},c2=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:u2,...e.schema}};return(i={})=>(n(i),{definition:r,params:i,effectKey:r.calculateKey(i),memoized:!1})},d2=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.')},f2=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")},cx=e=>{e.type==="artifact"&&(d2(e.filename),e.contentType!=="thumbnail"&&f2(e.content))},Io=d.createContext({registerRenderAsset:()=>{},unregisterRenderAsset:()=>{},renderAssets:[]}),p2=({children:e,collectAssets:t})=>{const[n,r]=d.useState([]),o=d.useRef([]),i=d.useCallback(l=>{cx(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(u=>u.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 c.jsx(Io.Provider,{value:a,children:e})},Jn=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,Iu=({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))},dx=d.createContext(null),h2=()=>oe.useContext(dx),Tu=({durationInFrames:e,times:t=1/0,children:n,name:r,showInTimeline:o,...i})=>{const s=Tt(),{durationInFrames:a}=ft();if(fu(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),u=Math.min(l,t),f=i.layout==="none"?void 0:i.style,p=e*(u-1),m=Math.floor(s/e)*e,w=Math.min(m,p),g=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 c.jsx(dx.Provider,{value:k,children:c.jsx(Rt,{durationInFrames:e,from:w,name:r??"<Loop>",_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/loop",_remotionInternalLoopDisplay:g,layout:i.layout,style:f,showInTimeline:o,children:n})})};Tu.useLoop=h2;var Nt=({logLevel:e,tag:t,message:n,mountTime:r})=>{const o=[r?Date.now()-r+"ms ":null,t].filter(Boolean).join(" ");bt.trace({logLevel:e,tag:null},`[${o}]`,n)},Ru=d.createContext({}),Lm={},Cc=[],fx=({children:e})=>{const[t,n]=d.useState(()=>Lm);return d.useEffect(()=>{const r=()=>{n(Lm)};return Cc.push(r),()=>{Cc=Cc.filter(o=>o!==r)}},[]),c.jsx(Ru.Provider,{value:t,children:e})},px=e=>{const t=e.indexOf("#");return t===-1?null:t},m2=e=>{const t=px(e);return t===null?e:e.slice(0,t)},To=e=>{const t=d.useContext(Ru),n=px(e),r=m2(e);return t[r]?n!==null?t[r]+e.slice(n):t[r]:e},ju=(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.")},v2=(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.")},Pu=({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"?v2(n,r):(typeof e<"u"||typeof t<"u")&&g2(e,t)},Fu=({startFrom:e,endAt:t,trimBefore:n,trimAfter:r})=>({trimBeforeValue:n??e??void 0,trimAfterValue:r??t??void 0}),y2=(e,t)=>{switch(t.type){case"got-duration":{const n=Jn(t.src);return e[n]===t.durationInSeconds?e:{...e,[n]:t.durationInSeconds}}default:return e}},Tp=d.createContext({durations:{},setDurations:()=>{throw new Error("context missing")}}),hx=({children:e})=>{const[t,n]=d.useReducer(y2,{}),r=d.useMemo(()=>({durations:t,setDurations:n}),[t]);return c.jsx(Tp.Provider,{value:r,children:e})},Rp=({crossOrigin:e,requestsVideoFrame:t,isClientSideRendering:n})=>{if(e!=null)return e;if(n||t)return"anonymous"},Dl=({mediaRef:e,mediaType:t,onAutoPlayError:n,logLevel:r,mountTime:o,reason:i,isPlayer:s})=>{const{current:a}=e;if(!a)return;Nt({logLevel:r,tag:"play",message:`Attempting to play ${a.src}. Reason: ${i}`,mountTime:o});const l=a.play();l.catch&&l.catch(u=>{if(a&&!u.message.includes("request was interrupted by a call to pause")&&!u.message.includes("The operation was aborted.")&&!u.message.includes("The fetching process for the media resource was aborted by the user agent")&&!u.message.includes("request was interrupted by a new load request")&&!u.message.includes("because the media was removed from the document")&&!(u.message.includes("user didn't interact with the document")&&a.muted)&&(console.log(`Could not play ${t} due to following error: `,u),!a.muted)){if(n){n();return}t==="video"&&s&&(bt.info({logLevel:r,tag:"<"+t+">"},"The video will be muted and we'll retry playing it."),bt.info({logLevel:r,tag:"<"+t+">"},"Use onAutoPlayError() to handle this error yourself."),a.muted=!0,a.play())}})},jp=({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}}},zm=!1,w2=e=>{zm||(zm=!0,typeof window<"u"&&bt.warn({logLevel:e,tag:null},"AudioContext is not supported in this browser"))},x2=({logLevel:e,latencyHint:t,audioEnabled:n,sampleRate:r})=>{const o=lt(),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 w2(e),null;const a=new AudioContext({latencyHint:t,sampleRate:r}),l=a.createGain();l.connect(a.destination),bt.trace({logLevel:e,tag:"audio"},"Creating new audio context"),a.suspend();let u=null;return{audioContext:a,gainNode:l,getState:()=>{const m=a.state;return u==="running"&&m!=="running"?"suspended-to-running":u==="suspended"&&m!=="suspended"?"running-to-suspended":m},resume:()=>{u="running";const m=a.resume();return m.finally(()=>{u==="running"&&(u=null)}),m},suspend:()=>{u="suspended";const m=a.suspend();return m.finally(()=>{u==="suspended"&&(u=null)}),m}}},[e,t,o.isRendering,n,r])},b2=(e,t)=>new Promise(n=>{const r=e.currentTime,i=e.getOutputTimestamp().performanceTime,s=performance.now(),a=()=>{var p;const{currentTime:l}=e,u=e.getOutputTimestamp(),f=performance.now()-s;if(i!==void 0&&u.performanceTime!==void 0&&u.performanceTime>i&&u.contextTime!==void 0&&u.contextTime>r){bt.verbose({logLevel:t,tag:"audio"},`waitUntilActuallyResumed: getOutputTimestamp.performanceTime advanced from ${i.toFixed(6)} to ${u.performanceTime.toFixed(6)} after ${f.toFixed(1)}ms. currentTime=${l.toFixed(6)} (advanced by ${(l-r).toFixed(6)}), getOutputTimestamp.performanceTime=${((p=u.performanceTime)==null?void 0:p.toFixed(1))??"undefined"}`),n();return}requestAnimationFrame(a)};requestAnimationFrame(a)}),Ic="data:audio/mp3;base64,/+MYxAAJcAV8AAgAABn//////+/gQ5BAMA+D4Pg+BAQBAEAwD4Pg+D4EBAEAQDAPg++hYBH///hUFQVBUFREDQNHmf///////+MYxBUGkAGIMAAAAP/29Xt6lUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV/+MYxDUAAANIAAAAAFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV",S2=(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},k2=(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,_i=d.createContext(null),_u=d.createContext(null),E2=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}`)},mx=({children:e,audioLatencyHint:t,audioEnabled:n,previewSampleRate:r})=>{const o=er(),i=r??48e3;d.useEffect(()=>{typeof window>"u"||(window.remotion_sampleRate=i)},[i]);const s=x2({logLevel:o,latencyHint:t,audioEnabled:n,sampleRate:i}),a=d.useRef(!1),l=d.useRef(null),u=d.useMemo(()=>({value:0}),[]),f=d.useRef([]),p=d.useMemo(()=>({dispatch:b=>{f.current.forEach(S=>S(b))},subscribe:b=>(f.current.push(b),{remove:()=>{f.current=f.current.filter(S=>S!==b)}})}),[]),h=d.useRef({scheduledEndTime:null,mediaEndTime:null}),m=d.useRef(new Map),w=d.useCallback(b=>{m.current.delete(b)},[]),g=d.useMemo(()=>({node:b,mediaTimestamp:S,sourceOffset:E,scheduledTime:R,duration:j,offset:I,originalUnloopedMediaTimestamp:_})=>{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=E2(A);j>0&&(W?m.current.set(b,{scheduledTime:R,offset:I,duration:j}):b.start(R,I,j));const P=R+j/b.playbackRate.value,F=S+I-E,H=F+j,O=s.audioContext.baseLatency+s.audioContext.outputLatency,T=R-s.audioContext.currentTime,C=h.current,N=C.scheduledEndTime!==null&&Math.abs(R-C.scheduledEndTime)>.001,$=C.mediaEndTime!==null&&Math.abs(F-C.mediaEndTime)>.001;return bt.verbose({logLevel:o,tag:"audio-scheduling"},"scheduled %c%s%c %s %c%s%c %s %c%s%c %s %s %s %s %s",N?"color: red; font-weight: bold":"",R.toFixed(4),"",P.toFixed(4),$?"color: red; font-weight: bold":"",F.toFixed(4),"",H.toFixed(4),j<0||T<0?"color: red; font-weight: bold":"color: blue; font-weight: bold",j<0?"missed "+Math.abs(I).toFixed(2)+"s":Math.abs(T).toFixed(2)+(T<0?" delay":" ahead"),"","current="+s.audioContext.currentTime.toFixed(4),"offset="+I.toFixed(4),"latency="+O.toFixed(4),"state="+s.audioContext.state,_!==F?"original_ts="+_.toFixed(4):"","action="+(W?"schedule":"start"),""),C.scheduledEndTime=P,C.mediaEndTime=H,j>0?{type:"started",scheduledTime:R}:{type:"not-started",reason:"missed "+Math.abs(I).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),m.current.forEach((S,E)=>{E.start(S.scheduledTime,S.offset,S.duration)}),m.current.clear();const b=s.resume();return l.current=new Promise(S=>{b2(s.audioContext,o).then(S),b.catch(E=>{bt.warn({logLevel:o,tag:"audio"},"AudioContext resume rejected, continuing without audio sync",E),S()})}).finally(()=>{l.current=null}),b.catch(()=>{})},[s,o]),v=d.useCallback(()=>l.current,[]),y=d.useCallback(()=>!s||!a.current?Promise.resolve():(a.current=!1,s.suspend()),[s]),x=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:u,audioSyncAnchorEmitter:p,scheduleAudioNode:g,resume:k,suspend:y,getIsResumingAudioContext:v,unscheduleAudioNode:w}),[s,u,p,g,k,y,v,w]);return c.jsx(_i.Provider,{value:x,children:e})},gx=({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=er(),i=Xs(),s=lt(),a=d.useContext(_i),l=(a==null?void 0:a.audioContext)??null,u=a==null?void 0:a.resume,[f]=d.useState(()=>new Array(t).fill(!0).map(()=>{const b=d.createRef();return{id:Math.random(),ref:b,mediaElementSourceNode:jp({audioContext:l,ref:b})}}));for(const{mediaElementSourceNode:b}of f)b==null||b.setAudioContext(l);(oe.useInsertionEffect??oe.useLayoutEffect)(()=>()=>{requestAnimationFrame(()=>{f.forEach(({mediaElementSourceNode:b})=>{b==null||b.cleanup()})})},[f]);const h=d.useRef(new Array(t).fill(!1)),m=d.useCallback(()=>{f.forEach(({ref:b,id:S})=>{var j;const E=(j=n.current)==null?void 0:j.find(I=>I.id===S),{current:R}=b;if(R){if(E===void 0){R.src!==Ic&&(R.src=Ic);return}if(!E)throw new TypeError("Expected audio data to be there");Object.keys(E.props).forEach(I=>{k2(I,E.props[I],R[I])&&(R[I]=E.props[I])})}})},[f]),w=d.useCallback(b=>{var O,T;const{aud:S,audioId:E,premounting:R,postmounting:j}=b,I=(O=n.current)==null?void 0:O.find(C=>C.audioId===E);if(I)return I;const _=h.current.findIndex(C=>C===!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:A,ref:W,mediaElementSourceNode:P}=f[_],F=[...h.current];F[_]=A,h.current=F;const H={props:S,id:A,el:W,audioId:E,mediaElementSourceNode:P,premounting:R,audioMounted:!!W.current,postmounting:j,cleanupOnMediaTagUnmount:()=>{}};return(T=n.current)==null||T.push(H),m(),H},[t,f,m]),g=d.useCallback(b=>{var R;const S=[...h.current],E=f.findIndex(j=>j.id===b);if(E===-1)throw new TypeError(`Unknown audio ref ${b}; refs: ${f.map(j=>j.id).join(", ")}`);S[E]=!1,h.current=S,n.current=(R=n.current)==null?void 0:R.filter(j=>j.id!==b),m()},[f,m]),k=d.useCallback(({aud:b,audioId:S,id:E,premounting:R,postmounting:j})=>{var _;let I=!1;n.current=(_=n.current)==null?void 0:_.map(A=>{const W=!!A.el.current;return A.audioMounted!==W&&(I=!0),A.id===E?S2(b,A.props)&&A.premounting===R&&A.postmounting===j?A.audioMounted===W?A:{...A,audioMounted:W}:(I=!0,{...A,props:b,premounting:R,postmounting:j,audioId:S,audioMounted:W}):A.audioMounted===W?A:{...A,audioMounted:W}}),I&&m()},[m]),v=d.useCallback(()=>{f.forEach(b=>{const S=n.current.find(E=>E.el===b.ref);S!=null&&S.premounting||Dl({mediaRef:b.ref,mediaType:"audio",onAutoPlayError:null,logLevel:o,mountTime:i,reason:"playing all audios",isPlayer:s.isPlayer})}),u==null||u()},[o,i,f,s.isPlayer,u]),y=d.useMemo(()=>({registerAudio:w,unregisterAudio:g,updateAudio:k,playAllAudios:v,numberOfAudioTags:t}),[t,v,w,g,k]),x=d.useMemo(()=>f.map(({id:b,ref:S})=>c.jsx("audio",{ref:S,preload:"metadata",src:Ic},b)),[f]);return c.jsxs(_u.Provider,{value:y,children:[x,e]})},C2=({aud:e,audioId:t,premounting:n,postmounting:r})=>{var l;const o=d.useContext(_i),i=d.useContext(_u),[s]=d.useState(()=>{if(i&&i.numberOfAudioTags>0)return i.registerAudio({aud:e,audioId:t,premounting:n,postmounting:r});const u=oe.createRef(),f=jp({audioContext:(o==null?void 0:o.audioContext)??null,ref:u});return{el:u,id:Math.random(),props:e,audioId:t,mediaElementSourceNode:f,premounting:n,audioMounted:!!u.current,postmounting:r,cleanupOnMediaTagUnmount:()=>{f==null||f.cleanup()}}});(l=s.mediaElementSourceNode)==null||l.setAudioContext((o==null?void 0:o.audioContext)??null);const a=oe.useInsertionEffect??oe.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},I2=1e-5,Ol=(e,t)=>Math.abs(e-t)<I2,vx=(e,t)=>Math.round(e/t*100)/100,tf=()=>typeof window>"u"||!/AppleWebKit/.test(window.navigator.userAgent)?!1:!window.navigator.userAgent.includes("Chrome/"),Mu=()=>typeof window>"u"?!1:/iP(ad|od|hone)/i.test(window.navigator.userAgent)&&tf(),T2=e=>Mu()&&e.startsWith("blob:"),nf=({actualFrom:e,fps:t})=>vx(Math.max(0,-e),t),rf=({duration:e,fps:t})=>vx(e,t),R2=({actualSrc:e,actualFrom:t,duration:n,fps:r})=>{if(T2(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=${nf({actualFrom:t,fps:r})}`;return Number.isFinite(n)?`${i},${rf({duration:n,fps:r})}`:i},j2=({prevStartFrom:e,newStartFrom:t,prevDuration:n,newDuration:r,fps:o})=>{const i=nf({actualFrom:e,fps:o}),s=nf({actualFrom:t,fps:o}),a=rf({duration:n,fps:o}),l=rf({duration:r,fps:o});return!(s<i||l>a)},P2=({actualSrc:e,actualFrom:t,duration:n,fps:r})=>{const o=d.useRef(t),i=d.useRef(n),s=d.useRef(e);return(!j2({prevStartFrom:o.current,newStartFrom:t,prevDuration:i.current,newDuration:n,fps:r})||e!==s.current)&&(o.current=t,i.current=n,s.current=e),R2({actualSrc:s.current,actualFrom:o.current,duration:i.current,fps:r})},Dm=!1,F2=e=>{Dm||(Dm=!0,bt.warn({logLevel:e,tag:null},"In Safari, setting a volume and a playback rate at the same time is buggy."),bt.warn({logLevel:e,tag:null},"In Desktop Safari, only volumes <= 1 will be applied."),bt.warn({logLevel:e,tag:null},e,"In Mobile Safari, the volume will be ignored and set to 1 if a playbackRate is set."))},yx=({mediaRef:e,volume:t,logLevel:n,source:r,shouldUseWebAudioApi:o})=>{var h,m,w;const i=d.useRef(null),s=d.useRef(t);s.current=t;const a=d.useContext(_i);if(!a)throw new Error("useAmplification must be used within a SharedAudioContext");const{audioContext:l,gainNode:u}=a;if(typeof window<"u"&&d.useLayoutEffect(()=>{var k,v;if(!l||!e.current||!o)return;if(e.current.playbackRate!==1&&tf()){F2(n);return}if(!r||!u)return;const g=new GainNode(l,{gain:s.current});return r.attemptToConnect(),r.get().connect(g),g.connect(u),i.current={gainNode:g},bt.trace({logLevel:n,tag:null},`Starting to amplify ${(k=e.current)==null?void 0:k.src}. Gain = ${s.current}, playbackRate = ${(v=e.current)==null?void 0:v.playbackRate}`),()=>{i.current=null,g.disconnect(),r.get().disconnect()}},[n,e,l,r,o,u]),i.current){const g=t;Ol(i.current.gainNode.gain.value,g)||(i.current.gainNode.gain.value=g,bt.trace({logLevel:n,tag:null},`Setting gain to ${g} for ${(h=e.current)==null?void 0:h.src}`))}return(tf()&&e.current&&((m=e.current)==null?void 0:m.playbackRate)!==1||!o)&&e.current&&!Ol(t,(w=e.current)==null?void 0:w.volume)&&(e.current.volume=Math.min(t,1)),i},yo=()=>{const e=d.useContext(gt);return(e==null?void 0:e.cumulatedNegativeFrom)??0},Mi=e=>{const t=Tu.useLoop(),n=Tt(),r=yo();return e==="repeat"||t===null?n+r:n+r+t.durationInFrames*t.iteration},wx=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]},_2=({compositionDurationInFrames:e,playbackRate:t,trimBefore:n,trimAfter:r,parentSequenceDurationInFrames:o,loop:i})=>{if(i)return e;const s=Iu({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},Ro=({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)},Om={},M2=e=>{Om[e]||(console.warn(e),Om[e]=!0)},xx=({volume:e,mediaVolume:t,mediaType:n,src:r,displayName:o,trimBefore:i,trimAfter:s,playbackRate:a,sequenceDurationInFrames:l,mediaStartsAt:u,loop:f})=>{if(!r)throw new Error("No src passed");const p=d.useContext(gt),[h]=d.useState(()=>e),m=_2({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,m+u))).fill(!0).map((b,S)=>Ro({frame:S+u,volume:e,mediaVolume:t})).join(","),[m,u,e,t]);d.useEffect(()=>{typeof e=="number"&&e!==h&&M2(`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`)},[h,n,r,e]);const g=typeof e=="function",k=du(),{rootId:v}=Gr(),y=0-u+(i??0);return d.useMemo(()=>({volumes:w,duration:m,doesVolumeChange:g,nonce:k,rootId:v,finalDisplayName:o??wx(r),startMediaFrom:y,src:r,playbackRate:a}),[w,m,g,k,v,o,r,y,a])},Pp=({volume:e,mediaVolume:t,src:n,mediaType:r,playbackRate:o,displayName:i,id:s,getStack:a,showInTimeline:l,premountDisplay:u,postmountDisplay:f,loopDisplay:p,documentationLink:h,refForOutline:m})=>{const w=d.useContext(gt),g=yo(),{registerSequence:k,unregisterSequence:v}=d.useContext(Pi),{durationInFrames:y}=ft(),x=yo(),{volumes:b,duration:S,doesVolumeChange:E,nonce:R,rootId:j,finalDisplayName:I}=xx({volume:e,mediaVolume:t,mediaType:r,src:n,displayName:i,trimAfter:void 0,trimBefore:void 0,playbackRate:o,sequenceDurationInFrames:y,mediaStartsAt:x,loop:!1}),{isStudio:_}=lt();d.useEffect(()=>{var A,W;if(!n)throw new Error("No src passed");if(!(!_&&((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:S,from:0,trimBefore:null,parent:(w==null?void 0:w.id)??null,displayName:I,documentationLink:h,rootId:j,volume:b,showInTimeline:!0,nonce:R.get(),startMediaFrom:0-g,mediaFrameAtSequenceZero:null,doesVolumeChange:E,loopDisplay:p,playbackRate:o,getStack:a,premountDisplay:u,postmountDisplay:f,controls:null,effects:[],refForOutline:m,isInsideSeries:!1,frozenFrame:null,frozenMediaFrame:null}),()=>{v(s)}},[S,s,w,n,k,v,b,E,R,r,g,o,a,l,u,f,p,h,j,I,_,m])},$2=(e,t)=>{const[n,r]=d.useState([]),[o,i]=d.useState([]),[s,a]=d.useState([]),u=lt().isRendering,f=d.useRef(!1),p=d.useCallback(w=>{if(u)return{unblock:()=>{}};let g=!1;return r(k=>[...k,w]),{unblock:()=>{g||(g=!0,r(k=>{const v=k.filter(y=>y!==w);return v.length===k.length?k:v}))}}},[u]),h=d.useCallback(w=>(i(g=>[...g,w]),{remove:()=>{i(g=>g.filter(k=>k!==w))}}),[]),m=d.useCallback(w=>(a(g=>[...g,w]),{remove:()=>{a(g=>g.filter(k=>k!==w))}}),[]);return d.useEffect(()=>{u||n.length>0&&!f.current&&(f.current=!0,o.forEach(w=>w()),Nt({logLevel:e,message:"Player is entering buffer state",mountTime:t,tag:"player"}))},[n]),typeof window<"u"&&d.useLayoutEffect(()=>{u||n.length===0&&f.current&&(f.current=!1,s.forEach(w=>w()),Nt({logLevel:e,message:"Player is exiting buffer state",mountTime:t,tag:"player"}))},[n]),d.useMemo(()=>({addBlock:p,listenForBuffering:h,listenForResume:m,buffering:f}),[p,f,h,m])},$i=oe.createContext(null),bx=({children:e})=>{const{logLevel:t,mountTime:n}=d.useContext(Eo),r=$2(t??"info",n);return c.jsx($i.Provider,{value:r,children:e})},Sx=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},$u=()=>{const e=d.useContext($i),t=er(),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");bt.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,bt.trace({logLevel:t,tag:"[buffer-state]"},"Removing buffer handle"),r())}}}}),[n,t])},A2=()=>/^((?!chrome|android).)*safari/i.test(window.navigator.userAgent),N2=({mediaRef:e,mediaType:t,onVariableFpsVideoDetected:n,pauseWhenBuffering:r,logLevel:o,mountTime:i})=>{const s=d.useRef(!1),{delayPlayback:a}=$u(),l=d.useCallback(u=>{var w;if(t!=="video"||!r)return;const f=e.current;if(!f)return;if(f.readyState>=f.HAVE_FUTURE_DATA&&!A2()){Nt({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){Nt({logLevel:o,message:"Not using buffer until first frame, because requestVideoFrameCallback is not supported",mountTime:i,tag:"buffer"});return}s.current=!0,Nt({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(),h=()=>{p.unblock(),f.removeEventListener("ended",h,{once:!0}),f.removeEventListener("pause",h,{once:!0}),s.current=!1},m=()=>{h()};f.requestVideoFrameCallback((g,k)=>{Math.abs(k.mediaTime-u)>.5&&n(),h()}),f.addEventListener("ended",m,{once:!0}),f.addEventListener("pause",m,{once:!0}),f.addEventListener("canplay",m,{once:!0})},[a,o,e,t,i,n,r]);return d.useMemo(()=>({isBuffering:()=>s.current,bufferUntilFirstFrame:l}),[l])},L2=e=>{const{duration:t,currentTime:n,paused:r,ended:o,desiredUnclampedTime:i,mediaTagTime:s,mediaTagLastUpdate:a,rvcTime:l,rvcLastUpdate:u,isVariableFpsVideo:f,acceptableTimeShift:p,lastSeekDueToShift:h,playing:m,playbackRate:w,mediaTagBufferingOrStalled:g,playerBuffering:k,absoluteFrame:v,onlyWarnForMediaSeekingError:y,isPremounting:x,isPostmounting:b,pauseWhenBuffering:S}=e,E=!Number.isNaN(t)&&Number.isFinite(t)?Math.min(t,i):i,R=Math.abs(E-s),j=l?Math.abs(E-l):null,I=u&&l>a?j:R,_=j&&!f?I:R;if(_>p&&h!==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 = ${x}, isPostmounting = ${b}, pauseWhenBuffering = ${S}`,bufferUntilFirstFrame:m&&w>0,playReason:m&&r?"player is playing but media tag is paused, and just seeked":null,warnAboutNonSeekable:!y};const A=m?.15:.01,W=Math.abs(n-E)>A;if(!m||k&&!g)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(!m||k)return{type:"none"};const F=r&&!o;if(F||v===0){const O=F?"media tag is paused":"absolute frame is 0";return{type:"play-and-seek",shouldBeTime:E,why:W?`is over timeshift threshold (threshold = ${A}) and ${O}`:null,playReason:`player is playing and ${O}`,bufferUntilFirstFrame:!f&&w>0}}return{type:"none"}},z2=e=>{var r,o;const t=oe.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},al=({mediaRef:e,time:t,logLevel:n,why:r,mountTime:o})=>{const i=Mu()?Number(t.toFixed(1)):t;return Nt({logLevel:n,tag:"seek",message:`Seeking from ${e.currentTime} to ${i}. src= ${e.src} Reason: ${r}`,mountTime:o}),e.currentTime=i,i},D2=({element:e,shouldBuffer:t,isPremounting:n,isPostmounting:r,logLevel:o,mountTime:i,src:s})=>{const a=$u(),[l,u]=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/")){Nt({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 g=p.playbackRate;p.load(),p.playbackRate=g}return}const h=g=>{let k=!1;f.forEach(v=>{v(g),k=!0}),f=[],u(v=>(v&&(k=!0),!1)),k&&Nt({logLevel:o,message:`Unmarking as buffering: ${p.src}. Reason: ${g}`,tag:"buffer",mountTime:i})},m=g=>{u(!0),Nt({logLevel:o,message:`Marking as buffering: ${p.src}. Reason: ${g}`,tag:"buffer",mountTime:i});const{unblock:k}=a.delayPlayback(),v=()=>{h('"canplay" was fired'),w()},y=()=>{h('"error" event was occurred'),w()};p.addEventListener("canplay",v,{once:!0}),f.push(()=>{p.removeEventListener("canplay",v)}),p.addEventListener("error",y,{once:!0}),f.push(()=>{p.removeEventListener("error",y)}),f.push(x=>{Nt({logLevel:o,message:`Unblocking ${p.src} from buffer. Reason: ${x}`,tag:"buffer",mountTime:i}),k()})},w=()=>{if(p.readyState<p.HAVE_FUTURE_DATA){if(m(`readyState is ${p.readyState}, which is less than HAVE_FUTURE_DATA`),!navigator.userAgent.includes("Firefox/")){Nt({logLevel:o,message:`Calling .load() on ${s} because readyState is ${p.readyState} and it is not Firefox. ${p.playbackRate}`,tag:"load",mountTime:i});const g=p.playbackRate;p.load(),p.playbackRate=g}}else{const g=()=>{m('"waiting" event was fired')};p.addEventListener("waiting",g),f.push(()=>{p.removeEventListener("waiting",g)})}};return w(),()=>{h("element was unmounted or prop changed")}},[a,s,e,n,r,o,t,i]),l},O2=({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 u=s.requestVideoFrameCallback((f,p)=>{if(o.current!==null){const h=Math.abs(o.current.time-p.mediaTime),m=Math.abs(n.current===null?1/0:p.mediaTime-n.current);h>.5&&m>.5&&p.mediaTime>o.current.time&&r()}o.current={time:p.mediaTime,lastUpdate:performance.now()},l()});a=()=>{s.cancelVideoFrameCallback(u),a=()=>{}}};return l(),()=>{a()}},[n,e,t,r]),o},kx=({frame:e,playbackRate:t,startFrom:n})=>Fi(e,[-1,n,n+1],[-1,n,n+t]),Ex=({fps:e,frame:t,playbackRate:n,startFrom:r})=>{const o=kx({frame:t,playbackRate:n,startFrom:r}),i=1e3/e;return o*i/1e3},Bm={},B2=(e,t)=>{if(e===null||e.seekable.length===0||e.seekable.length>1||Bm[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),Bm[e.src]=!0}},Cx=({mediaRef:e,src:t,mediaType:n,playbackRate:r,preservePitch:o=!0,onlyWarnForMediaSeekingError:i,acceptableTimeshift:s,pauseWhenBuffering:a,isPremounting:l,isPostmounting:u,onAutoPlayError:f})=>{const{playbackRate:p}=yp(),h=Tt(),m=Xr(),[w]=Iw(),g=d.useContext($i),{fps:k}=ft(),v=yo(),y=d.useRef(null),x=d.useRef(null),b=er(),S=Xs();if(!g)throw new Error("useMediaPlayback must be used inside a <BufferingContext>");const E=d.useRef({}),R=d.useCallback(()=>{t&&(E.current[t]||(bt.verbose({logLevel:b,tag:null},`Detected ${t} as a variable FPS video. Disabling buffering while seeking.`),E.current[t]=!0))},[b,t]),j=O2({mediaRef:e,mediaType:n,lastSeek:x,onVariableFpsVideoDetected:R}),I=z2(e),_=Ex({frame:h,playbackRate:r,startFrom:-v,fps:k}),A=D2({element:e,shouldBuffer:a,isPremounting:l,isPostmounting:u,logLevel:b,mountTime:S,src:t??null}),{bufferUntilFirstFrame:W,isBuffering:P}=N2({mediaRef:e,mediaType:n,onVariableFpsVideoDetected:R,pauseWhenBuffering:a,logLevel:b,mountTime:S}),F=r*p,H=(()=>{var D;return(D=e.current)!=null&&D.duration?Math.min(e.current.duration,s??.65):s??.65})(),O=Sx(g);d.useEffect(()=>{var $,D,B,Z,L;if(($=e.current)!=null&&$.paused)return;if(!w){Nt({logLevel:b,tag:"pause",message:`Pausing ${(D=e.current)==null?void 0:D.src} because ${l?"media is premounting":u?"media is postmounting":"Player is not playing"}`,mountTime:S}),(B=e.current)==null||B.pause();return}const C=A||P();g.buffering.current&&!C&&(Nt({logLevel:b,tag:"pause",message:`Pausing ${(Z=e.current)==null?void 0:Z.src} because player is buffering but media tag is not`,mountTime:S}),(L=e.current)==null||L.pause())},[P,A,g,O,l,b,e,n,S,w,u]);const T=lt();d.useLayoutEffect(()=>{const C=Math.max(0,F);e.current&&e.current.playbackRate!==C&&(e.current.playbackRate=C),e.current&&e.current.preservesPitch!==o&&(e.current.preservesPitch=o)},[e,F,o]),d.useEffect(()=>{var D,B;const C=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 ${C} element.`);const{current:N}=e,$=L2({duration:N.duration,currentTime:N.currentTime,paused:N.paused,ended:N.ended,desiredUnclampedTime:_,mediaTagTime:I.current.time,mediaTagLastUpdate:I.current.lastUpdate,rvcTime:((D=j.current)==null?void 0:D.time)??null,rvcLastUpdate:((B=j.current)==null?void 0:B.lastUpdate)??null,isVariableFpsVideo:!!E.current[t],acceptableTimeShift:H,lastSeekDueToShift:y.current,playing:w,playbackRate:F,mediaTagBufferingOrStalled:A||P(),playerBuffering:g.buffering.current,absoluteFrame:m,onlyWarnForMediaSeekingError:i,isPremounting:l,isPostmounting:u,pauseWhenBuffering:a});if($.type!=="none"){if($.type==="seek-due-to-shift"){x.current=al({mediaRef:N,time:$.shouldBeTime,logLevel:b,why:$.why,mountTime:S}),y.current=x.current,$.bufferUntilFirstFrame&&W($.shouldBeTime),$.playReason!==null&&Dl({mediaRef:e,mediaType:n,onAutoPlayError:f,logLevel:b,mountTime:S,reason:$.playReason,isPlayer:T.isPlayer}),$.warnAboutNonSeekable&&B2(N);return}if($.type==="seek-if-not-playing"){$.why!==null&&(x.current=al({mediaRef:N,time:$.shouldBeTime,logLevel:b,why:$.why,mountTime:S}));return}$.why!==null&&(x.current=al({mediaRef:N,time:$.shouldBeTime,logLevel:b,why:$.why,mountTime:S})),Dl({mediaRef:e,mediaType:n,onAutoPlayError:f,logLevel:b,mountTime:S,reason:$.playReason,isPlayer:T.isPlayer}),$.bufferUntilFirstFrame&&W($.shouldBeTime)}},[m,H,W,g.buffering,j,b,_,P,A,e,n,i,F,w,t,f,l,u,a,S,I,T.isPlayer])},Ix=({mediaRef:e,id:t,mediaType:n,onAutoPlayError:r,isPremounting:o,isPostmounting:i})=>{const{audioAndVideoTags:s,imperativePlaying:a}=Gr(),l=er(),u=Xs(),f=lt();d.useEffect(()=>{const p={id:t,play:h=>{if(a.current&&!(o||i))return Dl({mediaRef:e,mediaType:n,onAutoPlayError:r,logLevel:l,mountTime:u,reason:h,isPlayer:f.isPlayer})}};return s.current.push(p),()=>{s.current=s.current.filter(h=>h.id!==t)}},[s,t,e,n,r,a,o,i,l,u,f.isPlayer])},Fp=d.createContext({playerMuted:!1,mediaVolume:1}),_p=d.createContext({setPlayerMuted:()=>{throw new Error("default")},setMediaVolume:()=>{throw new Error("default")}}),Mp=()=>{const{mediaVolume:e}=d.useContext(Fp),{setMediaVolume:t}=d.useContext(_p);return d.useMemo(()=>[e,t],[e,t])},$p=()=>{const{playerMuted:e}=d.useContext(Fp),{setPlayerMuted:t}=d.useContext(_p);return d.useMemo(()=>[e,t],[e,t])},Ai=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.`)},W2=(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=er(),{volume:o,muted:i,playbackRate:s,preservePitch:a,shouldPreMountAudioTags:l,src:u,onDuration:f,acceptableTimeShiftInSeconds:p,_remotionInternalNeedsDurationCalculation:h,_remotionInternalNativeLoopPassed:m,_remotionInternalStack:w,allowAmplificationDuringRender:g,name:k,pauseWhenBuffering:v,showInTimeline:y,loopVolumeCurveBehavior:x,stack:b,crossOrigin:S,delayRenderRetries:E,delayRenderTimeoutInMilliseconds:R,toneFrequency:j,useWebAudioApi:I,onError:_,onNativeError:A,audioStreamIndex:W,...P}=e,[F]=Mp(),[H]=$p(),O=Mi(x??"repeat");if(!u)throw new TypeError("No 'src' was passed to <Html5Audio>.");const T=To(u),C=d.useContext(gt),[N]=d.useState(()=>String(Math.random())),$=Ro({frame:O,volume:o,mediaVolume:F});Ai($);const D=Rp({crossOrigin:S,requestsVideoFrame:!1,isClientSideRendering:!1}),B=d.useMemo(()=>({muted:i||H||$<=0,src:T,loop:m,crossOrigin:D,...P}),[m,H,i,P,T,$,D]),Z=d.useMemo(()=>`audio-${Co(u??"")}-${C==null?void 0:C.relativeFrom}-${C==null?void 0:C.cumulatedFrom}-${C==null?void 0:C.durationInFrames}-muted:${e.muted}-loop:${e.loop}`,[u,C==null?void 0:C.relativeFrom,C==null?void 0:C.cumulatedFrom,C==null?void 0:C.durationInFrames,e.muted,e.loop]),{el:L,mediaElementSourceNode:z,cleanupOnMediaTagUnmount:Q}=C2({aud:B,audioId:Z,premounting:!!(C!=null&&C.premounting),postmounting:!!(C!=null&&C.postmounting)}),G=d.useCallback(()=>w??null,[w]);Pp({volume:o,mediaVolume:F,src:u,mediaType:"audio",playbackRate:s??1,displayName:k??null,id:N,getStack:G,showInTimeline:y,premountDisplay:(C==null?void 0:C.premountDisplay)??null,postmountDisplay:(C==null?void 0:C.postmountDisplay)??null,loopDisplay:void 0,documentationLink:"https://www.remotion.dev/docs/html5-audio",refForOutline:null}),Cx({mediaRef:L,src:u,mediaType:"audio",playbackRate:s??1,preservePitch:a,onlyWarnForMediaSeekingError:!1,acceptableTimeshift:p??null,isPremounting:!!(C!=null&&C.premounting),isPostmounting:!!(C!=null&&C.postmounting),pauseWhenBuffering:v,onAutoPlayError:null}),Ix({id:N,isPostmounting:!!(C!=null&&C.postmounting),isPremounting:!!(C!=null&&C.premounting),mediaRef:L,mediaType:"audio",onAutoPlayError:null}),yx({logLevel:r,mediaRef:L,source:z,volume:$,shouldUseWebAudioApi:I??!1}),(oe.useInsertionEffect??oe.useLayoutEffect)(()=>()=>{requestAnimationFrame(()=>{Q()})},[Q]),d.useImperativeHandle(t,()=>L.current,[L]);const K=d.useRef(f);return K.current=f,d.useEffect(()=>{var ce;const{current:de}=L;if(!de)return;if(de.duration){(ce=K.current)==null||ce.call(K,de.src,de.duration);return}const ge=()=>{var se;(se=K.current)==null||se.call(K,de.src,de.duration)};return de.addEventListener("loadedmetadata",ge),()=>{de.removeEventListener("loadedmetadata",ge)}},[L,u]),n?null:c.jsx("audio",{ref:L,preload:"metadata",crossOrigin:D,...B})},Tx=d.forwardRef(W2),V2=(e,t)=>{const n=d.useRef(null),{volume:r,playbackRate:o,allowAmplificationDuringRender:i,onDuration:s,toneFrequency:a,_remotionInternalNeedsDurationCalculation:l,_remotionInternalNativeLoopPassed:u,acceptableTimeShiftInSeconds:f,name:p,onNativeError:h,delayRenderRetries:m,delayRenderTimeoutInMilliseconds:w,loopVolumeCurveBehavior:g,pauseWhenBuffering:k,audioStreamIndex:v,preservePitch:y,...x}=e,b=Xr(),S=Mi(g??"repeat"),E=Tt(),R=d.useContext(gt),{registerRenderAsset:j,unregisterRenderAsset:I}=d.useContext(Io),{delayRender:_,continueRender:A}=On(),W=d.useMemo(()=>`audio-${Co(e.src??"")}-${R==null?void 0:R.relativeFrom}-${R==null?void 0:R.cumulatedFrom}-${R==null?void 0:R.durationInFrames}`,[e.src,R==null?void 0:R.relativeFrom,R==null?void 0:R.cumulatedFrom,R==null?void 0:R.durationInFrames]),P=Ro({volume:r,frame:S,mediaVolume:1});Ai(P),d.useImperativeHandle(t,()=>n.current,[]),d.useEffect(()=>{if(!e.src)throw new Error("No src passed");if(window.remotion_audioEnabled&&!e.muted&&!(P<=0))return j({type:"audio",src:Jn(e.src),id:W,frame:b,volume:P,mediaFrame:E,playbackRate:e.playbackRate??1,toneFrequency:a??1,audioStartFrame:Math.max(0,-((R==null?void 0:R.cumulatedNegativeFrom)??0)),audioStreamIndex:v??0}),()=>I(W)},[e.muted,e.src,j,b,W,I,P,S,E,o,e.playbackRate,a,R==null?void 0:R.cumulatedNegativeFrom,v]);const{src:F}=e,H=t||l;return d.useLayoutEffect(()=>{var N,$;if((($=(N=window.process)==null?void 0:N.env)==null?void 0:$.NODE_ENV)==="test"||!H)return;const O=_("Loading <Html5Audio> duration with src="+F,{retries:m??void 0,timeoutInMilliseconds:w??void 0}),{current:T}=n,C=()=>{T!=null&&T.duration&&s(T.src,T.duration),A(O)};return T!=null&&T.duration?(s(T.src,T.duration),A(O)):T==null||T.addEventListener("loadedmetadata",C,{once:!0}),()=>{T==null||T.removeEventListener("loadedmetadata",C),A(O)}},[F,s,H,m,w,A,_]),H?c.jsx("audio",{ref:n,...x,onError:h}):null},H2=d.forwardRef(V2),U2=(e,t)=>{const n=d.useContext(_u),r=e,{startFrom:o,endAt:i,trimBefore:s,trimAfter:a,name:l,stack:u,pauseWhenBuffering:f,showInTimeline:p,onError:h,freeze:m,...w}=r,{loop:g,freeze:k,...v}=r,{fps:y}=ft(),x=lt(),b=Qs(f);if(x.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 m<"u")throw new TypeError('The "freeze" prop is not supported on <Html5Audio />. Use <Sequence freeze={...}> to freeze media playback.');const{durations:S,setDurations:E}=d.useContext(Tp);if(typeof e.src!="string")throw new TypeError(`The \`<Html5Audio>\` tag requires a string for \`src\`, but got ${JSON.stringify(e.src)} instead.`);const R=To(e.src),j=d.useCallback(P=>{console.log(P.currentTarget.error);const F=`Could not play audio with src ${R}: ${P.currentTarget.error}. See https://remotion.dev/docs/media-playback-error for help.`;if(g){if(h){h(new Error(F));return}Ns(new Error(F))}else h==null||h(new Error(F)),console.warn(F)},[g,h,R]),I=d.useCallback((P,F)=>{E({type:"got-duration",durationInSeconds:F,src:P})},[E]),_=S[Jn(R)]??S[Jn(e.src)];Pu({startFrom:o,endAt:i,trimBefore:s,trimAfter:a});const{trimBeforeValue:A,trimAfterValue:W}=Fu({startFrom:o,endAt:i,trimBefore:s,trimAfter:a});if(g&&_!==void 0){if(!Number.isFinite(_))return c.jsx(ll,{...v,ref:t,_remotionInternalNativeLoopPassed:!0});const P=_*y;return c.jsx(Tu,{layout:"none",durationInFrames:Iu({trimAfter:W,mediaDurationInFrames:P,playbackRate:e.playbackRate??1,trimBefore:A}),children:c.jsx(ll,{...v,ref:t,_remotionInternalNativeLoopPassed:!0})})}return typeof A<"u"||typeof W<"u"?c.jsx(Rt,{layout:"none",from:0-(A??0),showInTimeline:!1,durationInFrames:W,name:l,children:c.jsx(ll,{_remotionInternalNeedsDurationCalculation:!!g,pauseWhenBuffering:b,...w,ref:t})}):(ju({playbackRate:e.playbackRate,preservePitch:e.preservePitch,volume:e.volume},"Html5Audio"),x.isRendering?c.jsx(H2,{onDuration:I,...e,ref:t,onNativeError:j,_remotionInternalNeedsDurationCalculation:!!g}):c.jsx(Tx,{_remotionInternalNativeLoopPassed:e._remotionInternalNativeLoopPassed??!1,_remotionInternalStack:u??null,shouldPreMountAudioTags:n!==null&&n.numberOfAudioTags>0,...e,ref:t,onNativeError:j,onDuration:I,pauseWhenBuffering:b,_remotionInternalNeedsDurationCalculation:!!g,showInTimeline:p??!0}))},ll=d.forwardRef(U2);Ut(ll);var Z2=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},K2={...vr,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},...tr,...Qr,...qr},Y2=({color:e,width:t,height:n,effects:r=[],className:o,style:i,pixelDensity:s,overrideId:a,reference:l})=>{const{delayRender:u,continueRender:f,cancelRender:p}=On(),h=Z2(s),m=Math.ceil(t*h),w=Math.ceil(n*h),[g,k]=d.useState(null),v=na({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},[]),x=oa(),b=d.useCallback(E=>{k(E),typeof l=="function"?l(E):l&&(l.current=E)},[l]);d.useEffect(()=>{if(!g||!y)return;const E=u("Solid effect chain");if(!x)return f(E),()=>{f(E)};const R=y.getContext("2d",{colorSpace:"srgb"});if(!R){p(new Error("Failed to acquire 2D context for <Solid> source"));return}return R.clearRect(0,0,1,1),e!==void 0&&(R.fillStyle=e,R.fillRect(0,0,1,1)),ra({state:x.get(m,w),source:y,effects:v,output:g,width:m,height:w}).then(j=>{j&&f(E)}).catch(j=>{p(j)}),()=>{f(E)}},[e,g,y,x,m,w,u,f,p,v]);const S=d.useMemo(()=>({width:t,height:n,...i??{}}),[n,i,t]);return c.jsx("canvas",{ref:b,width:m,height:w,className:o,style:S})},G2=d.forwardRef(({effects:e=[],controls:t,color:n,height:r,width:o,className:i,durationInFrames:s,style:a,name:l,from:u,trimBefore:f,freeze:p,hidden:h,showInTimeline:m,pixelDensity:w,...g},k)=>{const v=ta(e),y=d.useRef(null);return d.useImperativeHandle(k,()=>y.current,[]),c.jsx(Rt,{layout:"none",from:u,trimBefore:f,freeze:p,hidden:h,showInTimeline:m,controls:t,_remotionInternalEffects:v,durationInFrames:s,name:l??"<Solid>",outlineRef:y,_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/solid",...g,children:c.jsx(Y2,{reference:y,overrideId:(t==null?void 0:t.overrideId)??null,color:n,height:r,width:o,className:i,style:a,effects:e,pixelDensity:w})})}),Rx=yr({Component:G2,componentName:"<Solid>",componentIdentity:"dev.remotion.remotion.Solid",schema:K2,supportsEffects:!0});Rx.displayName="Solid";Ut(Rx);var Fa=null,jx=()=>{if(Fa!==null)return Fa;if(typeof document>"u")return!1;const e=document.createElement("canvas"),t=e.getContext("2d");return Fa=typeof(t==null?void 0:t.drawElementImage)=="function"&&typeof e.requestPaint=="function"&&typeof e.captureElementImage=="function"&&"transferControlToOffscreen"in HTMLCanvasElement.prototype,Fa},X2="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 q2(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 Q2(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 _a=e=>e instanceof DOMException&&e.name==="InvalidStateError",Wm="HtmlInCanvas: Expected the element to be inside the viewport during rendering, but Chrome had no cached paint record for it.",Vm=({target:e,width:t,height:n})=>{e.width!==t&&(e.width=t),e.height!==n&&(e.height=n)},J2=({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()},Hm=d.createContext(null),Px=d.forwardRef(({width:e,height:t,effects:n,children:r,onPaint:o,onInit:i,pixelDensity:s,controls:a,style:l},u)=>{const f=d.useContext(Hm);q2(e,t);const p=Q2(s),h=Math.ceil(e*p),m=Math.ceil(t*p),{delayRender:w,continueRender:g,cancelRender:k}=On(),{isClientSideRendering:v,isRendering:y}=lt(),x=!y||v,b=o===void 0&&i===void 0;jx()||k(new Error(X2));const S=d.useRef(null),E=d.useRef(null),R=d.useRef(null),j=`${e}x${t}@${p}-${b?"direct":"offscreen"}`,I=d.useCallback(L=>{S.current=L,typeof u=="function"?u(L):u&&(u.current=L)},[u]),_=oa(),A=na({effects:n,overrideId:(a==null?void 0:a.overrideId)??null}),W=d.useRef(A);W.current=A;const P=d.useRef(o);P.current=o;const F=d.useRef(i);F.current=i;const H=d.useRef(!1),O=d.useRef(null),T=d.useRef(!1),C=d.useRef(f);C.current=f;const N=d.useCallback(async()=>{var Q;const L=R.current;if(!L)throw new Error("Canvas or scene element not found");const z=E.current;if(!z)throw new Error("HtmlInCanvas: paint target is not ready because the canvas is remounting");Vm({target:z,width:h,height:m});try{const G=S.current;if(!G)throw new Error("Canvas not found");const V=w("onPaint");if(!H.current){const de=F.current;if(!de)H.current=!0;else{let ge;try{ge=G.captureElementImage(L)}catch(ce){if(_a(ce)&&x){g(V);return}throw _a(ce)?new Error(Wm):ce}H.current=!0;try{if(z instanceof HTMLCanvasElement)throw new Error("HtmlInCanvas: onInit requires an OffscreenCanvas paint target");const ce=await de({canvas:z,element:L,elementImage:ge,pixelDensity:p});if(typeof ce!="function")throw new Error("HtmlInCanvas: when `onInit` is provided, it must return a cleanup function, or a Promise that resolves to one.");T.current?ce():O.current=ce}finally{ge.close()}}}let K;try{K=G.captureElementImage(L)}catch(de){if(_a(de)&&x){g(V);return}throw _a(de)?new Error(Wm):de}try{const de=P.current;if(de){if(z instanceof HTMLCanvasElement)throw new Error("HtmlInCanvas: onPaint requires an OffscreenCanvas paint target");const ge=de({canvas:z,element:L,elementImage:K,pixelDensity:p});ge&&await ge}else J2({canvas:z,element:L,elementImage:K,pixelDensity:p});await ra({state:_.get(h,m),source:z,effects:W.current,output:z,width:h,height:m})}finally{K.close()}(Q=C.current)==null||Q.requestParentPaint(),g(V)}catch(G){k(G)}},[m,h,_,g,k,w,p,x]);d.useLayoutEffect(()=>{const L=S.current;if(!L)throw new Error("Canvas not found");L.layoutSubtree=!0;const z=b?L:L.transferControlToOffscreen();return E.current=z,Vm({target:z,width:h,height:m}),H.current=!1,T.current=!1,L.addEventListener("paint",N),()=>{var Q;L.removeEventListener("paint",N),E.current=null,H.current=!1,T.current=!0,(Q=O.current)==null||Q.call(O),O.current=null}},[N,k,h,m,b]);const $=d.useRef(!1);d.useLayoutEffect(()=>{var z;if(!$.current){$.current=!0;return}const L=S.current;L&&((z=L.requestPaint)==null||z.call(L))},[o,A]),d.useLayoutEffect(()=>{const L=S.current;if(!L)return;const z=w("waiting for first paint after canvas resize");return L.addEventListener("paint",()=>{g(z)},{once:!0}),()=>{g(z)}},[e,t,g,w,j]);const D=d.useMemo(()=>({width:e,height:t}),[e,t]),B=d.useMemo(()=>({width:e,height:t,...l??{}}),[t,l,e]),Z=d.useMemo(()=>({requestParentPaint:()=>{var L,z;(z=(L=S.current)==null?void 0:L.requestPaint)==null||z.call(L)}}),[]);return c.jsx(Hm.Provider,{value:Z,children:c.jsx("canvas",{ref:I,width:h,height:m,style:B,children:c.jsx("div",{ref:R,style:D,children:r})},j)})});Px.displayName="HtmlInCanvasContent";var Fx=d.forwardRef(({width:e,height:t,effects:n=[],children:r,onPaint:o,onInit:i,pixelDensity:s,controls:a,style:l,durationInFrames:u,name:f,...p},h)=>{const m=ta(n),w=d.useRef(null),g=d.useCallback(k=>{w.current=k,typeof h=="function"?h(k):h&&(h.current=k)},[h]);return c.jsx(Rt,{durationInFrames:u,name:f??"<HtmlInCanvas>",_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/remotion/html-in-canvas",controls:a,_remotionInternalEffects:m,outlineRef:w,layout:"none",...p,children:c.jsx(Px,{ref:g,width:e,height:t,effects:n,onPaint:o,onInit:i,pixelDensity:s,controls:a,style:l,children:r})})});Fx.displayName="HtmlInCanvas";var eI={...vr,pixelDensity:{type:"number",min:1,max:3,step:.1,default:1,description:"Pixel density",hiddenFromList:!1},...tr,...Qr,...qr},tI=yr({Component:Fx,componentName:"<HtmlInCanvas>",componentIdentity:"dev.remotion.remotion.HtmlInCanvas",schema:eI,supportsEffects:!0}),_x=Object.assign(tI,{isSupported:jx});_x.displayName="HtmlInCanvas";Ut(_x);function cr(e){return e.startsWith("data:")&&e.length>100?e.slice(0,60)+"...["+e.length+" chars total]":e}var nI={...vr,...ji,fit:{type:"enum",default:"fill",description:"Fit",variants:{fill:{},contain:{},cover:{}}},...tr,...Qr,...qr},rI=()=>{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},oI=({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(u){i||(i=!0,s(),u())}function l(){a(()=>r(rI()))}if(o.onload=()=>{var u;Promise.resolve((u=o.decode)==null?void 0:u.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="${cr(e)}"`)));return}a(()=>n({element:o,width:f,height:p}))})},o.onerror=()=>{a(()=>r(new Error(`Could not load <CanvasImage> with src="${cr(e)}"`)))},t.addEventListener("abort",l,{once:!0}),t.aborted){l();return}o.crossOrigin="anonymous",o.src=e});function iI(e){return 1e3*2**(e-1)}var sI=({onFrame:e})=>{if(typeof requestAnimationFrame>"u")return e(),()=>{};const t=requestAnimationFrame(e);return()=>cancelAnimationFrame(t)},Mx=d.forwardRef(({src:e,width:t,height:n,fit:r="fill",effects:o,controls:i,onError:s,className:a,style:l,id:u,pauseWhenLoading:f,maxRetries:p=2,delayRenderRetries:h,delayRenderTimeoutInMilliseconds:m,refForOutline:w,...g},k)=>{const{delayRender:v,continueRender:y,cancelRender:x}=On(),{delayPlayback:b}=$u(),[S,E]=d.useState(null),[R,j]=d.useState(null),I=To(e),_=oa(),A=na({effects:o,overrideId:(i==null?void 0:i.overrideId)??null}),W=d.useContext(gt),P=d.useRef(null),[F,H]=d.useState(!1),O=!!(W!=null&&W.premounting),T=!!(W!=null&&W.postmounting),C=d.useCallback(({markAsReady:D})=>{const B=P.current;!B||B.continued||(B.continued=!0,D&&H(!1),y(B.handle),P.current=null)},[y]),N=d.useMemo(()=>typeof document>"u"?null:document.createElement("canvas"),[]),$=d.useCallback(D=>{E(D),w&&(w.current=D),typeof k=="function"?k(D):k&&(k.current=D)},[k,w]);return d.useLayoutEffect(()=>{if(!(!f||!F||O||T))return b().unblock},[b,F,T,O,f]),d.useLayoutEffect(()=>{const D=v(`Rendering <CanvasImage> with src="${cr(I)}"`,{retries:h??void 0,timeoutInMilliseconds:m??void 0}),B=new AbortController;let Z=!1,L=0,z=null;j(null),H(!0),P.current={handle:D,continued:!1};const Q=()=>{oI({src:I,signal:B.signal}).then(G=>{Z||j(G)}).catch(G=>{if(G.name==="AbortError"){C({markAsReady:!1});return}if(L++,L<=p){const V=iI(L);console.warn(`Could not load <CanvasImage> with src="${cr(I)}", retrying in ${V}ms`),z=setTimeout(()=>{Z||Q()},V)}else s?(s(G),C({markAsReady:!0})):x(G)})};return Q(),()=>{Z=!0,z!==null&&clearTimeout(z),B.abort(),C({markAsReady:!1})}},[I,x,C,v,h,m,p,s]),d.useLayoutEffect(()=>{if(!R||!S||!N)return;const D=v(`Applying effects to <CanvasImage> with src="${cr(I)}"`);let B=!1,Z=!1,L=()=>{};const z=()=>{Z||(Z=!0,y(D))},Q=t??R.width,G=n??R.height,V=N.getContext("2d",{colorSpace:"srgb"});return V?(N.width=Q,N.height=G,S.width=Q,S.height=G,V.clearRect(0,0,Q,G),V.drawImage(R.element,...rx(r,{width:R.width,height:R.height},{width:Q,height:G})),ra({state:_.get(Q,G),source:N,effects:A,output:S,width:Q,height:G}).then(K=>{K&&!B&&(L=sI({onFrame:()=>{B||(z(),C({markAsReady:!0}))}}))}).catch(K=>{B||(s?(s(K),z(),C({markAsReady:!0})):x(K))}),()=>{B=!0,L(),z()}):(x(new Error("Could not get 2D context for <CanvasImage> source canvas")),z(),()=>{z()})},[I,x,_,y,C,v,r,n,R,A,s,S,N,t]),c.jsx("canvas",{...g,ref:$,width:t,height:n,className:a,style:l,id:u})});Mx.displayName="CanvasImageContent";var aI=d.forwardRef(({src:e,width:t,height:n,fit:r,effects:o=[],className:i,style:s,id:a,onError:l,pauseWhenLoading:u,maxRetries:f,delayRenderRetries:p,delayRenderTimeoutInMilliseconds:h,durationInFrames:m,from:w,trimBefore:g,freeze:k,premountFor:v,postmountFor:y,styleWhilePremounted:x,styleWhilePostmounted:b,hidden:S,name:E,showInTimeline:R,stack:j,controls:I,_remotionInternalDocumentationLink:_,outlineRef:A,...W},P)=>{if(!e)throw new Error('No "src" prop was passed to <CanvasImage>.');const F=ta(o),H=d.useRef(null);d.useImperativeHandle(P,()=>H.current,[]);const{effectivePostmountFor:O,effectivePremountFor:T,freezeFrame:C,isPremountingOrPostmounting:N,postmountingActive:$,premountingActive:D,premountingStyle:B}=Js({from:w??0,durationInFrames:m??1/0,premountFor:v??null,postmountFor:y??null,style:s??null,styleWhilePremounted:x??null,styleWhilePostmounted:b??null,hideWhilePremounted:"display-none"});return c.jsx(qs,{frame:C,active:N,children:c.jsx(Rt,{layout:"none",from:w??0,trimBefore:g,durationInFrames:m??1/0,freeze:k,hidden:S,showInTimeline:R??!0,name:E??"<CanvasImage>",_remotionInternalDocumentationLink:_??"https://www.remotion.dev/docs/canvasimage",controls:I,_remotionInternalEffects:F,_remotionInternalIsMedia:{type:"image",src:e},_remotionInternalStack:j,_remotionInternalPremountDisplay:T||null,_remotionInternalPostmountDisplay:O||null,_remotionInternalIsPremounting:D,_remotionInternalIsPostmounting:$,outlineRef:A??H,children:c.jsx(Mx,{ref:H,src:e,width:t,height:n,fit:r,effects:o,controls:I,className:i,style:B??void 0,id:a,onError:l,pauseWhenLoading:u,maxRetries:f,delayRenderRetries:p,delayRenderTimeoutInMilliseconds:h,refForOutline:A??null,...W})})})}),Ap=yr({Component:aI,componentName:"<CanvasImage>",componentIdentity:"dev.remotion.remotion.CanvasImage",schema:nI,supportsEffects:!0});Ap.displayName="CanvasImage";Ut(Ap);var lI=({onLoad:e,onError:t,delayRenderRetries:n,delayRenderTimeoutInMilliseconds:r,...o},i)=>{const{delayRender:s,continueRender:a}=On(),[l]=d.useState(()=>s(`Loading <IFrame> with source ${o.src}`,{retries:n??void 0,timeoutInMilliseconds:r??void 0})),u=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 c.jsx("iframe",{referrerPolicy:"strict-origin-when-cross-origin",...o,ref:i,onError:f,onLoad:u})};d.forwardRef(lI);function uI(e){return 1e3*2**(e-1)}var cI=({onError:e,maxRetries:t=2,src:n,pauseWhenLoading:r,delayRenderRetries:o,delayRenderTimeoutInMilliseconds:i,onImageFrame:s,crossOrigin:a,decoding:l,ref:u,refForOutline:f,...p})=>{const h=d.useRef(null),m=d.useRef({}),{delayPlayback:w}=$u(),g=d.useContext(gt),[k,v]=d.useState(!1),y=d.useCallback(F=>{h.current=F,f.current=F,typeof u=="function"?u(F):u&&(u.current=F)},[u,f]),x=To(n),b=d.useCallback(F=>{if(!h.current)return;const H=h.current.src;setTimeout(()=>{var T;if(!h.current)return;const O=(T=h.current)==null?void 0:T.src;O===H&&(h.current.removeAttribute("src"),h.current.setAttribute("src",O))},F)},[]),{delayRender:S,continueRender:E,cancelRender:R}=On(),j=!!(g!=null&&g.premounting),I=!!(g!=null&&g.postmounting),_=d.useCallback(F=>{var H,O,T,C,N,$,D;if(m.current){if(m.current[(H=h.current)==null?void 0:H.src]=(m.current[(O=h.current)==null?void 0:O.src]??0)+1,e&&(m.current[(T=h.current)==null?void 0:T.src]??0)>t){e(F);return}if((m.current[(C=h.current)==null?void 0:C.src]??0)<=t){const B=uI(m.current[(N=h.current)==null?void 0:N.src]??0);console.warn(`Could not load image with source ${cr(($=h.current)==null?void 0:$.src)}, retrying again in ${B}ms`),b(B);return}try{R("Error loading image with src: "+cr((D=h.current)==null?void 0:D.src))}catch{}}},[R,t,e,b]);typeof window<"u"&&(d.useLayoutEffect(()=>{if(!(!r||!k||j||I))return w().unblock},[w,k,I,j,r]),d.useLayoutEffect(()=>{var C,N;if(((N=(C=window.process)==null?void 0:C.env)==null?void 0:N.NODE_ENV)==="test"){h.current&&(h.current.src=x);return}const{current:F}=h;if(!F)return;v(!0);const H=S("Loading <Img> with src="+cr(x),{retries:o??void 0,timeoutInMilliseconds:i??void 0});let O=!1;const T=()=>{var $,D,B;if(O){E(H);return}(m.current[($=h.current)==null?void 0:$.src]??0)>0&&(delete m.current[(D=h.current)==null?void 0:D.src],console.info(`Retry successful - ${cr((B=h.current)==null?void 0:B.src)} is now loaded`)),F&&(s==null||s(F)),v(!1),E(H)};if(!h.current){T();return}return F.src=x,F.decode().then(T).catch($=>{console.warn($),F.complete&&F.naturalWidth>0&&F.naturalHeight>0?T():F.addEventListener("load",T)}),()=>{O=!0,F.removeEventListener("load",T),E(H)}},[x,o,i,s,E,S]));const{isClientSideRendering:A,isRendering:W}=lt(),P=Rp({crossOrigin:a,requestsVideoFrame:!1,isClientSideRendering:A});return c.jsx("img",{...p,ref:y,crossOrigin:P,onError:_,decoding:W?"sync":l})},dI=({hidden:e,name:t,stack:n,showInTimeline:r,src:o,from:i,trimBefore:s,durationInFrames:a,freeze:l,premountFor:u,postmountFor:f,style:p,styleWhilePremounted:h,styleWhilePostmounted:m,controls:w,outlineRef:g,...k})=>{if(!o)throw new Error('No "src" prop was passed to <Img>.');const{effectivePostmountFor:v,effectivePremountFor:y,freezeFrame:x,isPremountingOrPostmounting:b,postmountingActive:S,premountingActive:E,premountingStyle:R}=Js({from:i??0,durationInFrames:a??1/0,premountFor:u??null,postmountFor:f??null,style:p??null,styleWhilePremounted:h??null,styleWhilePostmounted:m??null,hideWhilePremounted:"display-none"});return c.jsx(qs,{frame:x,active:b,children:c.jsx(Rt,{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:v||null,_remotionInternalIsPremounting:E,_remotionInternalIsPostmounting:S,name:t??"<Img>",controls:w,showInTimeline:r??!0,hidden:e,outlineRef:g,children:c.jsx(cI,{src:o,refForOutline:g,style:R??void 0,...k})})})},fI=Ap,pI={src:{type:"asset",default:void 0,description:"Source",keyframable:!1},...vr,...ji,...tr,...Qr,...qr},hI=new Set(["alt","crossOrigin","decoding","fetchPriority","loading","onError","onImageFrame","onLoad","sizes","srcSet","useMap"]),mI=e=>Object.keys(e).filter(t=>e[t]!==void 0&&hI.has(t)),gI=e=>e.map(t=>`"${t}"`).join(", "),vI=({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=mI(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"}.`)},yI=e=>{const t=e==null?void 0:e.objectFit;if(t==="fill"||t==="contain"||t==="cover")return t},wI=({effects:e=[],ref:t,hidden:n,name:r,stack:o,showInTimeline:i,src:s,from:a,trimBefore:l,durationInFrames:u,freeze:f,premountFor:p,postmountFor:h,styleWhilePremounted:m,styleWhilePostmounted:w,controls:g,width:k,height:v,className:y,style:x,id:b,pauseWhenLoading:S,maxRetries:E,delayRenderRetries:R,delayRenderTimeoutInMilliseconds:j,...I})=>{const _=d.useRef(null),A=Qs(S);if(e.length===0)return c.jsx(dI,{...I,ref:t,hidden:n,name:r,stack:o,showInTimeline:i,src:s,from:a,trimBefore:l,durationInFrames:u,freeze:f,premountFor:p,postmountFor:h,styleWhilePremounted:m,styleWhilePostmounted:w,controls:g,width:k,height:v,className:y,style:x,id:b,pauseWhenLoading:A,maxRetries:E,delayRenderRetries:R,delayRenderTimeoutInMilliseconds:j,outlineRef:_});if(!s)throw new Error('No "src" prop was passed to <Img>.');vI({props:I,ref:t,width:k,height:v});const W=typeof k=="number"?k:void 0,P=typeof v=="number"?v:void 0,F=I,H=yI(x)??"fill";return c.jsx(fI,{src:s,width:W,height:P,fit:H,effects:e,className:y,style:x,id:b,pauseWhenLoading:A,maxRetries:E,delayRenderRetries:R,delayRenderTimeoutInMilliseconds:j,from:a,trimBefore:l,durationInFrames:u,freeze:f,premountFor:p,postmountFor:h,styleWhilePremounted:m,styleWhilePostmounted:w,hidden:n,name:r??"<Img>",showInTimeline:i,stack:o,_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/img",controls:g,outlineRef:_,...F})},Np=yr({Component:wI,componentName:"<Img>",componentIdentity:"dev.remotion.remotion.Img",schema:pI,supportsEffects:!0});Ut(Np);var xI=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}`)},$x=({packageName:e,componentName:t})=>`${xI(e)}.${t}`,Lp={...vr,...tr},bI={...Lp,...Qr},Ax={...bI,...qr},SI={...Ax,...yu,...Tw},kI={...Lp,...yu,...Tw},EI=(e,t)=>{typeof e=="function"?e(t):e&&(e.current=t)},Nx=e=>{const t=yr(e);return Ut(t),t},Bl=(e,t,n)=>{const r=d.forwardRef((i,s)=>{const{durationInFrames:a,from:l,trimBefore:u,freeze:f,hidden:p,name:h,showInTimeline:m,stack:w,controls:g,...k}=i,v=d.useRef(null),y=d.useCallback(x=>{v.current=x,EI(s,x)},[s]);return c.jsx(Rt,{layout:"none",from:l??0,trimBefore:u,durationInFrames:a??1/0,freeze:f,hidden:p,name:h??t,showInTimeline:m??!0,controls:g,_remotionInternalStack:w,_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/interactive",outlineRef:v,children:oe.createElement(e,{...k,ref:y})})});r.displayName=t;const o=Nx({Component:r,componentName:t,componentIdentity:$x({packageName:"remotion",componentName:t.slice(1,-1)}),schema:n,supportsEffects:!1});return o.displayName=t,o},De=(e,t)=>Bl(e,t,SI),$o=(e,t)=>Bl(e,t,Lp),Cr={baseSchema:vr,transformSchema:tr,textSchema:yu,backgroundSchema:Qr,borderSchema:qr,premountSchema:ji,sequenceSchema:xi,withSchema:Nx,_internalMakeRemotionComponentIdentity:$x,A:De("a","<Interactive.A>"),Article:De("article","<Interactive.Article>"),Aside:De("aside","<Interactive.Aside>"),Button:De("button","<Interactive.Button>"),Circle:$o("circle","<Interactive.Circle>"),Code:De("code","<Interactive.Code>"),Div:De("div","<Interactive.Div>"),Ellipse:$o("ellipse","<Interactive.Ellipse>"),Em:De("em","<Interactive.Em>"),Footer:De("footer","<Interactive.Footer>"),G:$o("g","<Interactive.G>"),H1:De("h1","<Interactive.H1>"),H2:De("h2","<Interactive.H2>"),H3:De("h3","<Interactive.H3>"),H4:De("h4","<Interactive.H4>"),H5:De("h5","<Interactive.H5>"),H6:De("h6","<Interactive.H6>"),Header:De("header","<Interactive.Header>"),Label:De("label","<Interactive.Label>"),Li:De("li","<Interactive.Li>"),Line:$o("line","<Interactive.Line>"),Main:De("main","<Interactive.Main>"),Nav:De("nav","<Interactive.Nav>"),Ol:De("ol","<Interactive.Ol>"),P:De("p","<Interactive.P>"),Path:$o("path","<Interactive.Path>"),Pre:De("pre","<Interactive.Pre>"),Rect:$o("rect","<Interactive.Rect>"),Section:De("section","<Interactive.Section>"),Small:De("small","<Interactive.Small>"),Span:De("span","<Interactive.Span>"),Strong:De("strong","<Interactive.Strong>"),Svg:Bl("svg","<Interactive.Svg>",Ax),Text:Bl("text","<Interactive.Text>",kI),Ul:De("ul","<Interactive.Ul>")},CI=async({resolvedSrc:e,signal:t,requestInit:n,contentType:r})=>{const{decoder:o,selectedTrack:i}=await ax({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()}},Lx=oe.createRef(),II=({children:e,onlyRenderComposition:t,currentCompositionMetadata:n,initialCompositions:r,initialCanvasContent:o})=>{const[i,s]=d.useState([]),[a,l]=d.useState(o),[u,f]=d.useState(r),p=d.useRef(u),h=d.useCallback(x=>{f(b=>{const S=x(b);return p.current=S,S})},[]),m=d.useCallback(x=>{h(b=>{if(b.find(S=>S.id===x.id))throw new Error(`Multiple composition with id ${x.id} are registered.`);return[...b,x]})},[h]),w=d.useCallback(x=>{f(b=>b.filter(S=>S.id!==x))},[]),g=d.useCallback((x,b,S,E)=>{s(R=>[...R,{name:x,parent:b,nonce:S,stack:E}])},[]),k=d.useCallback((x,b)=>{s(S=>S.filter(E=>!(E.name===x&&E.parent===b)))},[]);d.useImperativeHandle(Lx,()=>({getCompositions:()=>p.current}),[]);const v=d.useMemo(()=>({registerComposition:m,unregisterComposition:w,registerFolder:g,unregisterFolder:k,setCanvasContent:l,onlyRenderComposition:t}),[m,g,w,k,t]),y=d.useMemo(()=>({compositions:u,folders:i,currentCompositionMetadata:n,canvasContent:a}),[u,i,n,a]);return c.jsx(Ci.Provider,{value:y,children:c.jsx(Ks.Provider,{value:v,children:e})})},zx={};tw(zx,{makeDefaultPreviewCSS:()=>RI,injectCSS:()=>TI,OBJECTFIT_CONTAIN_CLASS_NAME:()=>Ls});var Ma={},TI=e=>{if(typeof document>"u")return()=>{};if(Ma[e])return()=>{};const t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");return n.appendChild(document.createTextNode(e)),t.prepend(n),Ma[e]=n,()=>{const r=Ma[e];r&&(r.parentNode&&r.parentNode.removeChild(r),delete Ma[e])}},Ls="__remotion_objectfitcontain",RI=(e,t)=>e?`
58
+ ${e} * {
59
+ box-sizing: border-box;
60
+ }
61
+ ${e} *:-webkit-full-screen {
62
+ width: 100%;
63
+ height: 100%;
64
+ }
65
+ ${e} .${Ls} {
66
+ object-fit: contain;
67
+ }
68
+ `:`
69
+ * {
70
+ box-sizing: border-box;
71
+ }
72
+ body {
73
+ margin: 0;
74
+ background-color: ${t};
75
+ }
76
+ .${Ls} {
77
+ object-fit: contain;
78
+ }
79
+ `,Dx="__remotion-studio-container",jI=()=>document.getElementById(Dx),PI=oe.createContext(null),FI=null,Tc=[],_I=()=>FI,MI=e=>(Tc.push(e),()=>{Tc=Tc.filter(t=>t!==e)}),zp=d.createContext(null),$I=()=>{const e=d.useContext(zp);return!e||e.videoEnabled===null?window.remotion_videoEnabled:e.videoEnabled},AI=()=>{const e=d.useContext(zp);return!e||e.audioEnabled===null?window.remotion_audioEnabled:e.audioEnabled},NI=({children:e,videoEnabled:t,audioEnabled:n})=>{const r=d.useMemo(()=>({videoEnabled:t,audioEnabled:n}),[t,n]);return c.jsx(zp.Provider,{value:r,children:e})},LI=({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++}},[]),u=d.useMemo(()=>({logLevel:n,mountTime:Date.now()}),[n]);return c.jsx(Eo.Provider,{value:u,children:c.jsx(Ys.Provider,{value:l,children:c.jsx(ME,{frameState:a,children:c.jsx(NI,{videoEnabled:i,audioEnabled:s,children:c.jsx(lw,{children:c.jsx(fx,{children:c.jsx(DE,{children:c.jsx(hx,{children:c.jsx(bx,{children:c.jsx(mx,{audioLatencyHint:r,audioEnabled:s,previewSampleRate:o,children:c.jsx(gx,{numberOfAudioTags:t,children:e})})})})})})})})})})})},Um=["h264","h265","vp8","vp9","av1","mp3","aac","wav","prores","h264-mkv","h264-ts","gif"];function zI(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(!Um.includes(e))throw new Error(`The "${n}" prop ${t} must be one of ${Um.join(", ")}, but you passed ${e}.`)}}var DI=({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;Al(l,"width",e!=null&&e.width?s:a);const u=(e==null?void 0:e.height)??r??void 0;Al(u,"height",e!=null&&e.height?s:a);const f=(e==null?void 0:e.fps)??n??null;pu(f,e!=null&&e.fps?s:a);const p=(e==null?void 0:e.durationInFrames)??i??null;fu(p,{allowFloats:!1,component:`of the "<Composition />" component with the id "${t}"`});const h=e==null?void 0:e.defaultCodec;zI(h,s,"defaultCodec");const m=e==null?void 0:e.defaultOutName,w=e==null?void 0:e.defaultVideoImageFormat,g=e==null?void 0:e.defaultPixelFormat,k=e==null?void 0:e.defaultProResProfile,v=e==null?void 0:e.defaultSampleRate;return{width:l,height:u,fps:f,durationInFrames:p,defaultCodec:h,defaultOutName:m,defaultVideoImageFormat:w,defaultPixelFormat:g,defaultProResProfile:k,defaultSampleRate:v}},Zm=({calculated:e,compositionDurationInFrames:t,compositionFps:n,compositionHeight:r,compositionId:o,compositionWidth:i,defaultProps:s,originalProps:a})=>{const l=DI({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:Gd(s??{}),props:Gd((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}}},Ox=({calculateMetadata:e,signal:t,defaultProps:n,inputProps:r,compositionId:o,compositionDurationInFrames:i,compositionFps:s,compositionHeight:a,compositionWidth:l})=>{const u=e?e({defaultProps:n,props:r,abortSignal:t,compositionId:o,isRendering:Sn().isRendering}):null;return u!==null&&typeof u=="object"&&"then"in u?u.then(f=>Zm({calculated:f,compositionDurationInFrames:i,compositionFps:s,compositionHeight:a,compositionWidth:l,compositionId:o,defaultProps:n,originalProps:r})):Zm({calculated:u,compositionDurationInFrames:i,compositionFps:s,compositionHeight:a,compositionWidth:l,compositionId:o,defaultProps:n,originalProps:r})},Bx=e=>{const t=Ox(e);return typeof t=="object"&&"then"in t?t.then(({videoConfig:n})=>n):t.videoConfig},OI=e=>{try{return{type:"success",result:Ox(e)}}catch(t){return{type:"error",error:t}}},BI=e=>{try{return{type:"success",result:Bx(e)}}catch(t){return{type:"error",error:t}}},WI=oe.createContext(()=>{}),VI=()=>{if(Sn().isRendering){const e=window.remotion_envVariables;return e?{...JSON.parse(e),NODE_ENV:"production"}:{}}return{NODE_ENV:"production"}},HI=()=>{const e=VI();window.process||(window.process={}),window.process.env||(window.process.env={}),Object.keys(e).forEach(t=>{window.process.env[t]=e[t]})},UI=oe.createContext(null),ZI=d.createContext({setSize:()=>{},size:{size:"auto",translation:{x:0,y:0}}}),KI=({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)},YI=oe.createContext(null),GI=({src:e,transparent:t,currentTime:n,toneMapped:r})=>`http://localhost:${window.remotion_proxyPort}/proxy?src=${encodeURIComponent(Jn(e))}&time=${encodeURIComponent(Math.max(0,n))}&transparent=${String(t)}&toneMapped=${String(r)}`,XI=({onError:e,volume:t,playbackRate:n,src:r,muted:o,allowAmplificationDuringRender:i,transparent:s,toneMapped:a,toneFrequency:l,name:u,loopVolumeCurveBehavior:f,delayRenderRetries:p,delayRenderTimeoutInMilliseconds:h,onVideoFrame:m,crossOrigin:w,audioStreamIndex:g,preservePitch:k,...v})=>{const y=Xr(),x=Tt(),b=Mi(f),S=vu(),E=d.useContext(gt),R=yo(),{registerRenderAsset:j,unregisterRenderAsset:I}=d.useContext(Io);if(!r)throw new TypeError("No `src` was passed to <OffthreadVideo>.");const _=d.useMemo(()=>`offthreadvideo-${Co(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(!S)throw new Error("No video config found");const A=Ro({volume:t,frame:b,mediaVolume:1});Ai(A),d.useEffect(()=>{if(!r)throw new Error("No src passed");if(window.remotion_audioEnabled&&!o&&!(A<=0))return j({type:"video",src:Jn(r),id:_,frame:y,volume:A,mediaFrame:x,playbackRate:n,toneFrequency:l,audioStartFrame:Math.max(0,-((E==null?void 0:E.cumulatedNegativeFrom)??0)),audioStreamIndex:g}),()=>I(_)},[o,r,j,_,I,A,x,y,n,l,E==null?void 0:E.cumulatedNegativeFrom,g]);const W=d.useMemo(()=>kx({frame:x,playbackRate:n||1,startFrom:-R})/S.fps,[x,R,n,S.fps]),P=d.useMemo(()=>GI({src:r,currentTime:W,transparent:s,toneMapped:a}),[a,W,r,s]),[F,H]=d.useState(null),{delayRender:O,continueRender:T}=On();d.useLayoutEffect(()=>{if(!window.remotion_videoEnabled)return;const D=[];H(null);const B=new AbortController,Z=O(`Fetching ${P} from server`,{retries:p??void 0,timeoutInMilliseconds:h??void 0});return(async()=>{try{const z=await fetch(P,{signal:B.signal,cache:"no-store"});if(z.status!==200){if(z.status===500){const V=await z.json();if(V.error){const K=V.error.replace(/^Error: /,"");throw new Error(K)}}throw new Error(`Server returned status ${z.status} while fetching ${P}`)}const Q=await z.blob(),G=URL.createObjectURL(Q);D.push(()=>URL.revokeObjectURL(G)),H({src:G,handle:Z})}catch(z){if(z.message.includes("aborted")){T(Z);return}if(B.signal.aborted){T(Z);return}z.message.includes("Failed to fetch")&&(z=new Error(`Failed to fetch ${P}. This could be caused by Chrome rejecting the request because the disk space is low. Consider increasing the disk size of your environment.`,{cause:z})),e?e(z):Ns(z)}})(),D.push(()=>{B.signal.aborted||B.abort()}),()=>{D.forEach(z=>z())}},[P,p,h,e,T,O]);const C=d.useCallback(()=>{e?e==null||e(new Error("Failed to load image with src "+F)):Ns("Failed to load image with src "+F)},[F,e]),N=d.useMemo(()=>[Ls,v.className].filter(Ii).join(" "),[v.className]),$=d.useCallback(D=>{m&&m(D)},[m]);return!F||!window.remotion_videoEnabled?null:(T(F.handle),c.jsx(Np,{src:F.src,delayRenderRetries:p,delayRenderTimeoutInMilliseconds:h,onImageFrame:$,...v,onError:C,className:N}))},Wx=({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 ni extends Error{constructor({message:n,src:r}){super(n);Ae(this,"src");this.name="MediaPlaybackError",this.src=r}}var qI=(e,t)=>{const n=d.useContext(_i);if(!n)throw new Error("SharedAudioContext not found");const r=d.useRef(null),o=d.useMemo(()=>n.audioContext?jp({audioContext:n.audioContext,ref:r}):null,[n.audioContext]);(oe.useInsertionEffect??oe.useLayoutEffect)(()=>()=>{requestAnimationFrame(()=>{o==null||o.cleanup()})},[o]);const{volume:s,muted:a,playbackRate:l,preservePitch:u,onlyWarnForMediaSeekingError:f,src:p,onDuration:h,acceptableTimeShift:m,acceptableTimeShiftInSeconds:w,toneFrequency:g,name:k,_remotionInternalNativeLoopPassed:v,_remotionInternalStack:y,style:x,pauseWhenBuffering:b,showInTimeline:S,loopVolumeCurveBehavior:E,onError:R,onAutoPlayError:j,onVideoFrame:I,crossOrigin:_,delayRenderRetries:A,delayRenderTimeoutInMilliseconds:W,allowAmplificationDuringRender:P,useWebAudioApi:F,audioStreamIndex:H,...O}=e,T=Mi(E??"repeat"),{fps:C,durationInFrames:N}=ft(),$=d.useContext(gt),D=er(),B=Xs(),[Z]=d.useState(()=>String(Math.random()));if(typeof m<"u")throw new Error("acceptableTimeShift has been removed. Use acceptableTimeShiftInSeconds instead.");const[L]=Mp(),[z]=$p(),Q=Ro({frame:T,volume:s,mediaVolume:L});Ai(Q);const G=d.useCallback(()=>y??null,[y]);Pp({volume:s,mediaVolume:L,mediaType:"video",src:p,playbackRate:e.playbackRate??1,displayName:k??null,id:Z,getStack:G,showInTimeline:S,premountDisplay:($==null?void 0:$.premountDisplay)??null,postmountDisplay:($==null?void 0:$.postmountDisplay)??null,loopDisplay:void 0,documentationLink:f?"https://www.remotion.dev/docs/offthreadvideo":"https://www.remotion.dev/docs/html5-video",refForOutline:r}),Cx({mediaRef:r,src:p,mediaType:"video",playbackRate:e.playbackRate??1,preservePitch:u,onlyWarnForMediaSeekingError:f,acceptableTimeshift:w??null,isPremounting:!!($!=null&&$.premounting),isPostmounting:!!($!=null&&$.postmounting),pauseWhenBuffering:b,onAutoPlayError:j??null}),Ix({id:Z,isPostmounting:!!($!=null&&$.postmounting),isPremounting:!!($!=null&&$.premounting),mediaRef:r,mediaType:"video",onAutoPlayError:j??null}),yx({logLevel:D,mediaRef:r,volume:Q,source:o,shouldUseWebAudioApi:F??!1});const V=$?$.relativeFrom:0,K=$?Math.min($.durationInFrames,N):N,de=To(p),ge=P2({actualSrc:de,actualFrom:V,duration:K,fps:C});d.useImperativeHandle(t,()=>r.current,[]),d.useState(()=>Nt({logLevel:D,message:`Mounting video with source = ${ge}, v=${os}, user agent=${typeof navigator>"u"?"server":navigator.userAgent}`,tag:"video",mountTime:B})),d.useEffect(()=>{const{current:q}=r;if(!q)return;const J=()=>{var ie;if(q.error){if(console.error("Error occurred in video",q==null?void 0:q.error),R){const Me=new ni({message:`Code ${q.error.code}: ${q.error.message}`,src:p});R(Me);return}throw new ni({message:`The browser threw an error while playing the video ${p}: Code ${q.error.code} - ${(ie=q==null?void 0:q.error)==null?void 0:ie.message}. See https://remotion.dev/docs/media-playback-error for help. Pass an onError() prop to handle the error.`,src:p})}else{if(R){const Me=new ni({message:`The browser threw an error while playing the video ${p}`,src:p});R(Me);return}throw new ni({message:"The browser threw an error while playing the video",src:p})}};return q.addEventListener("error",J,{once:!0}),()=>{q.removeEventListener("error",J)}},[R,p]);const ce=d.useRef(h);ce.current=h,Wx({ref:r,onVideoFrame:I}),d.useEffect(()=>{var ie;const{current:q}=r;if(!q)return;if(q.duration){(ie=ce.current)==null||ie.call(ce,p,q.duration);return}const J=()=>{var Me;(Me=ce.current)==null||Me.call(ce,p,q.duration)};return q.addEventListener("loadedmetadata",J),()=>{q.removeEventListener("loadedmetadata",J)}},[p]),d.useEffect(()=>{const{current:q}=r;q&&(Mu()?q.preload="metadata":q.preload="auto")},[]);const se=d.useMemo(()=>({...x}),[x]),ee=Rp({crossOrigin:_,requestsVideoFrame:!!I,isClientSideRendering:!1});return c.jsx("video",{...O,ref:r,muted:a||z||Q<=0,playsInline:!0,src:ge,loop:v,style:se,disableRemotePlayback:!0,crossOrigin:ee,controls:!1})},Dp=d.forwardRef(qI),Op=e=>{const{startFrom:t,endAt:n,trimBefore:r,trimAfter:o,name:i,pauseWhenBuffering:s,stack:a,showInTimeline:l,...u}=e,f=lt(),p=Qs(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 h=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.`);Pu({startFrom:t,endAt:n,trimBefore:r,trimAfter:o});const{trimBeforeValue:m,trimAfterValue:w}=Fu({startFrom:t,endAt:n,trimBefore:r,trimAfter:o});if(typeof m<"u"||typeof w<"u")return c.jsx(Rt,{layout:"none",from:0-(m??0),showInTimeline:!1,durationInFrames:w,name:i,children:c.jsx(Op,{pauseWhenBuffering:p,...u,trimAfter:void 0,name:void 0,showInTimeline:l,trimBefore:void 0,stack:void 0,startFrom:void 0,endAt:void 0})});if(ju(e,"Video"),f.isRendering)return c.jsx(XI,{pauseWhenBuffering:p,...u,trimAfter:void 0,name:void 0,showInTimeline:l,trimBefore:void 0,stack:void 0,startFrom:void 0,endAt:void 0});const{transparent:g,toneMapped:k,onAutoPlayError:v,onVideoFrame:y,crossOrigin:x,delayRenderRetries:b,delayRenderTimeoutInMilliseconds:S,...E}=u;return c.jsx(Dp,{_remotionInternalStack:a??null,onDuration:h,onlyWarnForMediaSeekingError:!0,pauseWhenBuffering:p,showInTimeline:l??!0,onAutoPlayError:v??void 0,onVideoFrame:y??null,crossOrigin:x,...E,_remotionInternalNativeLoopPassed:!1})},Vx=({src:e,acceptableTimeShiftInSeconds:t,allowAmplificationDuringRender:n,audioStreamIndex:r,crossOrigin:o,delayRenderRetries:i,delayRenderTimeoutInMilliseconds:s,loopVolumeCurveBehavior:a,muted:l,name:u,onAutoPlayError:f,onError:p,onVideoFrame:h,pauseWhenBuffering:m,playbackRate:w,preservePitch:g,showInTimeline:k,style:v,toneFrequency:y,toneMapped:x,transparent:b,trimAfter:S,trimBefore:E,useWebAudioApi:R,volume:j,_remotionInternalNativeLoopPassed:I,endAt:_,stack:A,startFrom:W,imageFormat:P,...F})=>{if(P)throw new TypeError("The `<OffthreadVideo>` tag does no longer accept `imageFormat`. Use the `transparent` prop if you want to render a transparent video.");return c.jsx(Op,{acceptableTimeShiftInSeconds:t,allowAmplificationDuringRender:n??!0,audioStreamIndex:r??0,crossOrigin:o,delayRenderRetries:i,delayRenderTimeoutInMilliseconds:s,loopVolumeCurveBehavior:a??"repeat",muted:l??!1,name:u,onAutoPlayError:f??null,onError:p,onVideoFrame:h,pauseWhenBuffering:Qs(m),playbackRate:w??1,preservePitch:g,toneFrequency:y??1,showInTimeline:k??!0,src:e,stack:A,startFrom:W,_remotionInternalNativeLoopPassed:I??!1,endAt:_,style:v,toneMapped:x??!0,transparent:b??!1,trimAfter:S,trimBefore:E,useWebAudioApi:R??!1,volume:j,...F})};Ut(Vx);var QI="remotion_staticFilesChanged";function JI(){const e=oe.useContext(Ci),t=oe.useContext(Ri),n=oe.useContext(Ti),r=oe.useContext(gt),o=oe.useContext(Ys),i=oe.useContext(ko),s=oe.useContext(Ru),a=oe.useContext(hu),l=oe.useContext(Io),u=oe.useContext(Pi),f=oe.useContext(wu),p=oe.useContext(bu),h=oe.useContext($i),m=oe.useContext(Eo);return d.useMemo(()=>({compositionManagerCtx:e,timelineContext:t,setTimelineContext:n,sequenceContext:r,nonceContext:o,canUseRemotionHooksContext:i,preloadContext:s,resolveCompositionContext:a,renderAssetManagerContext:l,sequenceManagerContext:u,sequenceManagerRefContext:f,visualModePropStatusesRefContext:p,bufferManagerContext:h,logLevelContext:m}),[e,o,r,n,t,i,s,a,l,u,f,p,h,m])}var eT=e=>{const{children:t,contexts:n}=e;return c.jsx(Eo.Provider,{value:n.logLevelContext,children:c.jsx(ko.Provider,{value:n.canUseRemotionHooksContext,children:c.jsx(Ys.Provider,{value:n.nonceContext,children:c.jsx(Ru.Provider,{value:n.preloadContext,children:c.jsx(Ci.Provider,{value:n.compositionManagerCtx,children:c.jsx(wu.Provider,{value:n.sequenceManagerRefContext,children:c.jsx(Pi.Provider,{value:n.sequenceManagerContext,children:c.jsx(bu.Provider,{value:n.visualModePropStatusesRefContext,children:c.jsx(Io.Provider,{value:n.renderAssetManagerContext,children:c.jsx(hu.Provider,{value:n.resolveCompositionContext,children:c.jsx(Ri.Provider,{value:n.timelineContext,children:c.jsx(Ti.Provider,{value:n.setTimelineContext,children:c.jsx(gt.Provider,{value:n.sequenceContext,children:c.jsx($i.Provider,{value:n.bufferManagerContext,children:t})})})})})})})})})})})})})})},tT=d.createRef(),fe={MaxMediaCacheSizeContext:PI,useUnsafeVideoConfig:vu,useFrameForVolumeProp:Mi,useTimelinePosition:Xr,useAbsoluteTimelinePosition:Ew,evaluateVolume:Ro,getAbsoluteSrc:Jn,getAnimatedImageDurationInSeconds:CI,getAssetDisplayName:wx,Timeline:Qd,validateMediaTrimProps:Pu,validateMediaProps:ju,resolveTrimProps:Fu,VideoForPreview:Dp,CompositionManager:Ci,CompositionSetters:Ks,VisualModePropStatusesContext:xu,VisualModePropStatusesRefContext:bu,VisualModeDragOverridesContext:Su,VisualModeSettersContext:Mw,SequenceManager:Pi,SequenceManagerRefContext:wu,SequenceStackTracesUpdateContext:WI,baseSchema:vr,sequenceSchema:xi,SequenceWithoutSchema:nx,sequenceStyleSchema:jw,sequenceVisualStyleSchema:$E,sequencePremountSchema:Rw,textSchema:yu,transformSchema:tr,premountSchema:ji,flattenActiveSchema:Cp,getFlatSchemaWithAllKeys:Ip,RemotionRootContexts:LI,CompositionManagerProvider:II,useVideo:gu,getRoot:_I,useMediaVolumeState:Mp,usePlayerMutedState:$p,useMediaInTimeline:Pp,useLazyComponent:hw,truthy:Ii,SequenceContext:gt,PremountContext:Aw,usePremounting:Js,useRemotionContexts:JI,RemotionContextProvider:eT,CSSUtils:zx,setupEnvVariables:HI,MediaVolumeContext:Fp,SetMediaVolumeContext:_p,getRemotionEnvironment:Sn,SharedAudioContext:_i,SharedAudioContextProvider:mx,SharedAudioTagsContext:_u,SharedAudioTagsContextProvider:gx,invalidCompositionErrorMessage:kE,invalidFolderNameErrorMessage:Zk,calculateMediaDuration:Iu,isCompositionIdValid:gw,isFolderNameValid:ow,getPreviewDomElement:jI,compositionsRef:Lx,portalNode:Xd,waitForRoot:MI,SetTimelineContext:Ti,CanUseRemotionHooksProvider:Zd,CanUseRemotionHooks:ko,PrefetchProvider:fx,DurationsContextProvider:hx,IsPlayerContextProvider:Xk,useIsPlayer:dp,EditorPropsProvider:lw,EditorPropsContext:fp,usePreload:To,NonceContext:Ys,resolveVideoConfig:Bx,resolveVideoConfigOrCatch:BI,resolveVideoConfigWithMetadataOrCatch:OI,ResolveCompositionContext:hu,useResolvedVideoConfig:pp,resolveCompositionsRef:sE,REMOTION_STUDIO_CONTAINER_ELEMENT:Dx,RenderAssetManager:Io,persistCurrentFrame:ww,usePlaybackRate:yp,useTimelineContext:Gr,useTimelineSetFrame:Cw,isIosSafari:Mu,WATCH_REMOTION_STATIC_FILES:QI,addSequenceStackTraces:Ut,useMediaStartsAt:yo,BufferingProvider:bx,BufferingContextReact:$i,getComponentsToAddStacksTo:TE,getSequenceComponent:jE,getSingleChildComponent:PE,CurrentScaleContext:UI,PixelDensityContext:YI,PreviewSizeContext:ZI,calculateScale:KI,validateRenderAsset:cx,Log:bt,LogLevelContext:Eo,useLogLevel:er,playbackLogging:Nt,timeValueRef:iE,compositionSelectorRef:tT,RemotionEnvironmentContext:uw,warnAboutTooHighVolume:Ai,AudioForPreview:Tx,OBJECTFIT_CONTAIN_CLASS_NAME:Ls,InnerOffthreadVideo:Op,useBasicMediaInTimeline:xx,getInputPropsOverride:aw,setInputPropsOverride:nE,useVideoEnabled:$I,useAudioEnabled:AI,useIsPlayerBuffering:Sx,TimelinePosition:Qd,DelayRenderContextType:pw,TimelineContext:Ri,PlaybackRateContext:mp,AbsoluteTimeContext:gp,RenderAssetManagerProvider:p2,getEffectiveVisualModeValue:Yw,CompositionRenderErrorContext:nw,useEffectChainState:oa,createEffectChainState:sx,cleanupEffectChainState:ef,runEffectChain:ra,useMemoizedEffects:na,useMemoizedEffectDefinitions:ta,createEffect:c2,createWebGLContextError:YC,createWebGL2ContextError:ix,computeEffectiveSchemaValuesDotNotation:Jw,interpolateKeyframedStatus:ea,makeStaticDragOverride:AC,makeKeyframedDragOverride:NC,resolveDragOverrideValue:Eu,getStaticDragOverrideValue:LC,OverrideIdsToNodePathsGettersContext:Ep,OverrideIdsToNodePathsSettersContext:FC,findPropsToDelete:qw,makeSequencePropsSubscriptionKey:ar,getPropStatusesCtx:Xw,getEffectPropStatusesCtx:Gw,hiddenField:wp,durationInFramesField:bp,freezeField:Sp,fromField:Fw},Hx=e=>oe.Children.toArray(e).reduce((n,r)=>r.type===oe.Fragment?n.concat(Hx(r.props.children)):(n.push(r),n),[]),nT={durationInFrames:Cr.baseSchema.durationInFrames,name:Cr.sequenceSchema.name,hidden:Cr.sequenceSchema.hidden,showInTimeline:Cr.sequenceSchema.showInTimeline,freeze:Cr.baseSchema.freeze,trimBefore:Cr.sequenceSchema.trimBefore,layout:Cr.sequenceSchema.layout},rT=d.forwardRef(({offset:e=0,className:t="",stack:n=null,_remotionInternalRender:r=null,...o},i)=>(BE(),r?r({...o,offset:e,className:t||void 0,stack:n},i):c.jsx($w,{children:o.children}))),Ux=Cr.withSchema({Component:rT,componentName:"<Series.Sequence>",componentIdentity:"dev.remotion.remotion.Series.Sequence",schema:nT,supportsEffects:!1}),oT=nx,Km=({durationInFrames:e,offset:t,index:n,childrenLength:r})=>{const o=`index = ${n}, duration = ${e}`;(n!==r-1||e!==1/0)&&fu(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},iT=e=>{const t=d.useMemo(()=>{const n=Hx(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!==Ux)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 Km({durationInFrames:l.props.durationInFrames,offset:l.props.offset,index:o,childrenLength:n.length}),oe.cloneElement(l,{_remotionInternalRender:(u,f)=>{const p=u.durationInFrames,{durationInFrames:h,children:m,offset:w,controls:g,stack:k,from:v,name:y,...x}=u,b=Km({durationInFrames:p,offset:w,index:o,childrenLength:n.length}),S=i+b,E=i+p+b;return c.jsxs(c.Fragment,{children:[c.jsx(oT,{ref:f,name:y||"<Series.Sequence>",_remotionInternalDocumentationLink:y?void 0:"https://www.remotion.dev/docs/series",_remotionInternalStack:k??void 0,controls:g??void 0,from:S,durationInFrames:p,...x,children:c.jsx($w,{children:m})}),r(o+1,E)]})}})};return r(0,0)},[e.children]);return c.jsx(OE,{children:c.jsx(Rt,{layout:"none",name:"<Series>",_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/series",...e,children:t})})},sT=Object.assign(yr({Component:iT,componentName:"<Series>",componentIdentity:"dev.remotion.remotion.Series",schema:zE,supportsEffects:!1}),{Sequence:Ux});Ut(sT);var aT={"%3A":":","%2F":"/","%3F":"?","%23":"#","%5B":"[","%5D":"]","%40":"@","%21":"!","%24":"$","%26":"&","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";"},Ym={},lT=e=>{Ym[e]||(console.warn(e),Ym[e]=!0)},uT=e=>{for(const t of Object.keys(aT))if(e.includes(t))return{containsHex:!0,hexCode:t};return{containsHex:!1}},of=e=>e.startsWith("/")?of(e.substring(1)):e,cT=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}/${of(e)}`}return`/${of(e)}`},dT=e=>e.split("/").map(o=>encodeURIComponent(o)).join("/"),Bp=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=uT(e);t.containsHex&&lT(`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=dT(e),r=cT(n);return r.startsWith("/")?r:`/${r}`},fT=e=>{const t={...e,durationInFrames:1,fps:1};return oe.createElement(Nl,t)};Ut(fT);var Gm=e=>Math.round(e*1e5)/1e5,Rc=({element:e,desiredTime:t,logLevel:n,mountTime:r})=>{if(Ol(e.currentTime,t))return{wait:Promise.resolve(t),cancel:()=>{}};al({logLevel:n,mediaRef:e,time:t,why:"Seeking during rendering",mountTime:r});let o,i=null;const s=new Promise(l=>{o=e.requestVideoFrameCallback((u,f)=>{const p=f.expectedDisplayTime-u;if(p<=0){l(f.mediaTime);return}setTimeout(()=>{l(f.mediaTime)},p+150)})}),a=new Promise(l=>{const u=()=>{l()};e.addEventListener("seeked",u,{once:!0}),i=()=>{e.removeEventListener("seeked",u)}});return{wait:Promise.all([s,a]).then(([l])=>l),cancel:()=>{i==null||i(),e.cancelVideoFrameCallback(o)}}},pT=({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,u)=>{const f=Rc({element:e,desiredTime:t+i,logLevel:r,mountTime:o});f.wait.then(p=>{if(Math.abs(t-p)<=i)return l();const m=t>p?1:-1,w=Rc({element:e,desiredTime:p+i*m,logLevel:r,mountTime:o});s=w.cancel,w.wait.then(g=>{const k=Math.abs(t-g);if(Gm(k)<=Gm(i))return l();const v=Rc({element:e,desiredTime:t+i,logLevel:r,mountTime:o});return s=v.cancel,v.wait.then(()=>{l()}).catch(y=>{u(y)})}).catch(g=>{u(g)})}),s=f.cancel}),cancel:()=>{s()}}},hT=({onError:e,volume:t,allowAmplificationDuringRender:n,playbackRate:r,onDuration:o,toneFrequency:i,name:s,acceptableTimeShiftInSeconds:a,delayRenderRetries:l,delayRenderTimeoutInMilliseconds:u,loopVolumeCurveBehavior:f,audioStreamIndex:p,onVideoFrame:h,preservePitch:m,...w},g)=>{const k=Xr(),v=Tt(),y=Mi(f??"repeat"),x=vu(),b=d.useRef(null),S=d.useContext(gt),E=yo(),R=lt(),j=er(),I=Xs(),{delayRender:_,continueRender:A}=On(),{registerRenderAsset:W,unregisterRenderAsset:P}=d.useContext(Io),F=d.useMemo(()=>`video-${Co(w.src??"")}-${S==null?void 0:S.cumulatedFrom}-${S==null?void 0:S.relativeFrom}-${S==null?void 0:S.durationInFrames}`,[w.src,S==null?void 0:S.cumulatedFrom,S==null?void 0:S.relativeFrom,S==null?void 0:S.durationInFrames]);if(!x)throw new Error("No video config found");const H=Ro({volume:t,frame:y,mediaVolume:1});Ai(H),d.useEffect(()=>{if(!w.src)throw new Error("No src passed");if(!w.muted&&!(H<=0)&&window.remotion_audioEnabled)return W({type:"video",src:Jn(w.src),id:F,frame:k,volume:H,mediaFrame:v,playbackRate:r??1,toneFrequency:i??1,audioStartFrame:Math.max(0,-((S==null?void 0:S.cumulatedNegativeFrom)??0)),audioStreamIndex:p??0}),()=>P(F)},[w.muted,w.src,W,F,P,H,v,k,r,i,S==null?void 0:S.cumulatedNegativeFrom,p]),d.useImperativeHandle(g,()=>b.current,[]),Wx({ref:b,onVideoFrame:h}),d.useEffect(()=>{var Z,L;if(!window.remotion_videoEnabled)return;const{current:T}=b;if(!T)return;const C=Ex({frame:v,playbackRate:r||1,startFrom:-E,fps:x.fps}),N=_(`Rendering <Html5Video /> with src="${w.src}" at time ${C}`,{retries:l??void 0,timeoutInMilliseconds:u??void 0});if(((L=(Z=window.process)==null?void 0:Z.env)==null?void 0:L.NODE_ENV)==="test"){A(N);return}if(Ol(T.currentTime,C)){if(T.readyState>=2){A(N);return}const z=()=>{A(N)};return T.addEventListener("loadeddata",z,{once:!0}),()=>{T.removeEventListener("loadeddata",z)}}const $=()=>{A(N)},D=pT({element:T,desiredTime:C,fps:x.fps,logLevel:j,mountTime:I});D.prom.then(()=>{A(N)}),T.addEventListener("ended",$,{once:!0});const B=()=>{var z;if(T!=null&&T.error){if(console.error("Error occurred in video",T==null?void 0:T.error),e)return;throw new ni({message:`The browser threw an error while playing the video ${w.src}: Code ${T.error.code} - ${(z=T==null?void 0:T.error)==null?void 0:z.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 ni({message:"The browser threw an error",src:w.src})};return T.addEventListener("error",B,{once:!0}),()=>{D.cancel(),T.removeEventListener("ended",$),T.removeEventListener("error",B),A(N)}},[y,w.src,r,x.fps,v,E,e,l,u,j,I,A,_]);const{src:O}=w;return R.isRendering&&d.useLayoutEffect(()=>{var $,D;if(((D=($=window.process)==null?void 0:$.env)==null?void 0:D.NODE_ENV)==="test")return;const T=_("Loading <Html5Video> duration with src="+O,{retries:l??void 0,timeoutInMilliseconds:u??void 0}),{current:C}=b,N=()=>{C!=null&&C.duration&&o(O,C.duration),A(T)};return C!=null&&C.duration?(o(O,C.duration),A(T)):C==null||C.addEventListener("loadedmetadata",N,{once:!0}),()=>{C==null||C.removeEventListener("loadedmetadata",N),A(T)}},[O,o,l,u,A,_]),c.jsx("video",{ref:b,disableRemotePlayback:!0,...w})},mT=d.forwardRef(hT),gT=(e,t)=>{const{startFrom:n,endAt:r,trimBefore:o,trimAfter:i,name:s,pauseWhenBuffering:a,stack:l,_remotionInternalNativeLoopPassed:u,showInTimeline:f,onAutoPlayError:p,onVideoFrame:h,...m}=e,{loop:w,...g}=e,{fps:k}=ft(),v=lt(),y=Qs(a);if(v.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:x,setDurations:b}=d.useContext(Tp);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 S=To(e.src),E=d.useCallback((_,A)=>{b({type:"got-duration",durationInSeconds:A,src:_})},[b]),R=x[Jn(S)]??x[Jn(e.src)];Pu({startFrom:n,endAt:r,trimBefore:o,trimAfter:i});const{trimBeforeValue:j,trimAfterValue:I}=Fu({startFrom:n,endAt:r,trimBefore:o,trimAfter:i});if(w&&R!==void 0){if(!Number.isFinite(R))return c.jsx(ul,{...g,ref:t,stack:l,_remotionInternalNativeLoopPassed:!0});const _=R*k;return c.jsx(Tu,{durationInFrames:Iu({trimAfter:I,mediaDurationInFrames:_,playbackRate:e.playbackRate??1,trimBefore:j}),layout:"none",name:s,showInTimeline:!1,children:c.jsx(ul,{...g,ref:t,stack:l,_remotionInternalNativeLoopPassed:!0})})}return typeof j<"u"||typeof I<"u"?c.jsx(Rt,{layout:"none",from:0-(j??0),showInTimeline:!1,durationInFrames:I===void 0?void 0:I/(e.playbackRate??1),name:s,children:c.jsx(ul,{pauseWhenBuffering:y,onVideoFrame:h,...m,ref:t,stack:l})}):(ju({playbackRate:e.playbackRate,preservePitch:e.preservePitch,volume:e.volume},"Html5Video"),v.isRendering?c.jsx(mT,{onDuration:E,onVideoFrame:h??null,...m,ref:t}):c.jsx(Dp,{onlyWarnForMediaSeekingError:!1,...m,ref:t,onVideoFrame:h??null,pauseWhenBuffering:y,onDuration:E,_remotionInternalStack:l??null,_remotionInternalNativeLoopPassed:u??!1,showInTimeline:f??!0,onAutoPlayError:p??void 0}))},ul=d.forwardRef(gT);Ut(ul);FE();var vT={},yT=new Proxy(vT,{get(e,t){return t==="Bundling"||t==="Rendering"||t==="Log"||t==="Puppeteer"||t==="Output"?yT:()=>{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)}}});Rt.displayName="Sequence";Ut(Rt);RE(Rt);Ut(Nl);Ut(Kk);typeof window<"u"&&(window.remotion_renderReady=!1,window.remotion_delayRenderTimeouts||(window.remotion_delayRenderTimeouts={}),window.remotion_delayRenderHandles=[]);var wT={"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}},xT={"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"}},bT={"style.backgroundColor":{type:"color",default:"transparent",description:"Color"}},ST={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}},kT={...ST},ET={...wT,...bT,...xT,...kT},CT={layout:{type:"enum",default:"absolute-fill",description:"Layout",variants:{"absolute-fill":ET,none:{}}}};({...CT.layout});var IT=(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 TT(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 RT(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 jT(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 Au={validateFps:jT,validateDimension:TT,validateDurationInFrames:RT,validateDefaultAndInputProps:IT};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 Ct=25,sf=16,PT=()=>c.jsx("svg",{width:Ct,height:Ct,viewBox:"0 0 25 25",fill:"none",children:c.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"})}),FT=()=>c.jsxs("svg",{viewBox:"0 0 100 100",width:Ct,height:Ct,children:[c.jsx("rect",{x:"25",y:"20",width:"20",height:"60",fill:"#fff",ry:"5",rx:"5"}),c.jsx("rect",{x:"55",y:"20",width:"20",height:"60",fill:"#fff",ry:"5",rx:"5"})]}),_T=({isFullscreen:e})=>{const r=e?0:3,o=e?6*1.6:6/2,i=e?6*1.6:6*2;return c.jsxs("svg",{viewBox:"0 0 32 32",height:sf,width:sf,children:[c.jsx("path",{d:`
81
+ M ${r} ${i}
82
+ L ${o} ${o}
83
+ L ${i} ${r}
84
+ `,stroke:"#fff",strokeWidth:6,fill:"none"}),c.jsx("path",{d:`
85
+ M ${32-r} ${i}
86
+ L ${32-o} ${o}
87
+ L ${32-i} ${r}
88
+ `,stroke:"#fff",strokeWidth:6,fill:"none"}),c.jsx("path",{d:`
89
+ M ${r} ${32-i}
90
+ L ${o} ${32-o}
91
+ L ${i} ${32-r}
92
+ `,stroke:"#fff",strokeWidth:6,fill:"none"}),c.jsx("path",{d:`
93
+ M ${32-r} ${32-i}
94
+ L ${32-o} ${32-o}
95
+ L ${32-i} ${32-r}
96
+ `,stroke:"#fff",strokeWidth:6,fill:"none"})]})},MT=()=>c.jsx("svg",{width:Ct,height:Ct,viewBox:"0 0 24 24",children:c.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"})}),$T=()=>c.jsx("svg",{width:Ct,height:Ct,viewBox:"0 0 24 24",children:c.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"})}),Xm="__remotion_buffering_indicator",qm="__remotion_buffering_animation",AT={width:Ct,height:Ct,overflow:"hidden",lineHeight:"normal",fontSize:"inherit"},NT={width:14,height:14,overflow:"hidden",lineHeight:"normal",fontSize:"inherit"},LT=({type:e})=>{const t=e==="player"?AT:NT;return c.jsxs(c.Fragment,{children:[c.jsx("style",{type:"text/css",children:`
97
+ @keyframes ${qm} {
98
+ 0% {
99
+ rotate: 0deg;
100
+ }
101
+ 100% {
102
+ rotate: 360deg;
103
+ }
104
+ }
105
+
106
+ .${Xm} {
107
+ animation: ${qm} 1s linear infinite;
108
+ }
109
+ `}),c.jsx("div",{style:t,children:c.jsx("svg",{viewBox:e==="player"?"0 0 22 22":"0 0 18 18",style:t,className:Xm,children:c.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})})})]})},zT=({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},Zx=({previewSize:e,compositionWidth:t,compositionHeight:n,canvasSize:r})=>{const o=fe.calculateScale({canvasSize:r,compositionHeight:n,compositionWidth:t,previewSize:e}),i=0-(1-o)/2,s=i*t,a=i*n,l=t*o,u=n*o,f=r.width/2-l/2,p=r.height/2-u/2;return{centerX:f,centerY:p,xCorrection:s,yCorrection:a,scale:o}},Kx=({config:e,style:t,canvasSize:n,overflowVisible:r,layout:o})=>e?{position:"relative",overflow:r?"visible":"hidden",...zT({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}:{},Yx=({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"}:{},Gx=({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"}},Xx=oe.createContext(void 0),qx=oe.createContext(void 0);class DT{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 OT{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 Qx=e=>{const t=d.useContext(fe.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])},BT=({children:e,currentPlaybackRate:t})=>{const[n]=d.useState(()=>new DT);if(!d.useContext(fe.BufferingContextReact))throw new Error("BufferingContextReact not found");return d.useEffect(()=>{t&&n.dispatchRateChange(t)},[n,t]),Qx(n),c.jsx(Xx.Provider,{value:n,children:e})},Wp=(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)},u=()=>{r(!0),s()};return o.addEventListener("mouseenter",a),o.addEventListener("mouseleave",l),o.addEventListener("mousemove",u),()=>{o.removeEventListener("mouseenter",a),o.removeEventListener("mouseleave",l),o.removeEventListener("mousemove",u),clearTimeout(i)}},[t,e]),n},Nu=()=>{const[e,t,n]=fe.Timeline.usePlayingState(),[r,o]=d.useState(!1),i=fe.Timeline.useTimelinePosition(),s=d.useRef(i),a=fe.Timeline.useTimelineSetFrame(),l=fe.Timeline.useTimelineSetFrame(),u=d.useContext(fe.SharedAudioContext),f=d.useContext(fe.SharedAudioTagsContext),{audioAndVideoTags:p}=fe.useTimelineContext(),h=d.useRef(i);h.current=i;const m=fe.useVideo(),w=fe.useUnsafeVideoConfig(),g=d.useContext(Xx),k=((w==null?void 0:w.durationInFrames)??1)-1,v=i===k,y=i===0;if(!g)throw new TypeError("Expected Player event emitter context");const x=d.useContext(fe.BufferingContextReact);if(!x)throw new Error("Missing the buffering context. Most likely you have a Remotion version mismatch.");const{buffering:b}=x,S=d.useCallback(T=>{const C=w?fe.TimelinePosition.clampFrameToCompositionRange(T,w.durationInFrames):Math.max(0,T);m!=null&&m.id&&l(N=>({...N,[m.id]:C})),h.current=C,g.dispatchSeek(C)},[w,g,l,m==null?void 0:m.id]),E=d.useCallback(T=>{n.current||(o(!0),v&&S(0),u==null||u.resume(),f&&f.numberOfAudioTags>0&&T&&f.playAllAudios(),p.current.forEach(C=>C.play("player play() was called and playing audio from a click")),n.current=!0,t(!0),s.current=h.current,g.dispatchPlay())},[n,v,u,f,t,g,S,p]),R=d.useCallback(()=>{n.current&&(n.current=!1,t(!1),g.dispatchPause(),u==null||u.suspend())},[g,n,t,u]),j=d.useCallback(()=>{n.current&&(n.current=!1,h.current=s.current,w&&(l(T=>({...T,[w.id]:s.current})),t(!1),g.dispatchPause()))},[w,g,n,t,l]),I=m==null?void 0:m.id,_=d.useCallback(T=>{if(!I)return null;n.current||a(C=>{const N=C[I]??window.remotion_initialFrame??0,$=Math.max(0,N-T);return N===$?C:{...C,[I]:$}})},[n,a,I]),A=d.useCallback(T=>{if(!I)return null;n.current||a(C=>{const N=C[I]??window.remotion_initialFrame??0,$=Math.min(k,N+T);return N===$?C:{...C,[I]:$}})},[I,n,k,a]),W=d.useCallback(T=>{n.current?R():E(T)},[n,R,E]),P=d.useCallback(()=>n.current,[n]),F=d.useCallback(()=>h.current,[h]),H=d.useCallback(()=>b.current,[b]);return d.useMemo(()=>({frameBack:_,frameForward:A,isLastFrame:v,emitter:g,playing:e,play:E,pause:R,seek:S,isFirstFrame:y,getCurrentFrame:F,isPlaying:P,isBuffering:H,pauseAndReturnToPlayStart:j,hasPlayed:r,toggle:W}),[g,_,A,r,y,v,F,R,j,E,e,S,W,P,H])},WT=({browserMediaControlsBehavior:e,videoConfig:t,playbackRate:n})=>{const{playing:r,pause:o,play:i,emitter:s,getCurrentFrame:a,seek:l}=Nu(),u=d.useRef(!1);d.useEffect(()=>{r&&(u.current=!0)},[r]),d.useEffect(()=>{navigator.mediaSession&&e.mode!=="do-nothing"&&(r?navigator.mediaSession.playbackState="playing":u.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])},VT=({time:e,currentFrame:t,playbackSpeed:n,fps:r,actualLastFrame:o,actualFirstFrame:i,framesAdvanced:s,shouldLoop:a})=>{const u=(n<0?Math.ceil:Math.floor)(e*n/(1e3/r))-s,f=u+t,p=t>o||t<i,h=f>o||f<i,m=!a&&h&&!p;return n>0?h?{nextFrame:i,framesToAdvance:u,hasEnded:m}:{nextFrame:f,framesToAdvance:u,hasEnded:m}:h?{nextFrame:o,framesToAdvance:u,hasEnded:m}:{nextFrame:f,framesToAdvance:u,hasEnded:m}},Qm=()=>typeof document>"u"?!1:document.visibilityState==="hidden",HT=()=>{const e=d.useRef(Qm());return d.useEffect(()=>{const t=()=>{e.current=Qm()};return document.addEventListener("visibilitychange",t),()=>{document.removeEventListener("visibilitychange",t)}},[]),e},UT=.1,Jm=({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,u=l===0?.3:l,f=e.baseLatency+u;return Math.abs(a)<UT+f&&!i||Math.abs(a)<Number.EPSILON?!1:(fe.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)},ZT=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}`)},KT=({loop:e,playbackRate:t,moveToBeginningWhenEnded:n,inFrame:r,outFrame:o,browserMediaControlsBehavior:i,getCurrentFrame:s,muted:a})=>{const l=fe.useUnsafeVideoConfig(),u=fe.Timeline.useTimelinePosition(),{playing:f,pause:p,emitter:h,isPlaying:m}=Nu(),w=fe.Timeline.useTimelineSetFrame(),g=d.useContext(fe.SharedAudioContext),k=fe.useLogLevel(),v=HT(),y=d.useRef(0),x=d.useContext(fe.BufferingContextReact);if(!x)throw new Error("Missing the buffering context. Most likely you have a Remotion version mismatch.");WT({browserMediaControlsBehavior:i,playbackRate:t,videoConfig:l}),d.useLayoutEffect(()=>{if(!g||!g.audioContext||!l||a)return;Jm({audioContext:g.audioContext,audioSyncAnchor:g.audioSyncAnchor,absoluteTimeInSeconds:u/l.fps,globalPlaybackRate:t,logLevel:k,force:!1})&&g.audioSyncAnchorEmitter.dispatch("changed")},[l,u,k,t,g,a]),d.useLayoutEffect(()=>{const b=g==null?void 0:g.audioContext;if(!b||!l||a)return;const S=()=>{const E=g==null?void 0:g.getAudioContextState();E&&ZT(E)&&Jm({audioContext:b,audioSyncAnchor:g.audioSyncAnchor,absoluteTimeInSeconds:s()/l.fps,globalPlaybackRate:t,logLevel:k,force:!0})};return b==null||b.addEventListener("statechange",S),()=>{b==null||b.removeEventListener("statechange",S)}},[l,s,k,a,t,g]),d.useEffect(()=>{var P;if(!l)return;if(!f){(P=g==null?void 0:g.suspend)==null||P.call(g);return}let b=!1,S=null,E=performance.now(),R=0;const j=()=>{S!==null&&(S.type==="raf"?cancelAnimationFrame(S.id):clearTimeout(S.id))},I=()=>{b=!0,j()},_=()=>{var D,B;if(b)return;if(!m()){(D=g==null?void 0:g.suspend)==null||D.call(g);return}!a&&!x.buffering.current&&((B=g==null?void 0:g.resume)==null||B.call(g));const F=performance.now()-E,H=o??l.durationInFrames-1,O=r??0,T=s(),{nextFrame:C,framesToAdvance:N,hasEnded:$}=VT({time:F,currentFrame:T,playbackSpeed:t,fps:l.fps,actualFirstFrame:O,actualLastFrame:H,framesAdvanced:R,shouldLoop:e});if(R+=N,C!==s()&&(!$||n)&&!x.buffering.current&&w(Z=>({...Z,[l.id]:C})),$){I(),p(),h.dispatchEnded();return}A()},A=()=>{var H,O;const F=((H=g==null?void 0:g.getIsResumingAudioContext)==null?void 0:H.call(g))??null;if(F!==null&&!a){F.then(()=>{E=performance.now(),R=0,A()});return}if(x.buffering.current){a||(O=g==null?void 0:g.suspend)==null||O.call(g);const T=x.listenForResume(()=>{T.remove(),E=performance.now(),R=0,A()});return}if(v.current){S={type:"timeout",id:setTimeout(_,1e3/l.fps)};return}S={type:"raf",id:requestAnimationFrame(_)}};A();const W=()=>{document.visibilityState!=="visible"&&(j(),_())};return window.addEventListener("visibilitychange",W),()=>{window.removeEventListener("visibilitychange",W),I()}},[l,e,p,f,w,h,t,r,o,n,v,s,x,m,g,k,a]),d.useEffect(()=>{const b=performance.now(),S=b-y.current;if(S>=250){h.dispatchTimeUpdate({frame:u}),y.current=b;return}const E=setTimeout(()=>{h.dispatchTimeUpdate({frame:u}),y.current=performance.now()},250-S);return()=>clearTimeout(E)},[h,u]),d.useEffect(()=>{h.dispatchFrameUpdate({frame:u})},[h,u])},jc=[],Pc=e=>e?"current"in e?e.current:e:null,Vp=(e,t)=>{const[n,r]=d.useState(()=>{const s=Pc(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],u=l.getClientRects();if(!(u!=null&&u[0])){r(null);return}const f=a.width===0?1:u[0].width/a.width,p=a.height===0?1:u[0].height/a.height,h=t.shouldApplyCssTransforms||f===0?u[0].width:u[0].width*(1/f),m=t.shouldApplyCssTransforms||p===0?u[0].height:u[0].height*(1/p);r(w=>w&&w.width===h&&w.height===m&&w.left===u[0].x&&w.top===u[0].y&&w.windowSize.height===window.innerHeight&&w.windowSize.width===window.innerWidth?w:{width:h,height:m,left:u[0].x,top:u[0].y,windowSize:{height:window.innerHeight,width:window.innerWidth}})}),[t.shouldApplyCssTransforms]),i=d.useCallback(()=>{const s=Pc(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=Pc(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(()=>(jc.push(i),()=>{jc=jc.filter(s=>s!==i)}),[i]),d.useMemo(()=>n?{...n,refresh:i}:null,[n,i])},Hp=e=>e??"__remotion-player",YT={display:"flex",justifyContent:"center",alignItems:"center",flex:1,height:"100%",width:"100%"};class Jx extends oe.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?c.jsx("div",{style:YT,children:this.props.errorFallback({error:this.state.hasError})}):this.props.children}}var GT=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}},Fc={backgroundColor:"red",position:"absolute",padding:12,fontFamily:"Arial"},XT=["28d262b44cc61fa750f1686b16ad0604dabfe193fbc263eec05c89b7ad4c2cd6","4db1b0a94be33165dfefcb3ba03d04c7a2666dd27c496d3dc9fa41858e94925e","fbc48530bbf245da790f63675e84e06bab38c3b114fab07eb350025119922bdc","7baf10a8932757b1b3a22b3fce10a048747ac2f8eaf638603487e3705b07eb83","8a6c21a598d8c667272b5207c051b85997bf5b45d5fb712378be3f27cd72c6a6","a2f7aaac9c50a9255e7fc376110c4e0bfe153722dc66ed3c5d3bf2a135f65518"],eg=!1,qT=()=>{const[e,t]=oe.useState(!1);return d.useEffect(()=>{eg||(eg=!0,GT().then(n=>{n&&XT.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,Fc,{zIndex:"9999",cssText:`${Fc.cssText} !important;`}),i.innerHTML=`
110
+ <a href="https://github.com/remotion-dev/remotion/pull/4589" style="color: white;">
111
+ Remotion Unlicensed – Contact hi@remotion.dev
112
+ </a>
113
+ `,document.body.appendChild(i)}},r=new MutationObserver(()=>n());return r.observe(document.body,{childList:!0,subtree:!0}),()=>{r.disconnect()}},[e]),e?c.jsx("div",{style:Fc,className:"warning-banner",children:c.jsx("a",{style:{color:"white"},href:"https://github.com/remotion-dev/remotion/pull/4589",children:"Remotion Unlicensed – Contact hi@remotion.dev"})}):null},tg=({playing:e,buffering:t})=>e&&t?c.jsx(LT,{type:"player"}):e?c.jsx(FT,{}):c.jsx(PT,{}),Ao=12,ng=5,QT=({volume:e,isVertical:t,onBlur:n,inputRef:r,setVolume:o})=>{const i=d.useMemo(()=>{const h={paddingLeft:5,height:Ct,width:lo,display:"inline-flex",alignItems:"center"};return t?{...h,position:"absolute",transform:`rotate(-90deg) translateX(${lo/2+Ct/2}px)`}:{...h}},[t]),s=typeof oe.useId>"u"?"volume-slider":oe.useId(),[a]=d.useState(()=>`__remotion-volume-slider-${Co(s)}`.replace(".","")),l=d.useCallback(p=>{o(parseFloat(p.target.value))},[o]),u=d.useMemo(()=>{const p={WebkitAppearance:"none",backgroundColor:"rgba(255, 255, 255, 0.5)",borderRadius:ng/2,cursor:"pointer",height:ng,width:lo,backgroundImage:`linear-gradient(
114
+ to right,
115
+ white ${e*100}%, rgba(255, 255, 255, 0) ${e*100}%
116
+ )`};return t?{...p,bottom:Ct+lo/2}:p},[t,e]),f=`
117
+ .${a}::-webkit-slider-thumb {
118
+ -webkit-appearance: none;
119
+ background-color: white;
120
+ border-radius: ${Ao/2}px;
121
+ box-shadow: 0 0 2px black;
122
+ height: ${Ao}px;
123
+ width: ${Ao}px;
124
+ }
125
+
126
+ .${a}::-moz-range-thumb {
127
+ -webkit-appearance: none;
128
+ background-color: white;
129
+ border-radius: ${Ao/2}px;
130
+ box-shadow: 0 0 2px black;
131
+ height: ${Ao}px;
132
+ width: ${Ao}px;
133
+ }
134
+ `;return c.jsxs("div",{style:i,children:[c.jsx("style",{dangerouslySetInnerHTML:{__html:f}}),c.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:u})]})},JT=e=>c.jsx(QT,{...e}),lo=100,eR=({displayVerticalVolumeSlider:e,renderMuteButton:t,renderVolumeSlider:n})=>{const[r,o]=fe.usePlayerMutedState(),[i,s]=fe.useMediaVolumeState(),[a,l]=d.useState(!1),u=d.useRef(null),f=d.useRef(null),p=Wp(u,!1),h=d.useCallback(()=>{setTimeout(()=>{f.current&&document.activeElement!==f.current&&l(!1)},10)},[]),m=i===0,w=d.useCallback(()=>{if(m){s(1),o(!1);return}o(b=>!b)},[m,o,s]),g=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:Ct,height:Ct,cursor:"pointer",appearance:"none",background:"none",border:"none",padding:0}),[]),v=d.useCallback(({muted:b,volume:S})=>{const E=b||S===0;return c.jsx("button",{"aria-label":E?"Unmute sound":"Mute sound",title:E?"Unmute sound":"Mute sound",onClick:w,onBlur:h,onFocus:()=>l(!0),style:k,type:"button",children:E?c.jsx(MT,{}):c.jsx($T,{})})},[h,w,k]),y=d.useMemo(()=>t?t({muted:r,volume:i}):v({muted:r,volume:i}),[r,i,v,t]),x=d.useMemo(()=>(a||p)&&!r&&!fe.isIosSafari()?(n??JT)({isVertical:e,volume:i,onBlur:()=>l(!1),inputRef:f,setVolume:s}):null,[e,a,p,r,i,n,s]);return c.jsxs("div",{ref:u,style:g,children:[y,x]})};function tR(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 nR=35,rR=70,oR={height:30,paddingRight:15,paddingLeft:12,display:"flex",flexDirection:"row",alignItems:"center"},iR={width:22,display:"flex",alignItems:"center"},sR={width:14,height:14,color:"black"},aR=()=>c.jsx("svg",{viewBox:"0 0 512 512",style:sR,children:c.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"})}),lR=e=>{const t=e.toString();return t.includes(".")?t:t+".0"},uR=({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)},[]),u=r===e,f=d.useMemo(()=>({...oR,backgroundColor:i||u?"#eee":"transparent"}),[i,u]);return c.jsxs("div",{onPointerEnter:a,onPointerLeave:l,tabIndex:0,style:f,onClick:o,children:[c.jsx("div",{style:iR,children:e===n?c.jsx(aR,{}):null}),lR(e),"x"]},e)},cR=({setIsComponentVisible:e,playbackRates:t,canvasSize:n})=>{const{setPlaybackRate:r,playbackRate:o}=fe.usePlaybackRate(),[i,s]=d.useState(o);d.useEffect(()=>{const u=f=>{if(f.preventDefault(),f.key==="ArrowUp"){const p=t.findIndex(h=>h===i);if(p===0)return;s(p===-1?t[0]:t[p-1])}else if(f.key==="ArrowDown"){const p=t.findIndex(h=>h===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",u),()=>{window.removeEventListener("keydown",u)}},[t,i,r,e]);const a=d.useCallback(u=>{r(u),e(!1)},[e,r]),l=d.useMemo(()=>({position:"absolute",right:0,width:125,maxHeight:n.height-rR-nR,bottom:35,background:"#fff",borderRadius:4,overflow:"auto",color:"black",textAlign:"left"}),[n.height]);return c.jsx("div",{style:l,children:t.map(u=>c.jsx(uR,{selectedRate:o,onSelect:a,rate:u,keyboardSelectedRate:i},u))})},dR={fontSize:13,fontWeight:"bold",color:"white",border:"2px solid white",borderRadius:20,paddingLeft:8,paddingRight:8,paddingTop:2,paddingBottom:2},af={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"},fR={...af,position:"relative"},pR=({playbackRates:e,canvasSize:t})=>{const{ref:n,isComponentVisible:r,setIsComponentVisible:o}=tR(!1),{playbackRate:i}=fe.usePlaybackRate(),s=d.useCallback(a=>{a.stopPropagation(),a.preventDefault(),o(l=>!l)},[o]);return c.jsx("div",{ref:n,children:c.jsxs("button",{type:"button","aria-label":"Change playback rate",style:fR,onClick:s,children:[c.jsxs("div",{style:dR,children:[i,"x"]}),r&&c.jsx(cR,{canvasSize:t,playbackRates:e,setIsComponentVisible:o})]})})},rg=(e,t,n)=>Math.round(Fi(e,[0,n],[0,t-1],{extrapolateLeft:"clamp",extrapolateRight:"clamp"})),ri=5,Gi=12,lf=4,hR={userSelect:"none",WebkitUserSelect:"none",paddingTop:lf,paddingBottom:lf,boxSizing:"border-box",cursor:"pointer",position:"relative",touchAction:"none"},mR={height:ri,backgroundColor:"rgba(255, 255, 255, 0.25)",width:"100%",borderRadius:ri/2},gR=e=>{let t=e;for(;t.parentElement;)t=t.parentElement;return t},vR=({durationInFrames:e,onSeekEnd:t,onSeekStart:n,inFrame:r,outFrame:o})=>{const i=d.useRef(null),s=Wp(i,!1),a=Vp(i,{triggerOnWindowResize:!0,shouldApplyCssTransforms:!0}),{seek:l,play:u,pause:f,playing:p}=Nu(),h=fe.Timeline.useTimelinePosition(),[m,w]=d.useState({dragging:!1}),g=(a==null?void 0:a.width)??0,k=d.useCallback(E=>{var I;if(E.button!==0)return;const R=(I=i.current)==null?void 0:I.getBoundingClientRect().left,j=rg(E.clientX-R,e,g);f(),l(j),w({dragging:!0,wasPlaying:p}),n()},[e,g,f,l,p,n]),v=d.useCallback(E=>{var I;if(!a)throw new Error("Player has no size");if(!m.dragging)return;const R=(I=i.current)==null?void 0:I.getBoundingClientRect().left,j=rg(E.clientX-R,e,a.width);l(j)},[m.dragging,e,l,a]),y=d.useCallback(()=>{w({dragging:!1}),m.dragging&&(m.wasPlaying?u():f(),t())},[m,t,f,u]);d.useEffect(()=>{if(!m.dragging)return;const E=gR(i.current);return E.addEventListener("pointermove",v),E.addEventListener("pointerup",y),()=>{E.removeEventListener("pointermove",v),E.removeEventListener("pointerup",y)}},[m.dragging,v,y]);const x=d.useMemo(()=>({height:Gi,width:Gi,borderRadius:Gi/2,position:"absolute",top:lf-Gi/2+5/2,backgroundColor:"white",left:Math.max(0,h/Math.max(1,e-1)*g-Gi/2),boxShadow:"0 0 2px black",opacity:Number(s||m.dragging)}),[s,m.dragging,e,h,g]),b=d.useMemo(()=>({height:ri,backgroundColor:"rgba(255, 255, 255, 1)",width:(h-(r??0))/(e-1)*g,marginLeft:(r??0)/(e-1)*g,borderRadius:ri/2}),[e,h,r,g]),S=d.useMemo(()=>({height:ri,backgroundColor:"rgba(255, 255, 255, 0.25)",width:((o??e-1)-(r??0))/(e-1)*100+"%",marginLeft:(r??0)/(e-1)*100+"%",borderRadius:ri/2,position:"absolute"}),[e,r,o]);return c.jsxs("div",{ref:i,onPointerDown:k,style:hR,children:[c.jsxs("div",{style:mR,children:[c.jsx("div",{style:S}),c.jsx("div",{style:b})]}),c.jsx("div",{style:x})]})},og=e=>{const t=Math.floor(e/60),n=Math.floor(e-t*60);return`${String(t)}:${String(n).padStart(2,"0")}`},yR=({durationInFrames:e,maxTimeLabelWidth:t,fps:n})=>{const r=fe.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 c.jsxs("div",{style:o,children:[og(s/n)," / ",og(e/n)]})},wR=10,uf=12,xR=({allowFullscreen:e,playerWidth:t})=>d.useMemo(()=>{const r=Ct,o=Ct,i=e?sf:0,s=o+r+i+uf*2+wR*2,a=t-s,l=Math.max(a,0),u=l-lo,p=(u<lo?l:u)+s+lo,h=t<p;return{maxTimeLabelWidth:l===0?null:l,displayVerticalVolumeSlider:h}},[e,t]),bR=[0,.013,.049,.104,.175,.259,.352,.45,.55,.648,.741,.825,.896,.951,.987],SR=[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],kR=1/.7,ER={boxSizing:"border-box",position:"absolute",bottom:0,width:"100%",paddingTop:40,paddingBottom:10,backgroundImage:`linear-gradient(to bottom,${bR.map((e,t)=>`hsla(0, 0%, 0%, ${e}) ${SR[t]*kR}%`).join(", ")}, hsl(0, 0%, 0%) 100%)`,backgroundSize:"auto 145px",display:"flex",paddingRight:uf,paddingLeft:uf,flexDirection:"column",transition:"opacity 0.3s"},CR={display:"flex",flexDirection:"row",width:"100%",alignItems:"center",justifyContent:"center",userSelect:"none",WebkitUserSelect:"none"},IR={display:"flex",flexDirection:"row",userSelect:"none",WebkitUserSelect:"none",alignItems:"center"},Xi={width:12},TR={height:8},RR={flex:1},jR={},PR=({durationInFrames:e,isFullscreen:t,fps:n,showVolumeControls:r,onFullscreenButtonClick:o,allowFullscreen:i,onExitFullscreenButtonClick:s,spaceKeyToPlayOrPause:a,onSeekEnd:l,onSeekStart:u,inFrame:f,outFrame:p,initiallyShowControls:h,canvasSize:m,renderPlayPauseButton:w,renderFullscreenButton:g,alwaysShowControls:k,showPlaybackRateControl:v,containerRef:y,buffering:x,hideControlsWhenPointerDoesntMove:b,onPointerDown:S,onDoubleClick:E,renderMuteButton:R,renderVolumeSlider:j,playing:I,toggle:_,renderCustomControls:A})=>{const W=d.useRef(null),[P,F]=d.useState(!1),H=Wp(y,b),{maxTimeLabelWidth:O,displayVerticalVolumeSlider:T}=xR({allowFullscreen:i,playerWidth:(m==null?void 0:m.width)??0}),[C,N]=d.useState(()=>{if(typeof h=="boolean")return h;if(typeof h=="number"){if(h%1!==0)throw new Error("initiallyShowControls must be an integer or a boolean");if(Number.isNaN(h))throw new Error("initiallyShowControls must not be NaN");if(!Number.isFinite(h))throw new Error("initiallyShowControls must be finite");if(h<=0)throw new Error("initiallyShowControls must be a positive integer");return h}throw new TypeError("initiallyShowControls must be a number or a boolean")}),$=d.useMemo(()=>({...ER,opacity:Number(H||!I||C||k)}),[H,C,I,k]);d.useEffect(()=>{W.current&&a&&W.current.focus({preventScroll:!0})},[I,a]),d.useEffect(()=>{F((typeof document<"u"&&(document.fullscreenEnabled||document.webkitFullscreenEnabled))??!1)},[]),d.useEffect(()=>{if(C===!1)return;const V=setTimeout(()=>{N(!1)},C===!0?2e3:C);return()=>{clearInterval(V)}},[C]);const D=d.useMemo(()=>{if(v===!0)return[.5,.8,1,1.2,1.5,1.8,2,2.5,3];if(Array.isArray(v)){for(const G of v){if(typeof G!="number")throw new Error("Every item in showPlaybackRateControl must be a number");if(G<=0)throw new Error("Every item in showPlaybackRateControl must be positive")}return v}return null},[v]),B=A?A():null,Z=d.useRef(null),L=d.useRef(null),z=d.useCallback(G=>{(G.target===Z.current||G.target===L.current)&&(S==null||S(G))},[S]),Q=d.useCallback(G=>{(G.target===Z.current||G.target===L.current)&&(E==null||E(G))},[E]);return c.jsxs("div",{ref:Z,style:$,onPointerDown:z,onDoubleClick:Q,children:[c.jsxs("div",{ref:L,style:CR,children:[c.jsxs("div",{style:IR,children:[c.jsx("button",{ref:W,type:"button",style:af,onClick:_,"aria-label":I?"Pause video":"Play video",title:I?"Pause video":"Play video",children:w===null?c.jsx(tg,{buffering:x,playing:I}):w({playing:I,isBuffering:x})??c.jsx(tg,{buffering:x,playing:I})}),r?c.jsxs(c.Fragment,{children:[c.jsx("div",{style:Xi}),c.jsx(eR,{renderMuteButton:R,renderVolumeSlider:j,displayVerticalVolumeSlider:T})]}):null,c.jsx("div",{style:Xi}),c.jsx(yR,{durationInFrames:e,fps:n,maxTimeLabelWidth:O}),c.jsx("div",{style:Xi})]}),c.jsx("div",{style:RR}),B,B&&D&&m?c.jsx("div",{style:Xi}):null,D&&m&&c.jsx(pR,{canvasSize:m,playbackRates:D}),D&&P&&i?c.jsx("div",{style:Xi}):null,c.jsx("div",{style:jR,children:P&&i?c.jsx("button",{type:"button","aria-label":t?"Exit fullscreen":"Enter Fullscreen",title:t?"Exit fullscreen":"Enter Fullscreen",style:af,onClick:t?s:o,children:g===null?c.jsx(_T,{isFullscreen:t}):g({isFullscreen:t})}):null})]}),c.jsx("div",{style:TR}),c.jsx(vR,{onSeekEnd:l,onSeekStart:u,durationInFrames:e,inFrame:f,outFrame:p})]})},e1=typeof document>"u",FR=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}}},_R=e=>new Promise(t=>setTimeout(t,e)),MR=()=>{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])},$R=(e,t,n)=>{const r=MR(),o=d.useCallback(async l=>{if(l instanceof PointerEvent?l.pointerType==="touch":l.nativeEvent.pointerType==="touch"){e(l);return}r.clearPendingPromises();const u=FR(_R(200));r.appendPendingPromise(u);try{await u.promise,r.removePendingPromise(u),e(l)}catch(f){const p=f;if(r.removePendingPromise(u),!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=oe.version.split(".")[0];if(cf==="0")throw new Error(`Version ${cf} of "react" is not supported by Remotion`);var AR=parseInt(cf,10)>=18,NR=({controls:e,style:t,loop:n,autoPlay:r,allowFullscreen:o,inputProps:i,clickToPlay:s,showVolumeControls:a,doubleClickToFullscreen:l,spaceKeyToPlayOrPause:u,errorFallback:f,playbackRate:p,renderLoading:h,renderPoster:m,className:w,moveToBeginningWhenEnded:g,showPosterWhenUnplayed:k,showPosterWhenEnded:v,showPosterWhenPaused:y,showPosterWhenBuffering:x,showPosterWhenBufferingAndPaused:b,inFrame:S,outFrame:E,initiallyShowControls:R,renderFullscreen:j,renderPlayPauseButton:I,renderMuteButton:_,renderVolumeSlider:A,renderCustomControls:W,alwaysShowControls:P,showPlaybackRateControl:F,posterFillMode:H,bufferStateDelayInMilliseconds:O,hideControlsWhenPointerDoesntMove:T,overflowVisible:C,browserMediaControlsBehavior:N,overrideInternalClassName:$,noSuspense:D},B)=>{const Z=fe.useUnsafeVideoConfig(),L=fe.useVideo(),z=d.useRef(null),Q=Vp(z,{triggerOnWindowResize:!1,shouldApplyCssTransforms:!1}),[G,V]=d.useState(!1),[K,de]=d.useState(r),[ge,ce]=d.useState(()=>!1),[se,ee]=d.useState(!1),q=d.useMemo(()=>typeof document>"u"?!1:!!(document.fullscreenEnabled||document.webkitFullscreenEnabled),[]),J=Nu(),ie=J.toggle,{playerMuted:Me,mediaVolume:ke}=d.useContext(fe.MediaVolumeContext);d.useEffect(()=>{J.emitter.dispatchVolumeChange(ke)},[J.emitter,ke]);const be=Me||ke===0;d.useEffect(()=>{J.emitter.dispatchMuteChange({isMuted:be})},[J.emitter,be]),KT({loop:n,playbackRate:p,moveToBeginningWhenEnded:g,inFrame:S,outFrame:E,getCurrentFrame:J.getCurrentFrame,browserMediaControlsBehavior:N,muted:be}),d.useEffect(()=>{G&&!J.playing&&(V(!1),J.play())},[G,J]),d.useEffect(()=>{const{current:Re}=z;if(!Re)return;const _e=()=>{const we=document.fullscreenElement===Re||document.webkitFullscreenElement===Re;ce(we)};return document.addEventListener("fullscreenchange",_e),document.addEventListener("webkitfullscreenchange",_e),()=>{document.removeEventListener("fullscreenchange",_e),document.removeEventListener("webkitfullscreenchange",_e)}},[]);const $e=d.useCallback(Re=>{ie(Re)},[ie]),xe=d.useCallback(()=>{if(!o)throw new Error("allowFullscreen is false");if(!q)throw new Error("Browser doesnt support fullscreen");if(!z.current)throw new Error("No player ref found");z.current.webkitRequestFullScreen?z.current.webkitRequestFullScreen():z.current.requestFullscreen()},[o,q]),Te=d.useCallback(()=>{document.webkitExitFullscreen?document.webkitExitFullscreen():document.exitFullscreen()},[]);d.useEffect(()=>{const{current:Re}=z;if(!Re)return;const _e=()=>{const we=document.webkitFullscreenElement??document.fullscreenElement;we&&we===z.current?J.emitter.dispatchFullscreenChange({isFullscreen:!0}):J.emitter.dispatchFullscreenChange({isFullscreen:!1})};return Re.addEventListener("webkitfullscreenchange",_e),Re.addEventListener("fullscreenchange",_e),()=>{Re.removeEventListener("webkitfullscreenchange",_e),Re.removeEventListener("fullscreenchange",_e)}},[J.emitter]);const Pe=(Z==null?void 0:Z.durationInFrames)??1,Ee=d.useMemo(()=>!Z||!Q?null:Zx({canvasSize:Q,compositionHeight:Z.height,compositionWidth:Z.width,previewSize:"auto"}),[Q,Z]),Le=(Ee==null?void 0:Ee.scale)??1,jt=d.useRef(!1);d.useEffect(()=>{if(!jt.current){jt.current=!0;return}J.emitter.dispatchScaleChange(Le)},[J.emitter,Le]);const{setMediaVolume:zt,setPlayerMuted:pn}=d.useContext(fe.SetMediaVolumeContext),[Dt,In]=d.useState(!1);d.useEffect(()=>{let Re=null,_e=!1;const we=()=>{_e=!1,requestAnimationFrame(()=>{O===0?In(!0):Re=setTimeout(()=>{_e||In(!0)},O)})},rr=()=>{requestAnimationFrame(()=>{_e=!0,In(!1),Re&&clearTimeout(Re)})};return J.emitter.addEventListener("waiting",we),J.emitter.addEventListener("resume",rr),()=>{J.emitter.removeEventListener("waiting",we),J.emitter.removeEventListener("resume",rr),In(!1),Re&&clearTimeout(Re),_e=!0}},[O,J.emitter]),d.useImperativeHandle(B,()=>{const Re={play:J.play,pause:()=>{V(!1),J.pause()},toggle:$e,getContainerNode:()=>z.current,getCurrentFrame:J.getCurrentFrame,isPlaying:J.isPlaying,seekTo:_e=>{const we=Pe-1,rr=Math.max(0,Math.min(we,_e));J.isPlaying()&&(V(rr!==we||n),J.pause()),rr===we&&!n&&J.emitter.dispatchEnded(),J.seek(rr)},isFullscreen:()=>{const{current:_e}=z;return _e?document.fullscreenElement===_e||document.webkitFullscreenElement===_e:!1},requestFullscreen:xe,exitFullscreen:Te,getVolume:()=>Me?0:ke,setVolume:_e=>{if(typeof _e!="number")throw new TypeError(`setVolume() takes a number, got value of type ${typeof _e}`);if(isNaN(_e))throw new TypeError("setVolume() got a number that is NaN. Volume must be between 0 and 1.");if(_e<0||_e>1)throw new TypeError(`setVolume() got a number that is out of range. Must be between 0 and 1, got ${_e}`);zt(_e)},isMuted:()=>be,mute:()=>{pn(!0)},unmute:()=>{pn(!1)},getScale:()=>Le,pauseAndReturnToPlayStart:()=>{J.pauseAndReturnToPlayStart()}};return Object.assign(J.emitter,Re)},[Pe,Te,n,Me,be,ke,J,xe,pn,zt,$e,Le]);const Tn=L?L.component:null,Ze=d.useMemo(()=>Kx({canvasSize:Q,config:Z,style:t,overflowVisible:C,layout:Ee}),[Q,Z,Ee,C,t]),hn=d.useMemo(()=>Gx({config:Z,layout:Ee,scale:Le,overflowVisible:C}),[Z,Ee,C,Le]),tn=d.useMemo(()=>Yx({config:Z,layout:Ee,scale:Le,overflowVisible:C}),[Z,Ee,C,Le]),st=J.pause,Pt=J.emitter.dispatchError,vt=d.useCallback(Re=>{st(),Pt(Re)},[Pt,st]),wr=d.useCallback(Re=>{Re.stopPropagation(),xe()},[xe]),Jr=d.useCallback(Re=>{Re.stopPropagation(),Te()},[Te]),Zt=d.useCallback(Re=>{(Re instanceof MouseEvent?Re.button===2:Re.nativeEvent.button)||$e(Re)},[$e]),nr=d.useCallback(()=>{ee(!0)},[]),Bn=d.useCallback(()=>{ee(!1)},[]),eo=d.useCallback(()=>{ge?Te():xe()},[Te,ge,xe]),{handlePointerDown:M,handleDoubleClick:U}=$R(Zt,eo,l&&o&&q);d.useEffect(()=>{K&&(J.play(),de(!1))},[K,J]);const ne=d.useMemo(()=>h?h({height:Ze.height,width:Ze.width,isBuffering:Dt}):null,[Ze.height,Ze.width,h,Dt]),le=d.useMemo(()=>({type:"scale",scale:Le}),[Le]);if(!Z)return null;const he=m?m({height:H==="player-size"?Ze.height:Z.height,width:H==="player-size"?Ze.width:Z.width,isBuffering:Dt}):null;if(he===void 0)throw new TypeError("renderPoster() must return a React element, but undefined was returned");const ye=he&&[y&&!J.isPlaying()&&!se,v&&J.isLastFrame&&!J.isPlaying(),k&&!J.hasPlayed&&!J.isPlaying(),x&&Dt&&J.isPlaying(),b&&Dt&&!J.isPlaying()].some(Boolean),{left:Ce,top:Fe,width:Oe,height:ze,...Be}=hn,Rn=c.jsxs(c.Fragment,{children:[c.jsxs("div",{style:hn,onPointerDown:s?M:void 0,onDoubleClick:l?U:void 0,children:[c.jsxs("div",{style:tn,className:Hp($),children:[Tn?c.jsx(Jx,{onError:vt,errorFallback:f,children:c.jsx(fe.CurrentScaleContext.Provider,{value:le,children:c.jsx(Tn,{...(L==null?void 0:L.props)??{},...i??{}})})}):null,ye&&H==="composition-size"?c.jsx("div",{style:{...Be,width:Z.width,height:Z.height},onPointerDown:s?M:void 0,onDoubleClick:l?U:void 0,children:he}):null]}),c.jsx(qT,{})]}),ye&&H==="player-size"?c.jsx("div",{style:hn,onPointerDown:s?M:void 0,onDoubleClick:l?U:void 0,children:he}):null,e?c.jsx(PR,{fps:Z.fps,playing:J.playing,toggle:J.toggle,durationInFrames:Z.durationInFrames,containerRef:z,onFullscreenButtonClick:wr,isFullscreen:ge,allowFullscreen:o,showVolumeControls:a,onExitFullscreenButtonClick:Jr,spaceKeyToPlayOrPause:u,onSeekEnd:Bn,onSeekStart:nr,inFrame:S,outFrame:E,initiallyShowControls:R,canvasSize:Q,renderFullscreenButton:j,renderPlayPauseButton:I,alwaysShowControls:P,showPlaybackRateControl:F,buffering:Dt,hideControlsWhenPointerDoesntMove:T,onDoubleClick:l?U:void 0,onPointerDown:s?M:void 0,renderMuteButton:_,renderVolumeSlider:A,renderCustomControls:W}):null]});return D||e1&&!AR?c.jsx("div",{ref:z,style:Ze,className:w,children:Rn}):c.jsx("div",{ref:z,style:Ze,className:w,children:c.jsx(d.Suspense,{fallback:ne,children:Rn})})},LR=d.forwardRef(NR),t1="remotion.volumePreference",zR=(e,t,n)=>{if(!(typeof window>"u"))try{window.localStorage.setItem(n??t1,String(e))}catch(r){fe.Log.error({logLevel:t,tag:null},"Could not persist volume",r)}},DR=e=>{if(typeof window>"u")return 1;try{const t=window.localStorage.getItem(e??t1);return t?Number(t):1}catch{return 1}},Up="player-comp",n1=({children:e,timelineContext:t,playbackRateContext:n,fps:r,compositionHeight:o,compositionWidth:i,durationInFrames:s,component:a,numberOfSharedAudioTags:l,initiallyMuted:u,logLevel:f,audioLatencyHint:p,sampleRate:h,volumePersistenceKey:m,initialVolume:w,inputProps:g,audioEnabled:k})=>{const v=w===void 0,y=d.useMemo(()=>({compositions:[{component:a,durationInFrames:s,height:o,width:i,fps:r,id:Up,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:g},canvasContent:{type:"composition",compositionId:"player-comp"}}),[a,s,o,i,r,g]),[x,b]=d.useState(()=>u),[S,E]=d.useState(()=>v?DR(m??null):w),R=d.useMemo(()=>({playerMuted:x,mediaVolume:S}),[x,S]),j=d.useRef(!1),I=j.current||k&&!x&&S>0;j.current=I;const _=d.useCallback(F=>{E(F),v&&zR(F,f,m??null)},[v,f,m]),A=d.useMemo(()=>({setPlayerMuted:b,setMediaVolume:_}),[_]),W=d.useMemo(()=>({logLevel:f,mountTime:Date.now()}),[f]),P=d.useMemo(()=>({isPlayer:!0,isRendering:!1,isStudio:!1,isClientSideRendering:!1,isReadOnlyStudio:!1}),[]);return c.jsx(fe.RemotionEnvironmentContext.Provider,{value:P,children:c.jsx(fe.LogLevelContext.Provider,{value:W,children:c.jsx(fe.CanUseRemotionHooksProvider,{children:c.jsx(fe.AbsoluteTimeContext.Provider,{value:t,children:c.jsx(fe.PlaybackRateContext.Provider,{value:n,children:c.jsx(fe.TimelineContext.Provider,{value:t,children:c.jsx(fe.CompositionManager.Provider,{value:y,children:c.jsx(fe.PrefetchProvider,{children:c.jsx(fe.DurationsContextProvider,{children:c.jsx(fe.MediaVolumeContext.Provider,{value:R,children:c.jsx(fe.SetMediaVolumeContext.Provider,{value:A,children:c.jsx(fe.BufferingProvider,{children:c.jsx(fe.SharedAudioContextProvider,{audioLatencyHint:p,audioEnabled:I,previewSampleRate:h,children:c.jsx(fe.SharedAudioTagsContextProvider,{numberOfAudioTags:l,children:e})})})})})})})})})})})})})})},ig=!1,OR=(e,t)=>{e||ig||(ig=!0,fe.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."))},sg=(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},BR=({inFrame:e,durationInFrames:t,outFrame:n})=>{const r=sg(e,"inFrame"),o=sg(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)}},WR=({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)}`)}},VR=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.")}},HR=Au.validateFps,ag=Au.validateDimension,UR=Au.validateDurationInFrames,ZR=Au.validateDefaultAndInputProps,KR=e=>"component"in e?e.component:null,YR=({durationInFrames:e,compositionHeight:t,compositionWidth:n,fps:r,inputProps:o,style:i,controls:s=!1,loop:a=!1,autoPlay:l=!1,showVolumeControls:u=!0,allowFullscreen:f=!0,clickToPlay:p,doubleClickToFullscreen:h=!1,spaceKeyToPlayOrPause:m=!0,moveToBeginningWhenEnded:w=!0,numberOfSharedAudioTags:g=5,errorFallback:k=()=>"⚠️",playbackRate:v=1,renderLoading:y,className:x,showPosterWhenUnplayed:b,showPosterWhenEnded:S,showPosterWhenPaused:E,showPosterWhenBuffering:R,showPosterWhenBufferingAndPaused:j,initialFrame:I,renderPoster:_,inFrame:A,outFrame:W,initiallyShowControls:P,renderFullscreenButton:F,renderPlayPauseButton:H,renderVolumeSlider:O,renderCustomControls:T,alwaysShowControls:C=!1,initiallyMuted:N=!1,showPlaybackRateControl:$=!1,posterFillMode:D="player-size",bufferStateDelayInMilliseconds:B,hideControlsWhenPointerDoesntMove:Z=!0,overflowVisible:L=!1,renderMuteButton:z,browserMediaControlsBehavior:Q,overrideInternalClassName:G,logLevel:V="info",noSuspense:K,acknowledgeRemotionLicense:de,audioLatencyHint:ge="playback",sampleRate:ce=48e3,volumePersistenceKey:se,initialVolume:ee,...q},J)=>{if(typeof window<"u"&&(window.remotion_isPlayer=!0),q.defaultProps!==void 0)throw new Error("The <Player /> component does not accept `defaultProps`, but some were passed. Use `inputProps` instead.");const ie=KR(q);if((ie==null?void 0:ie.type)===Nl)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(ie===Nl)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(()=>OR(!!de,V));const Me=fe.useLazyComponent({compProps:q,componentName:"Player",noSuspense:!!K});WR({initialFrame:I,durationInFrames:e});const[ke,be]=d.useState(()=>({[Up]:I??0})),[$e,xe]=d.useState(!1),[Te]=d.useState("player-comp"),Pe=d.useRef(null),Ee=d.useRef([]),Le=d.useRef(!1),[jt,zt]=d.useState(v);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(ag(t,"compositionHeight","of the <Player /> component"),ag(n,"compositionWidth","of the <Player /> component"),UR(e,{component:"of the <Player/> component",allowFloats:!1}),HR(r,"as a prop of the <Player/> component",!1),ZR(o,"inputProps",null),BR({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 h!="boolean"&&typeof h<"u")throw new TypeError(`'doubleClickToFullscreen' must be a boolean or undefined but got '${typeof h}' instead`);if(typeof u!="boolean"&&typeof u<"u")throw new TypeError(`'showVolumeControls' must be a boolean or undefined but got '${typeof u}' 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 m!="boolean"&&typeof m<"u")throw new TypeError(`'spaceKeyToPlayOrPause' must be a boolean or undefined but got '${typeof m}' instead`);if(typeof ce!="number"||!Number.isFinite(ce)||Number.isNaN(ce)||ce<=0||ce%1!==0)throw new TypeError(`'sampleRate' must be a positive integer but got '${ce}' instead`);if(typeof ee<"u"&&typeof ee!="number")throw new TypeError(`'initialVolume' must be a number or undefined but got '${typeof ee}' instead`);if(typeof ee=="number"&&(!Number.isFinite(ee)||Number.isNaN(ee)||ee<0||ee>1))throw new TypeError(`'initialVolume' must be between 0 and 1 but got '${ee}' instead`);if(typeof g!="number"||g%1!==0||!Number.isFinite(g)||Number.isNaN(g)||g<0)throw new TypeError(`'numberOfSharedAudioTags' must be an integer but got '${g}' instead`);VR(jt),d.useEffect(()=>{zt(v)},[v]),d.useImperativeHandle(J,()=>Pe.current,[]),d.useState(()=>{fe.playbackLogging({logLevel:V,message:`[player] Mounting <Player>. User agent = ${typeof navigator>"u"?"server":navigator.userAgent}`,tag:"player",mountTime:Date.now()})});const pn=d.useMemo(()=>({frame:ke,playing:$e,rootId:Te,imperativePlaying:Le,audioAndVideoTags:Ee}),[ke,$e,Te]),Dt=d.useMemo(()=>({playbackRate:jt,setPlaybackRate:zt}),[jt]),In=d.useMemo(()=>({setFrame:be,setPlaying:xe}),[be]);typeof window<"u"&&d.useLayoutEffect(()=>{fe.CSSUtils.injectCSS(fe.CSSUtils.makeDefaultPreviewCSS(`.${Hp(G)}`,"#fff"))},[G]);const Tn=d.useMemo(()=>o??{},[o]),Ze=d.useMemo(()=>Q??{mode:"prevent-media-session"},[Q]);return c.jsx(fe.IsPlayerContextProvider,{children:c.jsx(n1,{timelineContext:pn,playbackRateContext:Dt,component:Me,compositionHeight:t,compositionWidth:n,durationInFrames:e,fps:r,numberOfSharedAudioTags:g,initiallyMuted:N,logLevel:V,audioLatencyHint:ge,sampleRate:ce,volumePersistenceKey:se,initialVolume:ee,inputProps:Tn,audioEnabled:!0,children:c.jsx(fe.SetTimelineContext.Provider,{value:In,children:c.jsx(BT,{currentPlaybackRate:jt,children:c.jsx(LR,{ref:Pe,posterFillMode:D,renderLoading:y,autoPlay:!!l,loop:!!a,controls:!!s,errorFallback:k,style:i,inputProps:Tn,allowFullscreen:!!f,moveToBeginningWhenEnded:!!w,clickToPlay:typeof p=="boolean"?p:!!s,showVolumeControls:!!u,doubleClickToFullscreen:!!h,spaceKeyToPlayOrPause:!!m,playbackRate:jt,className:x??void 0,showPosterWhenUnplayed:!!b,showPosterWhenEnded:!!S,showPosterWhenPaused:!!E,showPosterWhenBuffering:!!R,showPosterWhenBufferingAndPaused:!!j,renderPoster:_,inFrame:A??null,outFrame:W??null,initiallyShowControls:P??!0,renderFullscreen:F??null,renderPlayPauseButton:H??null,renderMuteButton:z??null,renderVolumeSlider:O??null,renderCustomControls:T??null,alwaysShowControls:C,showPlaybackRateControl:$,bufferStateDelayInMilliseconds:B??300,hideControlsWhenPointerDoesntMove:Z,overflowVisible:L,browserMediaControlsBehavior:Ze,overrideInternalClassName:G??void 0,noSuspense:!!K})})})})})},GR=d.forwardRef,XR=GR(YR),qR=()=>{const e=d.useContext(qx);if(!e)throw new TypeError("Expected Player event emitter context");return d.useMemo(()=>({emitter:e}),[e])},df=oe.version.split(".")[0];if(df==="0")throw new Error(`Version ${df} of "react" is not supported by Remotion`);var QR=parseInt(df,10)>=18,JR=({style:e,inputProps:t,errorFallback:n,renderLoading:r,className:o,overflowVisible:i,noSuspense:s,overrideInternalClassName:a},l)=>{const u=fe.useUnsafeVideoConfig(),f=fe.useVideo(),p=d.useRef(null),h=Vp(p,{triggerOnWindowResize:!1,shouldApplyCssTransforms:!1}),m=d.useMemo(()=>!u||!h?null:Zx({canvasSize:h,compositionHeight:u.height,compositionWidth:u.width,previewSize:"auto"}),[h,u]),w=(m==null?void 0:m.scale)??1,g=qR();Qx(g.emitter),d.useImperativeHandle(l,()=>{const j={getContainerNode:()=>p.current,getScale:()=>w};return Object.assign(g.emitter,j)},[w,g.emitter]);const k=f?f.component:null,v=d.useMemo(()=>Kx({config:u,style:e,canvasSize:h,overflowVisible:i,layout:m}),[h,u,m,i,e]),y=d.useMemo(()=>Gx({config:u,layout:m,scale:w,overflowVisible:i}),[u,m,i,w]),x=d.useMemo(()=>Yx({config:u,layout:m,scale:w,overflowVisible:i}),[u,m,i,w]),b=d.useCallback(j=>{g.emitter.dispatchError(j)},[g.emitter]),S=d.useMemo(()=>r?r({height:v.height,width:v.width,isBuffering:!1}):null,[v.height,v.width,r]),E=d.useMemo(()=>({type:"scale",scale:w}),[w]);if(!u)return null;const R=c.jsx("div",{style:y,children:c.jsx("div",{style:x,className:Hp(a),children:k?c.jsx(Jx,{onError:b,errorFallback:n,children:c.jsx(fe.CurrentScaleContext.Provider,{value:E,children:c.jsx(k,{...(f==null?void 0:f.props)??{},...t??{}})})}):null})});return s||e1&&!QR?c.jsx("div",{ref:p,style:v,className:o,children:R}):c.jsx("div",{ref:p,style:v,className:o,children:c.jsx(d.Suspense,{fallback:S,children:R})})},ej=d.forwardRef(JR),tj=({frameToDisplay:e,style:t,inputProps:n,compositionHeight:r,compositionWidth:o,durationInFrames:i,fps:s,className:a,errorFallback:l=()=>"⚠️",renderLoading:u,overflowVisible:f=!1,overrideInternalClassName:p,logLevel:h="info",noSuspense:m,...w},g)=>{typeof window<"u"&&d.useLayoutEffect(()=>{window.remotion_isPlayer=!0},[]);const[k]=d.useState(()=>String(Co(null))),v=d.useRef(null),y=d.useMemo(()=>({playing:!1,frame:{[Up]:e},rootId:k,imperativePlaying:{current:!1},audioAndVideoTags:{current:[]}}),[e,k]),x=d.useMemo(()=>({playbackRate:1,setPlaybackRate:()=>{throw new Error("thumbnail")}}),[]);d.useImperativeHandle(g,()=>v.current,[]);const b=fe.useLazyComponent({compProps:w,componentName:"Thumbnail",noSuspense:!!m}),[S]=d.useState(()=>new OT),E=d.useMemo(()=>n??{},[n]);return c.jsx(fe.IsPlayerContextProvider,{children:c.jsx(n1,{timelineContext:y,playbackRateContext:x,component:b,compositionHeight:r,compositionWidth:o,durationInFrames:i,fps:s,numberOfSharedAudioTags:0,initiallyMuted:!0,logLevel:h,audioLatencyHint:"playback",sampleRate:48e3,inputProps:E,audioEnabled:!1,children:c.jsx(qx.Provider,{value:S,children:c.jsx(ej,{ref:v,className:a,errorFallback:l,inputProps:E,renderLoading:u,style:t,overflowVisible:f,overrideInternalClassName:p,noSuspense:!!m})})})})},nj=d.forwardRef;nj(tj);const fi=[1,1.5,2,4];function lg(e){return fi.find(t=>t>e+1e-9)??fi[fi.length-1]}function rj(e,t){switch(t){case"L":return e.playing&&e.rate>0?{rate:lg(e.rate),playing:!0}:{rate:fi[0],playing:!0};case"J":return e.playing&&e.rate<0?{rate:-lg(-e.rate),playing:!0}:{rate:-fi[0],playing:!0};case"K":return{rate:fi[0],playing:!e.playing}}}function Zp(e,t,n){const r=Math.round(e*n),o=Math.round(t*n);return{from:r,durationInFrames:Math.max(1,o-r)}}function oj(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 ij(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],u=l?e[a].srcIn-l.srcOut:0;a>0&&u>=r&&(s=!s);const f=t?t.allowed[a]!==!1:!0;i.push(s&&f?o:1)}return i}const sj=({src:e,spans:t,punchInScale:n=1.07,punch:r=null,punchThresholdSec:o=.15,audioFadeSec:i=.01,background:s="black"})=>{const{fps:a}=ft(),l=d.useMemo(()=>ij(t,r,n,o),[t,r,n,o]),u=Math.max(1,Math.round(i*a));return c.jsx(Dn,{style:{backgroundColor:s},children:t.map((f,p)=>{const{from:h,durationInFrames:m}=Zp(f.outIn,f.outOut,a);return c.jsx(Rt,{from:h,durationInFrames:m,premountFor:a,children:c.jsx(Dn,{style:{transform:`scale(${l[p]})`},children:c.jsx(Vx,{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)/u,(m-w)/u))})})},p)})})};function Y(e,t,n){function r(a,l){var u;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(u=a._zod).traits??(u.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 u=n!=null&&n.Parent?new i:this;r(u,a),(l=u._zod).deferred??(l.deferred=[]);for(const f of u._zod.deferred)f();return u}return Object.defineProperty(s,"init",{value:r}),Object.defineProperty(s,Symbol.hasInstance,{value:a=>{var l,u;return n!=null&&n.Parent&&a instanceof n.Parent?!0:(u=(l=a==null?void 0:a._zod)==null?void 0:l.traits)==null?void 0:u.has(e)}}),Object.defineProperty(s,"name",{value:e}),s}class zs extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const r1={};function Hr(e){return r1}function aj(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 lj(e,t){return typeof t=="bigint"?t.toString():t}function o1(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Kp(e){return e==null}function Yp(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function uj(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 qe(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 Gp(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function qi(e){return JSON.stringify(e)}const i1=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function ff(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const cj=o1(()=>{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 Wl(e){if(ff(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(ff(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}const dj=new Set(["string","number","symbol"]);function Lu(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function jo(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 pe(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 fj(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const pj={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 hj(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 jo(e,{...e._zod.def,shape:n,checks:[]})}function mj(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 jo(e,{...e._zod.def,shape:n,checks:[]})}function gj(e,t){if(!Wl(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 Gp(this,"shape",r),r},checks:[]};return jo(e,n)}function vj(e,t){return jo(e,{...e._zod.def,get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return Gp(this,"shape",n),n},catchall:t._zod.def.catchall,checks:[]})}function yj(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 jo(t,{...t._zod.def,shape:o,checks:[]})}function wj(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 jo(t,{...t._zod.def,shape:o,checks:[]})}function ms(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 uo(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function $a(e){return typeof e=="string"?e:e==null?void 0:e.message}function Ur(e,t,n){var o,i,s,a,l,u;const r={...e,path:e.path??[]};if(!e.message){const f=$a((s=(i=(o=e.inst)==null?void 0:o._zod.def)==null?void 0:i.error)==null?void 0:s.call(i,e))??$a((a=t==null?void 0:t.error)==null?void 0:a.call(t,e))??$a((l=n.customError)==null?void 0:l.call(n,e))??$a((u=n.localeError)==null?void 0:u.call(n,e))??"Invalid input";r.message=f}return delete r.inst,delete r.continue,t!=null&&t.reportInput||delete r.input,r}function Xp(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Ds(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const s1=(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,lj,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},a1=Y("$ZodError",s1),l1=Y("$ZodError",s1,{Parent:Error});function xj(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 bj(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 u=s.path[l];l===s.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(n(s))):a[u]=a[u]||{_errors:[]},a=a[u],l++}}};return o(e),r}const Sj=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=>Ur(l,i,Hr())));throw i1(a,o==null?void 0:o.callee),a}return s.value},kj=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=>Ur(l,i,Hr())));throw i1(a,o==null?void 0:o.callee),a}return s.value},u1=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??a1)(i.issues.map(s=>Ur(s,o,Hr())))}:{success:!0,data:i.value}},Ej=u1(l1),c1=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=>Ur(s,o,Hr())))}:{success:!0,data:i.value}},Cj=c1(l1),Ij=/^[cC][^\s-]{8,}$/,Tj=/^[0-9a-z]+$/,Rj=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,jj=/^[0-9a-vA-V]{20}$/,Pj=/^[A-Za-z0-9]{27}$/,Fj=/^[a-zA-Z0-9_-]{21}$/,_j=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Mj=/^([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})$/,ug=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)$/,$j=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Aj="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Nj(){return new RegExp(Aj,"u")}const Lj=/^(?:(?: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])$/,zj=/^(([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})$/,Dj=/^((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])$/,Oj=/^(([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])$/,Bj=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,d1=/^[A-Za-z0-9_-]*$/,Wj=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,Vj=/^\+(?:[0-9]){6,14}[0-9]$/,f1="(?:(?:\\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])))",Hj=new RegExp(`^${f1}$`);function p1(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 Uj(e){return new RegExp(`^${p1(e)}$`)}function Zj(e){const t=p1({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(`^${f1}T(?:${r})$`)}const Kj=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}$`)},Yj=/^\d+$/,Gj=/^-?\d+(?:\.\d+)?/i,Xj=/true|false/i,qj=/^[^A-Z]*$/,Qj=/^[^a-z]*$/,Jt=Y("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),h1={number:"number",bigint:"bigint",object:"date"},m1=Y("$ZodCheckLessThan",(e,t)=>{Jt.init(e,t);const n=h1[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})}}),g1=Y("$ZodCheckGreaterThan",(e,t)=>{Jt.init(e,t);const n=h1[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})}}),Jj=Y("$ZodCheckMultipleOf",(e,t)=>{Jt.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):uj(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})}}),eP=Y("$ZodCheckNumberFormat",(e,t)=>{var s;Jt.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]=pj[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=Yj)}),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})}}),tP=Y("$ZodCheckMaxLength",(e,t)=>{var n;Jt.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Kp(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=Xp(o);r.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),nP=Y("$ZodCheckMinLength",(e,t)=>{var n;Jt.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Kp(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=Xp(o);r.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),rP=Y("$ZodCheckLengthEquals",(e,t)=>{var n;Jt.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Kp(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=Xp(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=Y("$ZodCheckStringFormat",(e,t)=>{var n,r;Jt.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=()=>{})}),oP=Y("$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})}}),iP=Y("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=qj),zu.init(e,t)}),sP=Y("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Qj),zu.init(e,t)}),aP=Y("$ZodCheckIncludes",(e,t)=>{Jt.init(e,t);const n=Lu(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})}}),lP=Y("$ZodCheckStartsWith",(e,t)=>{Jt.init(e,t);const n=new RegExp(`^${Lu(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})}}),uP=Y("$ZodCheckEndsWith",(e,t)=>{Jt.init(e,t);const n=new RegExp(`.*${Lu(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})}}),cP=Y("$ZodCheckOverwrite",(e,t)=>{Jt.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class dP{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
+ `).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 fP={major:4,minor:0,patch:0},nt=Y("$ZodType",(e,t)=>{var o;var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=fP;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 u=ms(s),f;for(const p of a){if(p._zod.def.when){if(!p._zod.def.when(s))continue}else if(u)continue;const h=s.issues.length,m=p._zod.check(s);if(m instanceof Promise&&(l==null?void 0:l.async)===!1)throw new zs;if(f||m instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await m,s.issues.length!==h&&(u||(u=ms(s,h)))});else{if(s.issues.length===h)continue;u||(u=ms(s,h))}}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(u=>i(u,r,a))}return i(l,r,a)}}e["~standard"]={validate:i=>{var s;try{const a=Ej(e,i);return a.success?{value:a.data}:{issues:(s=a.error)==null?void 0:s.issues}}catch{return Cj(e,i).then(l=>{var u;return l.success?{value:l.data}:{issues:(u=l.error)==null?void 0:u.issues}})}},vendor:"zod",version:1}}),qp=Y("$ZodString",(e,t)=>{var n;nt.init(e,t),e._zod.pattern=[...((n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)??[]].pop()??Kj(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}}),Qe=Y("$ZodStringFormat",(e,t)=>{zu.init(e,t),qp.init(e,t)}),pP=Y("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Mj),Qe.init(e,t)}),hP=Y("$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=ug(r))}else t.pattern??(t.pattern=ug());Qe.init(e,t)}),mP=Y("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=$j),Qe.init(e,t)}),gP=Y("$ZodURL",(e,t)=>{Qe.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:Wj.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})}}}),vP=Y("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Nj()),Qe.init(e,t)}),yP=Y("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Fj),Qe.init(e,t)}),wP=Y("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Ij),Qe.init(e,t)}),xP=Y("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Tj),Qe.init(e,t)}),bP=Y("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Rj),Qe.init(e,t)}),SP=Y("$ZodXID",(e,t)=>{t.pattern??(t.pattern=jj),Qe.init(e,t)}),kP=Y("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Pj),Qe.init(e,t)}),EP=Y("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Zj(t)),Qe.init(e,t)}),CP=Y("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Hj),Qe.init(e,t)}),IP=Y("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Uj(t)),Qe.init(e,t)}),TP=Y("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=_j),Qe.init(e,t)}),RP=Y("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Lj),Qe.init(e,t),e._zod.onattach.push(n=>{const r=n._zod.bag;r.format="ipv4"})}),jP=Y("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=zj),Qe.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})}}}),PP=Y("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Dj),Qe.init(e,t)}),FP=Y("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Oj),Qe.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 v1(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const _P=Y("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Bj),Qe.init(e,t),e._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64"}),e._zod.check=n=>{v1(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function MP(e){if(!d1.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return v1(n)}const $P=Y("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=d1),Qe.init(e,t),e._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64url"}),e._zod.check=n=>{MP(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),AP=Y("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Vj),Qe.init(e,t)});function NP(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 LP=Y("$ZodJWT",(e,t)=>{Qe.init(e,t),e._zod.check=n=>{NP(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),y1=Y("$ZodNumber",(e,t)=>{nt.init(e,t),e._zod.pattern=e._zod.bag.pattern??Gj,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}}),zP=Y("$ZodNumber",(e,t)=>{eP.init(e,t),y1.init(e,t)}),DP=Y("$ZodBoolean",(e,t)=>{nt.init(e,t),e._zod.pattern=Xj,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}}),OP=Y("$ZodUnknown",(e,t)=>{nt.init(e,t),e._zod.parse=n=>n}),BP=Y("$ZodNever",(e,t)=>{nt.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function cg(e,t,n){e.issues.length&&t.issues.push(...uo(n,e.issues)),t.value[n]=e.value}const WP=Y("$ZodArray",(e,t)=>{nt.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(u=>cg(u,n,s))):cg(l,n,s)}return i.length?Promise.all(i).then(()=>n):n}});function Aa(e,t,n){e.issues.length&&t.issues.push(...uo(n,e.issues)),t.value[n]=e.value}function dg(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(...uo(n,e.issues)):e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}const VP=Y("$ZodObject",(e,t)=>{nt.init(e,t);const n=o1(()=>{const p=Object.keys(t.shape);for(const m of p)if(!(t.shape[m]instanceof nt))throw new Error(`Invalid element at key "${m}": expected a Zod schema`);const h=fj(t.shape);return{shape:t.shape,keys:p,keySet:new Set(p),numKeys:p.length,optionalKeys:new Set(h)}});qe(e._zod,"propValues",()=>{const p=t.shape,h={};for(const m in p){const w=p[m]._zod;if(w.values){h[m]??(h[m]=new Set);for(const g of w.values)h[m].add(g)}}return h});const r=p=>{const h=new dP(["shape","payload","ctx"]),m=n.value,w=y=>{const x=qi(y);return`shape[${x}]._zod.run({ value: input[${x}], issues: [] }, ctx)`};h.write("const input = payload.value;");const g=Object.create(null);let k=0;for(const y of m.keys)g[y]=`key_${k++}`;h.write("const newResult = {}");for(const y of m.keys)if(m.optionalKeys.has(y)){const x=g[y];h.write(`const ${x} = ${w(y)};`);const b=qi(y);h.write(`
137
+ if (${x}.issues.length) {
138
+ if (input[${b}] === undefined) {
139
+ if (${b} in input) {
140
+ newResult[${b}] = undefined;
141
+ }
142
+ } else {
143
+ payload.issues = payload.issues.concat(
144
+ ${x}.issues.map((iss) => ({
145
+ ...iss,
146
+ path: iss.path ? [${b}, ...iss.path] : [${b}],
147
+ }))
148
+ );
149
+ }
150
+ } else if (${x}.value === undefined) {
151
+ if (${b} in input) newResult[${b}] = undefined;
152
+ } else {
153
+ newResult[${b}] = ${x}.value;
154
+ }
155
+ `)}else{const x=g[y];h.write(`const ${x} = ${w(y)};`),h.write(`
156
+ if (${x}.issues.length) payload.issues = payload.issues.concat(${x}.issues.map(iss => ({
157
+ ...iss,
158
+ path: iss.path ? [${qi(y)}, ...iss.path] : [${qi(y)}]
159
+ })));`),h.write(`newResult[${qi(y)}] = ${x}.value`)}h.write("payload.value = newResult;"),h.write("return payload;");const v=h.compile();return(y,x)=>v(p,y,x)};let o;const i=ff,s=!r1.jitless,l=s&&cj.value,u=t.catchall;let f;e._zod.parse=(p,h)=>{f??(f=n.value);const m=p.value;if(!i(m))return p.issues.push({expected:"object",code:"invalid_type",input:m,inst:e}),p;const w=[];if(s&&l&&(h==null?void 0:h.async)===!1&&h.jitless!==!0)o||(o=r(t.shape)),p=o(p,h);else{p.value={};const x=f.shape;for(const b of f.keys){const S=x[b],E=S._zod.run({value:m[b],issues:[]},h),R=S._zod.optin==="optional"&&S._zod.optout==="optional";E instanceof Promise?w.push(E.then(j=>R?dg(j,p,b,m):Aa(j,p,b))):R?dg(E,p,b,m):Aa(E,p,b)}}if(!u)return w.length?Promise.all(w).then(()=>p):p;const g=[],k=f.keySet,v=u._zod,y=v.def.type;for(const x of Object.keys(m)){if(k.has(x))continue;if(y==="never"){g.push(x);continue}const b=v.run({value:m[x],issues:[]},h);b instanceof Promise?w.push(b.then(S=>Aa(S,p,x))):Aa(b,p,x)}return g.length&&p.issues.push({code:"unrecognized_keys",keys:g,input:m,inst:e}),w.length?Promise.all(w).then(()=>p):p}});function fg(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=>Ur(i,r,Hr())))}),t}const HP=Y("$ZodUnion",(e,t)=>{nt.init(e,t),qe(e._zod,"optin",()=>t.options.some(n=>n._zod.optin==="optional")?"optional":void 0),qe(e._zod,"optout",()=>t.options.some(n=>n._zod.optout==="optional")?"optional":void 0),qe(e._zod,"values",()=>{if(t.options.every(n=>n._zod.values))return new Set(t.options.flatMap(n=>Array.from(n._zod.values)))}),qe(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=>Yp(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=>fg(s,n,e,r)):fg(i,n,e,r)}}),UP=Y("$ZodIntersection",(e,t)=>{nt.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,u])=>pg(n,l,u)):pg(n,i,s)}});function pf(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(Wl(e)&&Wl(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=pf(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=pf(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),ms(e))return e;const r=pf(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 ZP=Y("$ZodRecord",(e,t)=>{nt.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Wl(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 u=t.valueType._zod.run({value:o[l],issues:[]},r);u instanceof Promise?i.push(u.then(f=>{f.issues.length&&n.issues.push(...uo(l,f.issues)),n.value[l]=f.value})):(u.issues.length&&n.issues.push(...uo(l,u.issues)),n.value[l]=u.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(u=>Ur(u,r,Hr())),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(u=>{u.issues.length&&n.issues.push(...uo(s,u.issues)),n.value[a.value]=u.value})):(l.issues.length&&n.issues.push(...uo(s,l.issues)),n.value[a.value]=l.value)}}return i.length?Promise.all(i).then(()=>n):n}}),KP=Y("$ZodEnum",(e,t)=>{nt.init(e,t);const n=aj(t.entries);e._zod.values=new Set(n),e._zod.pattern=new RegExp(`^(${n.filter(r=>dj.has(typeof r)).map(r=>typeof r=="string"?Lu(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}}),YP=Y("$ZodTransform",(e,t)=>{nt.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}}),GP=Y("$ZodOptional",(e,t)=>{nt.init(e,t),e._zod.optin="optional",e._zod.optout="optional",qe(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),qe(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Yp(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)}),XP=Y("$ZodNullable",(e,t)=>{nt.init(e,t),qe(e._zod,"optin",()=>t.innerType._zod.optin),qe(e._zod,"optout",()=>t.innerType._zod.optout),qe(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Yp(n.source)}|null)$`):void 0}),qe(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)}),qP=Y("$ZodDefault",(e,t)=>{nt.init(e,t),e._zod.optin="optional",qe(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=>hg(i,t)):hg(o,t)}});function hg(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const QP=Y("$ZodPrefault",(e,t)=>{nt.init(e,t),e._zod.optin="optional",qe(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))}),JP=Y("$ZodNonOptional",(e,t)=>{nt.init(e,t),qe(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=>mg(i,e)):mg(o,e)}});function mg(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 eF=Y("$ZodCatch",(e,t)=>{nt.init(e,t),e._zod.optin="optional",qe(e._zod,"optout",()=>t.innerType._zod.optout),qe(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=>Ur(s,r,Hr()))},input:n.value}),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(i=>Ur(i,r,Hr()))},input:n.value}),n.issues=[]),n)}}),tF=Y("$ZodPipe",(e,t)=>{nt.init(e,t),qe(e._zod,"values",()=>t.in._zod.values),qe(e._zod,"optin",()=>t.in._zod.optin),qe(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=>gg(i,t,r)):gg(o,t,r)}});function gg(e,t,n){return ms(e)?e:t.out._zod.run({value:e.value,issues:e.issues},n)}const nF=Y("$ZodReadonly",(e,t)=>{nt.init(e,t),qe(e._zod,"propValues",()=>t.innerType._zod.propValues),qe(e._zod,"values",()=>t.innerType._zod.values),qe(e._zod,"optin",()=>t.innerType._zod.optin),qe(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(vg):vg(o)}});function vg(e){return e.value=Object.freeze(e.value),e}const rF=Y("$ZodCustom",(e,t)=>{Jt.init(e,t),nt.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=>yg(i,n,r,e));yg(o,n,r,e)}});function yg(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(Ds(o))}}class oF{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 iF(){return new oF}const Na=iF();function sF(e,t){return new e({type:"string",...pe(t)})}function aF(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...pe(t)})}function wg(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...pe(t)})}function lF(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...pe(t)})}function uF(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...pe(t)})}function cF(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...pe(t)})}function dF(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...pe(t)})}function fF(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...pe(t)})}function pF(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...pe(t)})}function hF(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...pe(t)})}function mF(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...pe(t)})}function gF(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...pe(t)})}function vF(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...pe(t)})}function yF(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...pe(t)})}function wF(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...pe(t)})}function xF(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...pe(t)})}function bF(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...pe(t)})}function SF(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...pe(t)})}function kF(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...pe(t)})}function EF(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...pe(t)})}function CF(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...pe(t)})}function IF(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...pe(t)})}function TF(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...pe(t)})}function RF(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...pe(t)})}function jF(e,t){return new e({type:"string",format:"date",check:"string_format",...pe(t)})}function PF(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...pe(t)})}function FF(e,t){return new e({type:"string",format:"duration",check:"string_format",...pe(t)})}function _F(e,t){return new e({type:"number",checks:[],...pe(t)})}function MF(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...pe(t)})}function $F(e,t){return new e({type:"boolean",...pe(t)})}function AF(e){return new e({type:"unknown"})}function NF(e,t){return new e({type:"never",...pe(t)})}function xg(e,t){return new m1({check:"less_than",...pe(t),value:e,inclusive:!1})}function _c(e,t){return new m1({check:"less_than",...pe(t),value:e,inclusive:!0})}function bg(e,t){return new g1({check:"greater_than",...pe(t),value:e,inclusive:!1})}function Mc(e,t){return new g1({check:"greater_than",...pe(t),value:e,inclusive:!0})}function Sg(e,t){return new Jj({check:"multiple_of",...pe(t),value:e})}function w1(e,t){return new tP({check:"max_length",...pe(t),maximum:e})}function Vl(e,t){return new nP({check:"min_length",...pe(t),minimum:e})}function x1(e,t){return new rP({check:"length_equals",...pe(t),length:e})}function LF(e,t){return new oP({check:"string_format",format:"regex",...pe(t),pattern:e})}function zF(e){return new iP({check:"string_format",format:"lowercase",...pe(e)})}function DF(e){return new sP({check:"string_format",format:"uppercase",...pe(e)})}function OF(e,t){return new aP({check:"string_format",format:"includes",...pe(t),includes:e})}function BF(e,t){return new lP({check:"string_format",format:"starts_with",...pe(t),prefix:e})}function WF(e,t){return new uP({check:"string_format",format:"ends_with",...pe(t),suffix:e})}function ia(e){return new cP({check:"overwrite",tx:e})}function VF(e){return ia(t=>t.normalize(e))}function HF(){return ia(e=>e.trim())}function UF(){return ia(e=>e.toLowerCase())}function ZF(){return ia(e=>e.toUpperCase())}function KF(e,t,n){return new e({type:"array",element:t,...pe(n)})}function YF(e,t,n){return new e({type:"custom",check:"custom",fn:t,...pe(n)})}const GF=Y("ZodISODateTime",(e,t)=>{EP.init(e,t),rt.init(e,t)});function XF(e){return RF(GF,e)}const qF=Y("ZodISODate",(e,t)=>{CP.init(e,t),rt.init(e,t)});function QF(e){return jF(qF,e)}const JF=Y("ZodISOTime",(e,t)=>{IP.init(e,t),rt.init(e,t)});function e_(e){return PF(JF,e)}const t_=Y("ZodISODuration",(e,t)=>{TP.init(e,t),rt.init(e,t)});function n_(e){return FF(t_,e)}const r_=(e,t)=>{a1.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>bj(e,n)},flatten:{value:n=>xj(e,n)},addIssue:{value:n=>e.issues.push(n)},addIssues:{value:n=>e.issues.push(...n)},isEmpty:{get(){return e.issues.length===0}}})},Du=Y("ZodError",r_,{Parent:Error}),o_=Sj(Du),i_=kj(Du),s_=u1(Du),a_=c1(Du),ut=Y("ZodType",(e,t)=>(nt.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)=>jo(e,n,r),e.brand=()=>e,e.register=(n,r)=>(n.add(e,r),e),e.parse=(n,r)=>o_(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>s_(e,n,r),e.parseAsync=async(n,r)=>i_(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>a_(e,n,r),e.spa=e.safeParseAsync,e.refine=(n,r)=>e.check(Q_(n,r)),e.superRefine=n=>e.check(J_(n)),e.overwrite=n=>e.check(ia(n)),e.optional=()=>Cg(e),e.nullable=()=>Ig(e),e.nullish=()=>Cg(Ig(e)),e.nonoptional=n=>H_(e,n),e.array=()=>Qn(e),e.or=n=>k1([e,n]),e.and=n=>A_(e,n),e.transform=n=>Tg(e,z_(n)),e.default=n=>B_(e,n),e.prefault=n=>V_(e,n),e.catch=n=>Z_(e,n),e.pipe=n=>Tg(e,n),e.readonly=()=>G_(e),e.describe=n=>{const r=e.clone();return Na.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){var n;return(n=Na.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Na.get(e);const r=e.clone();return Na.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),b1=Y("_ZodString",(e,t)=>{qp.init(e,t),ut.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(LF(...r)),e.includes=(...r)=>e.check(OF(...r)),e.startsWith=(...r)=>e.check(BF(...r)),e.endsWith=(...r)=>e.check(WF(...r)),e.min=(...r)=>e.check(Vl(...r)),e.max=(...r)=>e.check(w1(...r)),e.length=(...r)=>e.check(x1(...r)),e.nonempty=(...r)=>e.check(Vl(1,...r)),e.lowercase=r=>e.check(zF(r)),e.uppercase=r=>e.check(DF(r)),e.trim=()=>e.check(HF()),e.normalize=(...r)=>e.check(VF(...r)),e.toLowerCase=()=>e.check(UF()),e.toUpperCase=()=>e.check(ZF())}),l_=Y("ZodString",(e,t)=>{qp.init(e,t),b1.init(e,t),e.email=n=>e.check(aF(u_,n)),e.url=n=>e.check(fF(c_,n)),e.jwt=n=>e.check(TF(C_,n)),e.emoji=n=>e.check(pF(d_,n)),e.guid=n=>e.check(wg(kg,n)),e.uuid=n=>e.check(lF(La,n)),e.uuidv4=n=>e.check(uF(La,n)),e.uuidv6=n=>e.check(cF(La,n)),e.uuidv7=n=>e.check(dF(La,n)),e.nanoid=n=>e.check(hF(f_,n)),e.guid=n=>e.check(wg(kg,n)),e.cuid=n=>e.check(mF(p_,n)),e.cuid2=n=>e.check(gF(h_,n)),e.ulid=n=>e.check(vF(m_,n)),e.base64=n=>e.check(EF(S_,n)),e.base64url=n=>e.check(CF(k_,n)),e.xid=n=>e.check(yF(g_,n)),e.ksuid=n=>e.check(wF(v_,n)),e.ipv4=n=>e.check(xF(y_,n)),e.ipv6=n=>e.check(bF(w_,n)),e.cidrv4=n=>e.check(SF(x_,n)),e.cidrv6=n=>e.check(kF(b_,n)),e.e164=n=>e.check(IF(E_,n)),e.datetime=n=>e.check(XF(n)),e.date=n=>e.check(QF(n)),e.time=n=>e.check(e_(n)),e.duration=n=>e.check(n_(n))});function me(e){return sF(l_,e)}const rt=Y("ZodStringFormat",(e,t)=>{Qe.init(e,t),b1.init(e,t)}),u_=Y("ZodEmail",(e,t)=>{mP.init(e,t),rt.init(e,t)}),kg=Y("ZodGUID",(e,t)=>{pP.init(e,t),rt.init(e,t)}),La=Y("ZodUUID",(e,t)=>{hP.init(e,t),rt.init(e,t)}),c_=Y("ZodURL",(e,t)=>{gP.init(e,t),rt.init(e,t)}),d_=Y("ZodEmoji",(e,t)=>{vP.init(e,t),rt.init(e,t)}),f_=Y("ZodNanoID",(e,t)=>{yP.init(e,t),rt.init(e,t)}),p_=Y("ZodCUID",(e,t)=>{wP.init(e,t),rt.init(e,t)}),h_=Y("ZodCUID2",(e,t)=>{xP.init(e,t),rt.init(e,t)}),m_=Y("ZodULID",(e,t)=>{bP.init(e,t),rt.init(e,t)}),g_=Y("ZodXID",(e,t)=>{SP.init(e,t),rt.init(e,t)}),v_=Y("ZodKSUID",(e,t)=>{kP.init(e,t),rt.init(e,t)}),y_=Y("ZodIPv4",(e,t)=>{RP.init(e,t),rt.init(e,t)}),w_=Y("ZodIPv6",(e,t)=>{jP.init(e,t),rt.init(e,t)}),x_=Y("ZodCIDRv4",(e,t)=>{PP.init(e,t),rt.init(e,t)}),b_=Y("ZodCIDRv6",(e,t)=>{FP.init(e,t),rt.init(e,t)}),S_=Y("ZodBase64",(e,t)=>{_P.init(e,t),rt.init(e,t)}),k_=Y("ZodBase64URL",(e,t)=>{$P.init(e,t),rt.init(e,t)}),E_=Y("ZodE164",(e,t)=>{AP.init(e,t),rt.init(e,t)}),C_=Y("ZodJWT",(e,t)=>{LP.init(e,t),rt.init(e,t)}),S1=Y("ZodNumber",(e,t)=>{y1.init(e,t),ut.init(e,t),e.gt=(r,o)=>e.check(bg(r,o)),e.gte=(r,o)=>e.check(Mc(r,o)),e.min=(r,o)=>e.check(Mc(r,o)),e.lt=(r,o)=>e.check(xg(r,o)),e.lte=(r,o)=>e.check(_c(r,o)),e.max=(r,o)=>e.check(_c(r,o)),e.int=r=>e.check(Eg(r)),e.safe=r=>e.check(Eg(r)),e.positive=r=>e.check(bg(0,r)),e.nonnegative=r=>e.check(Mc(0,r)),e.negative=r=>e.check(xg(0,r)),e.nonpositive=r=>e.check(_c(0,r)),e.multipleOf=(r,o)=>e.check(Sg(r,o)),e.step=(r,o)=>e.check(Sg(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 ve(e){return _F(S1,e)}const I_=Y("ZodNumberFormat",(e,t)=>{zP.init(e,t),S1.init(e,t)});function Eg(e){return MF(I_,e)}const T_=Y("ZodBoolean",(e,t)=>{DP.init(e,t),ut.init(e,t)});function Ln(e){return $F(T_,e)}const R_=Y("ZodUnknown",(e,t)=>{OP.init(e,t),ut.init(e,t)});function bi(){return AF(R_)}const j_=Y("ZodNever",(e,t)=>{BP.init(e,t),ut.init(e,t)});function P_(e){return NF(j_,e)}const F_=Y("ZodArray",(e,t)=>{WP.init(e,t),ut.init(e,t),e.element=t.element,e.min=(n,r)=>e.check(Vl(n,r)),e.nonempty=n=>e.check(Vl(1,n)),e.max=(n,r)=>e.check(w1(n,r)),e.length=(n,r)=>e.check(x1(n,r)),e.unwrap=()=>e.element});function Qn(e,t){return KF(F_,e,t)}const __=Y("ZodObject",(e,t)=>{VP.init(e,t),ut.init(e,t),qe(e,"shape",()=>t.shape),e.keyof=()=>Po(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:bi()}),e.loose=()=>e.clone({...e._zod.def,catchall:bi()}),e.strict=()=>e.clone({...e._zod.def,catchall:P_()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>gj(e,n),e.merge=n=>vj(e,n),e.pick=n=>hj(e,n),e.omit=n=>mj(e,n),e.partial=(...n)=>yj(E1,e,n[0]),e.required=(...n)=>wj(C1,e,n[0])});function Ie(e,t){const n={type:"object",get shape(){return Gp(this,"shape",{...e}),this.shape},...pe(t)};return new __(n)}const M_=Y("ZodUnion",(e,t)=>{HP.init(e,t),ut.init(e,t),e.options=t.options});function k1(e,t){return new M_({type:"union",options:e,...pe(t)})}const $_=Y("ZodIntersection",(e,t)=>{UP.init(e,t),ut.init(e,t)});function A_(e,t){return new $_({type:"intersection",left:e,right:t})}const N_=Y("ZodRecord",(e,t)=>{ZP.init(e,t),ut.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function Yn(e,t,n){return new N_({type:"record",keyType:e,valueType:t,...pe(n)})}const hf=Y("ZodEnum",(e,t)=>{KP.init(e,t),ut.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 hf({...t,checks:[],...pe(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 hf({...t,checks:[],...pe(o),entries:i})}});function Po(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new hf({type:"enum",entries:n,...pe(t)})}const L_=Y("ZodTransform",(e,t)=>{YP.init(e,t),ut.init(e,t),e._zod.parse=(n,r)=>{n.addIssue=i=>{if(typeof i=="string")n.issues.push(Ds(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(Ds(s))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n)):(n.value=o,n)}});function z_(e){return new L_({type:"transform",transform:e})}const E1=Y("ZodOptional",(e,t)=>{GP.init(e,t),ut.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Cg(e){return new E1({type:"optional",innerType:e})}const D_=Y("ZodNullable",(e,t)=>{XP.init(e,t),ut.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Ig(e){return new D_({type:"nullable",innerType:e})}const O_=Y("ZodDefault",(e,t)=>{qP.init(e,t),ut.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function B_(e,t){return new O_({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const W_=Y("ZodPrefault",(e,t)=>{QP.init(e,t),ut.init(e,t),e.unwrap=()=>e._zod.def.innerType});function V_(e,t){return new W_({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const C1=Y("ZodNonOptional",(e,t)=>{JP.init(e,t),ut.init(e,t),e.unwrap=()=>e._zod.def.innerType});function H_(e,t){return new C1({type:"nonoptional",innerType:e,...pe(t)})}const U_=Y("ZodCatch",(e,t)=>{eF.init(e,t),ut.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Z_(e,t){return new U_({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const K_=Y("ZodPipe",(e,t)=>{tF.init(e,t),ut.init(e,t),e.in=t.in,e.out=t.out});function Tg(e,t){return new K_({type:"pipe",in:e,out:t})}const Y_=Y("ZodReadonly",(e,t)=>{nF.init(e,t),ut.init(e,t)});function G_(e){return new Y_({type:"readonly",innerType:e})}const X_=Y("ZodCustom",(e,t)=>{rF.init(e,t),ut.init(e,t)});function q_(e){const t=new Jt({check:"custom"});return t._zod.check=e,t}function Q_(e,t={}){return YF(X_,e,t)}function J_(e){const t=q_(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(Ds(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(Ds(o))}},e(n.value,n)));return t}const Ou=Po(["full-bleed","video-top","pip-bubble","graphic-only","blurred-behind","lower-third","split-left","split-right"]),Bu=Po(["TitleCard","StatCard","RuleCard","StrikethroughReveal","FlowDiagram","TerminalMock","ChatMock","ScreenshotFrame","BulletList"]),eM=Ie({startWord:ve().int().nonnegative(),endWord:ve().int().nonnegative()});Ie({id:me(),anchor:eM,layout:Ou,component:Bu,props:Yn(me(),bi()),overrides:Yn(me(),bi()).default({}),rationale:me().optional()});Ie({id:me(),kind:Po(["graphic","plain"]).optional(),layout:Ou,component:Bu.optional(),props:Yn(me(),bi()).optional(),startSec:ve().nonnegative(),endSec:ve().nonnegative(),graphicRect:Ie({x:ve(),y:ve(),w:ve(),h:ve()}).optional(),elements:Yn(me(),Ie({dx:ve().optional(),dy:ve().optional(),scale:ve().positive().optional(),hidden:Ln().optional()})).optional(),video:Ie({scale:ve().positive().max(4).optional(),dy:ve().optional(),dx:ve().optional(),autoZoom:Ln().optional()}).optional(),pip:Ie({cornerRadius:ve().min(0).max(1).optional(),x:ve().min(0).max(1).optional(),y:ve().min(0).max(1).optional()}).optional(),captionY:ve().min(0).max(1).optional(),captionScale:ve().min(.2).max(3).optional(),pinned:Ln().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'})});Ie({centerYFrac:ve().min(0).max(1),sizeFrac:ve().min(0).max(1).optional(),centerXFrac:ve().min(0).max(1).optional(),sourceAspect:ve().positive().optional(),subject:Po(["face","screen"]).optional()});const Qp=Ie({bg:me().default("#0B0B0E"),fg:me().default("#FFFFFF"),accent:me().default("#FFE14D"),muted:me().default("#9A9AA3"),success:me().default("#5FBF77"),cardBg:me().default("#15151B"),cardBorder:me().default("#2A2A33"),danger:me().default("#FF5C5C"),radiusPx:ve().default(24),fontDisplay:me().default("'Inter', 'Helvetica Neue', 'Arial Black', Arial, sans-serif"),fontMono:me().default("'SF Mono', 'Cascadia Code', Consolas, monospace")}),tM=Qp.parse({}),nM=Ie({eyebrow:me().max(28).optional(),title:me().min(1).max(48).describe("the claim WITHOUT the emphasis token — never repeat the emphasis here"),emphasis:me().max(16).optional().describe("the number/punch token pulled OUT of the title (e.g. '861%') — not a duplicate of it"),sub:me().max(64).optional()}),rM=Ie({label:me().min(1).max(28),value:me().min(1).max(12),caption:me().max(40).optional(),inverted:Ln().default(!1)}),oM=Ie({kicker:me().min(1).max(24),text:me().min(1).max(40),struck:me().max(40).optional()}),iM=Ie({lines:Qn(Ie({text:me().min(1).max(32),struck:Ln().default(!1),mark:Po(["none","cross","check"]).default("none")})).min(1).max(4)}),sM=Ie({title:me().max(28).optional(),items:Qn(me().min(1).max(36)).min(2).max(5)}),aM=Ie({nodes:Qn(me().min(1).max(16)).min(2).max(5),emphasizeLast:Ln().default(!0)}),lM=Ie({windows:Qn(Ie({title:me().max(24),lines:Qn(me().max(40)).min(1).max(6)})).min(1).max(5),fanOut:me().max(20).optional()}),uM=Ie({messages:Qn(Ie({from:Po(["user","agent"]),text:me().min(1).max(60)})).min(1).max(4),keyword:me().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'.")}),cM=Ie({src:me().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:me().max(32).optional(),kenBurns:Ln().default(!0)}),dM={TitleCard:{propsSchema:nM,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:rM,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:oM,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:iM,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:aM,defaultProps:{nodes:["A","B"]},defaultLayout:"graphic-only",altLayouts:[],whenToUse:"A causal chain or pipeline as chips with arrows (TEAM → AI AGENTS → CHURN)."},TerminalMock:{propsSchema:lM,defaultProps:{windows:[{title:"terminal-01",lines:["$ run"]}]},defaultLayout:"graphic-only",altLayouts:[],whenToUse:"Anything about running code/processes/agents — stylized terminal windows."},ChatMock:{propsSchema:uM,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:cM,defaultProps:{},defaultLayout:"video-top",altLayouts:["blurred-behind"],whenToUse:"Reference to a document/PR/review — a framed screenshot look with a label chip."},BulletList:{propsSchema:sM,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 Rg(e,t,n={}){const r=dM[e],o={...r.defaultProps,...t,...n},i=r.propsSchema.safeParse(o);return i.success?i.data:null}const fM=Ie({dx:ve().optional(),dy:ve().optional(),scale:ve().positive().optional(),hidden:Ln().optional()}),I1=Ie({props:Yn(me(),bi()).default({}),elements:Yn(me(),fM).default({}),timing:Ie({startSec:ve().nonnegative(),endSec:ve().nonnegative()}).optional(),component:Bu.optional(),layout:Ou.optional(),video:Ie({scale:ve().positive().max(4).optional(),dy:ve().optional(),dx:ve().optional(),autoZoom:Ln().optional()}).optional(),pip:Ie({cornerRadius:ve().min(0).max(1).optional(),x:ve().min(0).max(1).optional(),y:ve().min(0).max(1).optional()}).optional(),captionY:ve().min(0).max(1).optional(),captionScale:ve().min(.2).max(3).optional(),graphicRect:Ie({x:ve().min(0).max(1),y:ve().min(0).max(1),w:ve().min(.08).max(1),h:ve().min(.05).max(1)}).optional(),hidden:Ln().optional()}),pM=Ie({text:me().min(1).max(80),was:me()}),hM=Ie({fromKey:me().regex(/^w\d+$/),toKey:me().regex(/^w\d+$/),text:me().min(1).max(400),was:me()});function jg(e,t,n){var r;return((r=e[t])==null?void 0:r.was)??n}function Pg(e,t,n,r){var o;return((o=e.find(i=>i.fromKey===t&&i.toKey===n))==null?void 0:o.was)??r}function T1(e){return String(Math.round(e*1e3))}const mM=k1([Ie({at:ve().finite().nonnegative(),id:me().min(1)}),ve().finite().nonnegative().transform(e=>({at:e,id:T1(e)}))]);function gM(e,t){const n=T1(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 vM=Ie({theme:Qp.partial().default({}),captionsHidden:Ln().optional(),scenes:Yn(me(),I1).default({}),captions:Yn(me(),pM).default({}),captionWordsHidden:Yn(me(),Ie({was:me()})).default({}),captionRangeEdits:Qn(hM).default([]),captionLineTiming:Yn(me(),Ie({lead:ve().min(-30).max(30),tail:ve().min(-30).max(30)})).default({}),splits:Qn(mM).default([]),cuts:Qn(Ie({startSec:ve().nonnegative(),endSec:ve().nonnegative(),src:Ie({startSec:ve().nonnegative(),endSec:ve().nonnegative()}).optional()})).default([])}),yM=()=>vM.parse({});function wM(e,t){return Rg(e,{},t)??Rg(e,{},{})}function xM(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 mf(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=xM(t.scenes,i.id);if(!s)return i;const a=s.component!==void 0&&s.component!==i.component,l=s.component??i.component,u=s.component!==void 0&&a?wM(s.component,s.props):{...i.props,...s.props},f=s.layout!==void 0&&s.layout!==i.layout,{graphicRect:p,...h}=i;return{...f?h:i,component:l,layout:s.layout??i.layout,props:u,...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 Hl=.3;function Jp(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+Hl&&r.at<=s.endSec-Hl);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 R1(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 bM(e,t){return R1(Jp(e,t.splits),t)}function vn(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 Os(e){return/^\d+$/.test(e)}function He(e){return!e||!Number.isFinite(e.srcStart)?null:vn(e.srcStart)}const SM=8;function kM(e,t,n){var i,s;if(!Os(e))return{to:e};const r=Number(e);if(((i=n[r])==null?void 0:i.text)===t.was)return Fg(n[r]);const o=[];for(let a=1;a<=SM;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"}:Fg(n[o[0]])}function Fg(e){const t=He(e);return t===null?{to:null,reason:"unanchorable"}:{to:t}}function EM(e,t){const n=t.flatMap(a=>a.words),r={},o=[],i=Object.entries(e).map(([a,l])=>({key:a,edit:l,legacy:Os(a),claim:kM(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),u=l.length===1?l[0]:l.find(f=>!f.legacy);if(u===a){r[a.claim.to]=a.edit;continue}o.push({key:a.key,was:a.edit.was,reason:u===void 0?"collision":"superseded"})}return{edits:r,unresolved:o}}function CM(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 IM(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=He(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 TM(e,t,n,r){const o=e.map(l=>l.length+1),i=o.reduce((l,u)=>l+u,0),s=[];let a=t;for(let l=0;l<e.length;l++){const u=(n-t)*o[l]/i,f=l===e.length-1?n:a+u;s.push({text:e[l],start:a,end:f,srcStart:r[l]}),a=f}return s}function RM(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 P=0;P<r.length;P++)for(let F=0;F<r[P].words.length;F++)l.push({line:P,word:F,w:r[P].words[F]});const u=l.findIndex(P=>He(P.w)===s.fromKey);if(o.has(a)||i.has(s.fromKey)){n.push({key:a,expected:s.was,found:u===-1?null:l[u].w.text,reason:"duplicate-anchor"});continue}if(u===-1){n.push({key:a,expected:s.was,found:null});continue}let f=-1;for(let P=u;P<l.length;P++)if(He(l[P].w)===s.toKey){f=P;break}if(f===-1){n.push({key:a,expected:s.was,found:null});continue}const p=l.slice(u,f+1),h=p.map(P=>P.w.text).join(" ").normalize("NFC");if(h!==s.was.normalize("NFC")){n.push({key:a,expected:s.was,found:h});continue}const m=s.text.trim().split(/\s+/).filter(Boolean);if(m.length===0){n.push({key:a,expected:s.was,found:h});continue}o.add(a);for(const P of p){const F=He(P.w);F!==null&&i.add(F)}if(m.length===p.length){const P=new Map(p.map((F,H)=>[`${F.line}:${F.word}`,m[H]]));r=r.map((F,H)=>({...F,words:F.words.map((O,T)=>{const C=P.get(`${H}:${T}`);return C===void 0?O:{...O,text:C}})}));continue}const w=[],g=new Map;for(const P of p){const F=g.get(P.line);F?(F.last=P.word,F.words.push(P.w)):(w.push(P.line),g.set(P.line,{first:P.word,last:P.word,words:[P.w]}))}const k=w.map(P=>g.get(P).words.reduce((F,H)=>F+(H.end-H.start),0)),v=k.reduce((P,F)=>P+F,0),y=v>0?k:k.map(()=>1),x=v>0?v:k.length,b=y.map(P=>m.length*P/x),S=b.map(P=>Math.floor(P));let E=m.length-S.reduce((P,F)=>P+F,0);const R=b.map((P,F)=>({i:F,rem:P-Math.floor(P)})).sort((P,F)=>F.rem-P.rem||P.i-F.i);for(let P=0;E>0;P=(P+1)%R.length)S[R[P].i]++,E--;const j=p[0].w.srcStart,I=p[p.length-1].w.srcStart,_=m.map((P,F)=>m.length===1?j:j+(I-j)*F/(m.length-1));let A=0;const W=[];for(let P=0;P<r.length;P++){const F=r[P],H=g.get(P);if(!H){W.push(F);continue}const O=S[w.indexOf(P)],T=m.slice(A,A+O),C=_.slice(A,A+O);A+=O;const N=O===0?[]:TM(T,H.words[0].start,H.words[H.words.length-1].end,C),$=[...F.words.slice(0,H.first),...N,...F.words.slice(H.last+1)];$.length!==0&&W.push({...F,words:$})}r=W}return{lines:r,dropped:n}}function jM(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 h of i.words){const m=He(h),w=m===null?void 0:t[m];if(m===null||!w){s.push(h);continue}if(r.has(m)){n.push({key:m,expected:w.was,found:h.text,reason:"duplicate-anchor"}),s.push(h);continue}if(r.add(m),h.text!==w.was){n.push({key:m,expected:w.was,found:h.text}),s.push(h);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],u=s[s.length-1],f=l===i.words[0]?i.start:l.start,p=u===a?i.end:Math.max(u.end,u.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 Ul=.05;function PM(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 j1(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],h=He(p.words[0]),m=h===null?void 0:t[h];if(!(h===null||!m)){if(s.has(h)){n.push({key:h,expected:"",found:p.words[0].text,reason:"duplicate-anchor"});continue}s.add(h),i[f]=p.end+m.tail,f+1<r&&e[f+1].start===p.end&&(o[f+1]=i[f]),o[f]=p.start+m.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]+Ul),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]-Ul),a)}const u=e.map((f,p)=>{const h=o[p],m=i[p];return h===f.start&&m===f.end?f:{...f,start:h,end:m,words:PM(f.words,f.start,f.end,h,m)}});for(const f of Object.keys(t))s.has(f)||n.push({key:f,expected:"",found:null});return{lines:u,dropped:n}}function FM(e,t){return Qp.parse({...e,...t.theme})}function _g(e,t,n,r){const o=e.scenes[t]??I1.parse({});return{...e,scenes:{...e.scenes,[t]:{...o,elements:{...o.elements,[n]:{...o.elements[n],...r}}}}}}function _M(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 MM(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,u=Object.keys(s).length>0?{...r.elements,[n]:s}:l;return{...e,scenes:{...e.scenes,[t]:{...r,elements:u}}}}function $M(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 AM(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 P1(e){const t=e.indexOf("@");return t===-1?e:e.slice(0,t)}const NM=.6;function LM(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 zM(e,t){const n=t.outputDurationSec,r=[...e].sort((f,p)=>f.startSec-p.startSec);if(n<=0)return r;const o=LM(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(m=>m>f.start+1e-9&&m<f.end-1e-9),h=[f.start,...p,f.end];for(let m=0;m<h.length-1;m++){const w=h[m],g=h[m+1];if(g-w<NM)continue;let k=0;for(let v=0;v<o.length;v++)o[v]<=w+1e-9&&(k=v);a.push({start:w,end:g,clip:k})}}const l=new Map,u=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,...u].sort((f,p)=>f.startSec-p.startSec)}const DM=1.05;function OM(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 BM(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 WM{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 F1(e){return new WM(e.map(t=>({srcIn:t.srcIn,srcOut:t.srcOut,kind:"keep"})))}function Mg(e,t){const n=o=>o.words;if(e.every(o=>n(o).every(i=>i.srcStart!==void 0)))return[...e];const r=F1(t);return e.map(o=>({...o,words:n(o).map(i=>i.srcStart===void 0?{...i,srcStart:r.toSource(i.start)}:i)}))}const VM=/[\p{Script=Arabic}\p{Script=Hebrew}\p{Script=Syriac}\p{Script=Thaana}\p{Script=Nko}]/u,HM=new RegExp("\\p{L}","u");function eh(e){for(const t of e){if(VM.test(t))return"rtl";if(HM.test(t))return"ltr"}return"ltr"}const Bs="Noto Nastaliq Urdu",_1="fonts/NotoNastaliqUrdu-Bold.ttf";function UM(e){return e.some(t=>eh(t.words.map(n=>n.text).join(" "))==="rtl")}const M1=9,ZM=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"]);function KM(e,t=M1){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&&ZM.has(s[s.length-1].toLowerCase().replace(/\W/g,""));)s.pop();return s.join(" ").replace(/[,;:—–-]+$/,"")}const en={width:1080,height:1920};en.width;en.height;const sa={centerYFrac:.38,sizeFrac:.22},YM=.35,GM=.45,$1=1-1/DM,XM=.4*$1,qM=.6*$1;function A1(e,t,n=en){const r=e.w*n.width,o=e.h*n.height;return Math.max(o,r/(t.sourceAspect??n.width/n.height))}function QM(e,t,n=en){if(t.subject==="screen")return .5;const r=e.h*n.height,o=A1(e,t,n),i=o-r;if(i<=1)return .5;const s=t.sizeFrac??sa.sizeFrac,a=(t.centerYFrac-s/2-YM*s)*o,l=(t.centerYFrac+s/2)*o,u=(a+l)/2-GM*r,f=a-XM*r,p=l+qM*r-r,h=p<=f?Math.min(Math.max(u,p),f):p;return Math.min(1,Math.max(0,h/i))}function JM(e,t,n,r,o=en){if(r.length===0)return e;const i=t.h*o.height,s=A1(t,n,o);if(s-i<=1)return e;const l=i/s,u=1-l;if(u<=0)return e;let f=e*u;for(let p=0;p<r.length+1;p++){const h=r.find(x=>{const b=x.y,S=x.y+x.h,E=f+l,R=b<f&&f<S,j=b<E&&E<S;return R||j});if(!h)break;const m=[],w=h.y+h.h;w<=u&&m.push(w);const g=h.y-l;if(g>=0&&m.push(g),h.h<=l){const x=Math.max(0,h.y+h.h-l),b=Math.min(u,h.y);x<=b&&m.push(Math.min(Math.max(f,x),b))}const k=n.sizeFrac??sa.sizeFrac,v=n.centerYFrac+k/2,y=m.filter(x=>x+l>=v);if(y.length===0)return e;f=y.reduce((x,b)=>Math.abs(b-f)<Math.abs(x-f)?b:x)}return Math.min(1,Math.max(0,f/u))}function e4(e,t,n=en){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 t4={top:.12,bottom:.22,right:.16,left:.04},n4={top:.06,bottom:.12,right:.05,left:.05};function Zn(e=en){return e.width>e.height?n4:t4}function r4(e=en){const t=Zn(e);return{x:t.left,y:t.top,w:1-t.left-t.right,h:1-t.top-t.bottom}}const o4=.08,i4=.05;function Zl(e,t=en){const n=r4(t),r=1e-9,o=(u,f,p)=>u<f-r?f:u>p+r?p:u,i=o(e.w,o4,n.w),s=o(e.h,i4,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 $g=.045;function s4(e){return e.width>e.height?44:64}const or={x:0,y:0,w:1,h:1},$c=.3,No={x:.5-$c/2,y:.66,w:$c,h:$c*1080/1920};function wo(e,t=sa,n=[],r=en){const o=a=>JM(QM(a,t,r),a,t,n,r),i=a=>e4(a,t,r),s=r.width>r.height;switch(e){case"full-bleed":return{video:{rect:or,cornerRadius:0,blurPx:0,dim:0,opacity:1,objectPosY:o(or),objectPosX:i(or)},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:or,cornerRadius:0,blurPx:0,dim:0,opacity:1,objectPosY:o(or),objectPosX:i(or)},graphic:a,captionAnchor:s?.62:.49}}case"split-left":case"split-right":{if(s){const l=e==="split-left",u={x:l?0:.5,y:0,w:.5,h:1};return{video:{rect:u,cornerRadius:0,blurPx:0,dim:0,opacity:1,objectPosY:o(u),objectPosX:i(u)},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:No,cornerRadius:1,blurPx:0,dim:0,opacity:1,objectPosY:o(No),objectPosX:i(No)},graphic:{x:.06,y:.14,w:.78,h:.42},captionAnchor:s?.78:.61};case"graphic-only":return{video:{rect:No,cornerRadius:1,blurPx:0,dim:0,opacity:0,objectPosY:o(No),objectPosX:i(No)},graphic:{x:.04,y:.14,w:.8,h:.54},captionAnchor:s?.8:.73};case"blurred-behind":return{video:{rect:or,cornerRadius:0,blurPx:22,dim:.55,opacity:1,objectPosY:o(or),objectPosX:i(or)},graphic:{x:.07,y:.24,w:.77,h:.36},captionAnchor:s?.8:.69}}}const a4={x:.07,y:.24,w:.77,h:.36};function N1(e,t=en){return e.graphicRect?Zl(e.graphicRect,t):wo(e.layout,sa,[],t).graphic??a4}const L1=.35;function Br(e,t){for(const n of e)if(t>=n.startSec&&t<n.endSec)return n;return null}function xn(e,t,n){return e+(t-e)*n}function l4(e,t,n){return{x:xn(e.x,t.x,n),y:xn(e.y,t.y,n),w:xn(e.w,t.w,n),h:xn(e.h,t.h,n)}}function Ag(e,t,n){return{rect:l4(e.rect,t.rect,n),cornerRadius:xn(e.cornerRadius,t.cornerRadius,n),blurPx:xn(e.blurPx,t.blurPx,n),dim:xn(e.dim,t.dim,n),opacity:xn(e.opacity,t.opacity,n),objectPosY:xn(e.objectPosY,t.objectPosY,n),objectPosX:xn(e.objectPosX,t.objectPosX,n)}}function Kl(e){return e*e*(3-2*e)}function z1(e){return e.filter(t=>!(t.kind==="plain"&&t.layout==="full-bleed"))}function Ac(e,t,n,r){const o=wo(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 u4(e,t,n=sa,r=[],o=en){const i=z1(e),s=r.filter(v=>t>=v.startSec&&t<v.endSec),a=wo("full-bleed",n,s,o).video,l=Br(i,t);if(!l)return a;const u=Ac(l,n,s,o),f=Math.min(L1,(l.endSec-l.startSec)/2),p=t-l.startSec,h=l.endSec-t,m=Br(i,l.startSec-.001),w=Br(i,l.endSec+.001),g=m?Ac(m,n,s,o):a,k=w?Ac(w,n,s,o):a;return p<f?Ag(g,u,Kl(p/f)):h<f?Ag(u,k,Kl(1-h/f)):u}function c4(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 Nc(e){return e==="pip-bubble"||e==="graphic-only"?1:0}function d4(e,t){const n=z1(e),r=Br(n,t);if(!r)return 0;const o=Nc(r.layout),i=Math.min(L1,(r.endSec-r.startSec)/2),s=Br(n,r.startSec-.001),a=Br(n,r.endSec+.001),l=s?Nc(s.layout):0,u=a?Nc(a.layout):0,f=t-r.startSec,p=r.endSec-t;return f<i?xn(l,o,Kl(f/i)):p<i?xn(o,u,Kl(1-p/i)):o}function f4(e,t,n){return e.filter(r=>(r.startSec??Number.NEGATIVE_INFINITY)<n&&(r.endSec??Number.POSITIVE_INFINITY)>t)}function p4(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 h4(e,t,n,r=en){const o=wo(e,void 0,[],r),i=Zn(r),s=o.captionAnchor,a=l=>{const u={y:l-$g,h:$g*2};if(u.y<i.top||u.y+u.h>1-i.bottom||p4(u,t)>0)return!1;const f=n??o.graphic;return!(f&&Math.min(u.y+u.h,f.y+f.h)-Math.max(u.y,f.y)>0)};if(a(s))return s;for(let l=.02;l<=.6;l+=.02)for(const u of[s-l,s+l])if(a(u))return u;return s}const m4=.3,g4=.3,v4=.133,th=e=>e*(2-e);function D1(e,t=m4,n=g4){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 Ng=.4;function y4(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 w4(e,t){return t?e>=t.startSec-Ng&&e<=t.endSec+Ng:!1}function x4(e,t){return e??s4(t)}function b4(e){return e*10/64}function S4(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 k4(e,t){return e==="rtl"?`'${Bs}', ${t}`:t}function E4(e){return e==="rtl"?1.9:1.15}const C4=()=>{const[e]=oe.useState(()=>xE(`load ${Bs}`));return oe.useEffect(()=>{let t=!1;const n=()=>{t||(t=!0,bE(e))};return new FontFace(Bs,`url("${Bp(_1)}") format("truetype")`,{weight:"900"}).load().then(o=>{document.fonts.add(o),n()},n),n},[e]),null},I4=({line:e,wordOffset:t,verticalAnchor:n,fontSizePx:r,activeColor:o,fontFamily:i,textColor:s,ctaKeyword:a,ctaWindow:l})=>{const u=Tt(),{fps:f,width:p,height:h}=ft(),m=Zn({width:p,height:h}),w=e.start+u/f,g=eh(e.words.map(k=>k.text).join(" "));return c.jsx(Dn,{style:{pointerEvents:"none"},children:c.jsx("div",{style:{position:"absolute",top:`${n*100}%`,left:0,right:0,transform:"translateY(-50%)",direction:g,display:"flex",justifyContent:"center",gap:"0.28em",flexWrap:"wrap",paddingLeft:`${m.left*100}%`,paddingRight:`${m.right*100}%`,fontFamily:k4(g,i),fontWeight:900,fontSize:r,lineHeight:E4(g),textAlign:"center",color:s,WebkitTextStroke:`${b4(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,v)=>{const y=Math.max(k.end,k.start+.12),x=w>=k.start&&w<=y,b=x?Math.min(1,(w-k.start)/v4):0,S=th(b);return c.jsx("span",{"data-caption-word":t+v,"data-caption-text":k.text,"data-caption-src":He(k)===null?void 0:k.srcStart,style:{display:"inline-block",pointerEvents:"auto",transform:S>0?`scale(${1+.08*S})`:"scale(1)",color:x?o:s},children:y4(k.text,w4(k.start,l)?a:void 0)},v)})})})},T4=({lines:e,cues:t=[],verticalAnchor:n=.76,fontSizePx:r,activeColor:o="#FFE14D",theme:i,ctaKeyword:s,ctaWindow:a,sourceTextRegions:l=[]})=>{const{fps:u,width:f,height:p}=ft(),h={width:f,height:p},m=x4(r,h),{fontFamily:w,color:g}=S4(i),k=[];let v=0;for(const y of e)k.push(v),v+=y.words.length;return c.jsxs(Dn,{children:[UM(e)?c.jsx(C4,{}):null,e.map((y,x)=>{const b=t.length>0?Br(t,y.start):null,S=(b==null?void 0:b.captionY)!==void 0?b.captionY:t.length>0||l.length>0?h4((b==null?void 0:b.layout)??"full-bleed",f4(l,y.start,y.end),b==null?void 0:b.graphicRect,h):n,{from:E,durationInFrames:R}=Zp(y.start,y.end,u);return c.jsx(Rt,{from:E,durationInFrames:R,children:c.jsx(I4,{line:y,wordOffset:k[x],verticalAnchor:S,fontSizePx:m*((b==null?void 0:b.captionScale)??1),activeColor:o,fontFamily:w,textColor:g,ctaKeyword:s,ctaWindow:a})},x)})]})};function O1(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),u=Math.max(n.width/a,n.height/l),f=-t.x*u+(n.width-a*u)*Lg(r),p=-t.y*u+(n.height-l*u)*Lg(o);return{width:i*u,height:s*u,left:f,top:p}}function Lg(e){return Number.isFinite(e)?Math.min(1,Math.max(0,e)):.5}function B1(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,u=-t.y*a+(n.height-s*a)/2;return{width:r*a,height:o*a,left:l,top:u}}function R4(e,t){return B1(e,{x:0,y:0,w:e.width,h:e.height},t)}function W1(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 j4(e,t,n,r,o,i){return e==="fit"?B1(t,n,r):O1(t,n,r,o,i)}function P4(e,t,n,r){return e.length===0?{x:0,y:0,w:r.width,h:r.height,full:!0}:BM(e,W1(t,n),r)}function F4(e,t,n){if(e.length===0)return null;const r=W1(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 _4(e,t,n,r,o,i,s,a,l){if(!o)return null;if(e&&e.length>0){const f=F4(e,n,r);if(f)return O1(o,f.window,s,f.bias.x,f.bias.y)}if(!t||t.length<2)return null;const u=P4(t,n,r,o);return u.full?null:j4(i,o,u,s,a,l)}const M4=({cues:e,theme:t,face:n,zoomPlan:r,sourceTextRegions:o,contentTimeline:i,framingTimeline:s,spans:a,sourceSize:l,contentCropMode:u="cover",sourceFit:f="cover",children:p})=>{const h=Tt(),{fps:m,width:w,height:g}=ft(),k=h/m,y=u4(e,k,n??void 0,o??[],{width:w,height:g}),x=d4(e,k),b=y.rect.w*w,S=y.rect.h*g,E=y.cornerRadius*Math.min(b,S)/2,R=Br(e,k),j=R==null?void 0:R.video,I=r&&r.length>0?OM(r,k):1,_=Math.max(0,y.opacity*(1-.6*y.cornerRadius)),A=(j==null?void 0:j.autoZoom)!==!1,W=f==="contain"&&l!==void 0,P=A&&!W?1+(I-1)*_:1,F=(j==null?void 0:j.scale)??1,H=(j==null?void 0:j.dx)??0,O=(j==null?void 0:j.dy)??0,T=c4(P,F,H,O);return c.jsxs(Dn,{children:[c.jsx(Dn,{style:{background:t.bg,opacity:x}}),c.jsxs("div",{"data-edit-video":R==null?void 0:R.id,style:{position:"absolute",left:`${y.rect.x*100}%`,top:`${y.rect.y*100}%`,width:b,height:S,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:[c.jsx("div",{style:{position:"absolute",inset:0,filter:y.blurPx>.5?`blur(${y.blurPx}px)`:void 0,transform:T,transformOrigin:"50% 40%","--ossclip-obj-y":`${y.objectPosY*100}%`,"--ossclip-obj-x":`${y.objectPosX*100}%`},children:W?c.jsx($4,{source:l,slot:{width:b,height:S},children:p}):c.jsx(A4,{timeline:i,framing:s,spans:a,sourceSize:l,mode:u,tSec:k,slot:{width:b,height:S},posX:y.objectPosX,posY:y.objectPosY,children:p})}),c.jsx("div",{style:{position:"absolute",inset:0,background:"black",opacity:y.dim}})]})]})},$4=({source:e,slot:t,children:n})=>{const r=R4(e,t);return c.jsx("div",{style:{position:"absolute",width:r.width,height:r.height,left:r.left,top:r.top},children:n})},A4=({timeline:e,framing:t,spans:n,sourceSize:r,mode:o,tSec:i,slot:s,posX:a,posY:l,children:u})=>{const f=_4(t,e,n??[],i,r,o,s,a,l);return f?c.jsx("div",{style:{position:"absolute",width:f.width,height:f.height,left:f.left,top:f.top},children:u}):c.jsx("div",{style:{position:"absolute",inset:0},children:u})},nh=.94,N4=new Set(["FlowDiagram","StrikethroughReveal","ChatMock","BulletList"]),zg=2.4,za=.45,Wu=.58,$t=.72,L4=.62;function Wo(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 Ge=e=>typeof e=="string"?e:"",Pr=e=>Array.isArray(e)?e:[];function z4(e,t,n,r=1/0){switch(e){case"TitleCard":{const o=n-80,i=Ge(t.emphasis),s=28;let a=0,l=0;Ge(t.eyebrow)&&(a+=34*1.2,l++),i&&(a+=210*.95,l++);const u=i?64:96;return a+=Wo(Ge(t.title).length,u,o,1.05,$t),l++,Ge(t.sub)&&(a+=Wo(Ge(t.sub).length,40,o,1.2,Wu),l++),a+s*Math.max(0,l-1)}case"StatCard":{const o=Wo(Ge(t.label).length,42,n*.55,1.15,$t);let i=88+Math.max(o,110*1.15)+4;return Ge(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+=Wo(Ge(t.text).length,72,o,1.02,$t),Ge(t.struck)&&(i+=26+Wo(Ge(t.struck).length,44,o,1.2,$t)),i}case"StrikethroughReveal":{const o=Pr(t.lines).map(a=>Ge(a==null?void 0:a.text)),i=K1(o,n,r),s=o.reduce((a,l)=>a+Z1(l,i,n).length,0);return s*i*1.08+i*.2*Math.max(0,s-1)}case"FlowDiagram":{const o=Pr(t.nodes).map(l=>Ge(l)),i=Math.max(1,o.length),{mode:s,fontSize:a}=eb(o,n,r);return s==="row"?a*gs+4:a*(gs*i+J1*(i-1))}case"TerminalMock":{const o=Pr(t.windows);let i=0;for(const s of o){const a=Pr(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),Ge(t.fanOut)&&(i+=22+40*1.2),i}case"ChatMock":{const o=q1(t).map(s=>s.text),i=Q1(o,{widthPx:n,heightPx:r});return X1(o,i,n)}case"ScreenshotFrame":{const o=n*.94;return(Ge(t.src)?o*9/16:480)+4}case"BulletList":{const o=Pr(t.items).map(s=>Ge(s)),i=U1(o,n,r,!!Ge(t.title),Ge(t.title));return V4(o.length,i,!!Ge(t.title))}}}const kr=e=>Ge(e).split(/\s+/).reduce((t,n)=>Math.max(t,n.length),0);function D4(e,t){switch(e){case"RuleCard":{const n=kr(t.kicker)*30*($t+.28),r=kr(t.text)*72*$t,o=kr(t.struck)*44*($t+.04),i=Math.max(n,r,o);return i>0?156+i:0}case"TitleCard":{const n=Ge(t.emphasis)?64:96,r=kr(t.eyebrow)*34*($t+.35),o=kr(t.emphasis)*210*$t,i=kr(t.title)*n*($t+.02),s=kr(t.sub)*40*Wu,a=Math.max(r,o,i,s);return a>0?80+a:0}case"TerminalMock":{let n=0;for(const r of Pr(t.windows))for(const o of Pr(r==null?void 0:r.lines))n=Math.max(n,Ge(o).length);return n>0?108+n*27*L4:0}case"StatCard":{const n=Ge(t.value).length*110*$t;return n===0?0:164+kr(t.label)*42*$t+40+n}default:return 0}}const Dg=36,O4=120,V1=1.6,H1=.88,B4=($t+.28)*.36,W4=1.1;function V4(e,t,n){return(Math.max(1,e)*V1+(n?H1:0))*t}function U1(e,t=831,n=1/0,r=!1,o=""){const i=e.reduce((l,u)=>Math.max(l,u.length),0);if(i===0)return Dg;const s=Math.min(t/(i*$t+W4),o?t/(o.length*B4):1/0),a=n*nh/(Math.max(1,e.length)*V1+(r?H1:0));return Math.max(Dg,Math.min(O4,Math.floor(Math.min(s,a))))}const H4=92,U4=44,Z4=150,K4=[" → "," -> "," → "," > "];function Z1(e,t,n){const r=o=>o.length*t*$t<=n;if(r(e))return[e];for(const o of K4){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 K1(e,t=831,n=1/0){const r=e.reduce((s,a)=>Math.max(s,a.length),0);if(r===0)return H4;const o=t/(r*$t),i=n/(Math.max(1,e.length)*1.28);return Math.max(U4,Math.min(Z4,Math.floor(Math.min(o,i))))}const Og=22,Bg=44,Y4=96,Wg=22,Y1=.85,G1=.82;function X1(e,t,n){const o=(n-80)*G1-2*t*Y1;let i=0;for(const s of e)i+=Wo(s.length,t,o,1.2,Wu)+t*1.2+4;return i+t*.5*Math.max(0,e.length-1)}function q1(e){const t=Ge(e.keyword);return t?[{from:"user",text:`"${t.toUpperCase()}"`}]:Pr(e.messages).map(n=>{const r=n??{};return{from:r.from==="agent"?"agent":"user",text:Ge(r.text)}})}function Q1(e,t={}){const n=t.widthPx??831,r=t.heightPx??1/0,o=n-80,i=e.reduce((p,h)=>Math.max(p,h.length),0);if(i===0)return Bg;const s=e.flatMap(p=>p.split(/\s+/)).reduce((p,h)=>Math.max(p,h.length),0),a=p=>o*G1/(p*Wu+2*Y1),l=Math.min(i,Wg),u=i>Wg?Bg:Y4;let f=Math.floor(Math.min(a(l),a(s),u));for(;f>Og&&X1(e,f,n)>r*nh;)f-=1;return Math.max(Og,f)}const Vg=26,G4=22,X4=76,gs=2.1,J1=2.05;function eb(e,t,n=1/0){const r=e.reduce((g,k)=>g+k.length,0),o=Math.max(1,e.length),i=.78,s=1.6,a=1.8,l=t-20,u=Math.floor(Math.min(l/(i*r+s*o+a*(o-1)),n/gs)),f=Math.max(...e.map(g=>g.length),1),p=gs*o+J1*(o-1),h=Math.floor(Math.min(l/(i*f+s),n/p,X4)),m=u>=Vg;return h>=G4?m?u*gs>=h*p?{mode:"row",fontSize:u}:{mode:"stack",fontSize:h}:{mode:"stack",fontSize:h}:{mode:"row",fontSize:Math.max(Vg,u)}}function q4(e,t,n){if(N4.has(e))return 1;const r=n.heightPx*nh,o=u=>z4(e,t,n.widthPx/u)*u<=r;if(!o(za))return za;const i=D4(e,t),s=i>0?n.widthPx/i:zg;let a=za,l=Math.max(za,Math.min(zg,s));if(l<=a)return a;for(let u=0;u<24;u++){const f=(a+l)/2;o(f)?a=f:l=f}return a}function St(e=0){const t=Tt(),{fps:n}=ft();return Jd({frame:t-e,fps:n,config:{damping:200,stiffness:130},durationInFrames:Math.round(n*.5)})}function Gn(e,t=26){return{opacity:e,transform:`translateY(${(1-e)*t}px)`}}function xo(e){return{opacity:e,transform:`scale(${.9+.1*e})`}}function Q4(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 mt(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 J4=({props:e,theme:t,edits:n})=>{var l;const r=St(0),o=St(5),i=St(10),s=(l=e.emphasis)==null?void 0:l.trim(),a=!!s&&s.toLowerCase().includes(e.title.trim().toLowerCase());return c.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?c.jsx("div",{"data-edit-id":"eyebrow",style:{...Gn(r),fontSize:34,fontWeight:700,letterSpacing:"0.35em",color:t.muted,textTransform:"uppercase",...mt(n,"eyebrow")},children:e.eyebrow}):null,s?c.jsx("div",{"data-edit-id":"emphasis",style:{...Gn(o,40),fontSize:210,fontWeight:900,lineHeight:.95,...mt(n,"emphasis")},children:s}):null,a?null:c.jsx("div",{"data-edit-id":"title",style:{...Gn(s?i:o,34),fontSize:s?64:96,fontWeight:900,lineHeight:1.05,textTransform:"uppercase",letterSpacing:"0.02em",...mt(n,"title")},children:e.title}),e.sub?c.jsx("div",{"data-edit-id":"sub",style:{...Gn(i),fontSize:40,fontWeight:600,color:t.muted,...mt(n,"sub")},children:e.sub}):null]})},e$=({props:e,theme:t,edits:n})=>{const r=St(0),o=St(6),i=e.inverted;return c.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:30,fontFamily:t.fontDisplay,width:"100%",padding:"0 30px"},children:[c.jsxs("div",{style:{...xo(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:[c.jsx("div",{"data-edit-id":"label",style:{fontSize:42,fontWeight:800,textTransform:"uppercase",letterSpacing:"0.06em",lineHeight:1.15,maxWidth:"55%",...mt(n,"label")},children:e.label}),c.jsx("div",{"data-edit-id":"value",style:{fontSize:110,fontWeight:900,whiteSpace:"nowrap",...mt(n,"value")},children:e.value})]}),e.caption?c.jsx("div",{"data-edit-id":"caption",style:{...Gn(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",...mt(n,"caption")},children:e.caption}):null]})},t$=({props:e,theme:t,edits:n})=>{const r=St(0),o=St(8);return c.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:26,fontFamily:t.fontDisplay,width:"100%",padding:"0 30px"},children:[c.jsxs("div",{style:{...xo(r),width:"100%",background:t.fg,color:t.bg,borderRadius:t.radiusPx,padding:"40px 48px",textAlign:"left"},children:[c.jsx("div",{"data-edit-id":"kicker",style:{fontSize:30,fontWeight:800,letterSpacing:"0.28em",textTransform:"uppercase",color:"#55555E",marginBottom:14,fontFamily:t.fontMono,...mt(n,"kicker")},children:e.kicker}),c.jsx("div",{"data-edit-id":"text",style:{fontSize:72,fontWeight:900,lineHeight:1.02,textTransform:"uppercase",...mt(n,"text")},children:e.text})]}),e.struck?c.jsx("div",{"data-edit-id":"struck",style:{...Gn(o),fontSize:44,fontWeight:800,color:t.muted,textDecoration:"line-through",textDecorationThickness:6,textDecorationColor:t.danger,textTransform:"uppercase",letterSpacing:"0.04em",...mt(n,"struck")},children:e.struck}):null]})},n$=({text:e,struck:t,mark:n,delay:r,fontSize:o,theme:i,editId:s,edits:a})=>{const l=St(r),u=St(r+8);return c.jsxs("div",{"data-edit-id":s,style:{...Gn(l,30),position:"relative",display:"inline-block",...mt(a,s)},children:[c.jsxs("span",{style:{fontSize:o,fontWeight:900,textTransform:"uppercase",lineHeight:1.08,whiteSpace:"nowrap",color:t?i.muted:i.fg},children:[n!=="none"?c.jsx("span",{style:{color:n==="cross"?i.danger:i.success,marginRight:"0.3em"},children:n==="cross"?"✗":"✓"}):null,e]}),t?c.jsx("div",{style:{position:"absolute",left:"-2%",top:"50%",height:o*.11,width:`${u*104}%`,background:i.danger,borderRadius:o*.055,transform:"translateY(-50%) rotate(-2deg)"}}):null]})},r$=({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=K1(i,n,r),a=e.lines.flatMap((l,u)=>Z1(l.text,s,n??831).map((f,p)=>({text:f,struck:l.struck,mark:p===0?l.mark??"none":"none",lineIndex:u})));return c.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:s*.2,textAlign:"center",fontFamily:t.fontDisplay},children:a.map((l,u)=>c.jsx(n$,{text:l.text,struck:l.struck,mark:l.mark,delay:u*6,fontSize:s,theme:t,editId:`line-${l.lineIndex}`,edits:o},u))})},o$=({text:e,emphasized:t,delay:n,fontSize:r,theme:o,editId:i,edits:s})=>{const a=St(n);return c.jsx("div",{"data-edit-id":i,style:{...xo(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,...mt(s,i)},children:e})},i$=({delay:e,fontSize:t,theme:n,down:r=!1})=>{const o=St(e);return c.jsx("div",{style:{opacity:o,color:n.muted,fontSize:t*1.15,fontWeight:700,lineHeight:1,paddingLeft:r?0:t*.55},children:r?"↓":"→"})};function s$(e,t=a$,n){return eb(e,t,n)}const a$=864,l$=({props:e,theme:t,widthPx:n,heightPx:r,edits:o})=>{const{mode:i,fontSize:s}=s$(e.nodes,n,r),a=i==="row";return c.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,u)=>c.jsxs("div",{style:{display:"flex",flexDirection:a?"row":"column",alignItems:"center",gap:a?s*.55:s*.45},children:[u>0?c.jsx(i$,{delay:u*6+3,fontSize:s,theme:t,down:!a}):null,c.jsx(o$,{text:l,emphasized:e.emphasizeLast&&u===e.nodes.length-1,delay:u*6,fontSize:s,theme:t,editId:`node-${u}`,edits:o})]},u))})},u$=({title:e,lines:t,delay:n,theme:r,editId:o,edits:i})=>{const s=St(n);return c.jsxs("div",{"data-edit-id":o,style:{...xo(s),background:r.cardBg,border:`2px solid ${r.cardBorder}`,borderRadius:r.radiusPx/2,overflow:"hidden",width:"100%",fontFamily:r.fontMono,...mt(i,o)},children:[c.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"14px 20px",borderBottom:`2px solid ${r.cardBorder}`},children:[["#FF5F57","#FEBC2E","#28C840"].map(a=>c.jsx("div",{style:{width:16,height:16,borderRadius:8,background:a}},a)),c.jsx("div",{style:{marginLeft:10,fontSize:24,color:r.muted},children:e})]}),c.jsx("div",{style:{padding:"18px 22px",display:"flex",flexDirection:"column",gap:8},children:t.map((a,l)=>c.jsx("div",{style:{fontSize:27,color:r.fg,whiteSpace:"pre"},children:a},l))})]})},c$=({props:e,theme:t,edits:n})=>{const r=St(e.windows.length*6+4);return c.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:22,width:"100%",padding:"0 30px"},children:[e.windows.map((o,i)=>c.jsx(u$,{title:o.title,lines:o.lines,delay:i*6,theme:t,editId:`window-${i}`,edits:n},i)),e.fanOut?c.jsxs("div",{"data-edit-id":"fanOut",style:{...Gn(r),fontFamily:t.fontDisplay,fontSize:40,fontWeight:900,letterSpacing:"0.2em",color:t.fg,textTransform:"uppercase",...mt(n,"fanOut")},children:["⌄ ",e.fanOut]}):null]})},d$=({from:e,text:t,delay:n,fontSize:r,theme:o,editId:i,edits:s})=>{const a=St(n),l=e==="user";return c.jsx("div",{"data-edit-id":i,style:{...xo(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,...mt(s,i)},children:t})},f$=({props:e,theme:t,widthPx:n,heightPx:r,edits:o})=>{const i=q1(e),s=Q1(i.map(a=>a.text),{widthPx:n,heightPx:r});return c.jsx("div",{style:{display:"flex",flexDirection:"column",gap:s*.5,width:"100%",padding:"0 40px"},children:i.map((a,l)=>c.jsx(d$,{from:a.from,text:a.text,delay:l*8,fontSize:s,theme:t,editId:`message-${l}`,edits:o},l))})},p$=({props:e,theme:t,edits:n})=>{const r=St(0),o=St(8),i=Tt(),{fps:s}=ft(),a=e.kenBurns?Fi(i,[0,s*8],[1,1.08],{extrapolateRight:"clamp"}):1,l=e.src?/^https?:\/\//.test(e.src)?e.src:Bp(e.src):null;return c.jsxs("div",{"data-edit-id":"image",style:{...xo(r),position:"relative",width:"94%",...mt(n,"image")},children:[c.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?c.jsx(Np,{src:l,style:{width:"100%",display:"block",transform:`scale(${a})`}}):c.jsx("div",{style:{height:420,display:"flex",flexDirection:"column",gap:14,padding:30,transform:`scale(${a})`},children:[.9,.75,.85,.6,.8,.5].map((u,f)=>c.jsx("div",{style:{height:22,width:`${u*100}%`,borderRadius:6,background:f%3===0?t.cardBorder:"#22222B"}},f))})}),e.label?c.jsx("div",{"data-edit-id":"label",style:{...xo(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",...mt(n,"label")},children:e.label}):null]})},h$=({text:e,index:t,fontSize:n,theme:r,edits:o})=>{const i=`item-${t}`,s=St(t*7);return c.jsxs("div",{"data-edit-id":i,style:{...Gn(s,26),display:"flex",alignItems:"baseline",gap:n*.35,...mt(o,i)},children:[c.jsx("span",{style:{fontSize:n*.75,color:r.accent,fontWeight:900},children:"▸"}),c.jsx("span",{style:{fontSize:n,fontWeight:900,textTransform:"uppercase",lineHeight:1.15,whiteSpace:"nowrap",color:r.fg},children:e})]})},m$=({props:e,theme:t,widthPx:n,heightPx:r,edits:o})=>{const i=U1(e.items,n,r,!!e.title,e.title),s=St(0);return c.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:i*.45,fontFamily:t.fontDisplay},children:[e.title?c.jsx("div",{"data-edit-id":"title",style:{...Gn(s,20),fontSize:i*.36,fontWeight:700,letterSpacing:"0.28em",textTransform:"uppercase",color:t.muted,...mt(o,"title")},children:e.title}):null,e.items.map((a,l)=>c.jsx(h$,{text:a,index:l,fontSize:i,theme:t,edits:o},l))]})},g$={TitleCard:J4,StatCard:e$,RuleCard:t$,StrikethroughReveal:r$,FlowDiagram:l$,TerminalMock:c$,ChatMock:f$,ScreenshotFrame:p$,BulletList:m$},v$=new Set(["lower-third","full-bleed"]),y$=.55,w$=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}, ${y$})`},x$=e=>({width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",opacity:e,transform:e<1?`translateY(${(1-e)*18}px)`:void 0}),b$=({durationInFrames:e,children:t})=>{const n=Tt(),{fps:r}=ft(),{exitSec:o}=D1(e/r),i=(e-n)/r,s=o<=0?1:Math.min(1,Math.max(0,i/o));return c.jsx("div",{style:x$(th(s)),children:t})},S$=({durationInFrames:e,themeBg:t,radiusPx:n})=>{const r=Tt(),{fps:o}=ft(),{enterSec:i}=D1(e/o),s=i<=0?1:Math.min(1,Math.max(0,r/o/i)),a=th(s);return c.jsx("div",{style:{position:"absolute",inset:0,background:w$(t),backdropFilter:"blur(14px)",WebkitBackdropFilter:"blur(14px)",borderRadius:n,opacity:a,transform:a<1?`translateY(${(1-a)*18}px)`:void 0}})},k$=({cues:e,theme:t})=>{const{fps:n,width:r,height:o}=ft();return c.jsx(Dn,{style:{pointerEvents:"none"},children:e.map(i=>{if(i.kind==="plain"||!i.component||!i.props)return null;const s=N1(i,{width:r,height:o}),a=g$[i.component],{from:l,durationInFrames:u}=Zp(i.startSec,i.endSec,n),f=s.w*r,p=s.h*o,h=v$.has(i.layout),m=h?Math.min(24,Math.round(p*.12)):0,w=f-m*2,g=p-m*2,k=q4(i.component,i.props,{widthPx:w,heightPx:g});return c.jsx(Rt,{from:l,durationInFrames:u,children:c.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:c.jsxs(b$,{durationInFrames:u,children:[h?c.jsx(S$,{durationInFrames:u,themeBg:t.bg,radiusPx:t.radiusPx}):null,c.jsx("div",{style:{width:w/k,transform:`scale(${k})`,position:"relative"},children:c.jsx(a,{props:i.props,theme:t,widthPx:w/k,heightPx:g/k,edits:Q4(i.elements,k)})})]})})},i.id)})})},E$="made with ossclip",C$=.45,I$=.024;function T$(e=en){const t=Zn(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)*I$),opacity:C$,text:E$}}function R$(e){return e===!0}const j$=({theme:e,frame:t})=>{const n=T$(t);return c.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 P$(e){return e!==!0}const F$=({videoFileName:e,spans:t,captionLines:n,sceneCues:r,theme:o,settings:i,face:s,zoomPlan:a,ctaKeyword:l,ctaWindow:u,sourceTextRegions:f,contentTimeline:p,framingTimeline:h,sourceSize:m,contentCropMode:w,sourceFit:g,watermark:k,captionsHidden:v,staticCamera:y,punch:x})=>{if(!e)return c.jsx(Dn,{style:{backgroundColor:"#111",color:"#888",alignItems:"center",justifyContent:"center",fontFamily:"monospace",fontSize:40},children:"no production loaded"});const b=/^https?:\/\//.test(e)?e:Bp(e),S=g==="contain"||y===!0?null:oj(x);return c.jsxs(Dn,{style:{backgroundColor:"black"},children:[c.jsx(M4,{cues:r,theme:o,face:s,zoomPlan:a,sourceTextRegions:f,contentTimeline:p,framingTimeline:h,spans:t,sourceSize:m,contentCropMode:w,sourceFit:g,children:c.jsx(sj,{src:b,spans:t,...S?{punch:S}:{},...g==="contain"?{punchInScale:1,background:"transparent"}:{},...y===!0?{punchInScale:1}:{}})}),c.jsx(k$,{cues:r,theme:o}),P$(v)?c.jsx(T4,{lines:n,cues:r,activeColor:o.accent,theme:o,ctaKeyword:l,ctaWindow:u,sourceTextRegions:f}):null,R$(k)?c.jsx(j$,{theme:o,frame:{width:i.width,height:i.height}}):null]})},_$=600,M$=()=>({doc:yM(),past:[],future:[],dirty:!1,savedAt:0,lastCoalesce:null}),Hn=(e,t)=>e.scenes[t]??{props:{},elements:{}};function $$(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<_$;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=Hn(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(_g(e.doc,t.sceneId,t.elementId,t.patch),t.coalesce);case"clearElement":return n(_M(e.doc,t.sceneId,t.elementId));case"hideElement":return n(_g(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(MM(e.doc,t.sceneId,t.elementId)):e}case"patchTiming":{const o=Hn(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($M(e.doc,t.sceneId));case"patchVideo":{const o=Hn(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=Hn(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=Hn(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...o,captionY:t.y}}},t.coalesce)}case"patchCaptionScale":{const o=Hn(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:gM(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=Hn(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=Hn(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...o,component:t.component}}})}case"patchLayout":{const{graphicRect:o,...i}=Hn(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...i,layout:t.layout}}})}case"patchGraphicRect":{const o=Hn(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...o,graphicRect:t.rect}}},t.coalesce)}case"clearGraphicRect":return n(AM(e.doc,t.sceneId));case"patchCaption":{const o=vn(t.srcStart),i=jg(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=vn(t.fromSrcStart),i=vn(t.toSrcStart),s=t.text.trim();if(!s)return e;const a=Pg(e.doc.captionRangeEdits,o,i,t.was);if(s===a){const g=e.doc.captionRangeEdits.filter(k=>k.fromKey!==o||k.toKey!==i);return g.length===e.doc.captionRangeEdits.length?e:n({...e.doc,captionRangeEdits:g})}const l=Math.min(Math.round(t.fromSrcStart*1e3),Math.round(t.toSrcStart*1e3)),u=Math.max(Math.round(t.fromSrcStart*1e3),Math.round(t.toSrcStart*1e3)),f=g=>{if(Os(g))return!1;const k=Number(g.slice(1));return k>=l&&k<=u},p=Object.fromEntries(Object.entries(e.doc.captions).filter(([g])=>!f(g))),h=Object.fromEntries(Object.entries(e.doc.captionWordsHidden).filter(([g])=>!f(g))),m=Object.fromEntries(Object.entries(e.doc.captionLineTiming).filter(([g])=>!f(g))),w=[...e.doc.captionRangeEdits.filter(g=>{const k=Math.min(Number(g.fromKey.slice(1)),Number(g.toKey.slice(1)));return Math.max(Number(g.fromKey.slice(1)),Number(g.toKey.slice(1)))<l||k>u}),{fromKey:o,toKey:i,text:s,was:a}];return n({...e.doc,captions:p,captionWordsHidden:h,captionLineTiming:m,captionRangeEdits:w})}case"patchCaptionAllOccurrences":{let o=e.doc.captions,i=!1;for(const s of t.entries){const a=vn(s.srcStart),l=jg(o,a,s.was);if(t.text===l){if(!(a in o))continue;const{[a]:f,...p}=o;o=p,i=!0;continue}const u=o[a];u!==void 0&&u.text===t.text&&u.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=vn(a.fromSrcStart),u=vn(a.toSrcStart),f=Pg(i.captionRangeEdits,l,u,a.was);if(o===f){const w=i.captionRangeEdits.filter(g=>g.fromKey!==l||g.toKey!==u);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)),h=Math.max(Math.round(a.fromSrcStart*1e3),Math.round(a.toSrcStart*1e3)),m=w=>{if(Os(w))return!1;const g=Number(w.slice(1));return g>=p&&g<=h};i={...i,captions:Object.fromEntries(Object.entries(i.captions).filter(([w])=>!m(w))),captionWordsHidden:Object.fromEntries(Object.entries(i.captionWordsHidden).filter(([w])=>!m(w))),captionLineTiming:Object.fromEntries(Object.entries(i.captionLineTiming).filter(([w])=>!m(w))),captionRangeEdits:[...i.captionRangeEdits.filter(w=>{const g=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||g>h}),{fromKey:l,toKey:u,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=vn(s.srcStart);if(Math.abs(s.lead)<.001&&Math.abs(s.tail)<.001){if(!(a in o))continue;const{[a]:u,...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=vn(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=vn(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=vn(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"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($$,void 0,M$),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}),patchTheme:r=>t({type:"patchTheme",patch:r})}}function Hg(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 Ug(e){const t=e==null?void 0:e.closest("[data-edit-video]");return(t==null?void 0:t.dataset.editVideo)||null}function Zg(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 u=l.getBoundingClientRect();o=Math.min(o,u.left),i=Math.min(i,u.top),s=Math.max(s,u.right),a=Math.max(a,u.bottom)}),new DOMRect(o,i,s-o,a-i)}const Kg=.015,N$=1e-9;function Lo(e,t){let n=null,r=1/0;for(const o of e){const i=Math.abs(o.feature-o.target);i<=t+N$&&i<r&&(n=o,r=i)}return n}function Yg(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,u=l>=n.left&&l+e.w<=1-n.right,f=Lo([...u?[{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,h=e.y+e.h,m=.5-e.h/2,w=m>=n.top&&m+e.h<=1-n.bottom,g=Lo([...w?[{target:.5,feature:p}]:[],{target:n.top,feature:e.y},{target:1-n.bottom,feature:h}],r);return g&&(o.y=e.y+(g.target-g.feature),i.push({axis:"y",at:g.target})),{rect:o,guides:i}}if(t.includes("w")){const s=Lo([{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=Lo([{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=Lo([{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=Lo([{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 L$(e){const t=e.spans;if(t===void 0)return{};let n;try{n=F1(t).spans.length}catch{return{}}if(n===0)return{};const r={};return e.captionLines&&(r.captionLines=Mg(e.captionLines,t)),e.baseCaptionLines&&(r.baseCaptionLines=Mg(e.baseCaptionLines,t)),r}function Gg(e,t){const n=t.baseCaptionLines??t.captionLines??[],r=EM(e.captions,n);return{doc:{...e,captions:CM(e.captions,r)},unresolved:r.unresolved}}function z$(e){const t={};for(const[n,r]of Object.entries(e))Os(n)||(t[n]=r);return t}function D$(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 O$(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 tb(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 B$(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 W$(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 V$(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 H$(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 U$(e){if(e===void 0||e.trim()==="")return null;const t=Number(e);return He({srcStart:t})===null?null:t}function Z$(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=P1(e.id);return{sceneId:e.id,rootId:o,isSplitHalf:o!==e.id,startSec:e.startSec,endSec:e.endSec,targets:n}}function Xg(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 qg=64,Da=9,Oa=e=>Math.round(e*10)/10,zo=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},Qg={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"}},K$={...nb,background:"#ffe14d"},Y$={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}},G$={position:"absolute",cursor:"move",pointerEvents:"auto",zIndex:5},rb=/^(line|node|message|window|item)-(\d+)$/;function X$(e,t,n){const r=rb.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(),u=l[i];if(o==="node"||o==="item")l[i]=n;else if(o==="window"){if(typeof u!="object"||u===null)return null;const f=n.split(`
160
+ `).slice(0,6).map(p=>p.slice(0,40));l[i]={...u,lines:f}}else{if(typeof u!="object"||u===null)return null;l[i]={...u,text:n}}return{[s]:l}}function q$(e,t){const n=rb.exec(e);if(!n){const u=t[e];return typeof u=="string"?u: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 u=a==null?void 0:a.lines;return Array.isArray(u)&&u.every(f=>typeof f=="string")?u.join(`
161
+ `):null}const l=a==null?void 0:a.text;return typeof l=="string"?l:null}function ob(){const e=document.activeElement;(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&e.blur()}const Q$=({stageRef:e,selection:t,onSelect:n,edits:r,onSave:o,settings:i,playerRef:s,onTransport:a,onVideoPreview:l,onGraphicPreview:u,cue:f,cues:p,onToggleHelp:h,onRequestDelete:m})=>{const[w,g]=d.useState(null),k=d.useRef(null),v=d.useRef(0),y=d.useRef(null),x=d.useRef(0),b=d.useRef(null),S=d.useRef(0),E=d.useRef(null),[R,j]=d.useState(!1),[I,_]=d.useState([]),A=d.useRef(null),[W,P]=d.useState(null),[F,H]=d.useState(null),O=d.useRef(null),[T,C]=d.useState({dx:0,dy:0}),N=d.useRef(null),$=d.useRef(t),D=d.useCallback(L=>{$.current=L,n(L)},[n]);d.useEffect(()=>{$.current=t},[t]);const B=(L,z)=>{const Q=[];let G=null;for(let V=0;V<25;V++){const K=document.elementFromPoint(L,z);if(!K||K===document.documentElement||K===document.body){G=K;break}if(G=K,K.hasAttribute("data-edit-id")||K.hasAttribute("data-edit-scene")||K.hasAttribute("data-caption-word")||K.closest("[data-edit-video]")!==null||["BUTTON","INPUT","SELECT","TEXTAREA"].includes(K.tagName)||!(K instanceof HTMLElement))break;Q.push({el:K,prev:K.style.pointerEvents}),K.style.pointerEvents="none"}return Q.forEach(({el:V,prev:K})=>{V.style.pointerEvents=K}),G},Z=d.useCallback(()=>{var K,de;const L=e.current,z=(K=s.current)==null?void 0:K.getScale(),Q=((de=L==null?void 0:L.querySelector(".__remotion-player"))==null?void 0:de.getBoundingClientRect())??(L==null?void 0:L.getBoundingClientRect());if(!Q||!z||z<=0)return null;const G=i.width*z,V=i.height*z;return{left:Q.left+(Q.width-G)/2,top:Q.top+(Q.height-V)/2,w:G,h:V}},[e,s,i]);return d.useEffect(()=>{if(!t){g(null);return}let L;const z=()=>{var G;const Q=e.current;if(Q){const V=t.elementId?Zg(Q,t.sceneId,t.elementId):((G=Q.querySelector(`[data-edit-scene="${t.sceneId}"]`))==null?void 0:G.getBoundingClientRect())??null;g(V)}L=requestAnimationFrame(z)};return L=requestAnimationFrame(z),()=>cancelAnimationFrame(L)},[e,t]),d.useEffect(()=>{const L=z=>{var V,K;const Q=e.current;if(!Q||!Q.contains(z.target)||z.altKey||z.button!==0)return;(((V=$.current)==null?void 0:V.elementId)&&((K=N.current)==null?void 0:K.contains(z.target))||Hg(B(z.clientX,z.clientY))!==null)&&z.stopPropagation()};return window.addEventListener("pointerdown",L,!0),()=>window.removeEventListener("pointerdown",L,!0)},[e]),d.useEffect(()=>{const L=z=>{var ee,q,J,ie,Me,ke,be;const Q=e.current;if(!Q||!Q.contains(z.target))return;const G=document.activeElement;if((G instanceof HTMLInputElement||G instanceof HTMLTextAreaElement)&&G.contains(z.target)||(ob(),z.altKey||z.button!==0))return;const V=z.target instanceof Element?z.target.closest("[data-el-handle]"):null,K=$.current;if(V&&(K!=null&&K.elementId)){const $e=Zg(Q,K.sceneId,K.elementId);if($e){const xe=$e.left+$e.width/2,Te=$e.top+$e.height/2,Pe=Math.hypot(z.clientX-xe,z.clientY-Te);if(Pe>2){const Ee=((q=(ee=r.doc.scenes[K.sceneId])==null?void 0:ee.elements[K.elementId])==null?void 0:q.scale)??1;A.current={sceneId:K.sceneId,elementId:K.elementId,cx:xe,cy:Te,startDist:Pe,prior:Ee,factor:1},P(1)}}return}if((J=$.current)!=null&&J.elementId&&((ie=N.current)!=null&&ie.contains(z.target))){O.current={x:z.clientX,y:z.clientY,dx:0,dy:0},C({dx:0,dy:0});return}const de=z.target instanceof Element?z.target.closest("[data-box-handle]"):null,ge=$.current;if(de&&ge&&!ge.elementId){const $e=Q.querySelector(`[data-edit-scene="${ge.sceneId}"]`),xe=Z();if($e&&xe){const Te=$e.getBoundingClientRect();E.current=null,b.current={sceneId:ge.sceneId,handle:de.dataset.boxHandle,x:z.clientX,y:z.clientY,dx:0,dy:0,start:{x:(Te.left-xe.left)/xe.w,y:(Te.top-xe.top)/xe.h,w:Te.width/xe.w,h:Te.height/xe.h}},j(!0)}return}const ce=B(z.clientX,z.clientY),se=Hg(ce);if(!se){const $e=ce==null?void 0:ce.closest("[data-edit-scene]");if($e){D({sceneId:$e.dataset.editScene,elementId:null});return}const xe=Ug(ce),Te=Q.getBoundingClientRect().bottom;if(xe&&z.clientY<Te-qg){D({sceneId:xe,elementId:null});const Pe=p.find(Le=>Le.id===xe);if((Pe==null?void 0:Pe.layout)==="pip-bubble"&&!z.altKey){const Le=wo("pip-bubble",void 0,[],i).video.rect;y.current={sceneId:xe,x:z.clientX,y:z.clientY,base:{x:((Me=Pe.pip)==null?void 0:Me.x)??Le.x,y:((ke=Pe.pip)==null?void 0:ke.y)??Le.y},slot:{w:Le.w,h:Le.h}};return}const Ee=(be=r.doc.scenes[xe])==null?void 0:be.video;k.current={sceneId:xe,x:z.clientX,y:z.clientY,dx:0,dy:0,baseDx:(Ee==null?void 0:Ee.dx)??0,baseDy:(Ee==null?void 0:Ee.dy)??0};return}D(null);return}D({sceneId:se.sceneId,elementId:se.elementId}),O.current={x:z.clientX,y:z.clientY,dx:0,dy:0},C({dx:0,dy:0})};return window.addEventListener("mousedown",L),()=>window.removeEventListener("mousedown",L)},[e,D,r,Z,p,i]),d.useEffect(()=>{const L=()=>{var K,de;const G=(K=s.current)==null?void 0:K.getScale(),V=(de=e.current)==null?void 0:de.getBoundingClientRect();return G&&G>0?1/G:V&&V.width>0?i.width/V.width:1},z=G=>{const V=e.current;if(V&&!(b.current||A.current))if(y.current)V.style.cursor="move";else if(k.current)V.style.cursor="grabbing";else{const ee=G.target instanceof Element?G.target:null,q=ee!==null&&V.contains(ee)&&!ee.closest("button, input, select, textarea, [data-edit-id], [data-edit-scene], [data-caption-word]")&&G.clientY<V.getBoundingClientRect().bottom-qg,J=q&&(()=>{var Me;const ie=Ug(ee);return ie!==null&&((Me=p.find(ke=>ke.id===ie))==null?void 0:Me.layout)==="pip-bubble"})();V.style.cursor=q?J?"move":"grab":""}const K=A.current;if(K){const q=Math.hypot(G.clientX-K.cx,G.clientY-K.cy)/K.startDist;K.factor=Math.min(4/K.prior,Math.max(.05/K.prior,q)),P(K.factor);return}const de=b.current;if(de){de.dx=G.clientX-de.x,de.dy=G.clientY-de.y,E.current=G.altKey,S.current||(S.current=requestAnimationFrame(()=>{S.current=0;const ee=b.current,q=Z();if(!ee||!q)return;const J=Zl(Xg(ee.start,ee.handle,ee.dx/q.w,ee.dy/q.h),i);if(G.altKey)_([]),u({sceneId:ee.sceneId,rect:J});else{const ie=Yg(J,ee.handle,Zn(i),Kg);_(ie.guides),u({sceneId:ee.sceneId,rect:ie.rect})}}));return}if(y.current){x.current||(x.current=requestAnimationFrame(()=>{x.current=0;const ee=y.current,q=Z();if(!ee||!q)return;const J=(G.clientX-ee.x)/q.w,ie=(G.clientY-ee.y)/q.h;r.patchPip(ee.sceneId,{x:zo(Math.min(Math.max(ee.base.x+J,0),1-ee.slot.w)),y:zo(Math.min(Math.max(ee.base.y+ie,0),1-ee.slot.h))},`pip:${ee.sceneId}:drag`)}));return}const ce=k.current;if(ce){ce.dx=G.clientX-ce.x,ce.dy=G.clientY-ce.y,v.current||(v.current=requestAnimationFrame(()=>{v.current=0;const ee=k.current;if(!ee)return;const q=L();l({sceneId:ee.sceneId,patch:{dx:ee.baseDx+ee.dx*q,dy:ee.baseDy+ee.dy*q}})}));return}const se=O.current;se&&(se.dx=G.clientX-se.x,se.dy=G.clientY-se.y,C({dx:se.dx,dy:se.dy}))},Q=G=>{const V=A.current;if(V){A.current=null,P(null),Math.abs(V.factor-1)>.001&&r.patchElement(V.sceneId,V.elementId,{scale:Math.round(V.prior*V.factor*1e3)/1e3});return}const K=b.current;if(K){if(b.current=null,j(!1),_([]),S.current&&(cancelAnimationFrame(S.current),S.current=0),K.dx!==0||K.dy!==0){const ee=Z();if(ee){let q=Zl(Xg(K.start,K.handle,K.dx/ee.w,K.dy/ee.h),i);(E.current??G.altKey)||(q=Yg(q,K.handle,Zn(i),Kg).rect),r.patchGraphicRect(K.sceneId,{x:zo(q.x),y:zo(q.y),w:zo(q.w),h:zo(q.h)})}}E.current=null,u(null);return}if(y.current){y.current=null,x.current&&(cancelAnimationFrame(x.current),x.current=0);return}const ge=k.current;if(ge){if(k.current=null,v.current&&(cancelAnimationFrame(v.current),v.current=0),ge.dx!==0||ge.dy!==0){const ee=L();r.patchVideo(ge.sceneId,{dx:Oa(ge.baseDx+ge.dx*ee),dy:Oa(ge.baseDy+ge.dy*ee)})}l(null);return}const ce=O.current,se=$.current;if(!ce||!(se!=null&&se.elementId)){O.current=null;return}if(ce.dx!==0||ce.dy!==0){const ee=L(),q=r.doc.scenes[se.sceneId],J=q==null?void 0:q.elements[se.elementId];r.patchElement(se.sceneId,se.elementId,{dx:Oa(((J==null?void 0:J.dx)??0)+ce.dx*ee),dy:Oa(((J==null?void 0:J.dy)??0)+ce.dy*ee)})}O.current=null,C({dx:0,dy:0})};return window.addEventListener("mousemove",z),window.addEventListener("mouseup",Q),()=>{window.removeEventListener("mousemove",z),window.removeEventListener("mouseup",Q)}},[r,e,i,s,l,u,Z,p]),d.useEffect(()=>{const L=z=>{var de;const Q=e.current;if(!Q||!Q.contains(z.target))return;const G=(de=B(z.clientX,z.clientY))==null?void 0:de.closest("[data-caption-word]");if(!G)return;z.preventDefault();const V=U$(G.dataset.captionSrc),K=G.dataset.captionText??"";V===null||!K||H({srcStart:V,was:K,draft:K,rect:G.getBoundingClientRect()})};return window.addEventListener("dblclick",L),()=>window.removeEventListener("dblclick",L)},[e]),d.useEffect(()=>{const L=()=>{const V=document.activeElement;return V instanceof HTMLInputElement||V instanceof HTMLTextAreaElement||V instanceof HTMLSelectElement||V instanceof HTMLElement&&V.isContentEditable},z=()=>{const V=document.activeElement;return V instanceof HTMLTextAreaElement||V instanceof HTMLElement&&V.isContentEditable?!0:V instanceof HTMLInputElement&&!["range","checkbox","radio","button"].includes(V.type)},Q=()=>{const V=document.activeElement;V instanceof HTMLElement&&!z()&&V.blur()},G=V=>{var de,ge,ce;if(F!==null)return;const K=V.metaKey||V.ctrlKey;if(V.key==="Escape"){if(L()){(de=document.activeElement)==null||de.blur();return}D(null)}else if(K&&V.key.toLowerCase()==="z")V.preventDefault(),V.shiftKey?r.redo():r.undo();else if(K&&V.key.toLowerCase()==="y")V.preventDefault(),r.redo();else if(K&&V.key.toLowerCase()==="s")V.preventDefault(),o();else if(V.key===" "&&!K){if(z())return;const se=document.activeElement;if(se instanceof HTMLElement&&se.tagName==="BUTTON"&&((ge=e.current)!=null&&ge.contains(se)))return;Q(),V.preventDefault(),(ce=s.current)==null||ce.toggle()}else if(!K&&["j","k","l"].includes(V.key.toLowerCase())){if(z())return;Q(),V.preventDefault(),a(V.key.toUpperCase())}else if(!K&&!V.altKey&&(V.key==="ArrowLeft"||V.key==="ArrowRight")){if(L())return;V.preventDefault();const se=s.current;if(!se)return;se.seekTo(Math.max(0,se.getCurrentFrame()+(V.key==="ArrowRight"?1:-1)))}else if(K&&V.key.toLowerCase()==="b"){if(z())return;V.preventDefault();const se=s.current;if(!se)return;const ee=se.getCurrentFrame()/i.fps;if(!p.find(J=>ee>=J.startSec+Hl&&ee<=J.endSec-Hl))return;r.addSplit(Math.round(ee*1e3)/1e3)}else if(!K&&V.altKey&&(V.key==="ArrowLeft"||V.key==="ArrowRight")){if(z())return;const se=$.current,ee=se?(()=>{const q=p.findIndex(J=>J.id===se.sceneId);return q===-1?void 0:p[q+(V.key==="ArrowRight"?1:-1)]})():p[V.key==="ArrowRight"?0:p.length-1];if(!ee)return;V.preventDefault(),D({sceneId:ee.id,elementId:null})}else if(K&&(V.key==="ArrowLeft"||V.key==="ArrowRight")){if(z())return;V.preventDefault();const se=s.current;if(!se)return;const ee=se.getCurrentFrame()/i.fps,q=p.findIndex(ie=>ee>=ie.startSec&&ee<ie.endSec),J=p[(q===-1?0:q)+(V.key==="ArrowRight"?1:-1)];if(!J)return;se.seekTo(Math.round(J.startSec*i.fps)),D({sceneId:J.id,elementId:null})}else if(!K&&!V.altKey&&V.key==="?"){if(L())return;V.preventDefault(),h()}else if(!K&&(V.key==="Delete"||V.key==="Backspace")){if(L())return;const se=$.current;if(!se||se.elementId!==null||!f||f.id!==se.sceneId)return;const ee=Z$(f,r.doc);if(!ee)return;V.preventDefault(),m(ee)}};return window.addEventListener("keydown",G),()=>window.removeEventListener("keydown",G)},[D,r,F,o,s,e,a,f,p,i,h,m]),c.jsxs("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},children:[T.dx!==0||T.dy!==0||R?c.jsx("div",{"data-testid":"safe-area-guide",style:{position:"absolute",left:`${Zn(i).left*100}%`,top:`${Zn(i).top*100}%`,right:`${Zn(i).right*100}%`,bottom:`${Zn(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,I.map(L=>c.jsx("div",{"data-testid":`guide-${L.axis}`,style:{position:"absolute",pointerEvents:"none",background:"#FFE14D",...L.axis==="x"?{left:`${L.at*100}%`,top:0,bottom:0,width:1}:{top:`${L.at*100}%`,left:0,right:0,height:1}}},L.axis)),w&&t?c.jsxs("div",{ref:N,"data-testid":"overlay-box",style:{position:"fixed",pointerEvents:"auto",left:w.left+T.dx-Da/2+w.width*(1-(W??1))/2,top:w.top+T.dy-Da/2+w.height*(1-(W??1))/2,width:w.width*(W??1)+Da,height:w.height*(W??1)+Da,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?c.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(L=>c.jsx("div",{"data-el-handle":L,"data-testid":`el-handle-${L}`,style:{...K$,...Qg[L]}},L)):null,!t.elementId&&f&&f.kind!=="plain"?c.jsxs(c.Fragment,{children:[["top","bottom","left","right"].map(L=>c.jsx("div",{"data-box-handle":"move","data-testid":L==="top"?"box-handle-move":`box-handle-move-${L}`,style:{...G$,...Y$[L]}},L)),["nw","n","ne","e","se","s","sw","w"].map(L=>c.jsx("div",{"data-box-handle":L,"data-testid":`box-handle-${L}`,style:{...nb,...Qg[L]}},L))]}):null]}):null,F?c.jsx("input",{autoFocus:!0,"data-testid":"caption-edit",value:F.draft,onChange:L=>H({...F,draft:L.target.value}),onBlur:()=>{const L=F.draft.trim();L&&r.patchCaption(F.srcStart,L,F.was),H(null)},onKeyDown:L=>{L.key==="Enter"&&L.target.blur(),L.key==="Escape"&&H(null)},style:{position:"fixed",pointerEvents:"auto",left:F.rect.left-4,top:F.rect.top-4,width:Math.max(F.rect.width+40,90),height:F.rect.height+8,fontSize:Math.max(13,Math.min(F.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]})},Fn={display:"flex",flexDirection:"column",gap:6},Qi={display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},Ye={fontSize:11,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"#9A9AA3"},vs={fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",fontSize:13,background:"#0F0F14",border:"1px solid #2A2A33",borderRadius:6,color:"#fff",padding:"6px 8px",width:"100%"},gf={...vs,fontFamily:"'Inter', system-ui, sans-serif"},ot={display:"flex",flexDirection:"column",gap:14,padding:"16px 18px",borderBottom:"1px solid #22222a"},rn={fontSize:12,fontWeight:600,color:"#FF5C5C",background:"transparent",border:"1px solid #452626",borderRadius:6,padding:"7px 10px",cursor:"pointer"},on=()=>{var e,t;(t=(e=document.activeElement)==null?void 0:e.blur)==null||t.call(e)},J$=e=>String(Math.round(e*1e3)/1e3),Kt=({id:e,value:t,onCommit:n,min:r,max:o,dragStep:i})=>{const[s,a]=oe.useState(null),[l,u]=oe.useState(!1),f=oe.useRef(null),p=oe.useRef(null),h=r??-1/0,m=o??1/0,w=i??(r!==void 0&&o!==void 0?(o-r)/240:.5),g=s!==null;return c.jsxs("div",{style:Fn,children:[c.jsx("span",{style:Ye,children:e}),c.jsx("input",{type:"text",inputMode:"decimal",ref:f,"data-testid":`field-${e}`,style:{...vs,...g?{}:{cursor:"ew-resize",touchAction:"none"},...l?{borderColor:"#FFE14D",color:"#FFE14D"}:{}},value:s??(Number.isFinite(t)?J$(t):"0"),onFocus:k=>a(k.target.value),onBlur:()=>a(null),onPointerDown:k=>{g||(k.preventDefault(),p.current={x:k.clientX,v:Number.isFinite(t)?t:0,moved:!1},k.currentTarget.setPointerCapture(k.pointerId),u(!0))},onPointerMove:k=>{const v=p.current;if(!v)return;const y=k.clientX-v.x;if(!v.moved&&Math.abs(y)<=2)return;v.moved=!0;const x=Math.round(Math.min(m,Math.max(h,v.v+y*w))*1e3)/1e3;n(x)},onPointerUp:()=>{var v,y,x;const k=((v=p.current)==null?void 0:v.moved)===!0;p.current=null,u(!1),k||((y=f.current)==null||y.focus(),(x=f.current)==null||x.select())},onPointerCancel:()=>{p.current=null,u(!1)},onChange:k=>{a(k.target.value);const v=k.target.value.trim();if(v==="")return;const y=Number(v.replace(",","."));Number.isFinite(y)&&n(Math.min(m,Math.max(h,y)))}})]})},Ba=({id:e,value:t,isColor:n,onCommit:r})=>c.jsxs("div",{style:Fn,children:[c.jsx("span",{style:Ye,children:e}),c.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[n?c.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,c.jsx("input",{"data-testid":`theme-${e}`,style:{...gf,flex:1},value:t,onChange:o=>r(o.target.value)})]})]}),eA=({selection:e,cue:t,frame:n,allSceneIds:r,edits:o,onSelect:i,resolvedTheme:s,anchorText:a,onVideoPreview:l,runInfo:u,captionsHiddenByFlag:f})=>{var v,y,x,b,S,E,R,j,I,_,A,W;if(e!=null&&e.elementId&&t){const P=e.elementId,F=((v=t.elements)==null?void 0:v[P])??{},H=t.props?q$(P,t.props):null,O=/^window-\d+$/.test(P);return c.jsxs("div",{children:[c.jsxs("div",{style:ot,children:[c.jsx("span",{style:Ye,children:"Selected"}),c.jsx("div",{style:{fontSize:15,fontWeight:700,fontFamily:"ui-monospace, monospace"},children:P})]}),(()=>{var B;const T=/^line-(\d+)$/.exec(P),C=(B=t.props)==null?void 0:B.lines;if(t.component!=="StrikethroughReveal"||!T||!Array.isArray(C))return null;const N=Number(T[1]),$=C[N];if(!$)return null;const D=$.struck?"struck":($.mark??"none")!=="none"?$.mark:"plain";return c.jsx("div",{style:ot,children:c.jsxs("div",{style:Fn,children:[c.jsx("span",{style:Ye,children:"Line style"}),c.jsxs("select",{"data-testid":"line-style",style:vs,value:D,onChange:Z=>{const L=Z.target.value,z=C.slice();z[N]={...z[N],struck:L==="struck",mark:L==="cross"||L==="check"?L:"none"},o.patchProps(e.sceneId,{lines:z})},children:[c.jsx("option",{value:"plain",children:"plain"}),c.jsx("option",{value:"struck",children:"struck through"}),c.jsx("option",{value:"cross",children:"✗ wrong"}),c.jsx("option",{value:"check",children:"✓ right"})]})]})})})(),H!==null?c.jsx("div",{style:ot,children:c.jsxs("div",{style:Fn,children:[c.jsx("span",{style:Ye,children:"Text"}),(()=>{const T=C=>{const N=t.props??{},$=/^(line|node|message|window|item)-\d+$/.test(P)?X$(P,N,C):{[P]:C};$&&o.patchProps(e.sceneId,$,`text:${e.sceneId}:${P}`)};return O?c.jsx("textarea",{style:{...gf,resize:"vertical",fontFamily:"inherit"},"data-testid":"element-text",rows:Math.min(6,Math.max(2,H.split(`
162
+ `).length)),value:H,onChange:C=>T(C.target.value)}):c.jsx("input",{style:gf,"data-testid":"element-text",value:H,onChange:C=>T(C.target.value)})})()]})}):null,c.jsxs("div",{style:ot,children:[c.jsxs("div",{style:Fn,children:[c.jsxs("span",{style:Ye,children:["scale"," ",c.jsxs("span",{style:{color:"#EDEDF2"},children:[(F.scale??1).toFixed(2),"×"]})]}),c.jsx("input",{type:"range","data-testid":"el-scale-slider",min:.1,max:3,step:.01,value:F.scale??1,onChange:T=>o.patchElement(e.sceneId,P,{scale:Number(T.target.value)},`element:${e.sceneId}:${P}:scale`)})]}),c.jsxs("div",{style:Qi,children:[c.jsx(Kt,{id:"x",value:F.dx??0,dragStep:1,onCommit:T=>o.patchElement(e.sceneId,P,{dx:T},`element:${e.sceneId}:${P}:dx`)}),c.jsx(Kt,{id:"y",value:F.dy??0,dragStep:1,onCommit:T=>o.patchElement(e.sceneId,P,{dy:T},`element:${e.sceneId}:${P}:dy`)})]}),c.jsx(Kt,{id:"scale",value:F.scale??1,min:.05,max:4,dragStep:.01,onCommit:T=>o.patchElement(e.sceneId,P,{scale:T},`element:${e.sceneId}:${P}:scale`)})]}),c.jsxs("div",{style:ot,children:[c.jsx("button",{style:rn,onClick:()=>{on(),o.clearElement(e.sceneId,P)},children:"Reset element"}),c.jsx("button",{"data-testid":"delete-element",style:{...rn,marginTop:8},onClick:()=>{on(),o.hideElement(e.sceneId,P),i({sceneId:e.sceneId,elementId:null})},children:"Delete element"})]})]})}if(e&&t){const P=t.kind==="plain";if(((y=o.doc.scenes[e.sceneId])==null?void 0:y.hidden)===!0)return c.jsx("div",{children:c.jsxs("div",{style:ot,children:[c.jsx("span",{style:Ye,children:"Scene"}),c.jsxs("div",{style:{fontSize:15,fontWeight:700,fontFamily:"ui-monospace, monospace"},children:[e.sceneId," ",c.jsx("span",{style:{color:"#9A9AA3",fontWeight:400},children:"(deleted)"})]}),c.jsx("div",{style:{fontSize:12,color:"#9A9AA3"},children:"Its window plays as a plain take. Restore brings the graphic back."}),c.jsx("button",{"data-testid":"restore-scene",style:{...rn,color:"#5FBF77",border:"1px solid #24402c"},onClick:()=>{on(),o.restoreScene(e.sceneId)},children:"Restore scene"})]})});const F=o.doc.cuts.findIndex(O=>O.src===void 0&&O.startSec===t.startSec&&O.endSec===t.endSec);if(F!==-1)return c.jsx("div",{children:c.jsxs("div",{style:ot,children:[c.jsx("span",{style:Ye,children:P?"Take":"Scene"}),c.jsxs("div",{style:{fontSize:15,fontWeight:700,fontFamily:"ui-monospace, monospace"},children:[e.sceneId," ",c.jsx("span",{style:{color:"#9A9AA3",fontWeight:400},children:"(marked for removal)"})]}),c.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)."}),c.jsx("button",{"data-testid":"restore-chunk",style:{...rn,color:"#5FBF77",border:"1px solid #24402c"},onClick:()=>{on(),o.restoreChunk(F)},children:"Restore"})]})});const H=Object.entries(t.elements??{}).filter(([,O])=>O.hidden===!0).map(([O])=>{var N,$;const C=(($=(N=o.doc.scenes[e.sceneId])==null?void 0:N.elements[O])==null?void 0:$.hidden)===!0?e.sceneId:P1(e.sceneId);return{id:O,owningSceneId:C}});return c.jsxs("div",{children:[c.jsxs("div",{style:ot,children:[c.jsx("span",{style:Ye,children:P?"Take":"Scene"}),c.jsx("div",{style:{fontSize:15,fontWeight:700,fontFamily:"ui-monospace, monospace"},children:e.sceneId}),P?c.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]}),c.jsxs("div",{style:ot,children:[!P&&t.component?c.jsxs("div",{style:Fn,children:[c.jsx("span",{style:Ye,children:"Component"}),c.jsx("select",{style:vs,value:t.component,onChange:O=>o.patchComponent(e.sceneId,O.target.value),children:Bu.options.map(O=>c.jsx("option",{value:O,children:O},O))})]}):null,c.jsxs("div",{style:Fn,children:[c.jsx("span",{style:Ye,children:"Layout"}),c.jsx("select",{style:vs,"data-testid":"layout-select",value:t.layout,onChange:O=>o.patchLayout(e.sceneId,O.target.value),children:Ou.options.map(O=>c.jsx("option",{value:O,children:O},O))})]})]}),c.jsxs("div",{style:ot,children:[c.jsx("span",{style:Ye,children:"Video framing"}),c.jsxs("div",{style:Fn,children:[c.jsxs("span",{style:Ye,children:["zoom"," ",c.jsxs("span",{style:{color:"#EDEDF2"},children:[(((x=t.video)==null?void 0:x.scale)??1).toFixed(2),"×"]})]}),c.jsx("input",{type:"range","data-testid":"zoom-slider",min:.5,max:3,step:.01,value:((b=t.video)==null?void 0:b.scale)??1,onChange:O=>l({sceneId:e.sceneId,patch:{scale:Number(O.target.value)}}),onPointerUp:O=>{const T=Number(O.target.value);o.patchVideo(e.sceneId,{scale:T},`video:${e.sceneId}:scale`),l(null)},onKeyUp:O=>{if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(O.key))return;const C=Number(O.target.value);o.patchVideo(e.sceneId,{scale:C},`video:${e.sceneId}:scale`),l(null)}})]}),c.jsxs("label",{style:{display:"flex",gap:8,alignItems:"center",fontSize:12,color:"#9A9AA3",cursor:"pointer"},children:[c.jsx("input",{type:"checkbox","data-testid":"auto-zoom",checked:((S=t.video)==null?void 0:S.autoZoom)!==!1,onChange:O=>o.patchVideo(e.sceneId,{autoZoom:O.target.checked})}),"auto zoom (the slow push composes on top of your zoom)"]}),c.jsx("div",{style:{fontSize:12,color:"#9A9AA3"},children:"Pan: drag the picture on the stage."}),c.jsx(Kt,{id:"scale",value:((E=t.video)==null?void 0:E.scale)??1,min:.05,max:4,dragStep:.01,onCommit:O=>o.patchVideo(e.sceneId,{scale:O},`video:${e.sceneId}:scale`)}),c.jsxs("div",{style:Qi,children:[c.jsx(Kt,{id:"dx",value:((R=t.video)==null?void 0:R.dx)??0,dragStep:1,onCommit:O=>o.patchVideo(e.sceneId,{dx:O},`video:${e.sceneId}:dx`)}),c.jsx(Kt,{id:"dy",value:((j=t.video)==null?void 0:j.dy)??0,dragStep:1,onCommit:O=>o.patchVideo(e.sceneId,{dy:O},`video:${e.sceneId}:dy`)})]}),t.video?c.jsx("button",{style:rn,onClick:()=>{on(),o.clearVideo(e.sceneId)},children:"Reset framing"}):null]}),t.layout==="pip-bubble"?(()=>{const O=wo("pip-bubble",void 0,[],n).video,T=t.pip??{},C=T.cornerRadius??O.cornerRadius;return c.jsxs("div",{style:ot,children:[c.jsx("span",{style:Ye,children:"PiP bubble"}),c.jsxs("div",{style:Fn,children:[c.jsxs("span",{style:Ye,children:["roundness"," ",c.jsx("span",{style:{color:"#EDEDF2"},children:C.toFixed(2)})]}),c.jsx("input",{type:"range","data-testid":"pip-roundness",min:0,max:1,step:.01,value:C,onChange:N=>o.patchPip(e.sceneId,{cornerRadius:Number(N.target.value)},`pip:${e.sceneId}:cornerRadius`)})]}),c.jsxs("div",{style:Qi,children:[c.jsx(Kt,{id:"pip-x",value:T.x??O.rect.x,min:0,max:1-O.rect.w,dragStep:.002,onCommit:N=>o.patchPip(e.sceneId,{x:N},`pip:${e.sceneId}:x`)}),c.jsx(Kt,{id:"pip-y",value:T.y??O.rect.y,min:0,max:1-O.rect.h,dragStep:.002,onCommit:N=>o.patchPip(e.sceneId,{y:N},`pip:${e.sceneId}:y`)})]}),t.pip?c.jsx("button",{"data-testid":"reset-pip",style:rn,onClick:()=>{on(),o.clearPip(e.sceneId)},children:"Reset bubble"}):null]})})():null,(()=>{var C;if(P)return null;const O=N1(t,n),T=N=>$=>o.patchGraphicRect(e.sceneId,Zl({...O,[N]:$},n),`box:${e.sceneId}:${N}`);return c.jsxs("div",{style:ot,children:[c.jsx("span",{style:Ye,children:"Graphic box"}),c.jsx("div",{style:{fontSize:12,color:"#9A9AA3"},children:"Frame fractions — or drag the handles on the stage."}),c.jsxs("div",{style:Qi,children:[c.jsx(Kt,{id:"box-x",value:O.x,min:0,max:1,dragStep:.002,onCommit:T("x")}),c.jsx(Kt,{id:"box-y",value:O.y,min:0,max:1,dragStep:.002,onCommit:T("y")})]}),c.jsxs("div",{style:Qi,children:[c.jsx(Kt,{id:"box-w",value:O.w,min:.08,max:1,dragStep:.002,onCommit:T("w")}),c.jsx(Kt,{id:"box-h",value:O.h,min:.05,max:1,dragStep:.002,onCommit:T("h")})]}),(C=o.doc.scenes[e.sceneId])!=null&&C.graphicRect?c.jsx("button",{"data-testid":"reset-box",style:rn,onClick:()=>{on(),o.clearGraphicRect(e.sceneId)},children:"Reset box"}):null]})})(),(()=>{const O=wo(t.layout,void 0,[],n).captionAnchor,T=t.captionY??O,C=t.captionScale??1,N=o.doc.scenes[e.sceneId];return c.jsxs("div",{style:ot,children:[c.jsx("span",{style:Ye,children:"Captions"}),o.doc.captionsHidden===!0||f===!0?c.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,c.jsxs("div",{style:Fn,children:[c.jsxs("span",{style:Ye,children:["position"," ",c.jsx("span",{style:{color:"#EDEDF2"},children:T.toFixed(2)})]}),c.jsx("input",{type:"range","data-testid":"caption-y-slider",min:.05,max:.95,step:.01,value:T,onChange:$=>o.patchCaptionY(e.sceneId,Number($.target.value),`captionY:${e.sceneId}`)})]}),c.jsxs("div",{style:Fn,children:[c.jsxs("span",{style:Ye,children:["scale"," ",c.jsxs("span",{style:{color:"#EDEDF2"},children:[C.toFixed(2),"×"]})]}),c.jsx("input",{type:"range","data-testid":"caption-scale-slider",min:.2,max:3,step:.01,value:C,onChange:$=>o.patchCaptionScale(e.sceneId,Number($.target.value),`captionScale:${e.sceneId}`)})]}),c.jsx(Kt,{id:"caption-scale",value:C,min:.2,max:3,dragStep:.01,onCommit:$=>o.patchCaptionScale(e.sceneId,$,`captionScale:${e.sceneId}`)}),c.jsx("button",{"data-testid":"caption-y-all",style:{...rn,color:"#EDEDF2",border:"1px solid #2A2A33"},title:"Write this scene's caption position and scale to every scene — one undo step",onClick:()=>{on(),o.patchCaptionStyleAll(r,{y:T,scale:C})},children:"Apply to all scenes"}),(N==null?void 0:N.captionY)!==void 0||(N==null?void 0:N.captionScale)!==void 0?c.jsx("button",{"data-testid":"reset-caption-y",style:rn,onClick:()=>{on(),o.clearCaptionStyle(e.sceneId)},children:"Reset captions"}):null]})})(),c.jsxs("div",{style:ot,children:[c.jsx("span",{style:Ye,children:"Timing"}),c.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",c.jsxs("span",{style:{color:"#9A9AA3"},children:[" ","(",(t.endSec-t.startSec).toFixed(2),"s)"]})]}),c.jsx("div",{style:{fontSize:12,color:t.pinned?"#FFE14D":"#9A9AA3"},children:P?"Derived from the cut — not movable":t.pinned?"Pinned to these times":"Tracking transcript"}),!t.pinned&&a?c.jsxs("div",{style:{fontSize:12,color:"#9A9AA3",fontStyle:"italic"},children:["“",a,"”"]}):null,t.pinned?c.jsx("button",{style:rn,onClick:()=>{on(),o.clearTiming(e.sceneId)},children:"Un-pin (re-anchor to words)"}):null]}),P?null:c.jsx("div",{style:ot,children:c.jsx("button",{"data-testid":"delete-scene",style:rn,onClick:()=>{on(),o.hideScene(e.sceneId)},children:"Delete scene"})}),H.length>0?c.jsxs("div",{style:ot,children:[c.jsx("span",{style:Ye,children:"Hidden elements"}),H.map(({id:O,owningSceneId:T})=>c.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[c.jsx("span",{style:{fontSize:13,fontFamily:"ui-monospace, monospace",color:"#C9C9D4"},children:O}),c.jsx("button",{"data-testid":`restore-element-${O}`,style:{...rn,color:"#5FBF77",border:"1px solid #24402c",padding:"4px 8px"},onClick:()=>{on(),o.restoreElement(T,O)},children:"Restore"})]},O))]}):null,c.jsxs("div",{style:ot,children:[c.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."}),c.jsx("button",{"data-testid":"cut-chunk",style:rn,onClick:()=>{on(),o.cutChunk(t.startSec,t.endSec)},children:"Delete this chunk"})]})]})}const p=o.doc.theme,h=(P,F)=>o.patchTheme({[P]:F}),m=P=>`${Math.floor(P/60)}:${String(Math.floor(P%60)).padStart(2,"0")}`,w=((I=u==null?void 0:u.usage)==null?void 0:I.totals)??null,g=((_=u==null?void 0:u.production)==null?void 0:_.producer)??null,k=((A=u==null?void 0:u.production)==null?void 0:A.clip)??null;return c.jsxs("div",{children:[c.jsxs("div",{style:ot,children:[c.jsx("span",{style:Ye,children:"Theme"}),c.jsx("div",{style:{fontSize:12,color:"#9A9AA3"},children:"Nothing selected — global tokens."})]}),c.jsxs("div",{style:ot,children:[c.jsx(Ba,{id:"accent",value:p.accent??s.accent,isColor:!0,onCommit:P=>h("accent",P)}),c.jsx(Ba,{id:"bg",value:p.bg??s.bg,isColor:!0,onCommit:P=>h("bg",P)}),c.jsx(Ba,{id:"fg",value:p.fg??s.fg,isColor:!0,onCommit:P=>h("fg",P)}),c.jsx(Kt,{id:"radiusPx",value:p.radiusPx??s.radiusPx,min:0,dragStep:.5,onCommit:P=>h("radiusPx",P)}),c.jsx(Ba,{id:"fontDisplay",value:p.fontDisplay??s.fontDisplay,isColor:!1,onCommit:P=>h("fontDisplay",P)})]}),c.jsxs("div",{style:ot,children:[c.jsx("span",{style:Ye,children:"Captions"}),c.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,color:"#EDEDF2",cursor:"pointer"},children:[c.jsx("input",{type:"checkbox","data-testid":"captions-visible-toggle",checked:o.doc.captionsHidden!==!0&&f!==!0,disabled:f===!0&&o.doc.captionsHidden!==!0,onChange:P=>o.setCaptionsHidden(!P.target.checked)}),"Show captions"]}),o.doc.captionsHidden===!0?c.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?c.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]}),g||w?c.jsxs("div",{style:ot,"data-testid":"run-info",children:[c.jsx("span",{style:Ye,children:"This video"}),g?c.jsxs("div",{style:{fontSize:12,color:"#C9C9D4"},children:["planned by ",c.jsx("span",{style:{color:"#EDEDF2"},children:g.provider}),g.models.length>0?` (${g.models.join(", ")})`:"",g.cached?" · reused from cache":"",g.at?` · ${new Date(g.at).toLocaleString()}`:""]}):null,w?c.jsxs("div",{style:{fontSize:12,color:"#C9C9D4"},children:[w.calls," LLM call",w.calls===1?"":"s"," ·"," ",w.inputTokens.toLocaleString()," in / ",w.outputTokens.toLocaleString()," out tokens",w.anyEstimated?" (partly estimated)":""]}):null,w&&w.equivalentUsd!==null?c.jsx("div",{style:{fontSize:12,color:"#C9C9D4"},children:w.allUnbilled?`~$${w.equivalentUsd.toFixed(2)} of API-rate work, covered by the subscription`:w.billedUsd!==null?`~$${w.billedUsd.toFixed(2)} charged at API rates`:`~$${w.equivalentUsd.toFixed(2)} at API rates`}):null,k?c.jsxs("div",{style:{fontSize:12,color:"#C9C9D4"},children:["clip: ",m(k.startSec),"–",m(k.endSec),(W=u==null?void 0:u.production)!=null&&W.sourceDuration?` of ${m(u.production.sourceDuration)}`:""," ","(--clip ",k.targetSec,")"]}):null]}):null,c.jsx("div",{style:ot,children:c.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."})})]})},Lc=1.2,Yl=.05;function tA(e,t,n,r){return n<=0||r<=0?0:Math.min(1,Math.max(0,(e-t)/n))*r}const nA=16,rA=e=>Math.min(nA,Math.max(1,e));function oA(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 rh=e=>e.filter(t=>t.kind!=="plain");function iA(e,t,n,r){const o=rh(e),i=o.findIndex(m=>m.id===t),s=o[i];if(!s)return null;const a=s.endSec-s.startSec,l=i>0?o[i-1]:void 0,u=i<o.length-1?o[i+1]:void 0,f=l?l.endSec+Yl:0,p=u?u.startSec-Yl:r,h=Math.min(Math.max(s.startSec+n,f),Math.max(f,p-a));return{startSec:h,endSec:h+a}}function sA(e,t,n,r,o){const i=rh(e),s=i.findIndex(m=>m.id===t),a=s>0?i[s-1]:void 0,l=s>=0&&s<i.length-1?i[s+1]:void 0,u=a?a.endSec+Yl:0,f=l?l.startSec-Yl:o;let p=Math.min(Math.max(n,u),Math.max(u,f-Lc)),h=Math.max(Math.min(r,f),p+Lc);return h>f&&(h=f,p=Math.max(u,h-Lc)),{startSec:p,endSec:h}}function Jg(e,t,n,r){const o=[0,r,n];for(const a of rh(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 Wa(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 aA(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 zc(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 lA=10,uA=4,ev=8,tv=8,cA=300,dA=e=>{const t=Math.max(0,Math.round(e));return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`},fA=(e,t)=>{const[n,r]=oe.useState({}),o=oe.useRef({}),i=t.map(s=>s.toFixed(1)).join(",");return oe.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 u=document.createElement("canvas");return(async()=>{await new Promise((h,m)=>{l.onloadedmetadata=()=>h(),l.onerror=()=>m(new Error("no video for thumbnails"))}),u.width=168,u.height=Math.max(1,Math.round(168*l.videoHeight/Math.max(1,l.videoWidth)));const p=u.getContext("2d");if(p){for(const h of s){if(a)return;await new Promise(m=>{l.onseeked=()=>m(),l.currentTime=Math.max(0,Number(h))}),p.drawImage(l,0,0,u.width,u.height),o.current[h]=u.toDataURL("image/jpeg",.6)}a||r({...o.current})}})().catch(()=>{}),()=>{a=!0,l.removeAttribute("src"),l.load()}},[e,i]),n},pA=({cues:e,ghosts:t,cuts:n=[],spans:r=[],durationSec:o,fps:i,playerRef:s,selection:a,onSelect:l,edits:u,videoSrc:f,toSourceSec:p})=>{const h=d.useRef(null),m=d.useRef(null),w=d.useRef(!1),g=d.useRef(null),[k,v]=d.useState(0),y=d.useRef(k);y.current=k;const[x,b]=d.useState(null),[S,E]=d.useState(1),R=oe.useMemo(()=>p?e.filter(T=>T.kind==="plain").map(T=>p((T.startSec+T.endSec)/2)):[],[e,p]),j=fA(f,R),I=d.useRef(null),_=d.useRef(null),A=d.useCallback((T,C)=>{const N=I.current;E($=>{const D=rA(T);if(D===$||!N)return D;const B=N.getBoundingClientRect();return _.current={prevZoom:$,anchorX:C!==void 0?C-B.left:B.width/2},D})},[]);d.useLayoutEffect(()=>{const T=I.current,C=_.current;!T||!C||(_.current=null,T.scrollLeft=oA(C.prevZoom,S,T.clientWidth,T.scrollLeft,C.anchorX))},[S]);const W=d.useRef(S);W.current=S,d.useEffect(()=>{const T=I.current;if(!T)return;const C=N=>{N.ctrlKey||N.metaKey?(N.preventDefault(),A(W.current*Math.exp(-N.deltaY*.01),N.clientX)):T.scrollWidth>T.clientWidth&&(N.preventDefault(),T.scrollLeft+=N.deltaY+N.deltaX)};return T.addEventListener("wheel",C,{passive:!1}),()=>T.removeEventListener("wheel",C)},[A]),d.useEffect(()=>{const T=s.current;if(!T)return;v(T.getCurrentFrame());const C=N=>v(N.detail.frame);return T.addEventListener("frameupdate",C),()=>T.removeEventListener("frameupdate",C)},[s]),d.useEffect(()=>{const T=I.current;if(!T||o<=0||T.scrollWidth<=T.clientWidth)return;const C=k/i/o*T.scrollWidth,{scrollLeft:N,clientWidth:$}=T;(C<N||C>N+$)&&(T.scrollLeft=Math.max(0,Math.min(T.scrollWidth-$,C-$*.1)))},[k,i,o]),d.useEffect(()=>{var C,N;if(!a)return;const T=(C=I.current)==null?void 0:C.querySelector(`[data-testid="timeline-block-${a.sceneId}"]`);(N=T==null?void 0:T.scrollIntoView)==null||N.call(T,{inline:"nearest",block:"nearest"})},[a]);const P=d.useCallback(T=>{var $;const C=h.current;if(!C||o<=0)return;const N=C.getBoundingClientRect();($=s.current)==null||$.seekTo(Math.round(tA(T,N.left,N.width,o)*i))},[s,o,i]),F=d.useCallback((T,C)=>N=>{N.stopPropagation(),N.preventDefault();const $=h.current;$&&(m.current={sceneId:T.id,edge:C,startContentX:N.clientX-$.getBoundingClientRect().left,origStart:T.startSec,origEnd:T.endSec},b({sceneId:T.id,startSec:T.startSec,endSec:T.endSec,snapped:null}))},[]),H=d.useRef(0);d.useEffect(()=>{const T=$=>{const D=I.current;if(!D||D.scrollWidth<=D.clientWidth)return;const B=Date.now();if(B-H.current<cA)return;const Z=D.getBoundingClientRect(),L=D.scrollWidth-D.clientWidth;$>=Z.right-tv&&D.scrollLeft<L?(D.scrollLeft=Math.min(L,D.scrollLeft+D.clientWidth),H.current=B):$<=Z.left+tv&&D.scrollLeft>0&&(D.scrollLeft=Math.max(0,D.scrollLeft-D.clientWidth),H.current=B)},C=$=>{var ce;if((w.current||((ce=g.current)==null?void 0:ce.moved)===!0||m.current!==null)&&T($.clientX),w.current){P($.clientX);return}const B=g.current;if(B&&o>0){if(!B.moved&&Math.abs($.clientX-B.startX)<uA)return;if(B.moved=!0,B.scrub){P($.clientX);return}const se=h.current,ee=se==null?void 0:se.getBoundingClientRect(),q=ee?($.clientX-ee.left-B.startContentX)/ee.width*o:0;let J=q,ie=null;const Me=ee&&ee.width>0&&!$.altKey?e.find(be=>be.id===B.sceneId):void 0;if(Me&&ee){const be=ev/(ee.width/o),$e=Jg(e,B.sceneId,y.current/i,o),xe=Me.startSec+q,Te=Me.endSec+q,Pe=Wa(xe,$e,be),Ee=Wa(Te,$e,be),Le=Pe.snapped===null?1/0:Math.abs(Pe.sec-xe),jt=Ee.snapped===null?1/0:Math.abs(Ee.sec-Te);Le<=jt&&Pe.snapped!==null?(J=q+(Pe.sec-xe),ie=Pe.snapped):Ee.snapped!==null&&(J=q+(Ee.sec-Te),ie=Ee.snapped)}const ke=iA(e,B.sceneId,J,o);if(ke){const be=ie!==null&&(Math.abs(ke.startSec-ie)<1e-6||Math.abs(ke.endSec-ie)<1e-6)?ie:null;b({sceneId:B.sceneId,...ke,snapped:be})}return}const Z=m.current;if(!Z||o<=0)return;const L=h.current;if(!L)return;const z=L.getBoundingClientRect(),Q=($.clientX-z.left-Z.startContentX)/z.width*o;let G=Z.edge==="start"?Z.origStart+Q:Z.origStart,V=Z.edge==="end"?Z.origEnd+Q:Z.origEnd,K=null;if(!$.altKey&&z.width>0){const se=ev/(z.width/o),ee=Jg(e,Z.sceneId,y.current/i,o);if(Z.edge==="start"){const q=Wa(G,ee,se);G=q.sec,K=q.snapped}else{const q=Wa(V,ee,se);V=q.sec,K=q.snapped}}const de=sA(e,Z.sceneId,G,V,o),ge=K!==null&&(Math.abs(de.startSec-K)<1e-6||Math.abs(de.endSec-K)<1e-6)?K:null;b({sceneId:Z.sceneId,...de,snapped:ge})},N=$=>{w.current=!1;const D=g.current;if(D){g.current=null,D.moved&&!D.scrub&&b(Z=>(Z&&Z.sceneId===D.sceneId&&u.patchTiming(D.sceneId,Z.startSec,Z.endSec),null));return}const B=m.current;B&&(b(Z=>(Z&&Z.sceneId===B.sceneId&&(Z.startSec!==B.origStart||Z.endSec!==B.origEnd)&&u.patchTiming(B.sceneId,Z.startSec,Z.endSec),null)),m.current=null)};return window.addEventListener("mousemove",C),window.addEventListener("mouseup",N),()=>{window.removeEventListener("mousemove",C),window.removeEventListener("mouseup",N)}},[e,o,u,P,i]);const O=o>0?Math.min(1,k/i/o)*100:0;return c.jsxs("div",{style:hA,onMouseDownCapture:ob,children:[c.jsxs("div",{style:mA,children:[c.jsx("span",{style:vA,children:"ctrl+scroll to zoom"}),c.jsx("button",{"data-testid":"zoom-out",style:Dc,onClick:()=>A(S/2),disabled:S<=1,title:"Zoom out (ctrl/cmd + scroll on the timeline)",children:"−"}),c.jsxs("span",{"data-testid":"zoom-level",style:gA,children:[Math.round(S*10)/10,"×"]}),c.jsx("button",{"data-testid":"zoom-in",style:Dc,onClick:()=>A(S*2),disabled:S>=16,title:"Zoom in (ctrl/cmd + scroll on the timeline)",children:"+"}),c.jsx("button",{"data-testid":"zoom-fit",style:{...Dc,width:"auto",padding:"0 8px"},onClick:()=>A(1),disabled:S<=1,title:"Fit the whole clip in view",children:"fit"})]}),c.jsx("div",{ref:I,"data-testid":"timeline-scroller",style:yA,children:c.jsxs("div",{style:{width:`${S*100}%`,minWidth:"100%",paddingBottom:6},children:[c.jsx("div",{"data-testid":"ruler",style:wA,onMouseDown:T=>{T.preventDefault(),P(T.clientX),w.current=!0},children:(()=>{var Z;if(o<=0)return c.jsx("span",{style:Oc,children:"0:00"});const C=(((Z=I.current)==null?void 0:Z.clientWidth)??1200)*S/o;let $=[.5,1,2,5,10,15,30,60,120,300,600].find(L=>L*C>=70)??600;for(;o/($/5)>600;)$*=2;const D=$/5,B=[];for(let L=0;L<=o+1e-6;L+=D){const z=Math.round(L/D)%5===0,Q=`${L/o*100}%`;B.push(c.jsx("div",{style:{position:"absolute",left:Q,bottom:0,width:1,height:z?8:4,background:z?"#3A3A44":"#26262e",pointerEvents:"none"}},L.toFixed(3))),z&&L+D<=o&&B.push(c.jsx("span",{style:{...Oc,position:"absolute",left:Q,top:0,transform:L===0?void 0:"translateX(-50%)",pointerEvents:"none"},children:dA(L)},`l${L.toFixed(3)}`))}return c.jsxs(c.Fragment,{children:[B,c.jsx("span",{style:{...Oc,position:"absolute",right:2,top:0,pointerEvents:"none"},children:zc(o,i)})]})})()}),c.jsxs("div",{ref:h,style:xA,onMouseDown:T=>{T.preventDefault(),P(T.clientX),w.current=!0},children:[e.map(T=>{const C=T.kind==="plain",N=(x==null?void 0:x.sceneId)===T.id,$=N?x.startSec:T.startSec,D=N?x.endSec:T.endSec,B=o>0?$/o*100:0,Z=o>0?Math.max(0,(D-$)/o*100):0,L=(a==null?void 0:a.sceneId)===T.id,z=C&&p?j[p((T.startSec+T.endSec)/2).toFixed(1)]:void 0;return c.jsxs("div",{"data-testid":`timeline-block-${T.id}`,onMouseDown:Q=>{var G;Q.stopPropagation(),Q.preventDefault(),l({sceneId:T.id,elementId:null}),g.current={sceneId:T.id,startX:Q.clientX,startContentX:Q.clientX-(((G=h.current)==null?void 0:G.getBoundingClientRect().left)??0),moved:!1,scrub:C}},style:{...nv,left:`${B}%`,width:`${Z}%`,zIndex:N?4:L?3:1,border:L?"2px solid #5b8cff":C?"1px solid #22222a":"1px solid #2A2A33",backgroundColor:L?"#1c2333":C?"#131318":"#1A1A21",...z?{backgroundImage:`linear-gradient(rgba(10,10,14,0.35), rgba(10,10,14,0.6)), url(${z})`,backgroundSize:"auto 100%, auto 100%",backgroundRepeat:"repeat-x"}:{}},children:[c.jsx("span",{style:C?z?{...Va,color:"#D8D8DE",textShadow:"0 1px 2px rgba(0,0,0,0.9)"}:{...Va,color:"#55555f"}:Va,children:T.id}),!C&&T.pinned?c.jsx("span",{style:bA,children:"PIN"}):null,C?null:c.jsxs(c.Fragment,{children:[c.jsx("div",{onMouseDown:F(T,"start"),style:{...rv,left:0,cursor:"ew-resize"}}),c.jsx("div",{onMouseDown:F(T,"end"),style:{...rv,right:0,cursor:"ew-resize"}})]})]},T.id)}),t.map(T=>{const C=o>0?T.startSec/o*100:0,N=o>0?Math.max(0,(T.endSec-T.startSec)/o*100):0,$=(a==null?void 0:a.sceneId)===T.id;return c.jsx("div",{"data-testid":`timeline-block-${T.id}`,onMouseDown:D=>{D.stopPropagation(),D.preventDefault(),l({sceneId:T.id,elementId:null})},style:{...nv,left:`${C}%`,width:`${N}%`,zIndex:$?3:2,border:$?"2px dashed #5b8cff":"1px dashed #6a6a75",background:"transparent"},children:c.jsx("span",{style:{...Va,color:"#6a6a75",textDecoration:"line-through"},children:T.id})},`ghost-${T.id}`)}),n.map((T,C)=>{const N=D=>o>0?Math.min(100,Math.max(0,D/o*100)):0;if(!T.src){const D=Math.min(Math.max(T.startSec,0),o),B=Math.min(Math.max(T.endSec,0),o),Z=N(D),L=o>0?Math.max(0,(B-D)/o*100):0;return c.jsx("div",{"data-testid":`timeline-cut-${T.startSec}-${T.endSec}`,style:{...SA,left:`${Z}%`,width:`${L}%`},children:c.jsx("div",{style:kA})},`cut-${C}-${T.startSec}-${T.endSec}`)}if(r.length===0)return null;const $=N(aA(r,T.src.startSec));return c.jsx("div",{"data-testid":`timeline-cut-seam-${T.startSec}-${T.endSec}`,title:"Restore cut — the material returns on the next produce/Render",onMouseDown:D=>{D.stopPropagation(),D.preventDefault(),u.restoreChunk(C)},style:{...EA,left:`${$}%`},children:c.jsx("div",{style:CA})},`cut-${C}-${T.startSec}-${T.endSec}`)}),x?c.jsxs("div",{"data-testid":"drag-readout",style:{...ov,left:`${o>0?x.startSec/o*100:0}%`,transform:o>0&&x.startSec/o>.85?"translateX(-100%)":ov.transform},children:[zc(x.startSec,i)," – ",zc(x.endSec,i)]}):null,(x==null?void 0:x.snapped)!==null&&(x==null?void 0:x.snapped)!==void 0?c.jsx("div",{"data-testid":"snap-tick",style:{...IA,left:`${o>0?x.snapped/o*100:0}%`}}):null,c.jsx("div",{"data-testid":"playhead",style:{...TA,left:`${O}%`},children:c.jsx("div",{"data-testid":"playhead-grab",onMouseDown:T=>{T.stopPropagation(),T.preventDefault(),w.current=!0},style:RA})})]})]})})]})},hA={flexShrink:0,borderTop:"1px solid #1E1E24",background:"#111116",padding:"6px 20px 8px"},mA={display:"flex",justifyContent:"flex-end",alignItems:"center",gap:6,marginBottom:4},Dc={width:22,height:18,fontSize:12,lineHeight:1,color:"#EDEDF2",background:"#1A1A21",border:"1px solid #2A2A33",borderRadius:4,cursor:"pointer",padding:0},gA={fontSize:10,fontFamily:"ui-monospace, 'SF Mono', monospace",color:"#9A9AA3",minWidth:26,textAlign:"center"},vA={fontSize:10,color:"#55555f",marginRight:4,userSelect:"none"},yA={overflowX:"auto",overflowY:"hidden"},wA={position:"relative",height:18,padding:"0 2px",marginBottom:4,borderBottom:"1px solid #1E1E24",cursor:"ew-resize",userSelect:"none"},Oc={fontSize:10,fontFamily:"ui-monospace, 'SF Mono', monospace",color:"#9A9AA3"},xA={position:"relative",height:44,background:"#0F0F14",border:"1px solid #2A2A33",borderRadius:6,overflow:"visible",userSelect:"none"},nv={position:"absolute",top:3,bottom:3,borderRadius:4,boxSizing:"border-box",cursor:"pointer",display:"flex",alignItems:"center",overflow:"hidden"},Va={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"},bA={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"},SA={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)"},kA={position:"absolute",left:0,right:0,top:"50%",height:2,background:"rgba(255,92,92,0.8)"},EA={position:"absolute",top:-4,bottom:-4,width:12,marginLeft:-6,zIndex:4,cursor:"pointer",pointerEvents:"auto"},CA={position:"absolute",left:"50%",top:0,bottom:0,width:2,background:"#FF5C5C",pointerEvents:"none"},rv={position:"absolute",top:0,bottom:0,width:lA},IA={position:"absolute",top:-4,bottom:-4,width:1,zIndex:6,background:"#FFE14D",pointerEvents:"none"},ov={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"},TA={position:"absolute",top:-26,bottom:-4,width:2,zIndex:5,background:"#FFE14D",pointerEvents:"none"},RA={position:"absolute",top:0,bottom:0,left:-4,width:10,pointerEvents:"auto",cursor:"ew-resize"};function jA(e,t,n){const r=e.filter(h=>He(h.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(h=>{const m=He(h.word);return m!==null&&m in n.captionWordsHidden})||l.push("caption");const f=n.cuts.some(h=>h.src===void 0&&h.startSec===s&&h.endSec===a),p=e.some(h=>h.synthetic);return!f&&!p&&l.push("caption-video"),l.length===0?null:{startSec:s,endSec:a,words:r.map(h=>({srcStart:h.word.srcStart,was:h.live})),targets:l}}function PA(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?He(s[0].word):null,u=[];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),h=p.every(w=>He(w.word)!==null&&r(w.word)===void 0),m=l!==null&&He(p[0].word)===l;if(h&&!m&&i(p)===a){u.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 u}function FA(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 u=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 h=u;h<f;h++){const m=Math.abs(e[h]);m>p&&(p=m)}s[l]=p}return{buckets:s,fromSec:n,toSec:r}}const to=280,sn=48,Ha=1;let Ua=null;const _A=e=>((Ua===null||Ua.key!==e)&&(Ua={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)}),Ua.promise),iv=6,sv=8,MA=e=>{const t=e.anchorTop+e.anchorHeight+iv,n=e.anchorTop-e.menuH-iv,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(sv,Math.min(i,e.clientWidth-e.menuW-sv));return{top:o,left:s}},av="transcript-word-",lv=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^="${av}"]`))??null;if(n===null)return null;const r=Number(n.getAttribute("data-testid").slice(av.length));return Number.isInteger(r)?r:null},$A=e=>({lo:e.prev===null?e.track.start:e.prev.end===e.span.start?e.prev.start+Ul:e.prev.end,hi:e.next===null?e.track.end:e.next.start===e.span.end?e.next.end-Ul:e.next.start}),AA=(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)}},NA=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))}},LA=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},Za=(e,t)=>{const n=e[t],r=n==null?void 0:n.words[0],o=He(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)}},zA=(e,t)=>{const n=[];let r=0;for(const o of e){const i=new Set(o.words.map(l=>He(l)).filter(l=>l!==null)),s=t[r],a=l=>{const u=He(l);return u!==null&&i.has(u)};s!==void 0&&s.words.some(a)?(n.push(r),r++):n.push(null)}return n},DA=({baseLines:e,liveLines:t,timingLines:n,fps:r,playerRef:o,edits:i,onDeleteWords:s,width:a,workdir:l})=>{const[u,f]=d.useState(""),[p,h]=d.useState(null),[m,w]=d.useState(null),[g,k]=d.useState(null),[v,y]=d.useState(null),[x,b]=d.useState(!1),S=d.useRef(null),[E,R]=d.useState(null),[j,I]=d.useState(null),[_,A]=d.useState(null),[W,P]=d.useState(!1),[F,H]=d.useState(null),[O,T]=d.useState(!1),C=d.useRef(null),N=d.useRef(null),$=d.useMemo(()=>{const M=new Map;for(const U of e)for(const ne of U.words){const le=He(ne);if(le===null)continue;const he=M.get(le);he?he.push(ne.text):M.set(le,[ne.text])}return M},[e]),D=d.useMemo(()=>{var le;const M=[];let U=0;const ne=new Map;for(let he=0;he<t.length;he++){const ye=t[he];for(let Ce=0;Ce<ye.words.length;Ce++){const Fe=ye.words[Ce],Oe=He(Fe);let ze;if(Oe!==null){const Be=ne.get(Oe)??0;ne.set(Oe,Be+1),ze=(le=$.get(Oe))==null?void 0:le[Be]}M.push({index:U,base:ze??Fe.text,live:Fe.text,synthetic:Oe!==null&&ze===void 0,start:Fe.start,end:Fe.end,lineIndex:he,word:Fe}),U++}}return M},[$,t]);d.useEffect(()=>{w(null),k(null)},[D.length]);const B=d.useMemo(()=>new Set(Object.keys(i.doc.captionWordsHidden)),[i.doc.captionWordsHidden]),Z=M=>{const U=He(M.word);return U!==null&&B.has(U)},L=d.useMemo(()=>eh(D.map(M=>M.live).join(" ")),[D]);d.useEffect(()=>{if(L!=="rtl"||typeof FontFace>"u"||!document.fonts)return;let M=!1;for(const U of document.fonts)U.family===Bs&&(M=!0);if(!M)try{new FontFace(Bs,`url("/media/${_1}") format("truetype")`).load().then(ne=>document.fonts.add(ne),()=>{})}catch{}},[L]),d.useEffect(()=>{const M=o.current;if(!M)return;const U=ne=>{const le=ne.detail.frame/r,he=D.find(ye=>le>=ye.start&&le<ye.end);A(ye=>he?he.index===ye?ye:he.index:ye)};return M.addEventListener("frameupdate",U),()=>M.removeEventListener("frameupdate",U)},[o,r,D]),d.useEffect(()=>{var M,U,ne;_!==null&&((ne=(U=(M=C.current)==null?void 0:M.querySelector(`[data-testid="transcript-word-${_}"]`))==null?void 0:U.scrollIntoView)==null||ne.call(U,{block:"nearest"}))},[_]);const z=u.trim().normalize("NFC").toLowerCase(),Q=d.useMemo(()=>z?D.filter(M=>M.live.normalize("NFC").toLowerCase().includes(z)).map(M=>M.index):[],[z,D]),G=d.useMemo(()=>z?new Set(Q):null,[z,Q]),[V,K]=d.useState(0),de=M=>{var U,ne,le;(le=(ne=(U=C.current)==null?void 0:U.querySelector(`[data-testid="transcript-word-${M}"]`))==null?void 0:ne.scrollIntoView)==null||le.call(ne,{block:"center"})};d.useEffect(()=>{K(0),Q.length>0&&de(Q[0])},[Q]);const ge=M=>{if(Q.length===0)return;const U=(V+M+Q.length)%Q.length;K(U),de(Q[U])},ce=M=>{const U=M.draft.trim();U&&i.patchCaption(M.srcStart,U,M.base),h(null)},se=M=>{He(M.word)!==null&&ee(M.word)===void 0&&h({index:M.index,draft:M.live,srcStart:M.word.srcStart,base:M.base})},ee=M=>{const U=He(M);if(U===null)return;const ne=Number(U.slice(1));return i.doc.captionRangeEdits.find(le=>{const he=Number(le.fromKey.slice(1)),ye=Number(le.toKey.slice(1));return ne>=Math.min(he,ye)&&ne<=Math.max(he,ye)})},q=m===null?null:Math.min(m.anchor,m.focus),J=m===null?null:Math.max(m.anchor,m.focus),ie=q===null||J===null?[]:D.slice(q,J+1),Me=ie.length>0&&ie.every(Z),ke=ie.some(M=>He(M.word)===null),be=ie.map(M=>ee(M.word)).find(M=>M!==void 0),$e=M=>{var Oe,ze,Be;if(p!==null||g!==null||v!==null)return;const U=C.current;if(!U)return;const ne=(Oe=document.getSelection)==null?void 0:Oe.call(document);if(!ne||ne.isCollapsed)return;const{anchorNode:le,focusNode:he}=ne;if(!le||!he||!U.contains(le)||!U.contains(he))return;const ye=he.nodeType===3?he.parentElement:he;if((ze=ye==null?void 0:ye.closest)!=null&&ze.call(ye,"input, textarea"))return;const Ce=lv(le),Fe=lv(he);Ce===null||Fe===null||M.detail>=2&&Ce===Fe||(w({anchor:Math.min(Ce,Fe),focus:Math.max(Ce,Fe)}),(Be=ne.removeAllRanges)==null||Be.call(ne))};d.useLayoutEffect(()=>{if(q===null||J===null){H(null);return}const M=C.current,U=(M==null?void 0:M.querySelector(`[data-testid="transcript-word-${q}"]`))??null,ne=(M==null?void 0:M.querySelector(`[data-testid="transcript-word-${J}"]`))??null;if(!M||ne===null){H(null);return}const le=U!==null&&U.offsetTop===ne.offsetTop,he=le?Math.min(U.offsetLeft,ne.offsetLeft):ne.offsetLeft,ye=le?Math.max(U.offsetLeft+U.offsetWidth,ne.offsetLeft+ne.offsetWidth):ne.offsetLeft+ne.offsetWidth,Ce=N.current,Fe=MA({anchorTop:ne.offsetTop,anchorHeight:ne.offsetHeight,anchorLeft:he,anchorWidth:ye-he,menuW:(Ce==null?void 0:Ce.offsetWidth)??0,menuH:(Ce==null?void 0:Ce.offsetHeight)??0,scrollTop:M.scrollTop,clientWidth:M.clientWidth,clientHeight:M.clientHeight});H(Oe=>Oe!==null&&Oe.top===Fe.top&&Oe.left===Fe.left?Oe:Fe)},[q,J,a,p,g,v,F]),d.useEffect(()=>{T(!1),y(null)},[q,J]),d.useEffect(()=>{g!==null&&(q!==g.selLo||J!==g.selHi)&&k(null)},[g,q,J]);const xe=d.useMemo(()=>g!==null&&q!==null&&J!==null?PA(D,q,J,ee):[],[g,q,J,D,i.doc.captionRangeEdits]),Te=()=>{if(ie.length===0||ke)return;const M=jA(ie.map(U=>({word:U.word,live:U.live,synthetic:U.synthetic})),q!==null&&q>0?D[q-1].end:null,i.doc);M!==null&&(s(M),w(null))},Pe=()=>{if(ie.length===0||ke)return;const M=be;if(M!==void 0){const U=Math.min(Number(M.fromKey.slice(1)),Number(M.toKey.slice(1))),ne=Math.max(Number(M.fromKey.slice(1)),Number(M.toKey.slice(1))),le=D.filter(he=>{const ye=He(he.word);if(ye===null)return!1;const Ce=Number(ye.slice(1));return Ce>=U&&Ce<=ne});if(le.length===0)return;w({anchor:le[0].index,focus:le[le.length-1].index}),k({draft:le.map(he=>he.live).join(" ").normalize("NFC"),fromSrcStart:Number(M.fromKey.slice(1))/1e3,toSrcStart:Number(M.toKey.slice(1))/1e3,was:le.map(he=>he.base).join(" ").normalize("NFC"),rawWas:le.map(he=>he.base).join(" "),covered:!0,selLo:le[0].index,selHi:le[le.length-1].index});return}k({draft:ie.map(U=>U.live).join(" ").normalize("NFC"),fromSrcStart:ie[0].word.srcStart,toSrcStart:ie[ie.length-1].word.srcStart,was:ie.map(U=>U.base).join(" ").normalize("NFC"),rawWas:ie.map(U=>U.base).join(" "),covered:!1,selLo:q,selHi:J})},Ee=M=>{const U=M.draft.trim();if(U){const ne=U.split(/\s+/).filter(Boolean);!M.covered&&M.fromSrcStart===M.toSrcStart&&ne.length===1?i.patchCaption(M.fromSrcStart,U,M.rawWas):i.patchCaptionRange(M.fromSrcStart,M.toSrcStart,U,M.was),w(null)}k(null)},Le=M=>{const U=M.draft.trim();if(U){const ne=U.split(/\s+/).filter(Boolean);!M.covered&&M.fromSrcStart===M.toSrcStart&&ne.length===1?i.patchCaptionAllOccurrences([{srcStart:M.fromSrcStart,was:M.rawWas},...xe.map(le=>({srcStart:le.fromSrcStart,was:le.rawWas}))],U):i.patchCaptionRangeAllOccurrences([{fromSrcStart:M.fromSrcStart,toSrcStart:M.toSrcStart,was:M.was},...xe],U),w(null)}k(null)},jt=()=>{ie.length===0||ke||(i.hideCaptionWords(ie.filter(M=>!Z(M)).map(M=>({srcStart:M.word.srcStart,was:M.live}))),w(null))},zt=()=>{ie.length!==0&&(i.restoreCaptionWords(ie.filter(Z).map(M=>M.word.srcStart)),w(null))},pn=d.useMemo(()=>zA(t,n),[t,n]),Dt=M=>{var le;const U=pn[M]??null;if(U===null)return;const ne=He((le=n[U])==null?void 0:le.words[0]);return ne===null?void 0:i.doc.captionLineTiming[ne]},In=ie.length===0?0:ie[ie.length-1].lineIndex-ie[0].lineIndex+1,Tn=()=>{var Oe,ze;if(ie.length===0||ke)return;const M=n,U=pn[ie[0].lineIndex]??null,ne=pn[ie[ie.length-1].lineIndex]??null;if(U===null||ne===null)return;const le=[];for(let Be=U;Be<=ne;Be++){const Rn=Za(M,Be);if(Rn===null)return;le.push(Rn)}const he=le[0],ye=le[le.length-1],Ce={start:he.start,end:ye.end},Fe=$A({prev:U>0?M[U-1]:null,next:ne<M.length-1?M[ne+1]:null,span:Ce,track:{start:M[0].start,end:M[M.length-1].end}});y({track:M,from:U,to:ne,span:Ce,bounds:Fe,newSpan:AA({start:Ce.start+(((Oe=i.doc.captionLineTiming[he.key])==null?void 0:Oe.lead)??0),end:Ce.end+(((ze=i.doc.captionLineTiming[ye.key])==null?void 0:ze.tail)??0)},Fe.lo,Fe.hi)})},Ze=d.useMemo(()=>{if(v===null)return null;const M=[];for(let U=v.from;U<=v.to;U++){const ne=Za(v.track,U);if(ne===null)return null;M.push(ne)}return{lines:M,prev:v.from>0?Za(v.track,v.from-1):null,next:v.to<v.track.length-1?Za(v.track,v.to+1):null}},[v]),hn=d.useMemo(()=>{var he,ye;if(v===null||Ze===null)return null;const{lines:M,prev:U,next:ne}=Ze,le=i.doc.captionLineTiming;return LA({lines:M,span:v.span,newSpan:v.newSpan,prev:U===null?null:{...U,lead:((he=le[U.key])==null?void 0:he.lead)??0},next:ne===null?null:{...ne,tail:((ye=le[ne.key])==null?void 0:ye.tail)??0}})},[v,Ze,i.doc.captionLineTiming]),tn=d.useMemo(()=>{if(v===null||hn===null)return null;const M={...i.doc.captionLineTiming};for(const U of hn)M[vn(U.srcStart)]={lead:U.lead,tail:U.tail};return j1(v.track,M).lines},[v,hn,i.doc.captionLineTiming]),st=d.useMemo(()=>{if(v===null||tn===null)return null;const M=tn[v.from],U=tn[v.to];return M&&U?{start:M.start,end:U.end}:null},[v,tn]),Pt=v===null?0:v.to-v.from+1,vt=d.useMemo(()=>{if(v===null||Ze===null)return null;const M=Ze.prev??Ze.lines[0],U=Ze.next??Ze.lines[Ze.lines.length-1];return{srcStart:M.srcStart,srcEnd:U.srcEnd,outStart:M.start,dur:U.srcEnd-M.srcStart+2*Ha}},[v,Ze]);d.useEffect(()=>{I(null)},[l]),d.useEffect(()=>{if(v===null||j!==null)return;let M=!1;return _A(l).then(U=>{!M&&U!==null&&I(U)}),()=>{M=!0}},[v,j,l]);const wr=M=>vt===null?0:(M-vt.outStart+Ha)/vt.dur*to;d.useEffect(()=>{var Oe;if(v===null||st===null||tn===null||vt===null)return;const M=S.current,U=((Oe=M==null?void 0:M.getContext)==null?void 0:Oe.call(M,"2d"))??null;if(!M||!U)return;const ne=wr;U.fillStyle="#0F0F14",U.fillRect(0,0,to,sn);const le=Math.floor(to/2),he=j===null?new Float32Array(le):FA(j.channel,j.sampleRate,vt.srcStart-Ha,vt.srcEnd+Ha,le).buckets;U.fillStyle="#4a4a58";const ye=to/le;for(let ze=0;ze<le;ze++){const Be=Math.max(1,he[ze]*(sn-4));U.fillRect(ze*ye,(sn-Be)/2,Math.max(1,ye-1),Be)}U.fillStyle="rgba(255, 225, 77, 0.06)";for(const ze of[v.from-1,v.to+1]){const Be=tn[ze];Be&&U.fillRect(ne(Be.start),0,Math.max(1,ne(Be.end)-ne(Be.start)),sn)}const Ce=ne(st.start),Fe=ne(st.end);U.fillStyle="rgba(255, 225, 77, 0.18)",U.fillRect(Ce,0,Math.max(1,Fe-Ce),sn),U.fillStyle="#7a7a88";for(let ze=Math.max(0,v.from-1);ze<=v.to+1;ze++){const Be=tn[ze];Be&&(ze!==v.from&&U.fillRect(ne(Be.start),0,1,sn),ze!==v.to&&U.fillRect(ne(Be.end),0,1,sn))}U.fillStyle="#FFE14D",U.fillRect(Ce-1,0,2,sn),U.fillRect(Fe-1,0,2,sn)},[v,st,tn,vt,j]);const Jr=vt===null?0:vt.dur/to,Zt=v===null||st===null||vt===null?null:{lead:wr(st.start),tail:wr(st.end)},nr=M=>U=>{v!==null&&(U.preventDefault(),R({edge:M,startX:U.clientX,span:v.newSpan}))};d.useEffect(()=>{if(E===null||v===null)return;const M=ne=>{y({...v,newSpan:NA({edge:E.edge,span:E.span,dSec:(ne.clientX-E.startX)*Jr,lo:v.bounds.lo,hi:v.bounds.hi})})},U=()=>R(null);return window.addEventListener("pointermove",M),window.addEventListener("pointerup",U),window.addEventListener("pointercancel",U),window.addEventListener("blur",U),()=>{window.removeEventListener("pointermove",M),window.removeEventListener("pointerup",U),window.removeEventListener("pointercancel",U),window.removeEventListener("blur",U)}},[E,v,Jr]),d.useEffect(()=>{v===null&&E!==null&&R(null)},[v,E]);const Bn=()=>{if(st===null)return;const M=o.current;if(M){if(x){M.pause(),b(!1);return}M.seekTo(Math.ceil(st.start*r)),M.play(),b(!0)}};d.useEffect(()=>{if(!x||st===null)return;const M=o.current;if(!M)return;const U=st.end,ne=le=>{le.detail.frame/r>=U&&(M.pause(),b(!1))};return M.addEventListener("frameupdate",ne),()=>M.removeEventListener("frameupdate",ne)},[x,st,r,o]),d.useEffect(()=>{const M=o.current;if(!M)return;const U=()=>b(!1);return M.addEventListener("pause",U),()=>M.removeEventListener("pause",U)}),d.useEffect(()=>{var M;v!==null||!x||((M=o.current)==null||M.pause(),b(!1))},[v,x,o]);const eo=M=>{i.patchCaptionLineTiming(M),y(null)};return c.jsxs("div",{"data-testid":"transcript-panel",style:{...OA,width:a},children:[c.jsxs("div",{style:BA,children:[c.jsx("span",{style:WA,children:"Transcript"}),c.jsxs("div",{style:n3,children:[c.jsx("span",{style:cv,children:"Click to jump · double-click to retype · drag to select"}),c.jsx("button",{"data-testid":"transcript-help-toggle",style:r3,onClick:()=>P(M=>!M),title:"What each gesture does","aria-label":"Transcript help","aria-expanded":W,children:"?"})]}),W?c.jsx("div",{"data-testid":"transcript-help",style:cv,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,c.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[c.jsx("input",{"data-testid":"transcript-search",style:{...VA,flex:1},placeholder:"Find a word…",value:u,onChange:M=>f(M.target.value),onKeyDown:M=>{M.key==="Enter"&&(M.preventDefault(),ge(M.shiftKey?-1:1))}}),c.jsx("button",{"data-testid":"transcript-prev",style:dv,onClick:()=>ge(-1),disabled:Q.length===0,title:"Previous match (⇧Enter)","aria-label":"Previous match",children:"‹"}),c.jsx("button",{"data-testid":"transcript-next",style:dv,onClick:()=>ge(1),disabled:Q.length===0,title:"Next match (Enter)","aria-label":"Next match",children:"›"})]}),G?c.jsx("div",{"data-testid":"transcript-match-count",style:{fontSize:11,color:"#9A9AA3"},children:Q.length===0?"0 matches":`${V+1}/${Q.length} match${Q.length===1?"":"es"}`}):null]}),c.jsxs("div",{style:HA,"data-testid":"transcript-body",dir:L,ref:C,onMouseUp:$e,tabIndex:0,onKeyDown:M=>{if(!(p!==null||g!==null)){if(v!==null){M.key==="Escape"&&(M.stopPropagation(),y(null));return}if(M.key==="Escape"){if(m===null)return;M.stopPropagation(),w(null),k(null);return}(M.key==="Delete"||M.key==="Backspace")&&m!==null&&(M.preventDefault(),M.stopPropagation(),Me?zt():Te())}},children:[D.map((M,U)=>{const ne=ee(M.word),le=Dt(M.lineIndex),he=Z(M)?"hidden from captions — select and Restore":ne!==void 0?`part of a rewritten range (was “${ne.was}”) — select it and use Edit`:M.synthetic?`rewritten (was “${M.base}”) — select and Edit to change`:M.live!==M.base?`edited (was “${M.base}”) — double-click to retype`:"click to jump · double-click to retype";return c.jsxs(oe.Fragment,{children:[U>0?" ":null,(p==null?void 0:p.index)===M.index?c.jsx("input",{autoFocus:!0,"data-testid":"transcript-edit",style:a3,value:p.draft,onChange:ye=>h({...p,draft:ye.target.value}),onBlur:()=>ce(p),onKeyDown:ye=>{ye.key==="Enter"&&ye.target.blur(),ye.key==="Escape"&&h(null)}}):c.jsx("span",{"data-testid":`transcript-word-${M.index}`,onClick:ye=>{var Ce;if(g!==null&&k(null),v!==null&&y(null),ye.shiftKey){w(Fe=>Fe===null?{anchor:M.index,focus:M.index}:{...Fe,focus:M.index});return}(Ce=o.current)==null||Ce.seekTo(Math.ceil(M.start*r)),w({anchor:M.index,focus:M.index})},onDoubleClick:()=>se(M),title:le===void 0?he:`${he} · caption timing adjusted (${Math.round(le.lead*1e3)}ms in / ${Math.round(le.tail*1e3)}ms out) — Timing to change`,style:{...UA,...le!==void 0?QA:{},...Z(M)?qA:{},...M.live!==M.base||M.synthetic?YA:{},...q!==null&&M.index>=q&&M.index<=J?XA:{},...G!=null&&G.has(M.index)?ZA:{},...Q[V]===M.index?KA:{},..._===M.index?GA:{}},children:M.live})]},M.index)}),m!==null&&F!==null&&p===null&&g===null&&v===null?c.jsxs("div",{"data-testid":"transcript-selection-menu",role:"menu",ref:N,dir:"ltr",style:{...cl,top:F.top,left:F.left},children:[c.jsx(Do,{"data-testid":"transcript-edit-range",onClick:Pe,disabled:ke,title:ke?"A selected word has no source anchor (this project predates them) — re-run produce first":be!==void 0?"Re-edit the rewritten range this selection touches":ie.length===1?"Retype this word (1:1 — same as double-click)":"Rewrite these words as free text — word count may change",children:"Edit"}),c.jsx(Do,{"data-testid":"transcript-timing",onClick:Tn,disabled:ie.length===0||ke,title:ke?"A selected word has no source anchor (this project predates them) — re-run produce first":In===1?"Adjust when this caption appears and leaves":`Adjust when these ${In} captions appear and leave`,children:"Timing"}),Me?c.jsx(Do,{"data-testid":"transcript-restore",onClick:zt,title:"Show these words in the captions again",children:"Restore"}):c.jsxs("span",{style:{position:"relative"},children:[c.jsx(Do,{"data-testid":"transcript-delete-menu",onClick:()=>T(M=>!M),title:"Delete these words — from the captions only, or from the video too",children:"Delete ▾"}),O?c.jsxs("div",{"data-testid":"transcript-delete-flyout",dir:"ltr",style:o3,children:[c.jsx(Do,{"data-testid":"transcript-hide",onClick:()=>{T(!1),jt()},disabled:ke,title:ke?"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"}),c.jsx(Do,{"data-testid":"transcript-delete",onClick:()=>{T(!1),Te()},disabled:ke,title:ke?"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]}),c.jsxs("span",{style:fv,children:[ie.length," word",ie.length===1?"":"s"]})]}):null,g!==null&&F!==null?c.jsxs("div",{"data-testid":"transcript-range-popover",ref:N,dir:"ltr",style:{...cl,top:F.top,left:F.left,flexDirection:"column",alignItems:"stretch",gap:6},children:[c.jsx("textarea",{autoFocus:!0,"data-testid":"transcript-range-edit",rows:3,dir:"auto",style:s3,value:g.draft,onChange:M=>k({...g,draft:M.target.value}),onKeyDown:M=>{M.key==="Enter"&&!M.shiftKey&&(M.preventDefault(),Ee(g)),M.key==="Escape"&&k(null)}}),c.jsxs("div",{style:{display:"flex",gap:6},children:[c.jsx("button",{"data-testid":"transcript-apply",style:Oo,onClick:()=>Ee(g),title:"Rewrite this selection (Enter)",children:"Apply"}),xe.length>0?c.jsxs("button",{"data-testid":"transcript-apply-all",style:Oo,onClick:()=>Le(g),title:"Rewrite this selection AND every other place the same words occur — one undo step",children:["Apply to all (",xe.length,")"]}):null,c.jsx("button",{style:Oo,onClick:()=>k(null),title:"Discard the rewrite (Esc)",children:"Cancel"})]})]}):null,v!==null&&st!==null&&F!==null?c.jsxs("div",{"data-testid":"transcript-timing-popover",ref:N,dir:"ltr",style:{...cl,top:F.top,left:F.left,flexDirection:"column",alignItems:"stretch",gap:6},children:[c.jsxs("div",{style:{position:"relative",width:to,height:sn},children:[c.jsx("canvas",{"data-testid":"transcript-timing-canvas",ref:S,width:to,height:sn,style:{display:"block",borderRadius:4}}),Zt!==null?c.jsxs(c.Fragment,{children:[c.jsx("div",{"data-testid":"transcript-timing-band",title:Pt===1?"Drag to shift this caption, its duration intact":"Drag to shift these captions, every duration intact",onPointerDown:nr("band"),style:{...e3,left:Zt.lead,width:Math.max(0,Zt.tail-Zt.lead),cursor:(E==null?void 0:E.edge)==="band"?"grabbing":"grab"}}),c.jsx(uv,{"data-testid":"transcript-timing-handle-lead",title:Pt===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:Zt.lead,active:(E==null?void 0:E.edge)==="lead",onPointerDown:nr("lead")}),c.jsx(uv,{"data-testid":"transcript-timing-handle-tail",title:Pt===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:Zt.tail,active:(E==null?void 0:E.edge)==="tail",onPointerDown:nr("tail")})]}):null]}),c.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[c.jsx("button",{"data-testid":"transcript-timing-play",style:Oo,onClick:Bn,title:x?"Pause":Pt===1?"Play just this caption's span":"Play just these captions' span",children:x?"Pause":"Play"}),c.jsxs("span",{"data-testid":"transcript-timing-span",style:fv,children:[st.start.toFixed(2),"s – ",st.end.toFixed(2),"s",` · ${Pt} caption${Pt===1?"":"s"}`]}),c.jsx("button",{"data-testid":"transcript-timing-apply",style:Oo,onClick:()=>{hn!==null&&eo(hn)},title:Pt===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"}),c.jsx("button",{"data-testid":"transcript-timing-cancel",style:Oo,onClick:()=>y(null),title:"Discard the nudge (Esc)",children:"Cancel"})]})]}):null]})]})},Do=({children:e,...t})=>{const[n,r]=d.useState(!1);return c.jsx("button",{role:"menuitem",...t,style:{...i3,...n&&!t.disabled?{background:"#34343F"}:{},...t.disabled?{opacity:.5,cursor:"default"}:{}},onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:e})},uv=({x:e,active:t,...n})=>{const[r,o]=d.useState(!1);return c.jsx("div",{...n,style:{...JA,left:e-ib/2},onPointerEnter:()=>o(!0),onPointerLeave:()=>o(!1),children:c.jsx("div",{style:{...t3,background:t?"#fff":r?"#FFF0A0":"#FFE14D",width:t?4:2}})})},OA={flexShrink:0,display:"flex",flexDirection:"column",background:"#111116",minHeight:0},BA={display:"flex",flexDirection:"column",gap:8,padding:"14px 14px 10px",borderBottom:"1px solid #1E1E24"},WA={fontSize:11,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"#9A9AA3"},cv={fontSize:11,lineHeight:1.45,color:"#6a6a75"},VA={fontFamily:"'Inter', system-ui, sans-serif",fontSize:13,background:"#0F0F14",border:"1px solid #2A2A33",borderRadius:6,color:"#fff",padding:"6px 8px"},HA={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"},UA={cursor:"pointer",borderRadius:3,padding:"2px 4px",unicodeBidi:"isolate"},ZA={background:"#2b2b1a",outline:"1px solid #6b6432"},KA={background:"#3d3a17",outline:"2px solid #FFE14D",color:"#fff"},dv={width:26,height:30,fontSize:16,lineHeight:1,color:"#EDEDF2",background:"#1A1A21",border:"1px solid #2A2A33",borderRadius:6,cursor:"pointer",padding:0},YA={color:"#FFE14D"},GA={textDecoration:"underline",textUnderlineOffset:4},XA={background:"#FFE14D",color:"#111",borderRadius:0,boxShadow:"-4px 0 0 0 #FFE14D, 4px 0 0 0 #FFE14D"},qA={textDecoration:"line-through",color:"#6a6a75"},QA={borderBottom:"1px dotted #9A9AA3"},ib=12,JA={position:"absolute",top:0,width:ib,height:sn,cursor:"ew-resize",touchAction:"none",display:"flex",justifyContent:"center"},e3={position:"absolute",top:0,height:sn,touchAction:"none"},t3={height:"100%",borderRadius:1,pointerEvents:"none"},n3={display:"flex",gap:6,alignItems:"center",justifyContent:"space-between"},r3={width:20,height:20,fontSize:11,lineHeight:1,color:"#9A9AA3",background:"#1A1A21",border:"1px solid #2A2A33",borderRadius:6,cursor:"pointer",padding:0,flexShrink:0},cl={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},o3={...cl,top:"100%",left:0,marginTop:4,zIndex:32,minWidth:170,flexDirection:"column",alignItems:"stretch"},fv={fontSize:11,color:"#9A9AA3",paddingInline:"6px 8px",whiteSpace:"nowrap"},i3={fontSize:12,fontWeight:600,color:"#EDEDF2",background:"transparent",border:"none",borderRadius:6,padding:"6px 10px",cursor:"pointer",textAlign:"left",whiteSpace:"nowrap"},s3={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"},Oo={fontSize:11,color:"#EDEDF2",background:"#34343F",border:"1px solid #45454F",borderRadius:6,cursor:"pointer",padding:"4px 8px"},a3={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"},l3=[{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"]]}],u3=({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]),c.jsx("div",{style:c3,onMouseDown:e,children:c.jsxs("div",{"data-testid":"shortcuts-modal",style:d3,onMouseDown:t=>t.stopPropagation(),children:[c.jsxs("div",{style:f3,children:[c.jsx("span",{style:p3,children:"keybinds"}),c.jsx("span",{style:h3,children:"esc close"})]}),c.jsx("div",{style:m3,children:"available commands and configured shortcuts"}),l3.map(t=>c.jsxs("div",{style:{marginTop:18},children:[c.jsx("div",{style:g3,children:t.title}),t.rows.map(([n,r])=>c.jsxs("div",{style:v3,children:[c.jsx("span",{style:y3,children:n}),c.jsx("span",{style:w3,children:r})]},n))]},t.title))]})})),c3={position:"fixed",inset:0,zIndex:30,background:"rgba(5,5,8,0.6)",display:"flex",alignItems:"center",justifyContent:"center"},d3={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"},f3={display:"flex",justifyContent:"space-between",alignItems:"center"},p3={fontSize:18,fontWeight:700,color:"#EDEDF2"},h3={fontSize:13,fontWeight:700,color:"#0B0B0E",background:"#a8c7fa",borderRadius:4,padding:"3px 10px"},m3={fontSize:13,color:"#6a6a75",marginTop:4},g3={fontSize:14,fontWeight:700,color:"#8ab4f8",marginBottom:6},v3={display:"flex",gap:16,padding:"3px 0"},y3={width:290,flexShrink:0,color:"#c5a3ff",fontWeight:600,fontSize:13},w3={color:"#C9C9D4",fontSize:13},pv={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`}},x3=({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 u=i.current;if(!u)return;const f=u.querySelectorAll("input, button"),p=f[0],h=f[f.length-1];!p||!h||(l.shiftKey&&document.activeElement===p?(l.preventDefault(),h.focus()):!l.shiftKey&&document.activeElement===h&&(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 u;return(u=a==null?void 0:a.focus)==null?void 0:u.call(a)}},[]),c.jsx("div",{style:b3,onMouseDown:n,children:c.jsxs("form",{ref:i,"data-testid":"delete-scene-modal",role:"dialog","aria-modal":"true","aria-label":`Delete ${e.rootId}`,style:S3,onMouseDown:a=>a.stopPropagation(),onSubmit:a=>{a.preventDefault(),t(r)},children:[c.jsxs("div",{style:k3,children:[c.jsxs("span",{style:E3,children:["delete ",e.rootId,e.isSplitHalf?c.jsx("span",{style:C3,children:"half"}):null,"?"]}),c.jsx("span",{style:I3,children:"esc cancel"})]}),c.jsx("div",{style:T3,children:"undoable with ⌘Z, like every other edit"}),c.jsx("div",{style:{marginTop:16},children:e.targets.map(a=>c.jsxs("label",{style:R3,"data-testid":`delete-option-${a}`,children:[c.jsx("input",{type:"radio",name:"delete-target",value:a,checked:r===a,onChange:()=>o(a),style:j3}),c.jsxs("span",{children:[c.jsx("span",{style:P3,children:pv[a].label}),c.jsx("span",{style:F3,children:pv[a].detail(e)})]})]},a))}),c.jsxs("div",{style:_3,children:[c.jsx("button",{type:"button","data-testid":"delete-cancel",style:sb,onClick:n,children:"Cancel"}),c.jsx("button",{ref:s,type:"submit","data-testid":"delete-confirm",style:M3,children:"Delete"})]})]})})},b3={position:"fixed",inset:0,zIndex:30,background:"rgba(5,5,8,0.6)",display:"flex",alignItems:"center",justifyContent:"center"},S3={width:420,maxWidth:"90vw",background:"#12121A",border:"1px solid #3A3A48",borderRadius:8,padding:"18px 22px 20px",fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace"},k3={display:"flex",justifyContent:"space-between",alignItems:"center",gap:12},E3={fontSize:16,fontWeight:700,color:"#EDEDF2"},C3={fontSize:11,fontWeight:700,color:"#0B0B0E",background:"#c5a3ff",borderRadius:4,padding:"2px 6px",marginLeft:6},I3={fontSize:12,fontWeight:700,color:"#0B0B0E",background:"#a8c7fa",borderRadius:4,padding:"3px 10px",whiteSpace:"nowrap"},T3={fontSize:12,color:"#6a6a75",marginTop:4},R3={display:"flex",alignItems:"flex-start",gap:10,padding:"8px 0",cursor:"pointer"},j3={accentColor:"#8ab4f8",marginTop:2,cursor:"pointer"},P3={display:"block",fontSize:13,fontWeight:600,color:"#EDEDF2"},F3={display:"block",fontSize:12,color:"#9A9AA3",marginTop:2},_3={display:"flex",justifyContent:"flex-end",gap:8,marginTop:14},sb={fontSize:12,fontWeight:600,color:"#C9C9D4",background:"transparent",border:"1px solid #2A2A33",borderRadius:6,padding:"7px 12px",cursor:"pointer",fontFamily:"inherit"},M3={...sb,color:"#FF5C5C",border:"1px solid #452626"},hv={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`}},$3=({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=u=>{if(u.key==="Escape"){u.stopPropagation(),n();return}if(u.key!=="Tab")return;const f=i.current;if(!f)return;const p=f.querySelectorAll("input, button"),h=p[0],m=p[p.length-1];!h||!m||(u.shiftKey&&document.activeElement===h?(u.preventDefault(),m.focus()):!u.shiftKey&&document.activeElement===m&&(u.preventDefault(),h.focus()))};return window.addEventListener("keydown",l,!0),()=>window.removeEventListener("keydown",l,!0)},[n]),d.useEffect(()=>{var u;const l=document.activeElement;return(u=s.current)==null||u.focus(),()=>{var f;return(f=l==null?void 0:l.focus)==null?void 0:f.call(l)}},[]);const a=e.words.length;return c.jsx("div",{style:A3,onMouseDown:n,children:c.jsxs("form",{ref:i,"data-testid":"delete-words-modal",role:"dialog","aria-modal":"true","aria-label":`Delete ${a} word${a===1?"":"s"}`,style:N3,onMouseDown:l=>l.stopPropagation(),onSubmit:l=>{l.preventDefault(),t(r)},children:[c.jsxs("div",{style:L3,children:[c.jsxs("span",{style:z3,children:["delete ",a," word",a===1?"":"s","?"]}),c.jsx("span",{style:D3,children:"esc cancel"})]}),c.jsx("div",{style:O3,children:"undoable with ⌘Z, like every other edit"}),c.jsx("div",{style:{marginTop:16},children:e.targets.map(l=>c.jsxs("label",{style:B3,"data-testid":`delete-words-option-${l}`,children:[c.jsx("input",{type:"radio",name:"delete-words-target",value:l,checked:r===l,onChange:()=>o(l),style:W3}),c.jsxs("span",{children:[c.jsx("span",{style:V3,children:hv[l].label}),c.jsx("span",{style:H3,children:hv[l].detail(e)})]})]},l))}),c.jsxs("div",{style:U3,children:[c.jsx("button",{type:"button","data-testid":"delete-words-cancel",style:ab,onClick:n,children:"Cancel"}),c.jsx("button",{ref:s,type:"submit","data-testid":"delete-words-confirm",style:Z3,children:"Delete"})]})]})})},A3={position:"fixed",inset:0,zIndex:30,background:"rgba(5,5,8,0.6)",display:"flex",alignItems:"center",justifyContent:"center"},N3={width:420,maxWidth:"90vw",background:"#12121A",border:"1px solid #3A3A48",borderRadius:8,padding:"18px 22px 20px",fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace"},L3={display:"flex",justifyContent:"space-between",alignItems:"center",gap:12},z3={fontSize:16,fontWeight:700,color:"#EDEDF2"},D3={fontSize:12,fontWeight:700,color:"#0B0B0E",background:"#a8c7fa",borderRadius:4,padding:"3px 10px",whiteSpace:"nowrap"},O3={fontSize:12,color:"#6a6a75",marginTop:4},B3={display:"flex",alignItems:"flex-start",gap:10,padding:"8px 0",cursor:"pointer"},W3={accentColor:"#8ab4f8",marginTop:2,cursor:"pointer"},V3={display:"block",fontSize:13,fontWeight:600,color:"#EDEDF2"},H3={display:"block",fontSize:12,color:"#9A9AA3",marginTop:2},U3={display:"flex",justifyContent:"flex-end",gap:8,marginTop:14},ab={fontSize:12,fontWeight:600,color:"#C9C9D4",background:"transparent",border:"1px solid #2A2A33",borderRadius:6,padding:"7px 12px",cursor:"pointer",fontFamily:"inherit"},Z3={...ab,color:"#FF5C5C",border:"1px solid #452626"},K3=(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("/")}},mv=e=>e.scrollTop+e.clientHeight<e.scrollHeight-1,Y3=(e,t,n)=>n<=0?-1:Math.max(0,Math.min(n-1,e+t)),gv=({recent:e,required:t,onOpen:n,onClose:r})=>{const[o,i]=d.useState(null),[s,a]=d.useState(null),[l,u]=d.useState(!1),f=d.useRef(null),p=d.useRef(null),[h,m]=d.useState(!1),[w,g]=d.useState(!1),k=()=>{m(f.current?mv(f.current):!1)},v=()=>{g(p.current?mv(p.current):!1)},y=async S=>{try{const E=await fetch(`/api/fs${S?`?dir=${encodeURIComponent(S)}`:""}`),R=await E.json();if(!E.ok)throw new Error(R.error??`listing failed: ${E.status}`);i(R)}catch(E){a(E instanceof Error?E.message:String(E))}};d.useEffect(()=>{y()},[]),d.useEffect(()=>{const S=()=>{k(),v()};return S(),window.addEventListener("resize",S),()=>window.removeEventListener("resize",S)},[o,e]),d.useEffect(()=>{if(t)return;const S=E=>{E.key==="Escape"&&(E.stopPropagation(),r())};return window.addEventListener("keydown",S,!0),()=>window.removeEventListener("keydown",S,!0)},[t,r]);const x=S=>{var _;const E=S.key==="ArrowDown"?1:S.key==="ArrowUp"?-1:0;if(E===0&&S.key!=="Home"&&S.key!=="End")return;const R=Array.from(S.currentTarget.querySelectorAll("button"));if(R.length===0)return;const j=R.indexOf(document.activeElement),I=S.key==="Home"?0:S.key==="End"?R.length-1:Y3(j,E,R.length);S.preventDefault(),(_=R[I])==null||_.focus()},b=S=>{u(!0),a(null),n(S).then(E=>{u(!1),E&&a(E)})};return c.jsx("div",{style:G3,onMouseDown:t?void 0:r,children:c.jsxs("div",{"data-testid":"project-picker",style:X3,onMouseDown:S=>S.stopPropagation(),children:[c.jsxs("div",{style:q3,children:[c.jsx("span",{style:Q3,children:t?"open a project":"switch project"}),t?null:c.jsx("button",{"data-testid":"project-picker-close",style:J3,onClick:r,children:"esc close"})]}),c.jsx("div",{style:eN,children:"A project is a work directory a `ossclip produce` run wrote — the folder holding render-props.json."}),s?c.jsx("div",{"data-testid":"project-picker-error",style:tN,children:s}):null,e.length>0?c.jsxs("div",{style:{marginTop:16,flexShrink:0},children:[c.jsx("div",{style:vv,children:"recent"}),c.jsx("div",{ref:p,className:"ossclip-scroll-list",style:w?{...yv,...xv}:yv,onScroll:v,onKeyDown:x,"data-testid":"project-recent-list",children:e.map(S=>{const{head:E,tail:R}=K3(S);return c.jsxs("button",{"data-testid":"project-recent",className:"ossclip-picker-row",style:{...Bc,...sN},disabled:l,onClick:()=>b(S),title:S,children:[c.jsx("span",{style:{color:"#FFE14D",flexShrink:0},children:"▸"}),c.jsxs("span",{style:aN,children:[c.jsx("span",{style:lN,children:R}),E?c.jsx("span",{style:uN,children:E}):null]})]},S)})})]}):null,c.jsxs("div",{style:iN,children:[c.jsx("div",{style:vv,children:"browse"}),c.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 ",c.jsx("span",{style:{color:"#FFE14D"},children:"▸ .ossclip/…"})," entries."]}),o?c.jsxs(c.Fragment,{children:[c.jsxs("div",{style:nN,children:[c.jsx("span",{style:rN,title:o.dir,children:o.dir}),o.isWorkdir?c.jsx("button",{"data-testid":"project-open-current",style:oN,disabled:l,onClick:()=>b(o.dir),children:"open this project"}):null]}),c.jsxs("div",{ref:f,className:"ossclip-scroll-list",style:h?{...wv,...xv}:wv,onScroll:k,onKeyDown:x,"data-testid":"project-fs-list",children:[o.parent?c.jsxs("button",{"data-testid":"project-fs-up",className:"ossclip-picker-row",style:Bc,disabled:l,onClick:()=>void y(o.parent),children:[c.jsx("span",{style:{color:"#6a6a75",flexShrink:0},children:"↑"}),c.jsx("span",{style:bv,children:".."})]}):null,o.entries.map(S=>c.jsxs("button",{"data-testid":S.isWorkdir?"project-fs-workdir":"project-fs-dir",className:`ossclip-picker-row${S.isWorkdir?" is-workdir":""}`,style:Bc,disabled:l,onClick:()=>S.isWorkdir?b(S.path):void y(S.path),title:S.path,children:[c.jsx("span",{style:{flexShrink:0,color:S.isWorkdir?"#FFE14D":"#6a6a75"},children:S.isWorkdir?"▸":"▪"}),c.jsxs("span",{style:bv,children:[S.name,S.isWorkdir?null:c.jsx("span",{style:{color:"#55555f"},children:"/"})]}),S.isWorkdir?c.jsx("span",{style:cN,children:"project"}):null]},S.path)),o.entries.length===0?c.jsx("div",{style:{color:"#6a6a75",fontSize:12,padding:"6px 8px"},children:"no folders here"}):null]})]}):c.jsx("div",{style:{color:"#6a6a75",fontSize:13},children:"loading…"})]})]})})},G3={position:"fixed",inset:0,zIndex:30,background:"rgba(5,5,8,0.6)",display:"flex",alignItems:"center",justifyContent:"center"},X3={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"},q3={display:"flex",justifyContent:"space-between",alignItems:"center"},Q3={fontSize:18,fontWeight:700,color:"#EDEDF2"},J3={fontSize:13,fontWeight:700,color:"#0B0B0E",background:"#a8c7fa",border:"none",borderRadius:4,padding:"3px 10px",cursor:"pointer"},eN={fontSize:13,color:"#6a6a75",marginTop:4},tN={marginTop:12,fontSize:13,color:"#FF5C5C"},vv={fontSize:14,fontWeight:700,color:"#8ab4f8",marginBottom:6},nN={display:"flex",alignItems:"center",gap:10,marginBottom:6},rN={fontSize:12,color:"#9A9AA3",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},oN={flexShrink:0,fontSize:12,fontWeight:700,color:"#0B0B0E",background:"#FFE14D",border:"1px solid #FFE14D",borderRadius:6,padding:"4px 10px",cursor:"pointer"},iN={marginTop:16,display:"flex",flexDirection:"column",flex:1,minHeight:0},yv={maxHeight:218,overflowY:"auto",overscrollBehavior:"contain",flexShrink:0,display:"flex",flexDirection:"column",gap:2},wv={flex:1,minHeight:0,overflowY:"auto",overscrollBehavior:"contain",display:"flex",flexDirection:"column",gap:2},xv={maskImage:"linear-gradient(to bottom, black calc(100% - 24px), transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black calc(100% - 24px), transparent 100%)"},Bc={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"},bv={overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},sN={minHeight:46,alignItems:"center"},aN={display:"flex",flexDirection:"column",minWidth:0},lN={color:"#EDEDF2",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},uN={fontSize:11,color:"#6a6a75",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},cN={marginLeft:10,fontSize:11,fontWeight:700,color:"#FFE14D"},dN=({defaultOutPath:e,onCancel:t,onConfirm:n})=>{const[r,o]=d.useState(e??""),[i,s]=d.useState(!1);d.useEffect(()=>{const l=u=>{u.key==="Escape"?(u.stopPropagation(),t()):u.key==="Enter"&&!i&&(u.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 u=await l.json();u.path&&o(u.path)}}catch{}finally{s(!1)}};return c.jsx("div",{style:fN,onMouseDown:t,children:c.jsxs("div",{"data-testid":"render-modal",style:pN,onMouseDown:l=>l.stopPropagation(),children:[c.jsxs("div",{style:hN,children:[c.jsx("div",{style:mN,children:"🎬 Render Master Video"}),c.jsx("button",{style:gN,onClick:t,children:"✕"})]}),c.jsx("div",{style:vN,children:"Choose where to export your rendered master cut, or keep the default location."}),c.jsxs("div",{style:{marginTop:20},children:[c.jsx("label",{style:yN,children:"Export File Destination"}),c.jsxs("div",{style:wN,children:[c.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:xN,autoFocus:!0}),c.jsx("button",{"data-testid":"render-browse-btn",style:bN,onClick:a,disabled:i,title:"Open native file picker to choose destination",children:i?"Browsing…":"📁 Browse…"})]})]}),c.jsxs("div",{style:SN,children:[c.jsx("button",{style:kN,onClick:t,children:"Cancel"}),c.jsx("button",{"data-testid":"render-confirm-btn",style:EN,onClick:()=>n(r.trim()?r.trim():void 0),children:"Start Render ⚡"})]})]})})},fN={position:"fixed",inset:0,zIndex:40,background:"rgba(5,5,8,0.75)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center"},pN={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"},hN={display:"flex",justifyContent:"space-between",alignItems:"center"},mN={fontSize:18,fontWeight:700,color:"#EDEDF2",letterSpacing:"-0.01em"},gN={background:"transparent",border:"none",color:"#8B8B9E",fontSize:16,cursor:"pointer",padding:"4px 8px",borderRadius:4},vN={fontSize:13,color:"#8B8B9E",marginTop:6,lineHeight:1.4},yN={display:"block",fontSize:12,fontWeight:600,color:"#C9C9D4",marginBottom:8,textTransform:"uppercase",letterSpacing:"0.04em"},wN={display:"flex",gap:8},xN={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"},bN={background:"#1E1E2A",border:"1px solid #3A3A48",borderRadius:6,color:"#EDEDF2",padding:"0 16px",fontSize:13,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap"},SN={display:"flex",justifyContent:"flex-end",gap:12,marginTop:24},kN={background:"transparent",border:"1px solid #2C2C38",borderRadius:6,color:"#C9C9D4",padding:"9px 18px",fontSize:13,fontWeight:600,cursor:"pointer"},EN={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 CN(e){switch(e){case"override":return"Project override";case"flag":case"config":return"Your default portrait"}}function IN(e){const t=/^data:([^;,]+);base64,(.+)$/s.exec(e);return t?{mimeType:t[1],data:t[2]}:null}function TN(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 Sv=60,RN=({onClose:e})=>{const[t,n]=d.useState(null),[r,o]=d.useState(null),[i,s]=d.useState(""),[a,l]=d.useState(""),[u,f]=d.useState(""),[p,h]=d.useState(null),[m,w]=d.useState(!1),[g,k]=d.useState(null),[v,y]=d.useState(null),x=d.useRef(null);d.useEffect(()=>{const I=_=>{_.key==="Escape"&&(_.stopPropagation(),e())};return window.addEventListener("keydown",I,!0),()=>window.removeEventListener("keydown",I,!0)},[e]),d.useEffect(()=>{(async()=>{try{const I=await fetch("/api/thumbnail"),_=await I.json();if(!I.ok)throw new Error(_.error??`GET /api/thumbnail failed: ${I.status}`);n(_),h(_.imageUrl),_.concept&&(s(_.concept.overlayText),l(_.concept.scene),f(_.concept.styleNotes))}catch(I){o(I instanceof Error?I.message:String(I))}})()},[]);const b=async()=>{w(!0),k(null);try{const I=await fetch("/api/thumbnail/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({concept:{scene:a,overlayText:i,styleNotes:u}})}),_=await I.json();if(!I.ok||_.ok!==!0){k(_.error??`regenerate failed: ${I.status}`);return}h(_.imageUrl??null)}catch(I){k(I instanceof Error?I.message:String(I))}finally{w(!1)}},S=I=>{n(_=>_&&{..._,portrait:I})},E=async I=>{y(null);try{const _=await new Promise((F,H)=>{const O=new FileReader;O.onload=()=>F(String(O.result)),O.onerror=()=>H(new Error("could not read the image file")),O.readAsDataURL(I)}),A=IN(_);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)}),P=await W.json();if(!W.ok||P.ok!==!0){y(P.error??`swap failed: ${W.status}`);return}S(P.portrait??null)}catch(_){y(_ instanceof Error?_.message:String(_))}},R=async()=>{y(null);try{const I=await fetch("/api/thumbnail/portrait",{method:"DELETE"}),_=await I.json();if(!I.ok||_.ok!==!0){y(_.error??`reset failed: ${I.status}`);return}S(_.portrait??null)}catch(I){y(I instanceof Error?I.message:String(I))}},j=(t==null?void 0:t.status)==="unavailable";return c.jsx("div",{style:jN,onMouseDown:e,children:c.jsxs("div",{"data-testid":"thumbnail-modal",style:PN,onMouseDown:I=>I.stopPropagation(),children:[c.jsxs("div",{style:FN,children:[c.jsx("div",{style:_N,children:"AI Thumbnail"}),c.jsx("button",{style:MN,onClick:e,"aria-label":"Close",children:"✕"})]}),r?c.jsxs("div",{"data-testid":"thumbnail-load-error",style:Uc,children:["Couldn't load the thumbnail state: ",r]}):t===null?c.jsx("div",{style:Wc,children:"Loading…"}):j?c.jsx("div",{"data-testid":"thumbnail-unavailable",style:{...Wc,marginTop:12},children:TN(t.reason)}):c.jsxs(c.Fragment,{children:[t.status==="skipped"?c.jsx("div",{"data-testid":"thumbnail-skipped-note",style:{...Wc,marginTop:8},children:"Thumbnail was skipped at the concept approval prompt — regenerating replaces that decision."}):null,c.jsx("div",{style:$N,children:p?c.jsx("img",{"data-testid":"thumbnail-image",src:p,alt:"Current AI thumbnail",style:AN}):c.jsx("div",{"data-testid":"thumbnail-placeholder",style:NN,children:"No thumbnail generated yet — edit the concept and hit Regenerate."})}),t.portrait?c.jsxs("div",{"data-testid":"portrait-strip",style:LN,children:[c.jsx("img",{"data-testid":"portrait-preview",src:t.portrait.url,alt:"Portrait reference",style:zN}),c.jsxs("div",{style:{flex:1,minWidth:0},children:[c.jsx("div",{"data-testid":"portrait-source",style:DN,children:CN(t.portrait.source)}),c.jsx("div",{style:Ev,children:"The swap applies to this project only and is used by future renders too."})]}),c.jsx("button",{"data-testid":"portrait-swap-btn",style:kv,onClick:()=>{var I;return(I=x.current)==null?void 0:I.click()},disabled:m,children:"Swap face…"}),t.portrait.source==="override"?c.jsx("button",{"data-testid":"portrait-reset-btn",style:kv,onClick:()=>void R(),disabled:m,children:"Use default"}):null,c.jsx("input",{ref:x,"data-testid":"portrait-file-input",type:"file",accept:"image/png,image/jpeg,image/webp",style:{display:"none"},onChange:I=>{var A;const _=(A=I.target.files)==null?void 0:A[0];I.target.value="",_&&E(_)}})]}):null,v?c.jsx("div",{"data-testid":"portrait-error",style:Uc,children:v}):null,c.jsxs("div",{style:{marginTop:16},children:[c.jsxs("label",{style:Vc,children:["Overlay text — the words ON the image (",Sv," chars, 4–9 words)"]}),c.jsx("input",{"data-testid":"thumbnail-overlay-input",type:"text",maxLength:Sv,value:i,onChange:I=>s(I.target.value),style:Hc})]}),c.jsxs("div",{style:{marginTop:12},children:[c.jsx("label",{style:Vc,children:"Scene — what the image shows"}),c.jsx("textarea",{"data-testid":"thumbnail-scene-input",value:a,onChange:I=>l(I.target.value),rows:3,style:{...Hc,resize:"vertical"}})]}),c.jsxs("div",{style:{marginTop:12},children:[c.jsx("label",{style:Vc,children:"Style notes — palette, lighting, mood"}),c.jsx("textarea",{"data-testid":"thumbnail-style-input",value:u,onChange:I=>f(I.target.value),rows:3,style:{...Hc,resize:"vertical"}})]}),g?c.jsx("div",{"data-testid":"thumbnail-error",style:Uc,children:g}):null,c.jsxs("div",{style:ON,children:[c.jsx("div",{style:Ev,children:"Regenerating replaces the video's .thumbnail.png and saves this concept for future renders."}),c.jsx("button",{"data-testid":"thumbnail-regenerate-btn",style:{...BN,...m?{opacity:.6,cursor:"default"}:{}},onClick:()=>void b(),disabled:m,children:m?"Generating…":"Regenerate"})]})]})]})})},jN={position:"fixed",inset:0,zIndex:40,background:"rgba(5,5,8,0.75)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center"},PN={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"},FN={display:"flex",justifyContent:"space-between",alignItems:"center"},_N={fontSize:18,fontWeight:700,color:"#EDEDF2",letterSpacing:"-0.01em"},MN={background:"transparent",border:"none",color:"#8B8B9E",fontSize:16,cursor:"pointer",padding:"4px 8px",borderRadius:4},Wc={fontSize:13,color:"#8B8B9E",marginTop:6,lineHeight:1.4},$N={marginTop:16,border:"1px solid #2C2C38",borderRadius:6,background:"#09090D",aspectRatio:"16 / 9",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden"},AN={width:"100%",height:"100%",objectFit:"contain"},NN={color:"#8B8B9E",fontSize:13,padding:16,textAlign:"center"},LN={display:"flex",alignItems:"center",gap:12,marginTop:12,padding:"10px 12px",border:"1px solid #2C2C38",borderRadius:6,background:"#09090D"},zN={width:44,height:44,borderRadius:6,objectFit:"cover",flexShrink:0,border:"1px solid #2C2C38"},DN={fontSize:12,fontWeight:600,color:"#C9C9D4",marginBottom:2},kv={background:"transparent",border:"1px solid #3A3A48",borderRadius:6,color:"#C9C9D4",padding:"7px 12px",fontSize:12,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap"},Vc={display:"block",fontSize:12,fontWeight:600,color:"#C9C9D4",marginBottom:8,textTransform:"uppercase",letterSpacing:"0.04em"},Hc={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"},Uc={marginTop:12,color:"#FF5C5C",fontSize:13,fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",whiteSpace:"pre-wrap"},ON={display:"flex",justifyContent:"space-between",alignItems:"center",gap:12,marginTop:20},Ev={fontSize:12,color:"#8B8B9E",lineHeight:1.4},BN={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)"},Cv=3,Iv=5,Zc=500;function WN(e){return e.split(/\s+/).filter(t=>t.replace(/^#+/,"").length>0).map(t=>t.startsWith("#")?t:`#${t}`)}function VN(e){return e.map(t=>t.startsWith("#")?t:`#${t}`).join(" ")}function lb(e){return e.split(",").map(t=>t.trim()).filter(t=>t.length>0)}function ub(e){return e.join(", ")}function HN(e){return ub(lb(e)).length}function UN(e){const t=Math.max(0,Math.floor(e));return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`}function ZN(e){return`[${{browse:"Browse",search:"Search",benefit:"Benefit",alt:"Alt"}[e]}]`}const KN="This run never generated YouTube metadata. Run produce with --youtube (and an LLM provider) once — the pack lands here afterwards.",YN=({onClose:e})=>{var W;const[t,n]=d.useState(null),[r,o]=d.useState(null),[i,s]=d.useState([]),[a,l]=d.useState(null),[u,f]=d.useState(""),[p,h]=d.useState(""),[m,w]=d.useState(""),[g,k]=d.useState(null),[v,y]=d.useState(null),[x,b]=d.useState(null),[S,E]=d.useState(!1),[R,j]=d.useState(null);d.useEffect(()=>{const P=F=>{F.key==="Escape"&&(F.stopPropagation(),e())};return window.addEventListener("keydown",P,!0),()=>window.removeEventListener("keydown",P,!0)},[e]);const I=d.useCallback(async()=>{try{const P=await fetch("/api/youtube"),F=await P.json();if(!P.ok)throw new Error(F.error??`GET /api/youtube failed: ${P.status}`);n(F),F.pack&&(s(F.pack.titles),l(F.pack.titleAngles??null),f(F.pack.description),h(VN(F.pack.hashtags)),w(ub(F.pack.tags)),k(F.pack.hook60??null),y(F.pack.linkedinPost??null),b(F.pack.communityPost??null))}catch(P){o(P instanceof Error?P.message:String(P))}},[]);d.useEffect(()=>{I()},[I]);const _=async()=>{var P;E(!0),j(null);try{const F=await fetch("/api/youtube",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({pack:{titles:i,...a!==null?{titleAngles:a}:{},description:u,hashtags:WN(p),tags:lb(m),...(P=t==null?void 0:t.pack)!=null&&P.chapters?{chapters:t.pack.chapters}:{},...g!==null?{hook60:g}:{},...v!==null?{linkedinPost:v}:{},...x!==null?{communityPost:x}:{}}})}),H=await F.json();if(!F.ok||H.ok!==!0){j(H.error??`save failed: ${F.status}`);return}await I()}catch(F){j(F instanceof Error?F.message:String(F))}finally{E(!1)}},A=HN(m);return c.jsx("div",{style:GN,onMouseDown:e,children:c.jsxs("div",{"data-testid":"youtube-modal",style:XN,onMouseDown:P=>P.stopPropagation(),children:[c.jsxs("div",{style:qN,children:[c.jsx("div",{style:QN,children:"YouTube SEO metadata"}),c.jsx("button",{style:JN,onClick:e,"aria-label":"Close",children:"✕"})]}),r?c.jsxs("div",{"data-testid":"youtube-load-error",style:jv,children:["Couldn't load the YouTube pack: ",r]}):t===null?c.jsx("div",{style:Tv,children:"Loading…"}):t.available?c.jsxs(c.Fragment,{children:[c.jsxs("div",{style:{marginTop:16},children:[c.jsxs("label",{style:Er,children:["Title options (",Cv,"–",Iv,", up to 100 chars each)"]}),i.map((P,F)=>c.jsxs("div",{style:e5,children:[(a==null?void 0:a[F])!==void 0?c.jsx("span",{"data-testid":`youtube-title-angle-${F}`,style:t5,children:ZN(a[F])}):null,c.jsx("input",{"data-testid":`youtube-title-input-${F}`,type:"text",maxLength:100,value:P,onChange:H=>s(O=>O.map((T,C)=>C===F?H.target.value:T)),style:no}),c.jsx("button",{"data-testid":`youtube-title-remove-${F}`,style:Rv,disabled:i.length<=Cv,onClick:()=>{s(H=>H.filter((O,T)=>T!==F)),l(H=>H&&H.filter((O,T)=>T!==F))},"aria-label":`Remove title ${F+1}`,children:"✕"})]},F)),c.jsx("button",{"data-testid":"youtube-title-add",style:Rv,disabled:i.length>=Iv,onClick:()=>{s(P=>[...P,""]),l(P=>P&&[...P,"alt"])},children:"+ Add title"})]}),c.jsxs("div",{style:{marginTop:12},children:[c.jsx("label",{style:Er,children:"Description"}),c.jsx("textarea",{"data-testid":"youtube-description-input",value:u,onChange:P=>f(P.target.value),rows:6,style:{...no,resize:"vertical"}})]}),c.jsxs("div",{style:{marginTop:12},children:[c.jsx("label",{style:Er,children:"Hashtags — space-separated, # added if missing"}),c.jsx("input",{"data-testid":"youtube-hashtags-input",type:"text",value:p,onChange:P=>h(P.target.value),style:no})]}),c.jsxs("div",{style:{marginTop:12},children:[c.jsx("label",{style:Er,children:"Tags — comma-separated"}),c.jsx("input",{"data-testid":"youtube-tags-input",type:"text",value:m,onChange:P=>w(P.target.value),style:no}),c.jsxs("div",{"data-testid":"youtube-tags-counter",style:{...n5,...A>Zc?{color:"#FFB84D"}:{}},children:[A," / ",Zc,A>Zc?" — tags past the budget are dropped on save":""]})]}),(W=t.pack)!=null&&W.chapters&&t.pack.chapters.length>0?c.jsxs("div",{style:{marginTop:12},children:[c.jsx("label",{style:Er,children:"Chapters (read-only — embedded in the description on save/render)"}),c.jsx("div",{"data-testid":"youtube-chapters",style:r5,children:t.pack.chapters.map((P,F)=>c.jsxs("div",{children:[UN(P.atSec)," ",P.title]},F))}),c.jsx("div",{style:Pv,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,g!==null?c.jsxs("div",{style:{marginTop:12},children:[c.jsx("label",{style:Er,children:"First-60s hook strategy (for you — never uploaded)"}),c.jsx("textarea",{"data-testid":"youtube-hook60-input",value:g,onChange:P=>k(P.target.value),rows:3,style:{...no,resize:"vertical"}})]}):null,v!==null?c.jsxs("div",{style:{marginTop:12},children:[c.jsx("label",{style:Er,children:"LinkedIn post"}),c.jsx("textarea",{"data-testid":"youtube-linkedin-input",value:v,onChange:P=>y(P.target.value),rows:6,style:{...no,resize:"vertical"}})]}):null,x!==null?c.jsxs("div",{style:{marginTop:12},children:[c.jsx("label",{style:Er,children:"Community post"}),c.jsx("textarea",{"data-testid":"youtube-community-input",value:x,onChange:P=>b(P.target.value),rows:3,style:{...no,resize:"vertical"}})]}):null,R?c.jsx("div",{"data-testid":"youtube-error",style:jv,children:R}):null,c.jsxs("div",{style:o5,children:[c.jsx("div",{style:Pv,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."}),c.jsx("button",{"data-testid":"youtube-save-btn",style:{...i5,...S?{opacity:.6,cursor:"default"}:{}},onClick:()=>void _(),disabled:S,children:S?"Saving…":"Save"})]})]}):c.jsx("div",{"data-testid":"youtube-unavailable",style:{...Tv,marginTop:12},children:KN})]})})},GN={position:"fixed",inset:0,zIndex:40,background:"rgba(5,5,8,0.75)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center"},XN={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"},qN={display:"flex",justifyContent:"space-between",alignItems:"center"},QN={fontSize:18,fontWeight:700,color:"#EDEDF2",letterSpacing:"-0.01em"},JN={background:"transparent",border:"none",color:"#8B8B9E",fontSize:16,cursor:"pointer",padding:"4px 8px",borderRadius:4},Tv={fontSize:13,color:"#8B8B9E",marginTop:6,lineHeight:1.4},Er={display:"block",fontSize:12,fontWeight:600,color:"#C9C9D4",marginBottom:8,textTransform:"uppercase",letterSpacing:"0.04em"},no={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"},e5={display:"flex",gap:8,alignItems:"center",marginBottom:8},t5={fontSize:11,fontWeight:700,color:"#8B8B9E",fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",whiteSpace:"nowrap",minWidth:62},Rv={fontSize:12,fontWeight:600,color:"#C9C9D4",background:"#1A1A21",border:"1px solid #2A2A33",borderRadius:6,padding:"6px 10px",cursor:"pointer",whiteSpace:"nowrap"},n5={marginTop:6,fontSize:12,color:"#8B8B9E",fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace"},r5={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},jv={marginTop:12,color:"#FF5C5C",fontSize:13,fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",whiteSpace:"pre-wrap"},o5={display:"flex",justifyContent:"space-between",alignItems:"center",gap:12,marginTop:20},Pv={fontSize:12,color:"#8B8B9E",lineHeight:1.4,marginTop:6},i5={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 s5(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 a5(e){const t=e.trim().replace(/\s+/g," "),n=KM(t);return{preview:n,trimmed:n!==t}}function l5(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 Fv(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 u5(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 c5(e){return{...e.typed===(e.persistedText??"")?{}:{text:e.typed},...e.atSec===void 0?{}:{atSec:e.atSec},from:e.from}}const d5=({onClose:e,playheadSec:t})=>{const[n,r]=d.useState(null),[o,i]=d.useState(null),[s,a]=d.useState(""),[l,u]=d.useState(""),[f,p]=d.useState("final"),[h,m]=d.useState(null),[w,g]=d.useState(!1),[k,v]=d.useState(null),[y,x]=d.useState([]);d.useEffect(()=>{const I=_=>{_.key==="Escape"&&(_.stopPropagation(),e())};return window.addEventListener("keydown",I,!0),()=>window.removeEventListener("keydown",I,!0)},[e]),d.useEffect(()=>{(async()=>{try{const I=await fetch("/api/cover"),_=await I.json();if(!I.ok)throw new Error(_.error??`GET /api/cover failed: ${I.status}`);r(_),m(_.imageUrl),_.provenance&&(a(_.provenance.text),Fv(_.provenance).enabled&&p(_.provenance.frame.source))}catch(I){i(I instanceof Error?I.message:String(I))}})()},[]);const b=l5(l),S=a5(s),E=Fv((n==null?void 0:n.provenance)??null),R=async()=>{var I;if(b.ok){g(!0),v(null),x([]);try{const _=await fetch("/api/cover/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c5({typed:s,persistedText:((I=n==null?void 0:n.provenance)==null?void 0:I.text)??null,atSec:b.atSec,from:f}))}),A=await _.json();if(!_.ok||A.ok!==!0){v(A.error??`regenerate failed: ${_.status}`);return}if(m(A.imageUrl??null),x(A.notes??[]),A.provenance){const W=A.provenance;r(P=>P&&{...P,provenance:W,status:"ready"}),a(W.text)}u("")}catch(_){v(_ instanceof Error?_.message:String(_))}finally{g(!1)}}},j=(n==null?void 0:n.status)==="unavailable";return c.jsx("div",{style:f5,onMouseDown:e,children:c.jsxs("div",{"data-testid":"cover-modal",style:p5,onMouseDown:I=>I.stopPropagation(),children:[c.jsxs("div",{style:h5,children:[c.jsx("div",{style:m5,children:"Cover image"}),c.jsx("button",{style:g5,onClick:e,"aria-label":"Close",children:"✕"})]}),o?c.jsxs("div",{"data-testid":"cover-load-error",style:Yc,children:["Couldn't load the cover state: ",o]}):n===null?c.jsx("div",{style:_v,children:"Loading…"}):j?c.jsx("div",{"data-testid":"cover-unavailable",style:{..._v,marginTop:12},children:s5(n.reason)}):c.jsxs(c.Fragment,{children:[c.jsx("div",{style:v5,children:h?c.jsx("img",{"data-testid":"cover-image",src:h,alt:"Current cover",style:y5}):c.jsx("div",{"data-testid":"cover-placeholder",style:w5,children:"No cover on disk yet — set a headline and hit Apply."})}),c.jsxs("div",{style:{marginTop:16},children:[c.jsxs("label",{style:Mv,children:["Headline — at most ",M1," words (§35)"]}),c.jsx("input",{"data-testid":"cover-text-input",type:"text",value:s,onChange:I=>a(I.target.value),style:$v}),S.trimmed?c.jsxs("div",{"data-testid":"cover-headline-preview",style:{...Bo,marginTop:6},children:["Will render as: “",S.preview,"”"]}):null]}),c.jsxs("div",{style:{marginTop:16},children:[c.jsx("label",{style:Mv,children:"Frame"}),c.jsxs("div",{style:Av,children:[c.jsx("button",{"data-testid":"cover-playhead-btn",style:Kc,onClick:()=>u(t().toFixed(2)),disabled:w,children:"Use current playhead"}),c.jsx("input",{"data-testid":"cover-at-input",type:"text",inputMode:"decimal",placeholder:"seconds — blank keeps the current still",value:l,onChange:I=>u(I.target.value),style:{...$v,flex:1}})]}),b.ok?null:c.jsx("div",{"data-testid":"cover-at-error",style:Yc,children:b.message}),c.jsx("div",{style:{...Av,marginTop:10},children:["final","source"].map(I=>{const _=I==="source"&&!E.enabled;return c.jsx("button",{"data-testid":`cover-from-${I}`,style:{...Kc,...f===I?x5:{},..._?{opacity:.5,cursor:"default"}:{}},onClick:()=>p(I),disabled:w||_,"aria-pressed":f===I,children:I==="final"?"Finished video":"Original take"},I)})}),c.jsx("div",{"data-testid":"cover-from-note",style:{...Bo,marginTop:6},children:u5(f)}),E.note?c.jsx("div",{"data-testid":"cover-from-disabled-note",style:{...Bo,marginTop:4},children:E.note}):null,c.jsx("div",{style:{...Bo,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?c.jsx("div",{"data-testid":"cover-notes",style:{...Bo,marginTop:12},children:y.map(I=>c.jsx("div",{children:I},I))}):null,k?c.jsx("div",{"data-testid":"cover-error",style:Yc,children:k}):null,c.jsxs("div",{style:b5,children:[c.jsx("div",{style:Bo,children:n.outPath?`Writes ${n.outPath} — the video itself is untouched.`:"The video itself is untouched."}),c.jsxs("div",{style:{display:"flex",gap:8},children:[c.jsx("button",{"data-testid":"cover-cancel-btn",style:Kc,onClick:e,children:"Cancel"}),c.jsx("button",{"data-testid":"cover-apply-btn",style:{...S5,...w||!b.ok?{opacity:.6,cursor:"default"}:{}},onClick:()=>void R(),disabled:w||!b.ok,children:w?"Rebuilding…":"Apply"})]})]})]})]})})},f5={position:"fixed",inset:0,zIndex:40,background:"rgba(5,5,8,0.75)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center"},p5={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"},h5={display:"flex",justifyContent:"space-between",alignItems:"center"},m5={fontSize:18,fontWeight:700,color:"#EDEDF2",letterSpacing:"-0.01em"},g5={background:"transparent",border:"none",color:"#8B8B9E",fontSize:16,cursor:"pointer",padding:"4px 8px",borderRadius:4},_v={fontSize:13,color:"#8B8B9E",marginTop:6,lineHeight:1.4},v5={marginTop:16,border:"1px solid #2C2C38",borderRadius:6,background:"#09090D",maxHeight:320,minHeight:180,display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden"},y5={maxWidth:"100%",maxHeight:320,objectFit:"contain"},w5={color:"#8B8B9E",fontSize:13,padding:16,textAlign:"center"},Mv={display:"block",fontSize:12,fontWeight:600,color:"#C9C9D4",marginBottom:8,textTransform:"uppercase",letterSpacing:"0.04em"},$v={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},Kc={background:"transparent",border:"1px solid #3A3A48",borderRadius:6,color:"#C9C9D4",padding:"9px 12px",fontSize:12,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap"},x5={borderColor:"#5b8cff",color:"#EDEDF2"},Yc={marginTop:12,color:"#FF5C5C",fontSize:13,fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",whiteSpace:"pre-wrap"},b5={display:"flex",justifyContent:"space-between",alignItems:"center",gap:12,marginTop:20},Bo={fontSize:12,color:"#8B8B9E",lineHeight:1.4,wordBreak:"break-all"},S5={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 Ka(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 k5(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 Nv(e,t){const n=Math.max(0,Math.floor((t-e)/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,"0")}`}function E5(e,t){return e?{load:e,notifyDiscard:t}:{load:null,notifyDiscard:!1}}function C5(e,t){return e===null||e===t}function I5(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 T5(e){if(e.dirty){if(e.renderRunning){e.onBlocked();return}e.save().catch(t=>e.onSaveError(t instanceof Error?t.message:String(t)))}}function R5(e,t){const{cues:n}=mf(e,t);return Jp(n,t.splits).filter(o=>{var i;return((i=t.scenes[o.id])==null?void 0:i.hidden)===!0})}const Lv=e=>({...e,...L$(e)}),zv=e=>{const t=tb(e);e.forEach((n,r)=>{console.warn(`ossclip §137: dropped caption edit ${JSON.stringify(n)} — ${t[r]}`)})},j5=()=>{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,u]=d.useState([]),[f,p]=d.useState([]),h=d.useRef(e.doc.captions);h.current=e.doc.captions;const[m,w]=d.useState(null),[g,k]=d.useState(null),[v,y]=d.useState(null),[x,b]=d.useState(null),[S,E]=d.useState(null),[R,j]=d.useState(!1),[I,_]=d.useState(1),[A,W]=d.useState(null),[P,F]=d.useState(!1),[H,O]=d.useState([]),[T,C]=d.useState(null),N=d.useRef(null),[$,D]=d.useState(!1),[B,Z]=d.useState(null),[L,z]=d.useState(!1),[Q,G]=d.useState(),V=d.useRef(null);d.useEffect(()=>()=>{V.current!==null&&window.clearInterval(V.current)},[]);const[K,de]=d.useState(null),ge=d.useRef(null),ce=d.useRef(null),se=d.useRef(null),ee=d.useRef(null),[q,J]=d.useState(null),[ie,Me]=d.useState(null),ke=d.useCallback(X=>{var Ke;if(se.current=X,Me(X),(Ke=ee.current)==null||Ke.disconnect(),ee.current=null,!X)return;const re=()=>J({w:Math.max(0,X.clientWidth-Xc*2),h:Math.max(0,X.clientHeight-Xc*2)});re();const ae=new ResizeObserver(re);ae.observe(X),ee.current=ae},[]),[be,$e]=d.useState(1),xe=d.useRef(be);xe.current=be;const Te=d.useRef(null),Pe=d.useCallback((X,re)=>{const ae=se.current,Ke=Math.min(8,Math.max(.25,X)),Ft=xe.current;if(ae&&Ke!==Ft){const Ot=ae.getBoundingClientRect();Te.current={prev:Ft,ax:((re==null?void 0:re.x)??Ot.left+Ot.width/2)-Ot.left,ay:((re==null?void 0:re.y)??Ot.top+Ot.height/2)-Ot.top,sl:ae.scrollLeft,st:ae.scrollTop}}$e(Ke)},[]);d.useLayoutEffect(()=>{const X=se.current,re=Te.current;if(!X||!re)return;Te.current=null;const ae=be/re.prev;X.scrollLeft=(re.sl+re.ax)*ae-re.ax,X.scrollTop=(re.st+re.ay)*ae-re.ay},[be]),d.useEffect(()=>{const X=ie;if(!X)return;const re=ae=>{(ae.ctrlKey||ae.metaKey)&&(ae.preventDefault(),Pe(xe.current*Math.exp(-ae.deltaY*.01),{x:ae.clientX,y:ae.clientY}))};return X.addEventListener("wheel",re,{passive:!1}),()=>X.removeEventListener("wheel",re)},[ie,Pe]);const Ee=d.useRef(null);d.useEffect(()=>{const X=ae=>{const Ke=Ee.current,Ft=se.current;!Ke||!Ft||(Ft.scrollLeft=Ke.sl-(ae.clientX-Ke.x),Ft.scrollTop=Ke.st-(ae.clientY-Ke.y))},re=()=>{Ee.current=null};return window.addEventListener("mousemove",X),window.addEventListener("mouseup",re),()=>{window.removeEventListener("mousemove",X),window.removeEventListener("mouseup",re)}},[]);const[Le,jt]=d.useState(!1),[zt,pn]=d.useState(()=>{const X=Number(window.localStorage.getItem(Ov));return Number.isFinite(X)&&X>0?Bv(X):300}),Dt=d.useRef(null);d.useEffect(()=>{const X=ae=>{const Ke=Dt.current;Ke&&pn(Bv(Ke.startW+(ae.clientX-Ke.startX)))},re=()=>{Dt.current&&(Dt.current=null,pn(ae=>(window.localStorage.setItem(Ov,String(ae)),ae)))};return window.addEventListener("mousemove",X),window.addEventListener("mouseup",re),()=>{window.removeEventListener("mousemove",X),window.removeEventListener("mouseup",re)}},[]);const[In,Tn]=d.useState(!1),[Ze,hn]=d.useState(!1),[tn,st]=d.useState(!1),[Pt,vt]=d.useState(!1),[wr,Jr]=d.useState(!1);d.useEffect(()=>{if(!Pt)return;const X=re=>{re.key==="Escape"&&(re.stopPropagation(),vt(!1))};return window.addEventListener("keydown",X,!0),()=>window.removeEventListener("keydown",X,!0)},[Pt]);const[Zt,nr]=d.useState(null),[Bn,eo]=d.useState(null),[M,U]=d.useState(!0),ne=d.useCallback(X=>{const re=rj({rate:I,playing:R},X);_(re.rate);const ae=ce.current;ae&&(re.playing&&!R&&ae.play(),!re.playing&&R&&ae.pause())},[I,R]);d.useEffect(()=>{const X=ce.current;if(!X)return;const re=()=>j(!0),ae=()=>j(!1);return X.addEventListener("play",re),X.addEventListener("pause",ae),()=>{X.removeEventListener("play",re),X.removeEventListener("pause",ae)}});const le=d.useCallback(()=>{if(V.current!==null)return;const X=window.setInterval(()=>{(async()=>{try{const ae=await(await fetch("/api/render/status")).json();if(ae.running||ae.exitCode===null){Z(Ke=>({running:ae.running,lines:ae.lines??[],startedAt:ae.startedAt??(Ke==null?void 0:Ke.startedAt)}));return}if(V.current!==null&&(window.clearInterval(V.current),V.current=null),ae.exitCode===0){const Ft=await(await fetch("/api/production")).json(),Ot=Lv(Ft.renderProps);k(Ot),D(!!Ft.canRender);const Fo=E5(Ft.overrides,t.current);if(Fo.load){const Wn=h.current,mn=Gg(Fo.load,Ot);e.load(mn.doc),zv(mn.unresolved),u(mn.unresolved);const yt=O$(D$(Wn,mn.doc.captions));for(const hb of yt)console.warn(`ossclip §137: ${hb}`);p(yt)}else u([]),p([]);Fo.notifyDiscard&&r(!0),Z(Wn=>({running:!1,lines:ae.lines??[],succeeded:!0,startedAt:ae.startedAt??(Wn==null?void 0:Wn.startedAt),finishedAt:Date.now()})),fetch("/api/reveal-output",{method:"POST"}).catch(()=>{})}else Z({running:!1,lines:ae.lines??[],failed:ae.exitCode,cancelled:ae.cancelled})}catch{V.current===null&&le()}})()},1e3);V.current=X},[]),he=d.useCallback(async()=>{const X=await fetch("/api/production");if(!X.ok)throw new Error(`GET /api/production failed: ${X.status}`);const re=await X.json();if(re.defaultOutPath&&G(re.defaultOutPath),O(re.recent??[]),re.noWorkdir){u([]),p([]),F(!0);return}const ae=Lv(re.renderProps);k(ae);const Ke=N.current,Ft=re.workdir??null;N.current=Ft,C(Ft),D(!!re.canRender);const Ot=Gg(re.overrides,ae);e.load(Ot.doc),zv(Ot.unresolved),u(Ot.unresolved),p([]),fetch("/api/usage").then(async yt=>y(yt.ok?await yt.json():null)).catch(()=>y(null));const Wn=await(await fetch("/api/render/status")).json(),mn=C5(Ke,Ft)?I5(Wn):null;mn&&(Z(mn),mn.running?le():U(!1))},[le]);d.useEffect(()=>{he().catch(X=>b(X instanceof Error?X.message:String(X)))},[]);const ye=d.useCallback(async X=>{if(e.dirty&&!window.confirm("Unsaved edits will be lost — switch projects anyway?"))return null;try{const re=await fetch("/api/workdir",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({path:X})}),ae=await re.json().catch(()=>({}));return re.ok?(E(null),W(null),de(null),Z(null),$e(1),k(null),F(!1),await he(),null):ae.error??`open failed: ${re.status}`}catch(re){return re instanceof Error?re.message:String(re)}},[e.dirty,he]),Ce=d.useMemo(()=>{if(!g)return{lines:[],dropped:[]};const X=g.baseCaptionLines??g.captionLines??[];return IM(X,z$(e.doc.captions))},[g,e.doc.captions]),Fe=d.useMemo(()=>g?RM(Ce.lines,e.doc.captionRangeEdits):{lines:[],dropped:[]},[g,Ce,e.doc.captionRangeEdits]),Oe=d.useMemo(()=>g?jM(Fe.lines,e.doc.captionWordsHidden):{lines:[],dropped:[]},[g,Fe,e.doc.captionWordsHidden]),ze=d.useMemo(()=>g?j1(Oe.lines,e.doc.captionLineTiming):{lines:[],dropped:[]},[g,Oe,e.doc.captionLineTiming]),Be=d.useMemo(()=>tb(l),[l]),Rn=d.useMemo(()=>[...B$(Ce.dropped),...V$(Fe.dropped),...W$(Oe.dropped),...H$(ze.dropped)],[Ce,Fe,Oe,ze]),Re=Rn.join(`
163
+ `),_e=Rn.length>0&&Re!==m;d.useEffect(()=>{if(Rn.length!==0)for(const X of Rn)console.warn(`ossclip §137: ${X}`)},[Re]);const we=d.useMemo(()=>{if(!g)return null;const X=(g.baseSceneCues??g.sceneCues??[]).filter(yt=>yt.kind!=="plain"),re=g.baseTheme??g.theme??tM,{cues:ae}=mf(X,e.doc),{cues:Ke}=bM(ae,e.doc),Ft=zM(Ke,{outputDurationSec:g.outputDurationSec,clipStarts:(g.spans??[]).map(yt=>yt.outIn)}),Ot=Jp(Ft,e.doc.splits),{cues:Fo}=mf(Ot,e.doc),{cues:Wn}=R1(Fo,e.doc);let mn=A?Wn.map(yt=>yt.id===A.sceneId?{...yt,video:{...yt.video,...A.patch}}:yt):Wn;return K&&(mn=mn.map(yt=>yt.id===K.sceneId?{...yt,graphicRect:K.rect}:yt)),{...g,sceneCues:mn,captionLines:ze.lines,theme:FM(re,e.doc),captionsHidden:g.captionsHiddenByFlag===!0||e.doc.captionsHidden===!0,videoFileName:`/media/${g.videoFileName}`}},[g,e.doc,A,K,ze]),rr=()=>{T5({dirty:e.dirty,renderRunning:(B==null?void 0:B.running)===!0,save:e.save,onBlocked:()=>i(!0),onSaveError:X=>b(X)})},Vu=d.useCallback(async X=>{try{e.dirty&&await e.save();const re=await fetch("/api/render",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(X?{out:X}:{})});if(!re.ok){const ae=await re.json().catch(()=>({}));throw new Error(ae.error??`render failed to start: ${re.status}`)}Z({running:!0,lines:[],startedAt:Date.now()}),a(null),le()}catch(re){a(re instanceof Error?re.message:String(re))}},[e,le]),Hu=d.useMemo(()=>{if(!g)return[];const X=(g.baseSceneCues??g.sceneCues??[]).filter(re=>re.kind!=="plain");return R5(X,e.doc)},[g,e.doc]),xr=d.useMemo(()=>S?(we==null?void 0:we.sceneCues.find(X=>X.id===S.sceneId))??Hu.find(X=>X.id===S.sceneId)??null:null,[we,S,Hu]),cb=d.useMemo(()=>{if(!xr||!we)return;const X=we.captionLines.filter(ae=>ae.start<xr.endSec&&ae.end>xr.startSec).flatMap(ae=>ae.words).filter(ae=>ae.start<xr.endSec&&ae.end>xr.startSec).map(ae=>ae.text);if(X.length===0)return;const re=X.join(" ");return re.length>90?`${re.slice(0,90)}…`:re},[xr,we]);if(x)return c.jsx("div",{style:Gc,children:c.jsxs("div",{style:{padding:24,color:"#FF5C5C",fontFamily:"ui-monospace, monospace"},children:["Couldn't load the production: ",x]})});if(!we)return c.jsx("div",{style:Gc,children:P?c.jsx(gv,{recent:H,required:!0,onOpen:ye,onClose:()=>{}}):c.jsx("div",{style:{padding:24,color:"#9A9AA3"},children:"Loading production…"})});const db=we.settings.width/we.settings.height,fb=q?Math.max(220,Math.min(q.w,q.h*db)):380,pb=Math.round(fb*be),Uu=c.jsx("button",{"data-testid":"render-logs-toggle",style:{...ct,padding:"2px 8px"},onClick:()=>U(X=>!X),title:M?"Collapse the log":"Expand the log",children:M?"▾ logs":"▸ logs"});return c.jsxs("div",{style:Gc,children:[c.jsxs("div",{style:M5,children:[c.jsx("span",{style:$5,children:"ossclip"}),T?c.jsx("span",{"data-testid":"workdir-label",style:A5,title:T,children:T.split("/").filter(Boolean).slice(-2).join("/")}):null,c.jsxs("div",{style:{display:"flex",gap:8},children:[c.jsx("button",{"data-testid":"open-button",style:ct,onClick:()=>F(!0),title:T?`Open another project — currently ${T}`:"Open another project",children:"Open"}),c.jsx("button",{"data-testid":"undo-button",style:ct,onClick:()=>e.undo(),disabled:!e.canUndo,title:"Undo (⌘Z)","aria-label":"Undo",children:c.jsx(F5,{})}),c.jsx("button",{"data-testid":"redo-button",style:ct,onClick:()=>e.redo(),disabled:!e.canRedo,title:"Redo (⌘⇧Z)","aria-label":"Redo",children:c.jsx(_5,{})}),c.jsx("button",{"data-testid":"transcript-toggle",style:{...ct,...Le?{borderColor:"#5b8cff"}:{}},onClick:()=>jt(X=>!X),title:"Find and retype caption words across the whole transcript",children:"Transcript"}),c.jsx("button",{"data-testid":"cover-button",style:{...ct,...wr?{borderColor:"#5b8cff"}:{}},onClick:()=>Jr(!0),title:"Retype the cover headline or re-cut its frame — seconds, no re-render",children:"Cover"}),c.jsxs("div",{style:{position:"relative"},children:[c.jsx("button",{"data-testid":"youtube-menu",style:{...ct,...Pt||Ze||tn?{borderColor:"#5b8cff"}:{}},onClick:()=>vt(X=>!X),title:"AI thumbnail and SEO metadata for the YouTube upload","aria-haspopup":"menu","aria-expanded":Pt,children:"YouTube ▾"}),Pt?c.jsxs(c.Fragment,{children:[c.jsx("div",{style:z5,onMouseDown:()=>vt(!1)}),c.jsxs("div",{style:D5,role:"menu",children:[c.jsx("button",{"data-testid":"youtube-menu-thumbnail",style:Dv,role:"menuitem",onClick:()=>{vt(!1),hn(!0)},children:"Thumbnail"}),c.jsx("button",{"data-testid":"youtube-menu-seo",style:Dv,role:"menuitem",onClick:()=>{vt(!1),st(!0)},children:"SEO metadata"})]})]}):null]}),c.jsx("button",{style:{...ct,...e.dirty?L5:{}},onClick:rr,disabled:!e.dirty||(B==null?void 0:B.running)===!0,title:(B==null?void 0:B.running)===!0?"Can't save while a render is running":void 0,children:"Save"}),c.jsxs("div",{style:{display:"inline-flex",alignItems:"center"},children:[c.jsx("button",{"data-testid":"render-button",style:{...ct,borderTopRightRadius:0,borderBottomRightRadius:0,borderRight:"none"},onClick:()=>void Vu(),disabled:!$||(B==null?void 0:B.running)===!0,title:$?"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:B!=null&&B.running?"Rendering…":"Render"}),c.jsx("button",{"data-testid":"render-destination-button",style:{...ct,borderTopLeftRadius:0,borderBottomLeftRadius:0,padding:"7px 8px"},onClick:()=>z(!0),disabled:!$||(B==null?void 0:B.running)===!0,title:"Choose export file destination (Browse…)",children:"▾"})]})]}),c.jsx("span",{style:{...N5,color:e.dirty?"#FFE14D":"#5FBF77"},...e.dirty?{"data-testid":"dirty"}:{},children:e.dirty?"● Unsaved changes":"✓ Saved"}),c.jsx("button",{"data-testid":"shortcuts-button",style:{...ct,padding:"7px 10px"},onClick:()=>Tn(X=>!X),title:"Keyboard shortcuts (?)",children:"?"})]}),In?c.jsx(u3,{onClose:()=>Tn(!1)}):null,Ze?c.jsx(RN,{onClose:()=>hn(!1)}):null,tn?c.jsx(YN,{onClose:()=>st(!1)}):null,wr?c.jsx(d5,{onClose:()=>Jr(!1),playheadSec:()=>{var X;return(((X=ce.current)==null?void 0:X.getCurrentFrame())??0)/we.settings.fps}}):null,L?c.jsx(dN,{defaultOutPath:Q,onCancel:()=>z(!1),onConfirm:X=>{z(!1),Vu(X)}}):null,Zt?c.jsx(x3,{plan:Zt,onCancel:()=>nr(null),onConfirm:X=>{X==="graphic"?e.hideScene(Zt.sceneId):e.cutChunk(Zt.startSec,Zt.endSec),nr(null)}}):null,Bn?c.jsx($3,{plan:Bn,onCancel:()=>eo(null),onConfirm:X=>{X==="caption"?e.hideCaptionWords(Bn.words):e.cutWords(Bn.words,Bn.startSec,Bn.endSec),eo(null)}}):null,P?c.jsx(gv,{recent:H,required:!1,onOpen:ye,onClose:()=>F(!1)}):null,B?c.jsxs("div",{"data-testid":"render-log",style:{...Y5,borderColor:B.failed!==void 0?"#FF5C5C":"#2A2A33"},children:[B.failed!==void 0?c.jsxs("div",{style:{color:B.cancelled?"#9A9AA3":"#FF5C5C",marginBottom:4},"data-testid":B.cancelled?"render-cancelled":"render-failed",children:[B.cancelled?"render cancelled":`render failed (exit ${B.failed})`,c.jsx("button",{style:{...ct,marginLeft:10,padding:"2px 8px"},onClick:()=>Z(null),children:"Dismiss"}),c.jsx("span",{style:{marginLeft:6},children:Uu})]}):null,B.succeeded?c.jsxs("div",{"data-testid":"render-succeeded",style:Wv,children:[c.jsxs("span",{style:{color:"#5FBF77"},children:["✓ done",B.startedAt!=null&&B.finishedAt!==void 0?` · ${Nv(B.startedAt,B.finishedAt)}`:""]}),c.jsx("button",{"data-testid":"render-open-folder",style:{...ct,padding:"2px 8px"},onClick:()=>void fetch("/api/reveal-output",{method:"POST"}).catch(()=>{}),title:"Reveal the rendered file in your file manager",children:"Open folder"}),c.jsx("button",{style:{...ct,padding:"2px 8px"},onClick:()=>Z(null),children:"Dismiss"}),Uu]}):null,B.running?c.jsxs("div",{"data-testid":"render-status",style:Wv,children:[c.jsx("style",{children:"@keyframes ossclip-spin { to { transform: rotate(360deg) } }"}),c.jsx("span",{style:G5,"aria-hidden":!0}),c.jsxs("span",{style:{color:"#EDEDF2"},children:["rendering",B.startedAt!=null?` · ${Nv(B.startedAt,Date.now())}`:"",Ka(B.lines)!==null?` · ${Ka(B.lines)}%`:""]}),Ka(B.lines)!==null?c.jsx("div",{style:X5,children:c.jsx("div",{"data-testid":"render-progress-bar",style:{...q5,width:`${Ka(B.lines)}%`}})}):null,c.jsx("button",{"data-testid":"render-cancel",style:{...ct,padding:"2px 8px"},onClick:()=>void fetch("/api/render/cancel",{method:"POST"}),children:"Cancel"}),Uu]}):null,M?c.jsxs(c.Fragment,{children:[k5(B.lines).map(X=>c.jsx("div",{"data-testid":"render-pinned",style:{color:"#C9C9D4"},children:X},X)),c.jsx(P5,{lines:B.lines})]}):null]}):null,n?c.jsxs("div",{"data-testid":"reanchor-notice",style:Ji,children:["Render re-anchored your saved cuts and splits — edits made while it ran were dropped, not merged, to avoid overwriting that anchor.",c.jsx("button",{style:{...ct,marginLeft:10,padding:"2px 8px"},onClick:()=>r(!1),children:"Dismiss"})]}):null,Be.length>0||f.length>0?c.jsxs("div",{"data-testid":"caption-migration-notice",style:Ji,children:[[...Be,...f].map((X,re)=>c.jsx("div",{children:X},re)),c.jsx("button",{style:{...ct,marginLeft:10,padding:"2px 8px"},onClick:()=>{u([]),p([])},children:"Dismiss"})]}):null,_e?c.jsxs("div",{"data-testid":"caption-dropped-notice",style:Ji,children:[Rn.map((X,re)=>c.jsx("div",{children:X},re)),c.jsx("button",{style:{...ct,marginLeft:10,padding:"2px 8px"},onClick:()=>w(Re),children:"Dismiss"})]}):null,o?c.jsxs("div",{"data-testid":"save-blocked-notice",style:Ji,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.",c.jsx("button",{style:{...ct,marginLeft:10,padding:"2px 8px"},onClick:()=>i(!1),children:"Dismiss"})]}):null,s!==null?c.jsxs("div",{"data-testid":"render-refused-notice",style:Ji,children:["Render didn't start: ",s,c.jsx("button",{style:{...ct,marginLeft:10,padding:"2px 8px"},onClick:()=>a(null),children:"Dismiss"})]}):null,c.jsxs("div",{style:O5,children:[Le?c.jsxs(c.Fragment,{children:[c.jsx(DA,{baseLines:(g==null?void 0:g.baseCaptionLines)??(g==null?void 0:g.captionLines)??[],liveLines:Fe.lines,timingLines:Oe.lines,fps:we.settings.fps,playerRef:ce,edits:e,onDeleteWords:eo,width:zt,workdir:T}),c.jsx("div",{"data-testid":"transcript-divider",style:B5,title:"Drag to resize the transcript pane",onMouseDown:X=>{X.preventDefault(),Dt.current={startX:X.clientX,startW:zt}}})]}):null,c.jsxs("div",{style:W5,children:[c.jsx("div",{ref:ke,style:V5,onMouseDown:X=>{if(X.altKey||X.button===1){X.preventDefault();const re=se.current;re&&(Ee.current={x:X.clientX,y:X.clientY,sl:re.scrollLeft,st:re.scrollTop})}},children:c.jsx("div",{style:{margin:"auto",padding:Xc},children:c.jsxs("div",{ref:ge,"data-testid":"stage","data-playing":R?"true":"false","data-rate":I,style:{position:"relative",display:"inline-block"},children:[c.jsx(XR,{ref:ce,component:F$,inputProps:we,durationInFrames:Math.max(1,Math.round(we.outputDurationSec*we.settings.fps)),fps:we.settings.fps,compositionWidth:we.settings.width,compositionHeight:we.settings.height,style:{width:pb},controls:!0,clickToPlay:!1,playbackRate:I}),c.jsx(Q$,{stageRef:ge,selection:S,onSelect:E,edits:e,onSave:rr,settings:we.settings,cues:we.sceneCues,playerRef:ce,cue:xr,onTransport:ne,onVideoPreview:W,onGraphicPreview:de,onToggleHelp:()=>Tn(X=>!X),onRequestDelete:nr}),c.jsx("button",{"data-testid":"rate-chip",onClick:()=>ne("L"),title:"Playback rate — click to speed up (J/K/L on the keyboard)",style:Q5,children:I<0?`◂◂ ${Math.abs(I)}×`:`${I}×`})]})})}),c.jsxs("div",{style:H5,children:[c.jsx("button",{"data-testid":"view-zoom-out",style:qc,onClick:()=>Pe(be/2),disabled:be<=.25,title:"Zoom the preview out — below 100% shrinks under the fitted size",children:"−"}),c.jsxs("span",{"data-testid":"view-zoom-level",style:U5,children:[Math.round(be*100),"%"]}),c.jsx("button",{"data-testid":"view-zoom-in",style:qc,onClick:()=>Pe(be*2),disabled:be>=8,title:"Zoom the preview in — a viewing magnifier, it never edits the video",children:"+"}),c.jsx("button",{"data-testid":"view-zoom-fit",style:{...qc,width:"auto",padding:"0 8px"},onClick:()=>Pe(1),disabled:Math.abs(be-1)<.001,title:"Fit the preview to the window",children:"fit"}),c.jsx("span",{style:Z5,children:"⌥-drag pans"})]})]}),c.jsx("div",{style:K5,children:c.jsx(eA,{selection:S,cue:xr,frame:{width:we.settings.width,height:we.settings.height},allSceneIds:we.sceneCues.map(X=>X.id),edits:e,onSelect:E,resolvedTheme:we.theme,anchorText:cb,onVideoPreview:W,runInfo:v,captionsHiddenByFlag:(g==null?void 0:g.captionsHiddenByFlag)===!0})})]}),c.jsx(pA,{cues:we.sceneCues,ghosts:Hu,cuts:e.doc.cuts,spans:we.spans??[],durationSec:we.outputDurationSec,fps:we.settings.fps,playerRef:ce,selection:S,onSelect:E,edits:e,videoSrc:we.videoFileName,toSourceSec:X=>{var re;for(const ae of we.spans??[])if(X>=ae.outIn&&X<ae.outOut)return ae.srcIn+(X-ae.outIn);return((re=(we.spans??[])[0])==null?void 0:re.srcIn)??X}})]})},P5=({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]),c.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)=>c.jsx("div",{children:r},o))})},F5=()=>c.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:[c.jsx("path",{d:"M9 14 4 9l5-5"}),c.jsx("path",{d:"M4 9h10.5a5.5 5.5 0 0 1 0 11H11"})]}),_5=()=>c.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:[c.jsx("path",{d:"m15 14 5-5-5-5"}),c.jsx("path",{d:"M20 9H9.5a5.5 5.5 0 0 0 0 11H13"})]}),Gc={fontFamily:"'Inter', system-ui, sans-serif",background:"#0B0B0E",color:"#EDEDF2",height:"100vh",overflow:"hidden",display:"flex",flexDirection:"column"},M5={display:"flex",alignItems:"center",gap:14,padding:"10px 20px",borderBottom:"1px solid #1E1E24",background:"#111116"},$5={fontWeight:800,fontSize:14,letterSpacing:"0.02em",color:"#FFE14D",marginRight:8},A5={fontSize:12,fontFamily:"ui-monospace, 'SF Mono', monospace",color:"#6a6a75",maxWidth:260,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},N5={fontSize:12,fontFamily:"ui-monospace, 'SF Mono', monospace",marginLeft:"auto"},ct={fontSize:12,fontWeight:600,color:"#EDEDF2",background:"#1A1A21",border:"1px solid #2A2A33",borderRadius:6,padding:"7px 12px",cursor:"pointer"},L5={background:"#FFE14D",color:"#0B0B0E",border:"1px solid #FFE14D"},z5={position:"fixed",inset:0,zIndex:30},D5={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"},O5={display:"flex",flex:1,minHeight:0},Xc=32,Ov="ossclip.transcriptWidth",Bv=e=>Math.min(640,Math.max(220,e)),B5={width:5,flexShrink:0,cursor:"col-resize",background:"#1E1E24",borderLeft:"1px solid #2A2A33"},W5={position:"relative",flex:1,minWidth:0},V5={position:"absolute",inset:0,display:"flex",overflow:"auto"},H5={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},qc={width:22,height:18,fontSize:12,lineHeight:1,color:"#EDEDF2",background:"#1A1A21",border:"1px solid #2A2A33",borderRadius:4,cursor:"pointer",padding:0},U5={fontSize:10,fontFamily:"ui-monospace, 'SF Mono', monospace",color:"#9A9AA3",minWidth:34,textAlign:"center"},Z5={fontSize:10,color:"#55555f",userSelect:"none"},K5={width:260,flexShrink:0,borderLeft:"1px solid #1E1E24",background:"#111116",overflowY:"auto"},Y5={fontSize:11,fontFamily:"ui-monospace, 'SF Mono', monospace",color:"#9A9AA3",background:"#0F0F14",borderBottom:"1px solid #2A2A33",padding:"6px 20px",whiteSpace:"pre-wrap",flexShrink:0},Ji={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},Wv={display:"flex",alignItems:"center",gap:10,marginBottom:4},G5={width:12,height:12,flexShrink:0,border:"2px solid #2A2A33",borderTopColor:"#FFE14D",borderRadius:"50%",animation:"ossclip-spin 0.8s linear infinite"},X5={flex:1,maxWidth:260,height:4,background:"#1E1E24",borderRadius:2,overflow:"hidden"},q5={height:"100%",background:"#FFE14D",borderRadius:2,transition:"width 0.6s ease"},Q5={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"};Qc.createRoot(document.getElementById("root")).render(c.jsx(oe.StrictMode,{children:c.jsx(j5,{})}));