ossclip 0.1.31 → 0.1.34

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,166 @@
1
+ var rk=Object.defineProperty;var ok=(e,t,n)=>t in e?rk(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Oe=(e,t,n)=>ok(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 ik(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var d0={exports:{}},Eu={},f0={exports:{}},Fe={};/**
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 pa=Symbol.for("react.element"),sk=Symbol.for("react.portal"),ak=Symbol.for("react.fragment"),lk=Symbol.for("react.strict_mode"),uk=Symbol.for("react.profiler"),ck=Symbol.for("react.provider"),dk=Symbol.for("react.context"),fk=Symbol.for("react.forward_ref"),pk=Symbol.for("react.suspense"),hk=Symbol.for("react.memo"),mk=Symbol.for("react.lazy"),lm=Symbol.iterator;function gk(e){return e===null||typeof e!="object"?null:(e=lm&&e[lm]||e["@@iterator"],typeof e=="function"?e:null)}var p0={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},h0=Object.assign,m0={};function Hi(e,t,n){this.props=e,this.context=t,this.refs=m0,this.updater=n||p0}Hi.prototype.isReactComponent={};Hi.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")};Hi.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function g0(){}g0.prototype=Hi.prototype;function sp(e,t,n){this.props=e,this.context=t,this.refs=m0,this.updater=n||p0}var ap=sp.prototype=new g0;ap.constructor=sp;h0(ap,Hi.prototype);ap.isPureReactComponent=!0;var um=Array.isArray,y0=Object.prototype.hasOwnProperty,lp={current:null},v0={key:!0,ref:!0,__self:!0,__source:!0};function w0(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)y0.call(t,r)&&!v0.hasOwnProperty(r)&&(o[r]=t[r]);var a=arguments.length-2;if(a===1)o.children=n;else if(1<a){for(var l=Array(a),c=0;c<a;c++)l[c]=arguments[c+2];o.children=l}if(e&&e.defaultProps)for(r in a=e.defaultProps,a)o[r]===void 0&&(o[r]=a[r]);return{$$typeof:pa,type:e,key:i,ref:s,props:o,_owner:lp.current}}function yk(e,t){return{$$typeof:pa,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function up(e){return typeof e=="object"&&e!==null&&e.$$typeof===pa}function vk(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var cm=/\/+/g;function $c(e,t){return typeof e=="object"&&e!==null&&e.key!=null?vk(""+e.key):t.toString(36)}function Sl(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 pa:case sk:s=!0}}if(s)return s=e,o=o(s),e=r===""?"."+$c(s,0):r,um(o)?(n="",e!=null&&(n=e.replace(cm,"$&/")+"/"),Sl(o,t,n,"",function(c){return c})):o!=null&&(up(o)&&(o=yk(o,n+(!o.key||s&&s.key===o.key?"":(""+o.key).replace(cm,"$&/")+"/")+e)),t.push(o)),1;if(s=0,r=r===""?".":r+":",um(e))for(var a=0;a<e.length;a++){i=e[a];var l=r+$c(i,a);s+=Sl(i,t,n,l,o)}else if(l=gk(e),typeof l=="function")for(e=l.call(e),a=0;!(i=e.next()).done;)i=i.value,l=r+$c(i,a++),s+=Sl(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 _a(e,t,n){if(e==null)return e;var r=[],o=0;return Sl(e,r,"","",function(i){return t.call(n,i,o++)}),r}function wk(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 Jt={current:null},kl={transition:null},xk={ReactCurrentDispatcher:Jt,ReactCurrentBatchConfig:kl,ReactCurrentOwner:lp};function x0(){throw Error("act(...) is not supported in production builds of React.")}Fe.Children={map:_a,forEach:function(e,t,n){_a(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return _a(e,function(){t++}),t},toArray:function(e){return _a(e,function(t){return t})||[]},only:function(e){if(!up(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Fe.Component=Hi;Fe.Fragment=ak;Fe.Profiler=uk;Fe.PureComponent=sp;Fe.StrictMode=lk;Fe.Suspense=pk;Fe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=xk;Fe.act=x0;Fe.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=h0({},e.props),o=e.key,i=e.ref,s=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,s=lp.current),t.key!==void 0&&(o=""+t.key),e.type&&e.type.defaultProps)var a=e.type.defaultProps;for(l in t)y0.call(t,l)&&!v0.hasOwnProperty(l)&&(r[l]=t[l]===void 0&&a!==void 0?a[l]:t[l])}var l=arguments.length-2;if(l===1)r.children=n;else if(1<l){a=Array(l);for(var c=0;c<l;c++)a[c]=arguments[c+2];r.children=a}return{$$typeof:pa,type:e.type,key:o,ref:i,props:r,_owner:s}};Fe.createContext=function(e){return e={$$typeof:dk,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:ck,_context:e},e.Consumer=e};Fe.createElement=w0;Fe.createFactory=function(e){var t=w0.bind(null,e);return t.type=e,t};Fe.createRef=function(){return{current:null}};Fe.forwardRef=function(e){return{$$typeof:fk,render:e}};Fe.isValidElement=up;Fe.lazy=function(e){return{$$typeof:mk,_payload:{_status:-1,_result:e},_init:wk}};Fe.memo=function(e,t){return{$$typeof:hk,type:e,compare:t===void 0?null:t}};Fe.startTransition=function(e){var t=kl.transition;kl.transition={};try{e()}finally{kl.transition=t}};Fe.unstable_act=x0;Fe.useCallback=function(e,t){return Jt.current.useCallback(e,t)};Fe.useContext=function(e){return Jt.current.useContext(e)};Fe.useDebugValue=function(){};Fe.useDeferredValue=function(e){return Jt.current.useDeferredValue(e)};Fe.useEffect=function(e,t){return Jt.current.useEffect(e,t)};Fe.useId=function(){return Jt.current.useId()};Fe.useImperativeHandle=function(e,t,n){return Jt.current.useImperativeHandle(e,t,n)};Fe.useInsertionEffect=function(e,t){return Jt.current.useInsertionEffect(e,t)};Fe.useLayoutEffect=function(e,t){return Jt.current.useLayoutEffect(e,t)};Fe.useMemo=function(e,t){return Jt.current.useMemo(e,t)};Fe.useReducer=function(e,t,n){return Jt.current.useReducer(e,t,n)};Fe.useRef=function(e){return Jt.current.useRef(e)};Fe.useState=function(e){return Jt.current.useState(e)};Fe.useSyncExternalStore=function(e,t,n){return Jt.current.useSyncExternalStore(e,t,n)};Fe.useTransition=function(){return Jt.current.useTransition()};Fe.version="18.3.1";f0.exports=Fe;var d=f0.exports;const he=ik(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 bk=d,Sk=Symbol.for("react.element"),kk=Symbol.for("react.fragment"),Ek=Object.prototype.hasOwnProperty,Ck=bk.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Ik={key:!0,ref:!0,__self:!0,__source:!0};function b0(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)Ek.call(t,r)&&!Ik.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:Sk,type:e,key:i,ref:s,props:o,_owner:Ck.current}}Eu.Fragment=kk;Eu.jsx=b0;Eu.jsxs=b0;d0.exports=Eu;var u=d0.exports,Bd={},S0={exports:{}},En={},k0={exports:{}},E0={};/**
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(T,W){var R=T.length;T.push(W);e:for(;0<R;){var Z=R-1>>>1,Q=T[Z];if(0<o(Q,W))T[Z]=W,T[R]=Q,R=Z;else break e}}function n(T){return T.length===0?null:T[0]}function r(T){if(T.length===0)return null;var W=T[0],R=T.pop();if(R!==W){T[0]=R;e:for(var Z=0,Q=T.length,_=Q>>>1;Z<_;){var N=2*(Z+1)-1,z=T[N],ne=N+1,J=T[ne];if(0>o(z,R))ne<Q&&0>o(J,z)?(T[Z]=J,T[ne]=R,Z=ne):(T[Z]=z,T[N]=R,Z=N);else if(ne<Q&&0>o(J,R))T[Z]=J,T[ne]=R,Z=ne;else break e}}return W}function o(T,W){var R=T.sortIndex-W.sortIndex;return R!==0?R:T.id-W.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var s=Date,a=s.now();e.unstable_now=function(){return s.now()-a}}var l=[],c=[],f=1,p=null,m=3,y=!1,w=!1,x=!1,S=typeof setTimeout=="function"?setTimeout:null,h=typeof clearTimeout=="function"?clearTimeout:null,g=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function v(T){for(var W=n(c);W!==null;){if(W.callback===null)r(c);else if(W.startTime<=T)r(c),W.sortIndex=W.expirationTime,t(l,W);else break;W=n(c)}}function b(T){if(x=!1,v(T),!w)if(n(l)!==null)w=!0,H(k);else{var W=n(c);W!==null&&P(b,W.startTime-T)}}function k(T,W){w=!1,x&&(x=!1,h(I),I=-1),y=!0;var R=m;try{for(v(W),p=n(l);p!==null&&(!(p.expirationTime>W)||T&&!L());){var Z=p.callback;if(typeof Z=="function"){p.callback=null,m=p.priorityLevel;var Q=Z(p.expirationTime<=W);W=e.unstable_now(),typeof Q=="function"?p.callback=Q:p===n(l)&&r(l),v(W)}else r(l);p=n(l)}if(p!==null)var _=!0;else{var N=n(c);N!==null&&P(b,N.startTime-W),_=!1}return _}finally{p=null,m=R,y=!1}}var E=!1,C=null,I=-1,j=5,F=-1;function L(){return!(e.unstable_now()-F<j)}function V(){if(C!==null){var T=e.unstable_now();F=T;var W=!0;try{W=C(!0,T)}finally{W?M():(E=!1,C=null)}}else E=!1}var M;if(typeof g=="function")M=function(){g(V)};else if(typeof MessageChannel<"u"){var $=new MessageChannel,D=$.port2;$.port1.onmessage=V,M=function(){D.postMessage(null)}}else M=function(){S(V,0)};function H(T){C=T,E||(E=!0,M())}function P(T,W){I=S(function(){T(e.unstable_now())},W)}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(T){T.callback=null},e.unstable_continueExecution=function(){w||y||(w=!0,H(k))},e.unstable_forceFrameRate=function(T){0>T||125<T?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):j=0<T?Math.floor(1e3/T):5},e.unstable_getCurrentPriorityLevel=function(){return m},e.unstable_getFirstCallbackNode=function(){return n(l)},e.unstable_next=function(T){switch(m){case 1:case 2:case 3:var W=3;break;default:W=m}var R=m;m=W;try{return T()}finally{m=R}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(T,W){switch(T){case 1:case 2:case 3:case 4:case 5:break;default:T=3}var R=m;m=T;try{return W()}finally{m=R}},e.unstable_scheduleCallback=function(T,W,R){var Z=e.unstable_now();switch(typeof R=="object"&&R!==null?(R=R.delay,R=typeof R=="number"&&0<R?Z+R:Z):R=Z,T){case 1:var Q=-1;break;case 2:Q=250;break;case 5:Q=1073741823;break;case 4:Q=1e4;break;default:Q=5e3}return Q=R+Q,T={id:f++,callback:W,priorityLevel:T,startTime:R,expirationTime:Q,sortIndex:-1},R>Z?(T.sortIndex=R,t(c,T),n(l)===null&&T===n(c)&&(x?(h(I),I=-1):x=!0,P(b,R-Z))):(T.sortIndex=Q,t(l,T),w||y||(w=!0,H(k))),T},e.unstable_shouldYield=L,e.unstable_wrapCallback=function(T){var W=m;return function(){var R=m;m=W;try{return T.apply(this,arguments)}finally{m=R}}}})(E0);k0.exports=E0;var Tk=k0.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 jk=d,Sn=Tk;function ue(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 C0=new Set,Vs={};function zo(e,t){Mi(e,t),Mi(e+"Capture",t)}function Mi(e,t){for(Vs[e]=t,e=0;e<t.length;e++)C0.add(t[e])}var Er=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Wd=Object.prototype.hasOwnProperty,Rk=/^[: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]*$/,dm={},fm={};function Pk(e){return Wd.call(fm,e)?!0:Wd.call(dm,e)?!1:Rk.test(e)?fm[e]=!0:(dm[e]=!0,!1)}function Fk(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 $k(e,t,n,r){if(t===null||typeof t>"u"||Fk(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 Qt(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 At={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){At[e]=new Qt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];At[t]=new Qt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){At[e]=new Qt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){At[e]=new Qt(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){At[e]=new Qt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){At[e]=new Qt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){At[e]=new Qt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){At[e]=new Qt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){At[e]=new Qt(e,5,!1,e.toLowerCase(),null,!1,!1)});var cp=/[\-:]([a-z])/g;function dp(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(cp,dp);At[t]=new Qt(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(cp,dp);At[t]=new Qt(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(cp,dp);At[t]=new Qt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){At[e]=new Qt(e,1,!1,e.toLowerCase(),null,!1,!1)});At.xlinkHref=new Qt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){At[e]=new Qt(e,1,!1,e.toLowerCase(),null,!0,!0)});function fp(e,t,n,r){var o=At.hasOwnProperty(t)?At[t]:null;(o!==null?o.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&($k(t,n,o,r)&&(n=null),r||o===null?Pk(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 jr=jk.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Ma=Symbol.for("react.element"),ui=Symbol.for("react.portal"),ci=Symbol.for("react.fragment"),pp=Symbol.for("react.strict_mode"),Vd=Symbol.for("react.profiler"),I0=Symbol.for("react.provider"),T0=Symbol.for("react.context"),hp=Symbol.for("react.forward_ref"),Hd=Symbol.for("react.suspense"),Ud=Symbol.for("react.suspense_list"),mp=Symbol.for("react.memo"),Br=Symbol.for("react.lazy"),j0=Symbol.for("react.offscreen"),pm=Symbol.iterator;function ls(e){return e===null||typeof e!="object"?null:(e=pm&&e[pm]||e["@@iterator"],typeof e=="function"?e:null)}var it=Object.assign,_c;function Cs(e){if(_c===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);_c=t&&t[1]||""}return`
34
+ `+_c+e}var Mc=!1;function Ac(e,t){if(!e||Mc)return"";Mc=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(c){var r=c}Reflect.construct(e,[],t)}else{try{t.call()}catch(c){r=c}e.call(t.prototype)}else{try{throw Error()}catch(c){r=c}e()}}catch(c){if(c&&r&&typeof c.stack=="string"){for(var o=c.stack.split(`
35
+ `),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{Mc=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Cs(e):""}function _k(e){switch(e.tag){case 5:return Cs(e.type);case 16:return Cs("Lazy");case 13:return Cs("Suspense");case 19:return Cs("SuspenseList");case 0:case 2:case 15:return e=Ac(e.type,!1),e;case 11:return e=Ac(e.type.render,!1),e;case 1:return e=Ac(e.type,!0),e;default:return""}}function Zd(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 ci:return"Fragment";case ui:return"Portal";case Vd:return"Profiler";case pp:return"StrictMode";case Hd:return"Suspense";case Ud:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case T0:return(e.displayName||"Context")+".Consumer";case I0:return(e._context.displayName||"Context")+".Provider";case hp:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case mp:return t=e.displayName||null,t!==null?t:Zd(e.type)||"Memo";case Br:t=e._payload,e=e._init;try{return Zd(e(t))}catch{}}return null}function Mk(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 Zd(t);case 8:return t===pp?"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 ro(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function R0(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Ak(e){var t=R0(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 Aa(e){e._valueTracker||(e._valueTracker=Ak(e))}function P0(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=R0(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function zl(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 Kd(e,t){var n=t.checked;return it({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function hm(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=ro(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 F0(e,t){t=t.checked,t!=null&&fp(e,"checked",t,!1)}function Yd(e,t){F0(e,t);var n=ro(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")?Gd(e,t.type,n):t.hasOwnProperty("defaultValue")&&Gd(e,t.type,ro(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function mm(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 Gd(e,t,n){(t!=="number"||zl(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Is=Array.isArray;function Ci(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=""+ro(n),t=null,o=0;o<e.length;o++){if(e[o].value===n){e[o].selected=!0,r&&(e[o].defaultSelected=!0);return}t!==null||e[o].disabled||(t=e[o])}t!==null&&(t.selected=!0)}}function Xd(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(ue(91));return it({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function gm(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(ue(92));if(Is(n)){if(1<n.length)throw Error(ue(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:ro(n)}}function $0(e,t){var n=ro(t.value),r=ro(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 ym(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function _0(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 qd(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?_0(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Na,M0=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(Na=Na||document.createElement("div"),Na.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Na.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Hs(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var $s={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},Nk=["Webkit","ms","Moz","O"];Object.keys($s).forEach(function(e){Nk.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),$s[t]=$s[e]})});function A0(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||$s.hasOwnProperty(e)&&$s[e]?(""+t).trim():t+"px"}function N0(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=A0(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}var Lk=it({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 Jd(e,t){if(t){if(Lk[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(ue(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(ue(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(ue(61))}if(t.style!=null&&typeof t.style!="object")throw Error(ue(62))}}function Qd(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 ef=null;function gp(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var tf=null,Ii=null,Ti=null;function vm(e){if(e=ga(e)){if(typeof tf!="function")throw Error(ue(280));var t=e.stateNode;t&&(t=Ru(t),tf(e.stateNode,e.type,t))}}function L0(e){Ii?Ti?Ti.push(e):Ti=[e]:Ii=e}function O0(){if(Ii){var e=Ii,t=Ti;if(Ti=Ii=null,vm(e),t)for(e=0;e<t.length;e++)vm(t[e])}}function D0(e,t){return e(t)}function z0(){}var Nc=!1;function B0(e,t,n){if(Nc)return e(t,n);Nc=!0;try{return D0(e,t,n)}finally{Nc=!1,(Ii!==null||Ti!==null)&&(z0(),O0())}}function Us(e,t){var n=e.stateNode;if(n===null)return null;var r=Ru(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(ue(231,t,typeof n));return n}var nf=!1;if(Er)try{var us={};Object.defineProperty(us,"passive",{get:function(){nf=!0}}),window.addEventListener("test",us,us),window.removeEventListener("test",us,us)}catch{nf=!1}function Ok(e,t,n,r,o,i,s,a,l){var c=Array.prototype.slice.call(arguments,3);try{t.apply(n,c)}catch(f){this.onError(f)}}var _s=!1,Bl=null,Wl=!1,rf=null,Dk={onError:function(e){_s=!0,Bl=e}};function zk(e,t,n,r,o,i,s,a,l){_s=!1,Bl=null,Ok.apply(Dk,arguments)}function Bk(e,t,n,r,o,i,s,a,l){if(zk.apply(this,arguments),_s){if(_s){var c=Bl;_s=!1,Bl=null}else throw Error(ue(198));Wl||(Wl=!0,rf=c)}}function Bo(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 W0(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 wm(e){if(Bo(e)!==e)throw Error(ue(188))}function Wk(e){var t=e.alternate;if(!t){if(t=Bo(e),t===null)throw Error(ue(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 wm(o),e;if(i===r)return wm(o),t;i=i.sibling}throw Error(ue(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(ue(189))}}if(n.alternate!==r)throw Error(ue(190))}if(n.tag!==3)throw Error(ue(188));return n.stateNode.current===n?e:t}function V0(e){return e=Wk(e),e!==null?H0(e):null}function H0(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=H0(e);if(t!==null)return t;e=e.sibling}return null}var U0=Sn.unstable_scheduleCallback,xm=Sn.unstable_cancelCallback,Vk=Sn.unstable_shouldYield,Hk=Sn.unstable_requestPaint,ft=Sn.unstable_now,Uk=Sn.unstable_getCurrentPriorityLevel,yp=Sn.unstable_ImmediatePriority,Z0=Sn.unstable_UserBlockingPriority,Vl=Sn.unstable_NormalPriority,Zk=Sn.unstable_LowPriority,K0=Sn.unstable_IdlePriority,Cu=null,ar=null;function Kk(e){if(ar&&typeof ar.onCommitFiberRoot=="function")try{ar.onCommitFiberRoot(Cu,e,void 0,(e.current.flags&128)===128)}catch{}}var Kn=Math.clz32?Math.clz32:Xk,Yk=Math.log,Gk=Math.LN2;function Xk(e){return e>>>=0,e===0?32:31-(Yk(e)/Gk|0)|0}var La=64,Oa=4194304;function Ts(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 Hl(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=Ts(a):(i&=s,i!==0&&(r=Ts(i)))}else s=n&~o,s!==0?r=Ts(s):i!==0&&(r=Ts(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-Kn(t),o=1<<n,r|=e[n],t&=~o;return r}function qk(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 Jk(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,o=e.expirationTimes,i=e.pendingLanes;0<i;){var s=31-Kn(i),a=1<<s,l=o[s];l===-1?(!(a&n)||a&r)&&(o[s]=qk(a,t)):l<=t&&(e.expiredLanes|=a),i&=~a}}function of(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Y0(){var e=La;return La<<=1,!(La&4194240)&&(La=64),e}function Lc(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function ha(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Kn(t),e[t]=n}function Qk(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-Kn(n),i=1<<o;t[o]=0,r[o]=-1,e[o]=-1,n&=~i}}function vp(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Kn(n),o=1<<r;o&t|e[r]&t&&(e[r]|=t),n&=~o}}var De=0;function G0(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var X0,wp,q0,J0,Q0,sf=!1,Da=[],Yr=null,Gr=null,Xr=null,Zs=new Map,Ks=new Map,Vr=[],eE="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 bm(e,t){switch(e){case"focusin":case"focusout":Yr=null;break;case"dragenter":case"dragleave":Gr=null;break;case"mouseover":case"mouseout":Xr=null;break;case"pointerover":case"pointerout":Zs.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ks.delete(t.pointerId)}}function cs(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=ga(t),t!==null&&wp(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function tE(e,t,n,r,o){switch(t){case"focusin":return Yr=cs(Yr,e,t,n,r,o),!0;case"dragenter":return Gr=cs(Gr,e,t,n,r,o),!0;case"mouseover":return Xr=cs(Xr,e,t,n,r,o),!0;case"pointerover":var i=o.pointerId;return Zs.set(i,cs(Zs.get(i)||null,e,t,n,r,o)),!0;case"gotpointercapture":return i=o.pointerId,Ks.set(i,cs(Ks.get(i)||null,e,t,n,r,o)),!0}return!1}function ew(e){var t=Eo(e.target);if(t!==null){var n=Bo(t);if(n!==null){if(t=n.tag,t===13){if(t=W0(n),t!==null){e.blockedOn=t,Q0(e.priority,function(){q0(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 El(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=af(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);ef=r,n.target.dispatchEvent(r),ef=null}else return t=ga(n),t!==null&&wp(t),e.blockedOn=n,!1;t.shift()}return!0}function Sm(e,t,n){El(e)&&n.delete(t)}function nE(){sf=!1,Yr!==null&&El(Yr)&&(Yr=null),Gr!==null&&El(Gr)&&(Gr=null),Xr!==null&&El(Xr)&&(Xr=null),Zs.forEach(Sm),Ks.forEach(Sm)}function ds(e,t){e.blockedOn===t&&(e.blockedOn=null,sf||(sf=!0,Sn.unstable_scheduleCallback(Sn.unstable_NormalPriority,nE)))}function Ys(e){function t(o){return ds(o,e)}if(0<Da.length){ds(Da[0],e);for(var n=1;n<Da.length;n++){var r=Da[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Yr!==null&&ds(Yr,e),Gr!==null&&ds(Gr,e),Xr!==null&&ds(Xr,e),Zs.forEach(t),Ks.forEach(t),n=0;n<Vr.length;n++)r=Vr[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Vr.length&&(n=Vr[0],n.blockedOn===null);)ew(n),n.blockedOn===null&&Vr.shift()}var ji=jr.ReactCurrentBatchConfig,Ul=!0;function rE(e,t,n,r){var o=De,i=ji.transition;ji.transition=null;try{De=1,xp(e,t,n,r)}finally{De=o,ji.transition=i}}function oE(e,t,n,r){var o=De,i=ji.transition;ji.transition=null;try{De=4,xp(e,t,n,r)}finally{De=o,ji.transition=i}}function xp(e,t,n,r){if(Ul){var o=af(e,t,n,r);if(o===null)Kc(e,t,r,Zl,n),bm(e,r);else if(tE(o,e,t,n,r))r.stopPropagation();else if(bm(e,r),t&4&&-1<eE.indexOf(e)){for(;o!==null;){var i=ga(o);if(i!==null&&X0(i),i=af(e,t,n,r),i===null&&Kc(e,t,r,Zl,n),i===o)break;o=i}o!==null&&r.stopPropagation()}else Kc(e,t,r,null,n)}}var Zl=null;function af(e,t,n,r){if(Zl=null,e=gp(r),e=Eo(e),e!==null)if(t=Bo(e),t===null)e=null;else if(n=t.tag,n===13){if(e=W0(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 Zl=e,null}function tw(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(Uk()){case yp:return 1;case Z0:return 4;case Vl:case Zk:return 16;case K0:return 536870912;default:return 16}default:return 16}}var Zr=null,bp=null,Cl=null;function nw(){if(Cl)return Cl;var e,t=bp,n=t.length,r,o="value"in Zr?Zr.value:Zr.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 Cl=o.slice(e,1<r?1-r:void 0)}function Il(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 za(){return!0}function km(){return!1}function Cn(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)?za:km,this.isPropagationStopped=km,this}return it(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=za)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=za)},persist:function(){},isPersistent:za}),t}var Ui={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Sp=Cn(Ui),ma=it({},Ui,{view:0,detail:0}),iE=Cn(ma),Oc,Dc,fs,Iu=it({},ma,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:kp,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!==fs&&(fs&&e.type==="mousemove"?(Oc=e.screenX-fs.screenX,Dc=e.screenY-fs.screenY):Dc=Oc=0,fs=e),Oc)},movementY:function(e){return"movementY"in e?e.movementY:Dc}}),Em=Cn(Iu),sE=it({},Iu,{dataTransfer:0}),aE=Cn(sE),lE=it({},ma,{relatedTarget:0}),zc=Cn(lE),uE=it({},Ui,{animationName:0,elapsedTime:0,pseudoElement:0}),cE=Cn(uE),dE=it({},Ui,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),fE=Cn(dE),pE=it({},Ui,{data:0}),Cm=Cn(pE),hE={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},mE={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"},gE={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function yE(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=gE[e])?!!t[e]:!1}function kp(){return yE}var vE=it({},ma,{key:function(e){if(e.key){var t=hE[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Il(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?mE[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:kp,charCode:function(e){return e.type==="keypress"?Il(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Il(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),wE=Cn(vE),xE=it({},Iu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Im=Cn(xE),bE=it({},ma,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:kp}),SE=Cn(bE),kE=it({},Ui,{propertyName:0,elapsedTime:0,pseudoElement:0}),EE=Cn(kE),CE=it({},Iu,{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}),IE=Cn(CE),TE=[9,13,27,32],Ep=Er&&"CompositionEvent"in window,Ms=null;Er&&"documentMode"in document&&(Ms=document.documentMode);var jE=Er&&"TextEvent"in window&&!Ms,rw=Er&&(!Ep||Ms&&8<Ms&&11>=Ms),Tm=" ",jm=!1;function ow(e,t){switch(e){case"keyup":return TE.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function iw(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var di=!1;function RE(e,t){switch(e){case"compositionend":return iw(t);case"keypress":return t.which!==32?null:(jm=!0,Tm);case"textInput":return e=t.data,e===Tm&&jm?null:e;default:return null}}function PE(e,t){if(di)return e==="compositionend"||!Ep&&ow(e,t)?(e=nw(),Cl=bp=Zr=null,di=!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 rw&&t.locale!=="ko"?null:t.data;default:return null}}var FE={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 Rm(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!FE[e.type]:t==="textarea"}function sw(e,t,n,r){L0(r),t=Kl(t,"onChange"),0<t.length&&(n=new Sp("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var As=null,Gs=null;function $E(e){yw(e,0)}function Tu(e){var t=hi(e);if(P0(t))return e}function _E(e,t){if(e==="change")return t}var aw=!1;if(Er){var Bc;if(Er){var Wc="oninput"in document;if(!Wc){var Pm=document.createElement("div");Pm.setAttribute("oninput","return;"),Wc=typeof Pm.oninput=="function"}Bc=Wc}else Bc=!1;aw=Bc&&(!document.documentMode||9<document.documentMode)}function Fm(){As&&(As.detachEvent("onpropertychange",lw),Gs=As=null)}function lw(e){if(e.propertyName==="value"&&Tu(Gs)){var t=[];sw(t,Gs,e,gp(e)),B0($E,t)}}function ME(e,t,n){e==="focusin"?(Fm(),As=t,Gs=n,As.attachEvent("onpropertychange",lw)):e==="focusout"&&Fm()}function AE(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Tu(Gs)}function NE(e,t){if(e==="click")return Tu(t)}function LE(e,t){if(e==="input"||e==="change")return Tu(t)}function OE(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Gn=typeof Object.is=="function"?Object.is:OE;function Xs(e,t){if(Gn(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(!Wd.call(t,o)||!Gn(e[o],t[o]))return!1}return!0}function $m(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function _m(e,t){var n=$m(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=$m(n)}}function uw(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?uw(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function cw(){for(var e=window,t=zl();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=zl(e.document)}return t}function Cp(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 DE(e){var t=cw(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&uw(n.ownerDocument.documentElement,n)){if(r!==null&&Cp(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=_m(n,i);var s=_m(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 zE=Er&&"documentMode"in document&&11>=document.documentMode,fi=null,lf=null,Ns=null,uf=!1;function Mm(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;uf||fi==null||fi!==zl(r)||(r=fi,"selectionStart"in r&&Cp(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}),Ns&&Xs(Ns,r)||(Ns=r,r=Kl(lf,"onSelect"),0<r.length&&(t=new Sp("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=fi)))}function Ba(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var pi={animationend:Ba("Animation","AnimationEnd"),animationiteration:Ba("Animation","AnimationIteration"),animationstart:Ba("Animation","AnimationStart"),transitionend:Ba("Transition","TransitionEnd")},Vc={},dw={};Er&&(dw=document.createElement("div").style,"AnimationEvent"in window||(delete pi.animationend.animation,delete pi.animationiteration.animation,delete pi.animationstart.animation),"TransitionEvent"in window||delete pi.transitionend.transition);function ju(e){if(Vc[e])return Vc[e];if(!pi[e])return e;var t=pi[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in dw)return Vc[e]=t[n];return e}var fw=ju("animationend"),pw=ju("animationiteration"),hw=ju("animationstart"),mw=ju("transitionend"),gw=new Map,Am="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 ao(e,t){gw.set(e,t),zo(t,[e])}for(var Hc=0;Hc<Am.length;Hc++){var Uc=Am[Hc],BE=Uc.toLowerCase(),WE=Uc[0].toUpperCase()+Uc.slice(1);ao(BE,"on"+WE)}ao(fw,"onAnimationEnd");ao(pw,"onAnimationIteration");ao(hw,"onAnimationStart");ao("dblclick","onDoubleClick");ao("focusin","onFocus");ao("focusout","onBlur");ao(mw,"onTransitionEnd");Mi("onMouseEnter",["mouseout","mouseover"]);Mi("onMouseLeave",["mouseout","mouseover"]);Mi("onPointerEnter",["pointerout","pointerover"]);Mi("onPointerLeave",["pointerout","pointerover"]);zo("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));zo("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));zo("onBeforeInput",["compositionend","keypress","textInput","paste"]);zo("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));zo("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));zo("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var js="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(" "),VE=new Set("cancel close invalid load scroll toggle".split(" ").concat(js));function Nm(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,Bk(r,t,void 0,e),e.currentTarget=null}function yw(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],o=r.event;r=r.listeners;e:{var i=void 0;if(t)for(var s=r.length-1;0<=s;s--){var a=r[s],l=a.instance,c=a.currentTarget;if(a=a.listener,l!==i&&o.isPropagationStopped())break e;Nm(o,a,c),i=l}else for(s=0;s<r.length;s++){if(a=r[s],l=a.instance,c=a.currentTarget,a=a.listener,l!==i&&o.isPropagationStopped())break e;Nm(o,a,c),i=l}}}if(Wl)throw e=rf,Wl=!1,rf=null,e}function Ze(e,t){var n=t[hf];n===void 0&&(n=t[hf]=new Set);var r=e+"__bubble";n.has(r)||(vw(t,e,2,!1),n.add(r))}function Zc(e,t,n){var r=0;t&&(r|=4),vw(n,e,r,t)}var Wa="_reactListening"+Math.random().toString(36).slice(2);function qs(e){if(!e[Wa]){e[Wa]=!0,C0.forEach(function(n){n!=="selectionchange"&&(VE.has(n)||Zc(n,!1,e),Zc(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Wa]||(t[Wa]=!0,Zc("selectionchange",!1,t))}}function vw(e,t,n,r){switch(tw(t)){case 1:var o=rE;break;case 4:o=oE;break;default:o=xp}n=o.bind(null,t,n,e),o=void 0,!nf||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(o=!0),r?o!==void 0?e.addEventListener(t,n,{capture:!0,passive:o}):e.addEventListener(t,n,!0):o!==void 0?e.addEventListener(t,n,{passive:o}):e.addEventListener(t,n,!1)}function Kc(e,t,n,r,o){var i=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var a=r.stateNode.containerInfo;if(a===o||a.nodeType===8&&a.parentNode===o)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&(l=s.stateNode.containerInfo,l===o||l.nodeType===8&&l.parentNode===o))return;s=s.return}for(;a!==null;){if(s=Eo(a),s===null)return;if(l=s.tag,l===5||l===6){r=i=s;continue e}a=a.parentNode}}r=r.return}B0(function(){var c=i,f=gp(n),p=[];e:{var m=gw.get(e);if(m!==void 0){var y=Sp,w=e;switch(e){case"keypress":if(Il(n)===0)break e;case"keydown":case"keyup":y=wE;break;case"focusin":w="focus",y=zc;break;case"focusout":w="blur",y=zc;break;case"beforeblur":case"afterblur":y=zc;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":y=Em;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":y=aE;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":y=SE;break;case fw:case pw:case hw:y=cE;break;case mw:y=EE;break;case"scroll":y=iE;break;case"wheel":y=IE;break;case"copy":case"cut":case"paste":y=fE;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":y=Im}var x=(t&4)!==0,S=!x&&e==="scroll",h=x?m!==null?m+"Capture":null:m;x=[];for(var g=c,v;g!==null;){v=g;var b=v.stateNode;if(v.tag===5&&b!==null&&(v=b,h!==null&&(b=Us(g,h),b!=null&&x.push(Js(g,b,v)))),S)break;g=g.return}0<x.length&&(m=new y(m,w,null,n,f),p.push({event:m,listeners:x}))}}if(!(t&7)){e:{if(m=e==="mouseover"||e==="pointerover",y=e==="mouseout"||e==="pointerout",m&&n!==ef&&(w=n.relatedTarget||n.fromElement)&&(Eo(w)||w[Cr]))break e;if((y||m)&&(m=f.window===f?f:(m=f.ownerDocument)?m.defaultView||m.parentWindow:window,y?(w=n.relatedTarget||n.toElement,y=c,w=w?Eo(w):null,w!==null&&(S=Bo(w),w!==S||w.tag!==5&&w.tag!==6)&&(w=null)):(y=null,w=c),y!==w)){if(x=Em,b="onMouseLeave",h="onMouseEnter",g="mouse",(e==="pointerout"||e==="pointerover")&&(x=Im,b="onPointerLeave",h="onPointerEnter",g="pointer"),S=y==null?m:hi(y),v=w==null?m:hi(w),m=new x(b,g+"leave",y,n,f),m.target=S,m.relatedTarget=v,b=null,Eo(f)===c&&(x=new x(h,g+"enter",w,n,f),x.target=v,x.relatedTarget=S,b=x),S=b,y&&w)t:{for(x=y,h=w,g=0,v=x;v;v=Jo(v))g++;for(v=0,b=h;b;b=Jo(b))v++;for(;0<g-v;)x=Jo(x),g--;for(;0<v-g;)h=Jo(h),v--;for(;g--;){if(x===h||h!==null&&x===h.alternate)break t;x=Jo(x),h=Jo(h)}x=null}else x=null;y!==null&&Lm(p,m,y,x,!1),w!==null&&S!==null&&Lm(p,S,w,x,!0)}}e:{if(m=c?hi(c):window,y=m.nodeName&&m.nodeName.toLowerCase(),y==="select"||y==="input"&&m.type==="file")var k=_E;else if(Rm(m))if(aw)k=LE;else{k=AE;var E=ME}else(y=m.nodeName)&&y.toLowerCase()==="input"&&(m.type==="checkbox"||m.type==="radio")&&(k=NE);if(k&&(k=k(e,c))){sw(p,k,n,f);break e}E&&E(e,m,c),e==="focusout"&&(E=m._wrapperState)&&E.controlled&&m.type==="number"&&Gd(m,"number",m.value)}switch(E=c?hi(c):window,e){case"focusin":(Rm(E)||E.contentEditable==="true")&&(fi=E,lf=c,Ns=null);break;case"focusout":Ns=lf=fi=null;break;case"mousedown":uf=!0;break;case"contextmenu":case"mouseup":case"dragend":uf=!1,Mm(p,n,f);break;case"selectionchange":if(zE)break;case"keydown":case"keyup":Mm(p,n,f)}var C;if(Ep)e:{switch(e){case"compositionstart":var I="onCompositionStart";break e;case"compositionend":I="onCompositionEnd";break e;case"compositionupdate":I="onCompositionUpdate";break e}I=void 0}else di?ow(e,n)&&(I="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(I="onCompositionStart");I&&(rw&&n.locale!=="ko"&&(di||I!=="onCompositionStart"?I==="onCompositionEnd"&&di&&(C=nw()):(Zr=f,bp="value"in Zr?Zr.value:Zr.textContent,di=!0)),E=Kl(c,I),0<E.length&&(I=new Cm(I,e,null,n,f),p.push({event:I,listeners:E}),C?I.data=C:(C=iw(n),C!==null&&(I.data=C)))),(C=jE?RE(e,n):PE(e,n))&&(c=Kl(c,"onBeforeInput"),0<c.length&&(f=new Cm("onBeforeInput","beforeinput",null,n,f),p.push({event:f,listeners:c}),f.data=C))}yw(p,t)})}function Js(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Kl(e,t){for(var n=t+"Capture",r=[];e!==null;){var o=e,i=o.stateNode;o.tag===5&&i!==null&&(o=i,i=Us(e,n),i!=null&&r.unshift(Js(e,i,o)),i=Us(e,t),i!=null&&r.push(Js(e,i,o))),e=e.return}return r}function Jo(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Lm(e,t,n,r,o){for(var i=t._reactName,s=[];n!==null&&n!==r;){var a=n,l=a.alternate,c=a.stateNode;if(l!==null&&l===r)break;a.tag===5&&c!==null&&(a=c,o?(l=Us(n,i),l!=null&&s.unshift(Js(n,l,a))):o||(l=Us(n,i),l!=null&&s.push(Js(n,l,a)))),n=n.return}s.length!==0&&e.push({event:t,listeners:s})}var HE=/\r\n?/g,UE=/\u0000|\uFFFD/g;function Om(e){return(typeof e=="string"?e:""+e).replace(HE,`
38
+ `).replace(UE,"")}function Va(e,t,n){if(t=Om(t),Om(e)!==t&&n)throw Error(ue(425))}function Yl(){}var cf=null,df=null;function ff(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 pf=typeof setTimeout=="function"?setTimeout:void 0,ZE=typeof clearTimeout=="function"?clearTimeout:void 0,Dm=typeof Promise=="function"?Promise:void 0,KE=typeof queueMicrotask=="function"?queueMicrotask:typeof Dm<"u"?function(e){return Dm.resolve(null).then(e).catch(YE)}:pf;function YE(e){setTimeout(function(){throw e})}function Yc(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),Ys(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=o}while(n);Ys(t)}function qr(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 zm(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 Zi=Math.random().toString(36).slice(2),ir="__reactFiber$"+Zi,Qs="__reactProps$"+Zi,Cr="__reactContainer$"+Zi,hf="__reactEvents$"+Zi,GE="__reactListeners$"+Zi,XE="__reactHandles$"+Zi;function Eo(e){var t=e[ir];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Cr]||n[ir]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=zm(e);e!==null;){if(n=e[ir])return n;e=zm(e)}return t}e=n,n=e.parentNode}return null}function ga(e){return e=e[ir]||e[Cr],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function hi(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(ue(33))}function Ru(e){return e[Qs]||null}var mf=[],mi=-1;function lo(e){return{current:e}}function Ke(e){0>mi||(e.current=mf[mi],mf[mi]=null,mi--)}function Ue(e,t){mi++,mf[mi]=e.current,e.current=t}var oo={},Zt=lo(oo),sn=lo(!1),$o=oo;function Ai(e,t){var n=e.type.contextTypes;if(!n)return oo;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 an(e){return e=e.childContextTypes,e!=null}function Gl(){Ke(sn),Ke(Zt)}function Bm(e,t,n){if(Zt.current!==oo)throw Error(ue(168));Ue(Zt,t),Ue(sn,n)}function ww(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(ue(108,Mk(e)||"Unknown",o));return it({},n,r)}function Xl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||oo,$o=Zt.current,Ue(Zt,e),Ue(sn,sn.current),!0}function Wm(e,t,n){var r=e.stateNode;if(!r)throw Error(ue(169));n?(e=ww(e,t,$o),r.__reactInternalMemoizedMergedChildContext=e,Ke(sn),Ke(Zt),Ue(Zt,e)):Ke(sn),Ue(sn,n)}var vr=null,Pu=!1,Gc=!1;function xw(e){vr===null?vr=[e]:vr.push(e)}function qE(e){Pu=!0,xw(e)}function uo(){if(!Gc&&vr!==null){Gc=!0;var e=0,t=De;try{var n=vr;for(De=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}vr=null,Pu=!1}catch(o){throw vr!==null&&(vr=vr.slice(e+1)),U0(yp,uo),o}finally{De=t,Gc=!1}}return null}var gi=[],yi=0,ql=null,Jl=0,$n=[],_n=0,_o=null,xr=1,br="";function So(e,t){gi[yi++]=Jl,gi[yi++]=ql,ql=e,Jl=t}function bw(e,t,n){$n[_n++]=xr,$n[_n++]=br,$n[_n++]=_o,_o=e;var r=xr;e=br;var o=32-Kn(r)-1;r&=~(1<<o),n+=1;var i=32-Kn(t)+o;if(30<i){var s=o-o%5;i=(r&(1<<s)-1).toString(32),r>>=s,o-=s,xr=1<<32-Kn(t)+o|n<<o|r,br=i+e}else xr=1<<i|n<<o|r,br=e}function Ip(e){e.return!==null&&(So(e,1),bw(e,1,0))}function Tp(e){for(;e===ql;)ql=gi[--yi],gi[yi]=null,Jl=gi[--yi],gi[yi]=null;for(;e===_o;)_o=$n[--_n],$n[_n]=null,br=$n[--_n],$n[_n]=null,xr=$n[--_n],$n[_n]=null}var bn=null,xn=null,Xe=!1,Un=null;function Sw(e,t){var n=An(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 Vm(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,bn=e,xn=qr(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,bn=e,xn=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=_o!==null?{id:xr,overflow:br}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=An(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,bn=e,xn=null,!0):!1;default:return!1}}function gf(e){return(e.mode&1)!==0&&(e.flags&128)===0}function yf(e){if(Xe){var t=xn;if(t){var n=t;if(!Vm(e,t)){if(gf(e))throw Error(ue(418));t=qr(n.nextSibling);var r=bn;t&&Vm(e,t)?Sw(r,n):(e.flags=e.flags&-4097|2,Xe=!1,bn=e)}}else{if(gf(e))throw Error(ue(418));e.flags=e.flags&-4097|2,Xe=!1,bn=e}}}function Hm(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;bn=e}function Ha(e){if(e!==bn)return!1;if(!Xe)return Hm(e),Xe=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!ff(e.type,e.memoizedProps)),t&&(t=xn)){if(gf(e))throw kw(),Error(ue(418));for(;t;)Sw(e,t),t=qr(t.nextSibling)}if(Hm(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(ue(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){xn=qr(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}xn=null}}else xn=bn?qr(e.stateNode.nextSibling):null;return!0}function kw(){for(var e=xn;e;)e=qr(e.nextSibling)}function Ni(){xn=bn=null,Xe=!1}function jp(e){Un===null?Un=[e]:Un.push(e)}var JE=jr.ReactCurrentBatchConfig;function ps(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(ue(309));var r=n.stateNode}if(!r)throw Error(ue(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(ue(284));if(!n._owner)throw Error(ue(290,e))}return e}function Ua(e,t){throw e=Object.prototype.toString.call(t),Error(ue(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Um(e){var t=e._init;return t(e._payload)}function Ew(e){function t(h,g){if(e){var v=h.deletions;v===null?(h.deletions=[g],h.flags|=16):v.push(g)}}function n(h,g){if(!e)return null;for(;g!==null;)t(h,g),g=g.sibling;return null}function r(h,g){for(h=new Map;g!==null;)g.key!==null?h.set(g.key,g):h.set(g.index,g),g=g.sibling;return h}function o(h,g){return h=to(h,g),h.index=0,h.sibling=null,h}function i(h,g,v){return h.index=v,e?(v=h.alternate,v!==null?(v=v.index,v<g?(h.flags|=2,g):v):(h.flags|=2,g)):(h.flags|=1048576,g)}function s(h){return e&&h.alternate===null&&(h.flags|=2),h}function a(h,g,v,b){return g===null||g.tag!==6?(g=nd(v,h.mode,b),g.return=h,g):(g=o(g,v),g.return=h,g)}function l(h,g,v,b){var k=v.type;return k===ci?f(h,g,v.props.children,b,v.key):g!==null&&(g.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===Br&&Um(k)===g.type)?(b=o(g,v.props),b.ref=ps(h,g,v),b.return=h,b):(b=_l(v.type,v.key,v.props,null,h.mode,b),b.ref=ps(h,g,v),b.return=h,b)}function c(h,g,v,b){return g===null||g.tag!==4||g.stateNode.containerInfo!==v.containerInfo||g.stateNode.implementation!==v.implementation?(g=rd(v,h.mode,b),g.return=h,g):(g=o(g,v.children||[]),g.return=h,g)}function f(h,g,v,b,k){return g===null||g.tag!==7?(g=Po(v,h.mode,b,k),g.return=h,g):(g=o(g,v),g.return=h,g)}function p(h,g,v){if(typeof g=="string"&&g!==""||typeof g=="number")return g=nd(""+g,h.mode,v),g.return=h,g;if(typeof g=="object"&&g!==null){switch(g.$$typeof){case Ma:return v=_l(g.type,g.key,g.props,null,h.mode,v),v.ref=ps(h,null,g),v.return=h,v;case ui:return g=rd(g,h.mode,v),g.return=h,g;case Br:var b=g._init;return p(h,b(g._payload),v)}if(Is(g)||ls(g))return g=Po(g,h.mode,v,null),g.return=h,g;Ua(h,g)}return null}function m(h,g,v,b){var k=g!==null?g.key:null;if(typeof v=="string"&&v!==""||typeof v=="number")return k!==null?null:a(h,g,""+v,b);if(typeof v=="object"&&v!==null){switch(v.$$typeof){case Ma:return v.key===k?l(h,g,v,b):null;case ui:return v.key===k?c(h,g,v,b):null;case Br:return k=v._init,m(h,g,k(v._payload),b)}if(Is(v)||ls(v))return k!==null?null:f(h,g,v,b,null);Ua(h,v)}return null}function y(h,g,v,b,k){if(typeof b=="string"&&b!==""||typeof b=="number")return h=h.get(v)||null,a(g,h,""+b,k);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case Ma:return h=h.get(b.key===null?v:b.key)||null,l(g,h,b,k);case ui:return h=h.get(b.key===null?v:b.key)||null,c(g,h,b,k);case Br:var E=b._init;return y(h,g,v,E(b._payload),k)}if(Is(b)||ls(b))return h=h.get(v)||null,f(g,h,b,k,null);Ua(g,b)}return null}function w(h,g,v,b){for(var k=null,E=null,C=g,I=g=0,j=null;C!==null&&I<v.length;I++){C.index>I?(j=C,C=null):j=C.sibling;var F=m(h,C,v[I],b);if(F===null){C===null&&(C=j);break}e&&C&&F.alternate===null&&t(h,C),g=i(F,g,I),E===null?k=F:E.sibling=F,E=F,C=j}if(I===v.length)return n(h,C),Xe&&So(h,I),k;if(C===null){for(;I<v.length;I++)C=p(h,v[I],b),C!==null&&(g=i(C,g,I),E===null?k=C:E.sibling=C,E=C);return Xe&&So(h,I),k}for(C=r(h,C);I<v.length;I++)j=y(C,h,I,v[I],b),j!==null&&(e&&j.alternate!==null&&C.delete(j.key===null?I:j.key),g=i(j,g,I),E===null?k=j:E.sibling=j,E=j);return e&&C.forEach(function(L){return t(h,L)}),Xe&&So(h,I),k}function x(h,g,v,b){var k=ls(v);if(typeof k!="function")throw Error(ue(150));if(v=k.call(v),v==null)throw Error(ue(151));for(var E=k=null,C=g,I=g=0,j=null,F=v.next();C!==null&&!F.done;I++,F=v.next()){C.index>I?(j=C,C=null):j=C.sibling;var L=m(h,C,F.value,b);if(L===null){C===null&&(C=j);break}e&&C&&L.alternate===null&&t(h,C),g=i(L,g,I),E===null?k=L:E.sibling=L,E=L,C=j}if(F.done)return n(h,C),Xe&&So(h,I),k;if(C===null){for(;!F.done;I++,F=v.next())F=p(h,F.value,b),F!==null&&(g=i(F,g,I),E===null?k=F:E.sibling=F,E=F);return Xe&&So(h,I),k}for(C=r(h,C);!F.done;I++,F=v.next())F=y(C,h,I,F.value,b),F!==null&&(e&&F.alternate!==null&&C.delete(F.key===null?I:F.key),g=i(F,g,I),E===null?k=F:E.sibling=F,E=F);return e&&C.forEach(function(V){return t(h,V)}),Xe&&So(h,I),k}function S(h,g,v,b){if(typeof v=="object"&&v!==null&&v.type===ci&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case Ma:e:{for(var k=v.key,E=g;E!==null;){if(E.key===k){if(k=v.type,k===ci){if(E.tag===7){n(h,E.sibling),g=o(E,v.props.children),g.return=h,h=g;break e}}else if(E.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===Br&&Um(k)===E.type){n(h,E.sibling),g=o(E,v.props),g.ref=ps(h,E,v),g.return=h,h=g;break e}n(h,E);break}else t(h,E);E=E.sibling}v.type===ci?(g=Po(v.props.children,h.mode,b,v.key),g.return=h,h=g):(b=_l(v.type,v.key,v.props,null,h.mode,b),b.ref=ps(h,g,v),b.return=h,h=b)}return s(h);case ui:e:{for(E=v.key;g!==null;){if(g.key===E)if(g.tag===4&&g.stateNode.containerInfo===v.containerInfo&&g.stateNode.implementation===v.implementation){n(h,g.sibling),g=o(g,v.children||[]),g.return=h,h=g;break e}else{n(h,g);break}else t(h,g);g=g.sibling}g=rd(v,h.mode,b),g.return=h,h=g}return s(h);case Br:return E=v._init,S(h,g,E(v._payload),b)}if(Is(v))return w(h,g,v,b);if(ls(v))return x(h,g,v,b);Ua(h,v)}return typeof v=="string"&&v!==""||typeof v=="number"?(v=""+v,g!==null&&g.tag===6?(n(h,g.sibling),g=o(g,v),g.return=h,h=g):(n(h,g),g=nd(v,h.mode,b),g.return=h,h=g),s(h)):n(h,g)}return S}var Li=Ew(!0),Cw=Ew(!1),Ql=lo(null),eu=null,vi=null,Rp=null;function Pp(){Rp=vi=eu=null}function Fp(e){var t=Ql.current;Ke(Ql),e._currentValue=t}function vf(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 Ri(e,t){eu=e,Rp=vi=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(on=!0),e.firstContext=null)}function On(e){var t=e._currentValue;if(Rp!==e)if(e={context:e,memoizedValue:t,next:null},vi===null){if(eu===null)throw Error(ue(308));vi=e,eu.dependencies={lanes:0,firstContext:e}}else vi=vi.next=e;return t}var Co=null;function $p(e){Co===null?Co=[e]:Co.push(e)}function Iw(e,t,n,r){var o=t.interleaved;return o===null?(n.next=n,$p(t)):(n.next=o.next,o.next=n),t.interleaved=n,Ir(e,r)}function Ir(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 Wr=!1;function _p(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Tw(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 kr(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Jr(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Ae&2){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,Ir(e,n)}return o=r.interleaved,o===null?(t.next=t,$p(r)):(t.next=o.next,o.next=t),r.interleaved=t,Ir(e,n)}function Tl(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,vp(e,n)}}function Zm(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 tu(e,t,n,r){var o=e.updateQueue;Wr=!1;var i=o.firstBaseUpdate,s=o.lastBaseUpdate,a=o.shared.pending;if(a!==null){o.shared.pending=null;var l=a,c=l.next;l.next=null,s===null?i=c:s.next=c,s=l;var f=e.alternate;f!==null&&(f=f.updateQueue,a=f.lastBaseUpdate,a!==s&&(a===null?f.firstBaseUpdate=c:a.next=c,f.lastBaseUpdate=l))}if(i!==null){var p=o.baseState;s=0,f=c=l=null,a=i;do{var m=a.lane,y=a.eventTime;if((r&m)===m){f!==null&&(f=f.next={eventTime:y,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var w=e,x=a;switch(m=t,y=n,x.tag){case 1:if(w=x.payload,typeof w=="function"){p=w.call(y,p,m);break e}p=w;break e;case 3:w.flags=w.flags&-65537|128;case 0:if(w=x.payload,m=typeof w=="function"?w.call(y,p,m):w,m==null)break e;p=it({},p,m);break e;case 2:Wr=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,m=o.effects,m===null?o.effects=[a]:m.push(a))}else y={eventTime:y,lane:m,tag:a.tag,payload:a.payload,callback:a.callback,next:null},f===null?(c=f=y,l=p):f=f.next=y,s|=m;if(a=a.next,a===null){if(a=o.shared.pending,a===null)break;m=a,a=m.next,m.next=null,o.lastBaseUpdate=m,o.shared.pending=null}}while(!0);if(f===null&&(l=p),o.baseState=l,o.firstBaseUpdate=c,o.lastBaseUpdate=f,t=o.shared.interleaved,t!==null){o=t;do s|=o.lane,o=o.next;while(o!==t)}else i===null&&(o.shared.lanes=0);Ao|=s,e.lanes=s,e.memoizedState=p}}function Km(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(ue(191,o));o.call(r)}}}var ya={},lr=lo(ya),ea=lo(ya),ta=lo(ya);function Io(e){if(e===ya)throw Error(ue(174));return e}function Mp(e,t){switch(Ue(ta,t),Ue(ea,e),Ue(lr,ya),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:qd(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=qd(t,e)}Ke(lr),Ue(lr,t)}function Oi(){Ke(lr),Ke(ea),Ke(ta)}function jw(e){Io(ta.current);var t=Io(lr.current),n=qd(t,e.type);t!==n&&(Ue(ea,e),Ue(lr,n))}function Ap(e){ea.current===e&&(Ke(lr),Ke(ea))}var nt=lo(0);function nu(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 Xc=[];function Np(){for(var e=0;e<Xc.length;e++)Xc[e]._workInProgressVersionPrimary=null;Xc.length=0}var jl=jr.ReactCurrentDispatcher,qc=jr.ReactCurrentBatchConfig,Mo=0,ot=null,wt=null,It=null,ru=!1,Ls=!1,na=0,QE=0;function zt(){throw Error(ue(321))}function Lp(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Gn(e[n],t[n]))return!1;return!0}function Op(e,t,n,r,o,i){if(Mo=i,ot=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,jl.current=e===null||e.memoizedState===null?rC:oC,e=n(r,o),Ls){i=0;do{if(Ls=!1,na=0,25<=i)throw Error(ue(301));i+=1,It=wt=null,t.updateQueue=null,jl.current=iC,e=n(r,o)}while(Ls)}if(jl.current=ou,t=wt!==null&&wt.next!==null,Mo=0,It=wt=ot=null,ru=!1,t)throw Error(ue(300));return e}function Dp(){var e=na!==0;return na=0,e}function rr(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return It===null?ot.memoizedState=It=e:It=It.next=e,It}function Dn(){if(wt===null){var e=ot.alternate;e=e!==null?e.memoizedState:null}else e=wt.next;var t=It===null?ot.memoizedState:It.next;if(t!==null)It=t,wt=e;else{if(e===null)throw Error(ue(310));wt=e,e={memoizedState:wt.memoizedState,baseState:wt.baseState,baseQueue:wt.baseQueue,queue:wt.queue,next:null},It===null?ot.memoizedState=It=e:It=It.next=e}return It}function ra(e,t){return typeof t=="function"?t(e):t}function Jc(e){var t=Dn(),n=t.queue;if(n===null)throw Error(ue(311));n.lastRenderedReducer=e;var r=wt,o=r.baseQueue,i=n.pending;if(i!==null){if(o!==null){var s=o.next;o.next=i.next,i.next=s}r.baseQueue=o=i,n.pending=null}if(o!==null){i=o.next,r=r.baseState;var a=s=null,l=null,c=i;do{var f=c.lane;if((Mo&f)===f)l!==null&&(l=l.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),r=c.hasEagerState?c.eagerState:e(r,c.action);else{var p={lane:f,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};l===null?(a=l=p,s=r):l=l.next=p,ot.lanes|=f,Ao|=f}c=c.next}while(c!==null&&c!==i);l===null?s=r:l.next=a,Gn(r,t.memoizedState)||(on=!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,ot.lanes|=i,Ao|=i,o=o.next;while(o!==e)}else o===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Qc(e){var t=Dn(),n=t.queue;if(n===null)throw Error(ue(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);Gn(i,t.memoizedState)||(on=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function Rw(){}function Pw(e,t){var n=ot,r=Dn(),o=t(),i=!Gn(r.memoizedState,o);if(i&&(r.memoizedState=o,on=!0),r=r.queue,zp(_w.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||It!==null&&It.memoizedState.tag&1){if(n.flags|=2048,oa(9,$w.bind(null,n,r,o,t),void 0,null),Tt===null)throw Error(ue(349));Mo&30||Fw(n,t,o)}return o}function Fw(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=ot.updateQueue,t===null?(t={lastEffect:null,stores:null},ot.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function $w(e,t,n,r){t.value=n,t.getSnapshot=r,Mw(t)&&Aw(e)}function _w(e,t,n){return n(function(){Mw(t)&&Aw(e)})}function Mw(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Gn(e,n)}catch{return!0}}function Aw(e){var t=Ir(e,1);t!==null&&Yn(t,e,1,-1)}function Ym(e){var t=rr();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ra,lastRenderedState:e},t.queue=e,e=e.dispatch=nC.bind(null,ot,e),[t.memoizedState,e]}function oa(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=ot.updateQueue,t===null?(t={lastEffect:null,stores:null},ot.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 Nw(){return Dn().memoizedState}function Rl(e,t,n,r){var o=rr();ot.flags|=e,o.memoizedState=oa(1|t,n,void 0,r===void 0?null:r)}function Fu(e,t,n,r){var o=Dn();r=r===void 0?null:r;var i=void 0;if(wt!==null){var s=wt.memoizedState;if(i=s.destroy,r!==null&&Lp(r,s.deps)){o.memoizedState=oa(t,n,i,r);return}}ot.flags|=e,o.memoizedState=oa(1|t,n,i,r)}function Gm(e,t){return Rl(8390656,8,e,t)}function zp(e,t){return Fu(2048,8,e,t)}function Lw(e,t){return Fu(4,2,e,t)}function Ow(e,t){return Fu(4,4,e,t)}function Dw(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 zw(e,t,n){return n=n!=null?n.concat([e]):null,Fu(4,4,Dw.bind(null,t,e),n)}function Bp(){}function Bw(e,t){var n=Dn();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Lp(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Ww(e,t){var n=Dn();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Lp(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function Vw(e,t,n){return Mo&21?(Gn(n,t)||(n=Y0(),ot.lanes|=n,Ao|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,on=!0),e.memoizedState=n)}function eC(e,t){var n=De;De=n!==0&&4>n?n:4,e(!0);var r=qc.transition;qc.transition={};try{e(!1),t()}finally{De=n,qc.transition=r}}function Hw(){return Dn().memoizedState}function tC(e,t,n){var r=eo(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Uw(e))Zw(t,n);else if(n=Iw(e,t,n,r),n!==null){var o=Xt();Yn(n,e,r,o),Kw(n,t,r)}}function nC(e,t,n){var r=eo(e),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Uw(e))Zw(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,Gn(a,s)){var l=t.interleaved;l===null?(o.next=o,$p(t)):(o.next=l.next,l.next=o),t.interleaved=o;return}}catch{}finally{}n=Iw(e,t,o,r),n!==null&&(o=Xt(),Yn(n,e,r,o),Kw(n,t,r))}}function Uw(e){var t=e.alternate;return e===ot||t!==null&&t===ot}function Zw(e,t){Ls=ru=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Kw(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,vp(e,n)}}var ou={readContext:On,useCallback:zt,useContext:zt,useEffect:zt,useImperativeHandle:zt,useInsertionEffect:zt,useLayoutEffect:zt,useMemo:zt,useReducer:zt,useRef:zt,useState:zt,useDebugValue:zt,useDeferredValue:zt,useTransition:zt,useMutableSource:zt,useSyncExternalStore:zt,useId:zt,unstable_isNewReconciler:!1},rC={readContext:On,useCallback:function(e,t){return rr().memoizedState=[e,t===void 0?null:t],e},useContext:On,useEffect:Gm,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Rl(4194308,4,Dw.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Rl(4194308,4,e,t)},useInsertionEffect:function(e,t){return Rl(4,2,e,t)},useMemo:function(e,t){var n=rr();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=rr();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=tC.bind(null,ot,e),[r.memoizedState,e]},useRef:function(e){var t=rr();return e={current:e},t.memoizedState=e},useState:Ym,useDebugValue:Bp,useDeferredValue:function(e){return rr().memoizedState=e},useTransition:function(){var e=Ym(!1),t=e[0];return e=eC.bind(null,e[1]),rr().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=ot,o=rr();if(Xe){if(n===void 0)throw Error(ue(407));n=n()}else{if(n=t(),Tt===null)throw Error(ue(349));Mo&30||Fw(r,t,n)}o.memoizedState=n;var i={value:n,getSnapshot:t};return o.queue=i,Gm(_w.bind(null,r,i,e),[e]),r.flags|=2048,oa(9,$w.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=rr(),t=Tt.identifierPrefix;if(Xe){var n=br,r=xr;n=(r&~(1<<32-Kn(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=na++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=QE++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},oC={readContext:On,useCallback:Bw,useContext:On,useEffect:zp,useImperativeHandle:zw,useInsertionEffect:Lw,useLayoutEffect:Ow,useMemo:Ww,useReducer:Jc,useRef:Nw,useState:function(){return Jc(ra)},useDebugValue:Bp,useDeferredValue:function(e){var t=Dn();return Vw(t,wt.memoizedState,e)},useTransition:function(){var e=Jc(ra)[0],t=Dn().memoizedState;return[e,t]},useMutableSource:Rw,useSyncExternalStore:Pw,useId:Hw,unstable_isNewReconciler:!1},iC={readContext:On,useCallback:Bw,useContext:On,useEffect:zp,useImperativeHandle:zw,useInsertionEffect:Lw,useLayoutEffect:Ow,useMemo:Ww,useReducer:Qc,useRef:Nw,useState:function(){return Qc(ra)},useDebugValue:Bp,useDeferredValue:function(e){var t=Dn();return wt===null?t.memoizedState=e:Vw(t,wt.memoizedState,e)},useTransition:function(){var e=Qc(ra)[0],t=Dn().memoizedState;return[e,t]},useMutableSource:Rw,useSyncExternalStore:Pw,useId:Hw,unstable_isNewReconciler:!1};function Vn(e,t){if(e&&e.defaultProps){t=it({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function wf(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:it({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var $u={isMounted:function(e){return(e=e._reactInternals)?Bo(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Xt(),o=eo(e),i=kr(r,o);i.payload=t,n!=null&&(i.callback=n),t=Jr(e,i,o),t!==null&&(Yn(t,e,o,r),Tl(t,e,o))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Xt(),o=eo(e),i=kr(r,o);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Jr(e,i,o),t!==null&&(Yn(t,e,o,r),Tl(t,e,o))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Xt(),r=eo(e),o=kr(n,r);o.tag=2,t!=null&&(o.callback=t),t=Jr(e,o,r),t!==null&&(Yn(t,e,r,n),Tl(t,e,r))}};function Xm(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?!Xs(n,r)||!Xs(o,i):!0}function Yw(e,t,n){var r=!1,o=oo,i=t.contextType;return typeof i=="object"&&i!==null?i=On(i):(o=an(t)?$o:Zt.current,r=t.contextTypes,i=(r=r!=null)?Ai(e,o):oo),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=$u,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=o,e.__reactInternalMemoizedMaskedChildContext=i),t}function qm(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&&$u.enqueueReplaceState(t,t.state,null)}function xf(e,t,n,r){var o=e.stateNode;o.props=n,o.state=e.memoizedState,o.refs={},_p(e);var i=t.contextType;typeof i=="object"&&i!==null?o.context=On(i):(i=an(t)?$o:Zt.current,o.context=Ai(e,i)),o.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(wf(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&&$u.enqueueReplaceState(o,o.state,null),tu(e,n,o,r),o.state=e.memoizedState),typeof o.componentDidMount=="function"&&(e.flags|=4194308)}function Di(e,t){try{var n="",r=t;do n+=_k(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 ed(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function bf(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var sC=typeof WeakMap=="function"?WeakMap:Map;function Gw(e,t,n){n=kr(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){su||(su=!0,Ff=r),bf(e,t)},n}function Xw(e,t,n){n=kr(-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(){bf(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){bf(e,t),typeof r!="function"&&(Qr===null?Qr=new Set([this]):Qr.add(this));var s=t.stack;this.componentDidCatch(t.value,{componentStack:s!==null?s:""})}),n}function Jm(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new sC;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=xC.bind(null,e,t,n),t.then(e,e))}function Qm(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 eg(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=kr(-1,1),t.tag=2,Jr(n,t,1))),n.lanes|=1),e)}var aC=jr.ReactCurrentOwner,on=!1;function Gt(e,t,n,r){t.child=e===null?Cw(t,null,n,r):Li(t,e.child,n,r)}function tg(e,t,n,r,o){n=n.render;var i=t.ref;return Ri(t,o),r=Op(e,t,n,r,i,o),n=Dp(),e!==null&&!on?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,Tr(e,t,o)):(Xe&&n&&Ip(t),t.flags|=1,Gt(e,t,r,o),t.child)}function ng(e,t,n,r,o){if(e===null){var i=n.type;return typeof i=="function"&&!Gp(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,qw(e,t,i,r,o)):(e=_l(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:Xs,n(s,r)&&e.ref===t.ref)return Tr(e,t,o)}return t.flags|=1,e=to(i,r),e.ref=t.ref,e.return=t,t.child=e}function qw(e,t,n,r,o){if(e!==null){var i=e.memoizedProps;if(Xs(i,r)&&e.ref===t.ref)if(on=!1,t.pendingProps=r=i,(e.lanes&o)!==0)e.flags&131072&&(on=!0);else return t.lanes=e.lanes,Tr(e,t,o)}return Sf(e,t,n,r,o)}function Jw(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},Ue(xi,wn),wn|=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,Ue(xi,wn),wn|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,Ue(xi,wn),wn|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,Ue(xi,wn),wn|=r;return Gt(e,t,o,n),t.child}function Qw(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Sf(e,t,n,r,o){var i=an(n)?$o:Zt.current;return i=Ai(t,i),Ri(t,o),n=Op(e,t,n,r,i,o),r=Dp(),e!==null&&!on?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,Tr(e,t,o)):(Xe&&r&&Ip(t),t.flags|=1,Gt(e,t,n,o),t.child)}function rg(e,t,n,r,o){if(an(n)){var i=!0;Xl(t)}else i=!1;if(Ri(t,o),t.stateNode===null)Pl(e,t),Yw(t,n,r),xf(t,n,r,o),r=!0;else if(e===null){var s=t.stateNode,a=t.memoizedProps;s.props=a;var l=s.context,c=n.contextType;typeof c=="object"&&c!==null?c=On(c):(c=an(n)?$o:Zt.current,c=Ai(t,c));var f=n.getDerivedStateFromProps,p=typeof f=="function"||typeof s.getSnapshotBeforeUpdate=="function";p||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(a!==r||l!==c)&&qm(t,s,r,c),Wr=!1;var m=t.memoizedState;s.state=m,tu(t,r,s,o),l=t.memoizedState,a!==r||m!==l||sn.current||Wr?(typeof f=="function"&&(wf(t,n,f,r),l=t.memoizedState),(a=Wr||Xm(t,n,a,r,m,l,c))?(p||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount()),typeof s.componentDidMount=="function"&&(t.flags|=4194308)):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),s.props=r,s.state=l,s.context=c,r=a):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{s=t.stateNode,Tw(e,t),a=t.memoizedProps,c=t.type===t.elementType?a:Vn(t.type,a),s.props=c,p=t.pendingProps,m=s.context,l=n.contextType,typeof l=="object"&&l!==null?l=On(l):(l=an(n)?$o:Zt.current,l=Ai(t,l));var y=n.getDerivedStateFromProps;(f=typeof y=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(a!==p||m!==l)&&qm(t,s,r,l),Wr=!1,m=t.memoizedState,s.state=m,tu(t,r,s,o);var w=t.memoizedState;a!==p||m!==w||sn.current||Wr?(typeof y=="function"&&(wf(t,n,y,r),w=t.memoizedState),(c=Wr||Xm(t,n,c,r,m,w,l)||!1)?(f||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(r,w,l),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(r,w,l)),typeof s.componentDidUpdate=="function"&&(t.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof s.componentDidUpdate!="function"||a===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=w),s.props=r,s.state=w,s.context=l,r=c):(typeof s.componentDidUpdate!="function"||a===e.memoizedProps&&m===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&m===e.memoizedState||(t.flags|=1024),r=!1)}return kf(e,t,n,r,i,o)}function kf(e,t,n,r,o,i){Qw(e,t);var s=(t.flags&128)!==0;if(!r&&!s)return o&&Wm(t,n,!1),Tr(e,t,i);r=t.stateNode,aC.current=t;var a=s&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&s?(t.child=Li(t,e.child,null,i),t.child=Li(t,null,a,i)):Gt(e,t,a,i),t.memoizedState=r.state,o&&Wm(t,n,!0),t.child}function ex(e){var t=e.stateNode;t.pendingContext?Bm(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Bm(e,t.context,!1),Mp(e,t.containerInfo)}function og(e,t,n,r,o){return Ni(),jp(o),t.flags|=256,Gt(e,t,n,r),t.child}var Ef={dehydrated:null,treeContext:null,retryLane:0};function Cf(e){return{baseLanes:e,cachePool:null,transitions:null}}function tx(e,t,n){var r=t.pendingProps,o=nt.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),Ue(nt,o&1),e===null)return yf(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=Au(s,r,0,null),e=Po(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=Cf(n),t.memoizedState=Ef,e):Wp(t,s));if(o=e.memoizedState,o!==null&&(a=o.dehydrated,a!==null))return lC(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=to(o,l),r.subtreeFlags=o.subtreeFlags&14680064),a!==null?i=to(a,i):(i=Po(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?Cf(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},i.memoizedState=s,i.childLanes=e.childLanes&~n,t.memoizedState=Ef,r}return i=e.child,e=i.sibling,r=to(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 Wp(e,t){return t=Au({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Za(e,t,n,r){return r!==null&&jp(r),Li(t,e.child,null,n),e=Wp(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function lC(e,t,n,r,o,i,s){if(n)return t.flags&256?(t.flags&=-257,r=ed(Error(ue(422))),Za(e,t,s,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,o=t.mode,r=Au({mode:"visible",children:r.children},o,0,null),i=Po(i,o,s,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&Li(t,e.child,null,s),t.child.memoizedState=Cf(s),t.memoizedState=Ef,i);if(!(t.mode&1))return Za(e,t,s,null);if(o.data==="$!"){if(r=o.nextSibling&&o.nextSibling.dataset,r)var a=r.dgst;return r=a,i=Error(ue(419)),r=ed(i,r,void 0),Za(e,t,s,r)}if(a=(s&e.childLanes)!==0,on||a){if(r=Tt,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,Ir(e,o),Yn(r,e,o,-1))}return Yp(),r=ed(Error(ue(421))),Za(e,t,s,r)}return o.data==="$?"?(t.flags|=128,t.child=e.child,t=bC.bind(null,e),o._reactRetry=t,null):(e=i.treeContext,xn=qr(o.nextSibling),bn=t,Xe=!0,Un=null,e!==null&&($n[_n++]=xr,$n[_n++]=br,$n[_n++]=_o,xr=e.id,br=e.overflow,_o=t),t=Wp(t,r.children),t.flags|=4096,t)}function ig(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),vf(e.return,t,n)}function td(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 nx(e,t,n){var r=t.pendingProps,o=r.revealOrder,i=r.tail;if(Gt(e,t,r.children,n),r=nt.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&&ig(e,n,t);else if(e.tag===19)ig(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(Ue(nt,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&&nu(e)===null&&(o=n),n=n.sibling;n=o,n===null?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),td(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&&nu(e)===null){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}td(t,!0,n,null,i);break;case"together":td(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Pl(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Tr(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Ao|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(ue(153));if(t.child!==null){for(e=t.child,n=to(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=to(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function uC(e,t,n){switch(t.tag){case 3:ex(t),Ni();break;case 5:jw(t);break;case 1:an(t.type)&&Xl(t);break;case 4:Mp(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,o=t.memoizedProps.value;Ue(Ql,r._currentValue),r._currentValue=o;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(Ue(nt,nt.current&1),t.flags|=128,null):n&t.child.childLanes?tx(e,t,n):(Ue(nt,nt.current&1),e=Tr(e,t,n),e!==null?e.sibling:null);Ue(nt,nt.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return nx(e,t,n);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),Ue(nt,nt.current),r)break;return null;case 22:case 23:return t.lanes=0,Jw(e,t,n)}return Tr(e,t,n)}var rx,If,ox,ix;rx=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}};If=function(){};ox=function(e,t,n,r){var o=e.memoizedProps;if(o!==r){e=t.stateNode,Io(lr.current);var i=null;switch(n){case"input":o=Kd(e,o),r=Kd(e,r),i=[];break;case"select":o=it({},o,{value:void 0}),r=it({},r,{value:void 0}),i=[];break;case"textarea":o=Xd(e,o),r=Xd(e,r),i=[];break;default:typeof o.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Yl)}Jd(n,r);var s;n=null;for(c in o)if(!r.hasOwnProperty(c)&&o.hasOwnProperty(c)&&o[c]!=null)if(c==="style"){var a=o[c];for(s in a)a.hasOwnProperty(s)&&(n||(n={}),n[s]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(Vs.hasOwnProperty(c)?i||(i=[]):(i=i||[]).push(c,null));for(c in r){var l=r[c];if(a=o!=null?o[c]:void 0,r.hasOwnProperty(c)&&l!==a&&(l!=null||a!=null))if(c==="style")if(a){for(s in a)!a.hasOwnProperty(s)||l&&l.hasOwnProperty(s)||(n||(n={}),n[s]="");for(s in l)l.hasOwnProperty(s)&&a[s]!==l[s]&&(n||(n={}),n[s]=l[s])}else n||(i||(i=[]),i.push(c,n)),n=l;else c==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(i=i||[]).push(c,l)):c==="children"?typeof l!="string"&&typeof l!="number"||(i=i||[]).push(c,""+l):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(Vs.hasOwnProperty(c)?(l!=null&&c==="onScroll"&&Ze("scroll",e),i||a===l||(i=[])):(i=i||[]).push(c,l))}n&&(i=i||[]).push("style",n);var c=i;(t.updateQueue=c)&&(t.flags|=4)}};ix=function(e,t,n,r){n!==r&&(t.flags|=4)};function hs(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 Bt(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 cC(e,t,n){var r=t.pendingProps;switch(Tp(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Bt(t),null;case 1:return an(t.type)&&Gl(),Bt(t),null;case 3:return r=t.stateNode,Oi(),Ke(sn),Ke(Zt),Np(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Ha(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Un!==null&&(Mf(Un),Un=null))),If(e,t),Bt(t),null;case 5:Ap(t);var o=Io(ta.current);if(n=t.type,e!==null&&t.stateNode!=null)ox(e,t,n,r,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(ue(166));return Bt(t),null}if(e=Io(lr.current),Ha(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[ir]=t,r[Qs]=i,e=(t.mode&1)!==0,n){case"dialog":Ze("cancel",r),Ze("close",r);break;case"iframe":case"object":case"embed":Ze("load",r);break;case"video":case"audio":for(o=0;o<js.length;o++)Ze(js[o],r);break;case"source":Ze("error",r);break;case"img":case"image":case"link":Ze("error",r),Ze("load",r);break;case"details":Ze("toggle",r);break;case"input":hm(r,i),Ze("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},Ze("invalid",r);break;case"textarea":gm(r,i),Ze("invalid",r)}Jd(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]):Vs.hasOwnProperty(s)&&a!=null&&s==="onScroll"&&Ze("scroll",r)}switch(n){case"input":Aa(r),mm(r,i,!0);break;case"textarea":Aa(r),ym(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=Yl)}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=_0(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[ir]=t,e[Qs]=r,rx(e,t,!1,!1),t.stateNode=e;e:{switch(s=Qd(n,r),n){case"dialog":Ze("cancel",e),Ze("close",e),o=r;break;case"iframe":case"object":case"embed":Ze("load",e),o=r;break;case"video":case"audio":for(o=0;o<js.length;o++)Ze(js[o],e);o=r;break;case"source":Ze("error",e),o=r;break;case"img":case"image":case"link":Ze("error",e),Ze("load",e),o=r;break;case"details":Ze("toggle",e),o=r;break;case"input":hm(e,r),o=Kd(e,r),Ze("invalid",e);break;case"option":o=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},o=it({},r,{value:void 0}),Ze("invalid",e);break;case"textarea":gm(e,r),o=Xd(e,r),Ze("invalid",e);break;default:o=r}Jd(n,o),a=o;for(i in a)if(a.hasOwnProperty(i)){var l=a[i];i==="style"?N0(e,l):i==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&M0(e,l)):i==="children"?typeof l=="string"?(n!=="textarea"||l!=="")&&Hs(e,l):typeof l=="number"&&Hs(e,""+l):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(Vs.hasOwnProperty(i)?l!=null&&i==="onScroll"&&Ze("scroll",e):l!=null&&fp(e,i,l,s))}switch(n){case"input":Aa(e),mm(e,r,!1);break;case"textarea":Aa(e),ym(e);break;case"option":r.value!=null&&e.setAttribute("value",""+ro(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?Ci(e,!!r.multiple,i,!1):r.defaultValue!=null&&Ci(e,!!r.multiple,r.defaultValue,!0);break;default:typeof o.onClick=="function"&&(e.onclick=Yl)}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 Bt(t),null;case 6:if(e&&t.stateNode!=null)ix(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(ue(166));if(n=Io(ta.current),Io(lr.current),Ha(t)){if(r=t.stateNode,n=t.memoizedProps,r[ir]=t,(i=r.nodeValue!==n)&&(e=bn,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[ir]=t,t.stateNode=r}return Bt(t),null;case 13:if(Ke(nt),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Xe&&xn!==null&&t.mode&1&&!(t.flags&128))kw(),Ni(),t.flags|=98560,i=!1;else if(i=Ha(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(ue(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(ue(317));i[ir]=t}else Ni(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Bt(t),i=!1}else Un!==null&&(Mf(Un),Un=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||nt.current&1?xt===0&&(xt=3):Yp())),t.updateQueue!==null&&(t.flags|=4),Bt(t),null);case 4:return Oi(),If(e,t),e===null&&qs(t.stateNode.containerInfo),Bt(t),null;case 10:return Fp(t.type._context),Bt(t),null;case 17:return an(t.type)&&Gl(),Bt(t),null;case 19:if(Ke(nt),i=t.memoizedState,i===null)return Bt(t),null;if(r=(t.flags&128)!==0,s=i.rendering,s===null)if(r)hs(i,!1);else{if(xt!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(s=nu(e),s!==null){for(t.flags|=128,hs(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 Ue(nt,nt.current&1|2),t.child}e=e.sibling}i.tail!==null&&ft()>zi&&(t.flags|=128,r=!0,hs(i,!1),t.lanes=4194304)}else{if(!r)if(e=nu(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),hs(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!Xe)return Bt(t),null}else 2*ft()-i.renderingStartTime>zi&&n!==1073741824&&(t.flags|=128,r=!0,hs(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=ft(),t.sibling=null,n=nt.current,Ue(nt,r?n&1|2:n&1),t):(Bt(t),null);case 22:case 23:return Kp(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?wn&1073741824&&(Bt(t),t.subtreeFlags&6&&(t.flags|=8192)):Bt(t),null;case 24:return null;case 25:return null}throw Error(ue(156,t.tag))}function dC(e,t){switch(Tp(t),t.tag){case 1:return an(t.type)&&Gl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Oi(),Ke(sn),Ke(Zt),Np(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Ap(t),null;case 13:if(Ke(nt),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(ue(340));Ni()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ke(nt),null;case 4:return Oi(),null;case 10:return Fp(t.type._context),null;case 22:case 23:return Kp(),null;case 24:return null;default:return null}}var Ka=!1,Ht=!1,fC=typeof WeakSet=="function"?WeakSet:Set,ye=null;function wi(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){ut(e,t,r)}else n.current=null}function Tf(e,t,n){try{n()}catch(r){ut(e,t,r)}}var sg=!1;function pC(e,t){if(cf=Ul,e=cw(),Cp(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var o=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var s=0,a=-1,l=-1,c=0,f=0,p=e,m=null;t:for(;;){for(var y;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),(y=p.firstChild)!==null;)m=p,p=y;for(;;){if(p===e)break t;if(m===n&&++c===o&&(a=s),m===i&&++f===r&&(l=s),(y=p.nextSibling)!==null)break;p=m,m=p.parentNode}p=y}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(df={focusedElem:e,selectionRange:n},Ul=!1,ye=t;ye!==null;)if(t=ye,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ye=e;else for(;ye!==null;){t=ye;try{var w=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(w!==null){var x=w.memoizedProps,S=w.memoizedState,h=t.stateNode,g=h.getSnapshotBeforeUpdate(t.elementType===t.type?x:Vn(t.type,x),S);h.__reactInternalSnapshotBeforeUpdate=g}break;case 3:var v=t.stateNode.containerInfo;v.nodeType===1?v.textContent="":v.nodeType===9&&v.documentElement&&v.removeChild(v.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(ue(163))}}catch(b){ut(t,t.return,b)}if(e=t.sibling,e!==null){e.return=t.return,ye=e;break}ye=t.return}return w=sg,sg=!1,w}function Os(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&&Tf(t,n,i)}o=o.next}while(o!==r)}}function _u(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 jf(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 sx(e){var t=e.alternate;t!==null&&(e.alternate=null,sx(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[ir],delete t[Qs],delete t[hf],delete t[GE],delete t[XE])),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 ax(e){return e.tag===5||e.tag===3||e.tag===4}function ag(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||ax(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 Rf(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=Yl));else if(r!==4&&(e=e.child,e!==null))for(Rf(e,t,n),e=e.sibling;e!==null;)Rf(e,t,n),e=e.sibling}function Pf(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(Pf(e,t,n),e=e.sibling;e!==null;)Pf(e,t,n),e=e.sibling}var $t=null,Hn=!1;function Ar(e,t,n){for(n=n.child;n!==null;)lx(e,t,n),n=n.sibling}function lx(e,t,n){if(ar&&typeof ar.onCommitFiberUnmount=="function")try{ar.onCommitFiberUnmount(Cu,n)}catch{}switch(n.tag){case 5:Ht||wi(n,t);case 6:var r=$t,o=Hn;$t=null,Ar(e,t,n),$t=r,Hn=o,$t!==null&&(Hn?(e=$t,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):$t.removeChild(n.stateNode));break;case 18:$t!==null&&(Hn?(e=$t,n=n.stateNode,e.nodeType===8?Yc(e.parentNode,n):e.nodeType===1&&Yc(e,n),Ys(e)):Yc($t,n.stateNode));break;case 4:r=$t,o=Hn,$t=n.stateNode.containerInfo,Hn=!0,Ar(e,t,n),$t=r,Hn=o;break;case 0:case 11:case 14:case 15:if(!Ht&&(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)&&Tf(n,t,s),o=o.next}while(o!==r)}Ar(e,t,n);break;case 1:if(!Ht&&(wi(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){ut(n,t,a)}Ar(e,t,n);break;case 21:Ar(e,t,n);break;case 22:n.mode&1?(Ht=(r=Ht)||n.memoizedState!==null,Ar(e,t,n),Ht=r):Ar(e,t,n);break;default:Ar(e,t,n)}}function lg(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new fC),t.forEach(function(r){var o=SC.bind(null,e,r);n.has(r)||(n.add(r),r.then(o,o))})}}function Bn(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:$t=a.stateNode,Hn=!1;break e;case 3:$t=a.stateNode.containerInfo,Hn=!0;break e;case 4:$t=a.stateNode.containerInfo,Hn=!0;break e}a=a.return}if($t===null)throw Error(ue(160));lx(i,s,o),$t=null,Hn=!1;var l=o.alternate;l!==null&&(l.return=null),o.return=null}catch(c){ut(o,t,c)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)ux(t,e),t=t.sibling}function ux(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Bn(t,e),tr(e),r&4){try{Os(3,e,e.return),_u(3,e)}catch(x){ut(e,e.return,x)}try{Os(5,e,e.return)}catch(x){ut(e,e.return,x)}}break;case 1:Bn(t,e),tr(e),r&512&&n!==null&&wi(n,n.return);break;case 5:if(Bn(t,e),tr(e),r&512&&n!==null&&wi(n,n.return),e.flags&32){var o=e.stateNode;try{Hs(o,"")}catch(x){ut(e,e.return,x)}}if(r&4&&(o=e.stateNode,o!=null)){var i=e.memoizedProps,s=n!==null?n.memoizedProps:i,a=e.type,l=e.updateQueue;if(e.updateQueue=null,l!==null)try{a==="input"&&i.type==="radio"&&i.name!=null&&F0(o,i),Qd(a,s);var c=Qd(a,i);for(s=0;s<l.length;s+=2){var f=l[s],p=l[s+1];f==="style"?N0(o,p):f==="dangerouslySetInnerHTML"?M0(o,p):f==="children"?Hs(o,p):fp(o,f,p,c)}switch(a){case"input":Yd(o,i);break;case"textarea":$0(o,i);break;case"select":var m=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!i.multiple;var y=i.value;y!=null?Ci(o,!!i.multiple,y,!1):m!==!!i.multiple&&(i.defaultValue!=null?Ci(o,!!i.multiple,i.defaultValue,!0):Ci(o,!!i.multiple,i.multiple?[]:"",!1))}o[Qs]=i}catch(x){ut(e,e.return,x)}}break;case 6:if(Bn(t,e),tr(e),r&4){if(e.stateNode===null)throw Error(ue(162));o=e.stateNode,i=e.memoizedProps;try{o.nodeValue=i}catch(x){ut(e,e.return,x)}}break;case 3:if(Bn(t,e),tr(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Ys(t.containerInfo)}catch(x){ut(e,e.return,x)}break;case 4:Bn(t,e),tr(e);break;case 13:Bn(t,e),tr(e),o=e.child,o.flags&8192&&(i=o.memoizedState!==null,o.stateNode.isHidden=i,!i||o.alternate!==null&&o.alternate.memoizedState!==null||(Up=ft())),r&4&&lg(e);break;case 22:if(f=n!==null&&n.memoizedState!==null,e.mode&1?(Ht=(c=Ht)||f,Bn(t,e),Ht=c):Bn(t,e),tr(e),r&8192){if(c=e.memoizedState!==null,(e.stateNode.isHidden=c)&&!f&&e.mode&1)for(ye=e,f=e.child;f!==null;){for(p=ye=f;ye!==null;){switch(m=ye,y=m.child,m.tag){case 0:case 11:case 14:case 15:Os(4,m,m.return);break;case 1:wi(m,m.return);var w=m.stateNode;if(typeof w.componentWillUnmount=="function"){r=m,n=m.return;try{t=r,w.props=t.memoizedProps,w.state=t.memoizedState,w.componentWillUnmount()}catch(x){ut(r,n,x)}}break;case 5:wi(m,m.return);break;case 22:if(m.memoizedState!==null){cg(p);continue}}y!==null?(y.return=m,ye=y):cg(p)}f=f.sibling}e:for(f=null,p=e;;){if(p.tag===5){if(f===null){f=p;try{o=p.stateNode,c?(i=o.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(a=p.stateNode,l=p.memoizedProps.style,s=l!=null&&l.hasOwnProperty("display")?l.display:null,a.style.display=A0("display",s))}catch(x){ut(e,e.return,x)}}}else if(p.tag===6){if(f===null)try{p.stateNode.nodeValue=c?"":p.memoizedProps}catch(x){ut(e,e.return,x)}}else if((p.tag!==22&&p.tag!==23||p.memoizedState===null||p===e)&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===e)break e;for(;p.sibling===null;){if(p.return===null||p.return===e)break e;f===p&&(f=null),p=p.return}f===p&&(f=null),p.sibling.return=p.return,p=p.sibling}}break;case 19:Bn(t,e),tr(e),r&4&&lg(e);break;case 21:break;default:Bn(t,e),tr(e)}}function tr(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(ax(n)){var r=n;break e}n=n.return}throw Error(ue(160))}switch(r.tag){case 5:var o=r.stateNode;r.flags&32&&(Hs(o,""),r.flags&=-33);var i=ag(e);Pf(e,i,o);break;case 3:case 4:var s=r.stateNode.containerInfo,a=ag(e);Rf(e,a,s);break;default:throw Error(ue(161))}}catch(l){ut(e,e.return,l)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function hC(e,t,n){ye=e,cx(e)}function cx(e,t,n){for(var r=(e.mode&1)!==0;ye!==null;){var o=ye,i=o.child;if(o.tag===22&&r){var s=o.memoizedState!==null||Ka;if(!s){var a=o.alternate,l=a!==null&&a.memoizedState!==null||Ht;a=Ka;var c=Ht;if(Ka=s,(Ht=l)&&!c)for(ye=o;ye!==null;)s=ye,l=s.child,s.tag===22&&s.memoizedState!==null?dg(o):l!==null?(l.return=s,ye=l):dg(o);for(;i!==null;)ye=i,cx(i),i=i.sibling;ye=o,Ka=a,Ht=c}ug(e)}else o.subtreeFlags&8772&&i!==null?(i.return=o,ye=i):ug(e)}}function ug(e){for(;ye!==null;){var t=ye;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Ht||_u(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!Ht)if(n===null)r.componentDidMount();else{var o=t.elementType===t.type?n.memoizedProps:Vn(t.type,n.memoizedProps);r.componentDidUpdate(o,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&Km(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}Km(t,s,n)}break;case 5:var a=t.stateNode;if(n===null&&t.flags&4){n=a;var l=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&n.focus();break;case"img":l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var c=t.alternate;if(c!==null){var f=c.memoizedState;if(f!==null){var p=f.dehydrated;p!==null&&Ys(p)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(ue(163))}Ht||t.flags&512&&jf(t)}catch(m){ut(t,t.return,m)}}if(t===e){ye=null;break}if(n=t.sibling,n!==null){n.return=t.return,ye=n;break}ye=t.return}}function cg(e){for(;ye!==null;){var t=ye;if(t===e){ye=null;break}var n=t.sibling;if(n!==null){n.return=t.return,ye=n;break}ye=t.return}}function dg(e){for(;ye!==null;){var t=ye;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{_u(4,t)}catch(l){ut(t,n,l)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var o=t.return;try{r.componentDidMount()}catch(l){ut(t,o,l)}}var i=t.return;try{jf(t)}catch(l){ut(t,i,l)}break;case 5:var s=t.return;try{jf(t)}catch(l){ut(t,s,l)}}}catch(l){ut(t,t.return,l)}if(t===e){ye=null;break}var a=t.sibling;if(a!==null){a.return=t.return,ye=a;break}ye=t.return}}var mC=Math.ceil,iu=jr.ReactCurrentDispatcher,Vp=jr.ReactCurrentOwner,Ln=jr.ReactCurrentBatchConfig,Ae=0,Tt=null,yt=null,_t=0,wn=0,xi=lo(0),xt=0,ia=null,Ao=0,Mu=0,Hp=0,Ds=null,rn=null,Up=0,zi=1/0,yr=null,su=!1,Ff=null,Qr=null,Ya=!1,Kr=null,au=0,zs=0,$f=null,Fl=-1,$l=0;function Xt(){return Ae&6?ft():Fl!==-1?Fl:Fl=ft()}function eo(e){return e.mode&1?Ae&2&&_t!==0?_t&-_t:JE.transition!==null?($l===0&&($l=Y0()),$l):(e=De,e!==0||(e=window.event,e=e===void 0?16:tw(e.type)),e):1}function Yn(e,t,n,r){if(50<zs)throw zs=0,$f=null,Error(ue(185));ha(e,n,r),(!(Ae&2)||e!==Tt)&&(e===Tt&&(!(Ae&2)&&(Mu|=n),xt===4&&Hr(e,_t)),ln(e,r),n===1&&Ae===0&&!(t.mode&1)&&(zi=ft()+500,Pu&&uo()))}function ln(e,t){var n=e.callbackNode;Jk(e,t);var r=Hl(e,e===Tt?_t:0);if(r===0)n!==null&&xm(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&xm(n),t===1)e.tag===0?qE(fg.bind(null,e)):xw(fg.bind(null,e)),KE(function(){!(Ae&6)&&uo()}),n=null;else{switch(G0(r)){case 1:n=yp;break;case 4:n=Z0;break;case 16:n=Vl;break;case 536870912:n=K0;break;default:n=Vl}n=vx(n,dx.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function dx(e,t){if(Fl=-1,$l=0,Ae&6)throw Error(ue(327));var n=e.callbackNode;if(Pi()&&e.callbackNode!==n)return null;var r=Hl(e,e===Tt?_t:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=lu(e,r);else{t=r;var o=Ae;Ae|=2;var i=px();(Tt!==e||_t!==t)&&(yr=null,zi=ft()+500,Ro(e,t));do try{vC();break}catch(a){fx(e,a)}while(!0);Pp(),iu.current=i,Ae=o,yt!==null?t=0:(Tt=null,_t=0,t=xt)}if(t!==0){if(t===2&&(o=of(e),o!==0&&(r=o,t=_f(e,o))),t===1)throw n=ia,Ro(e,0),Hr(e,r),ln(e,ft()),n;if(t===6)Hr(e,r);else{if(o=e.current.alternate,!(r&30)&&!gC(o)&&(t=lu(e,r),t===2&&(i=of(e),i!==0&&(r=i,t=_f(e,i))),t===1))throw n=ia,Ro(e,0),Hr(e,r),ln(e,ft()),n;switch(e.finishedWork=o,e.finishedLanes=r,t){case 0:case 1:throw Error(ue(345));case 2:ko(e,rn,yr);break;case 3:if(Hr(e,r),(r&130023424)===r&&(t=Up+500-ft(),10<t)){if(Hl(e,0)!==0)break;if(o=e.suspendedLanes,(o&r)!==r){Xt(),e.pingedLanes|=e.suspendedLanes&o;break}e.timeoutHandle=pf(ko.bind(null,e,rn,yr),t);break}ko(e,rn,yr);break;case 4:if(Hr(e,r),(r&4194240)===r)break;for(t=e.eventTimes,o=-1;0<r;){var s=31-Kn(r);i=1<<s,s=t[s],s>o&&(o=s),r&=~i}if(r=o,r=ft()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*mC(r/1960))-r,10<r){e.timeoutHandle=pf(ko.bind(null,e,rn,yr),r);break}ko(e,rn,yr);break;case 5:ko(e,rn,yr);break;default:throw Error(ue(329))}}}return ln(e,ft()),e.callbackNode===n?dx.bind(null,e):null}function _f(e,t){var n=Ds;return e.current.memoizedState.isDehydrated&&(Ro(e,t).flags|=256),e=lu(e,t),e!==2&&(t=rn,rn=n,t!==null&&Mf(t)),e}function Mf(e){rn===null?rn=e:rn.push.apply(rn,e)}function gC(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(!Gn(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 Hr(e,t){for(t&=~Hp,t&=~Mu,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Kn(t),r=1<<n;e[n]=-1,t&=~r}}function fg(e){if(Ae&6)throw Error(ue(327));Pi();var t=Hl(e,0);if(!(t&1))return ln(e,ft()),null;var n=lu(e,t);if(e.tag!==0&&n===2){var r=of(e);r!==0&&(t=r,n=_f(e,r))}if(n===1)throw n=ia,Ro(e,0),Hr(e,t),ln(e,ft()),n;if(n===6)throw Error(ue(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,ko(e,rn,yr),ln(e,ft()),null}function Zp(e,t){var n=Ae;Ae|=1;try{return e(t)}finally{Ae=n,Ae===0&&(zi=ft()+500,Pu&&uo())}}function No(e){Kr!==null&&Kr.tag===0&&!(Ae&6)&&Pi();var t=Ae;Ae|=1;var n=Ln.transition,r=De;try{if(Ln.transition=null,De=1,e)return e()}finally{De=r,Ln.transition=n,Ae=t,!(Ae&6)&&uo()}}function Kp(){wn=xi.current,Ke(xi)}function Ro(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,ZE(n)),yt!==null)for(n=yt.return;n!==null;){var r=n;switch(Tp(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Gl();break;case 3:Oi(),Ke(sn),Ke(Zt),Np();break;case 5:Ap(r);break;case 4:Oi();break;case 13:Ke(nt);break;case 19:Ke(nt);break;case 10:Fp(r.type._context);break;case 22:case 23:Kp()}n=n.return}if(Tt=e,yt=e=to(e.current,null),_t=wn=t,xt=0,ia=null,Hp=Mu=Ao=0,rn=Ds=null,Co!==null){for(t=0;t<Co.length;t++)if(n=Co[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}Co=null}return e}function fx(e,t){do{var n=yt;try{if(Pp(),jl.current=ou,ru){for(var r=ot.memoizedState;r!==null;){var o=r.queue;o!==null&&(o.pending=null),r=r.next}ru=!1}if(Mo=0,It=wt=ot=null,Ls=!1,na=0,Vp.current=null,n===null||n.return===null){xt=1,ia=t,yt=null;break}e:{var i=e,s=n.return,a=n,l=t;if(t=_t,a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var c=l,f=a,p=f.tag;if(!(f.mode&1)&&(p===0||p===11||p===15)){var m=f.alternate;m?(f.updateQueue=m.updateQueue,f.memoizedState=m.memoizedState,f.lanes=m.lanes):(f.updateQueue=null,f.memoizedState=null)}var y=Qm(s);if(y!==null){y.flags&=-257,eg(y,s,a,i,t),y.mode&1&&Jm(i,c,t),t=y,l=c;var w=t.updateQueue;if(w===null){var x=new Set;x.add(l),t.updateQueue=x}else w.add(l);break e}else{if(!(t&1)){Jm(i,c,t),Yp();break e}l=Error(ue(426))}}else if(Xe&&a.mode&1){var S=Qm(s);if(S!==null){!(S.flags&65536)&&(S.flags|=256),eg(S,s,a,i,t),jp(Di(l,a));break e}}i=l=Di(l,a),xt!==4&&(xt=2),Ds===null?Ds=[i]:Ds.push(i),i=s;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var h=Gw(i,l,t);Zm(i,h);break e;case 1:a=l;var g=i.type,v=i.stateNode;if(!(i.flags&128)&&(typeof g.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(Qr===null||!Qr.has(v)))){i.flags|=65536,t&=-t,i.lanes|=t;var b=Xw(i,a,t);Zm(i,b);break e}}i=i.return}while(i!==null)}mx(n)}catch(k){t=k,yt===n&&n!==null&&(yt=n=n.return);continue}break}while(!0)}function px(){var e=iu.current;return iu.current=ou,e===null?ou:e}function Yp(){(xt===0||xt===3||xt===2)&&(xt=4),Tt===null||!(Ao&268435455)&&!(Mu&268435455)||Hr(Tt,_t)}function lu(e,t){var n=Ae;Ae|=2;var r=px();(Tt!==e||_t!==t)&&(yr=null,Ro(e,t));do try{yC();break}catch(o){fx(e,o)}while(!0);if(Pp(),Ae=n,iu.current=r,yt!==null)throw Error(ue(261));return Tt=null,_t=0,xt}function yC(){for(;yt!==null;)hx(yt)}function vC(){for(;yt!==null&&!Vk();)hx(yt)}function hx(e){var t=yx(e.alternate,e,wn);e.memoizedProps=e.pendingProps,t===null?mx(e):yt=t,Vp.current=null}function mx(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=dC(n,t),n!==null){n.flags&=32767,yt=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{xt=6,yt=null;return}}else if(n=cC(n,t,wn),n!==null){yt=n;return}if(t=t.sibling,t!==null){yt=t;return}yt=t=e}while(t!==null);xt===0&&(xt=5)}function ko(e,t,n){var r=De,o=Ln.transition;try{Ln.transition=null,De=1,wC(e,t,n,r)}finally{Ln.transition=o,De=r}return null}function wC(e,t,n,r){do Pi();while(Kr!==null);if(Ae&6)throw Error(ue(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(ue(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(Qk(e,i),e===Tt&&(yt=Tt=null,_t=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Ya||(Ya=!0,vx(Vl,function(){return Pi(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=Ln.transition,Ln.transition=null;var s=De;De=1;var a=Ae;Ae|=4,Vp.current=null,pC(e,n),ux(n,e),DE(df),Ul=!!cf,df=cf=null,e.current=n,hC(n),Hk(),Ae=a,De=s,Ln.transition=i}else e.current=n;if(Ya&&(Ya=!1,Kr=e,au=o),i=e.pendingLanes,i===0&&(Qr=null),Kk(n.stateNode),ln(e,ft()),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(su)throw su=!1,e=Ff,Ff=null,e;return au&1&&e.tag!==0&&Pi(),i=e.pendingLanes,i&1?e===$f?zs++:(zs=0,$f=e):zs=0,uo(),null}function Pi(){if(Kr!==null){var e=G0(au),t=Ln.transition,n=De;try{if(Ln.transition=null,De=16>e?16:e,Kr===null)var r=!1;else{if(e=Kr,Kr=null,au=0,Ae&6)throw Error(ue(331));var o=Ae;for(Ae|=4,ye=e.current;ye!==null;){var i=ye,s=i.child;if(ye.flags&16){var a=i.deletions;if(a!==null){for(var l=0;l<a.length;l++){var c=a[l];for(ye=c;ye!==null;){var f=ye;switch(f.tag){case 0:case 11:case 15:Os(8,f,i)}var p=f.child;if(p!==null)p.return=f,ye=p;else for(;ye!==null;){f=ye;var m=f.sibling,y=f.return;if(sx(f),f===c){ye=null;break}if(m!==null){m.return=y,ye=m;break}ye=y}}}var w=i.alternate;if(w!==null){var x=w.child;if(x!==null){w.child=null;do{var S=x.sibling;x.sibling=null,x=S}while(x!==null)}}ye=i}}if(i.subtreeFlags&2064&&s!==null)s.return=i,ye=s;else e:for(;ye!==null;){if(i=ye,i.flags&2048)switch(i.tag){case 0:case 11:case 15:Os(9,i,i.return)}var h=i.sibling;if(h!==null){h.return=i.return,ye=h;break e}ye=i.return}}var g=e.current;for(ye=g;ye!==null;){s=ye;var v=s.child;if(s.subtreeFlags&2064&&v!==null)v.return=s,ye=v;else e:for(s=g;ye!==null;){if(a=ye,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:_u(9,a)}}catch(k){ut(a,a.return,k)}if(a===s){ye=null;break e}var b=a.sibling;if(b!==null){b.return=a.return,ye=b;break e}ye=a.return}}if(Ae=o,uo(),ar&&typeof ar.onPostCommitFiberRoot=="function")try{ar.onPostCommitFiberRoot(Cu,e)}catch{}r=!0}return r}finally{De=n,Ln.transition=t}}return!1}function pg(e,t,n){t=Di(n,t),t=Gw(e,t,1),e=Jr(e,t,1),t=Xt(),e!==null&&(ha(e,1,t),ln(e,t))}function ut(e,t,n){if(e.tag===3)pg(e,e,n);else for(;t!==null;){if(t.tag===3){pg(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Qr===null||!Qr.has(r))){e=Di(n,e),e=Xw(t,e,1),t=Jr(t,e,1),e=Xt(),t!==null&&(ha(t,1,e),ln(t,e));break}}t=t.return}}function xC(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Xt(),e.pingedLanes|=e.suspendedLanes&n,Tt===e&&(_t&n)===n&&(xt===4||xt===3&&(_t&130023424)===_t&&500>ft()-Up?Ro(e,0):Hp|=n),ln(e,t)}function gx(e,t){t===0&&(e.mode&1?(t=Oa,Oa<<=1,!(Oa&130023424)&&(Oa=4194304)):t=1);var n=Xt();e=Ir(e,t),e!==null&&(ha(e,t,n),ln(e,n))}function bC(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),gx(e,n)}function SC(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(ue(314))}r!==null&&r.delete(t),gx(e,n)}var yx;yx=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||sn.current)on=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return on=!1,uC(e,t,n);on=!!(e.flags&131072)}else on=!1,Xe&&t.flags&1048576&&bw(t,Jl,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Pl(e,t),e=t.pendingProps;var o=Ai(t,Zt.current);Ri(t,n),o=Op(null,t,r,e,o,n);var i=Dp();return t.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,an(r)?(i=!0,Xl(t)):i=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,_p(t),o.updater=$u,t.stateNode=o,o._reactInternals=t,xf(t,r,e,n),t=kf(null,t,r,!0,i,n)):(t.tag=0,Xe&&i&&Ip(t),Gt(null,t,o,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Pl(e,t),e=t.pendingProps,o=r._init,r=o(r._payload),t.type=r,o=t.tag=EC(r),e=Vn(r,e),o){case 0:t=Sf(null,t,r,e,n);break e;case 1:t=rg(null,t,r,e,n);break e;case 11:t=tg(null,t,r,e,n);break e;case 14:t=ng(null,t,r,Vn(r.type,e),n);break e}throw Error(ue(306,r,""))}return t;case 0:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Vn(r,o),Sf(e,t,r,o,n);case 1:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Vn(r,o),rg(e,t,r,o,n);case 3:e:{if(ex(t),e===null)throw Error(ue(387));r=t.pendingProps,i=t.memoizedState,o=i.element,Tw(e,t),tu(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=Di(Error(ue(423)),t),t=og(e,t,r,n,o);break e}else if(r!==o){o=Di(Error(ue(424)),t),t=og(e,t,r,n,o);break e}else for(xn=qr(t.stateNode.containerInfo.firstChild),bn=t,Xe=!0,Un=null,n=Cw(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Ni(),r===o){t=Tr(e,t,n);break e}Gt(e,t,r,n)}t=t.child}return t;case 5:return jw(t),e===null&&yf(t),r=t.type,o=t.pendingProps,i=e!==null?e.memoizedProps:null,s=o.children,ff(r,o)?s=null:i!==null&&ff(r,i)&&(t.flags|=32),Qw(e,t),Gt(e,t,s,n),t.child;case 6:return e===null&&yf(t),null;case 13:return tx(e,t,n);case 4:return Mp(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Li(t,null,r,n):Gt(e,t,r,n),t.child;case 11:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Vn(r,o),tg(e,t,r,o,n);case 7:return Gt(e,t,t.pendingProps,n),t.child;case 8:return Gt(e,t,t.pendingProps.children,n),t.child;case 12:return Gt(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,Ue(Ql,r._currentValue),r._currentValue=s,i!==null)if(Gn(i.value,s)){if(i.children===o.children&&!sn.current){t=Tr(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=kr(-1,n&-n),l.tag=2;var c=i.updateQueue;if(c!==null){c=c.shared;var f=c.pending;f===null?l.next=l:(l.next=f.next,f.next=l),c.pending=l}}i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),vf(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(ue(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),vf(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}Gt(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,r=t.pendingProps.children,Ri(t,n),o=On(o),r=r(o),t.flags|=1,Gt(e,t,r,n),t.child;case 14:return r=t.type,o=Vn(r,t.pendingProps),o=Vn(r.type,o),ng(e,t,r,o,n);case 15:return qw(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Vn(r,o),Pl(e,t),t.tag=1,an(r)?(e=!0,Xl(t)):e=!1,Ri(t,n),Yw(t,r,o),xf(t,r,o,n),kf(null,t,r,!0,e,n);case 19:return nx(e,t,n);case 22:return Jw(e,t,n)}throw Error(ue(156,t.tag))};function vx(e,t){return U0(e,t)}function kC(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 An(e,t,n,r){return new kC(e,t,n,r)}function Gp(e){return e=e.prototype,!(!e||!e.isReactComponent)}function EC(e){if(typeof e=="function")return Gp(e)?1:0;if(e!=null){if(e=e.$$typeof,e===hp)return 11;if(e===mp)return 14}return 2}function to(e,t){var n=e.alternate;return n===null?(n=An(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 _l(e,t,n,r,o,i){var s=2;if(r=e,typeof e=="function")Gp(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case ci:return Po(n.children,o,i,t);case pp:s=8,o|=8;break;case Vd:return e=An(12,n,t,o|2),e.elementType=Vd,e.lanes=i,e;case Hd:return e=An(13,n,t,o),e.elementType=Hd,e.lanes=i,e;case Ud:return e=An(19,n,t,o),e.elementType=Ud,e.lanes=i,e;case j0:return Au(n,o,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case I0:s=10;break e;case T0:s=9;break e;case hp:s=11;break e;case mp:s=14;break e;case Br:s=16,r=null;break e}throw Error(ue(130,e==null?e:typeof e,""))}return t=An(s,n,t,o),t.elementType=e,t.type=r,t.lanes=i,t}function Po(e,t,n,r){return e=An(7,e,r,t),e.lanes=n,e}function Au(e,t,n,r){return e=An(22,e,r,t),e.elementType=j0,e.lanes=n,e.stateNode={isHidden:!1},e}function nd(e,t,n){return e=An(6,e,null,t),e.lanes=n,e}function rd(e,t,n){return t=An(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function CC(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=Lc(0),this.expirationTimes=Lc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Lc(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function Xp(e,t,n,r,o,i,s,a,l){return e=new CC(e,t,n,a,l),t===1?(t=1,i===!0&&(t|=8)):t=0,i=An(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},_p(i),e}function IC(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:ui,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function wx(e){if(!e)return oo;e=e._reactInternals;e:{if(Bo(e)!==e||e.tag!==1)throw Error(ue(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(an(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(ue(171))}if(e.tag===1){var n=e.type;if(an(n))return ww(e,n,t)}return t}function xx(e,t,n,r,o,i,s,a,l){return e=Xp(n,r,!0,e,o,i,s,a,l),e.context=wx(null),n=e.current,r=Xt(),o=eo(n),i=kr(r,o),i.callback=t??null,Jr(n,i,o),e.current.lanes=o,ha(e,o,r),ln(e,r),e}function Nu(e,t,n,r){var o=t.current,i=Xt(),s=eo(o);return n=wx(n),t.context===null?t.context=n:t.pendingContext=n,t=kr(i,s),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Jr(o,t,s),e!==null&&(Yn(e,o,s,i),Tl(e,o,s)),s}function uu(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 hg(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function qp(e,t){hg(e,t),(e=e.alternate)&&hg(e,t)}function TC(){return null}var bx=typeof reportError=="function"?reportError:function(e){console.error(e)};function Jp(e){this._internalRoot=e}Lu.prototype.render=Jp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(ue(409));Nu(e,t,null,null)};Lu.prototype.unmount=Jp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;No(function(){Nu(null,e,null,null)}),t[Cr]=null}};function Lu(e){this._internalRoot=e}Lu.prototype.unstable_scheduleHydration=function(e){if(e){var t=J0();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Vr.length&&t!==0&&t<Vr[n].priority;n++);Vr.splice(n,0,e),n===0&&ew(e)}};function Qp(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Ou(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function mg(){}function jC(e,t,n,r,o){if(o){if(typeof r=="function"){var i=r;r=function(){var c=uu(s);i.call(c)}}var s=xx(t,r,e,0,null,!1,!1,"",mg);return e._reactRootContainer=s,e[Cr]=s.current,qs(e.nodeType===8?e.parentNode:e),No(),s}for(;o=e.lastChild;)e.removeChild(o);if(typeof r=="function"){var a=r;r=function(){var c=uu(l);a.call(c)}}var l=Xp(e,0,!1,null,null,!1,!1,"",mg);return e._reactRootContainer=l,e[Cr]=l.current,qs(e.nodeType===8?e.parentNode:e),No(function(){Nu(t,l,n,r)}),l}function Du(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=uu(s);a.call(l)}}Nu(t,s,e,o)}else s=jC(n,t,e,o,r);return uu(s)}X0=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Ts(t.pendingLanes);n!==0&&(vp(t,n|1),ln(t,ft()),!(Ae&6)&&(zi=ft()+500,uo()))}break;case 13:No(function(){var r=Ir(e,1);if(r!==null){var o=Xt();Yn(r,e,1,o)}}),qp(e,1)}};wp=function(e){if(e.tag===13){var t=Ir(e,134217728);if(t!==null){var n=Xt();Yn(t,e,134217728,n)}qp(e,134217728)}};q0=function(e){if(e.tag===13){var t=eo(e),n=Ir(e,t);if(n!==null){var r=Xt();Yn(n,e,t,r)}qp(e,t)}};J0=function(){return De};Q0=function(e,t){var n=De;try{return De=e,t()}finally{De=n}};tf=function(e,t,n){switch(t){case"input":if(Yd(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=Ru(r);if(!o)throw Error(ue(90));P0(r),Yd(r,o)}}}break;case"textarea":$0(e,n);break;case"select":t=n.value,t!=null&&Ci(e,!!n.multiple,t,!1)}};D0=Zp;z0=No;var RC={usingClientEntryPoint:!1,Events:[ga,hi,Ru,L0,O0,Zp]},ms={findFiberByHostInstance:Eo,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},PC={bundleType:ms.bundleType,version:ms.version,rendererPackageName:ms.rendererPackageName,rendererConfig:ms.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:jr.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=V0(e),e===null?null:e.stateNode},findFiberByHostInstance:ms.findFiberByHostInstance||TC,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 Ga=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ga.isDisabled&&Ga.supportsFiber)try{Cu=Ga.inject(PC),ar=Ga}catch{}}En.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=RC;En.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Qp(t))throw Error(ue(200));return IC(e,t,null,n)};En.createRoot=function(e,t){if(!Qp(e))throw Error(ue(299));var n=!1,r="",o=bx;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=Xp(e,1,!1,null,null,n,!1,r,o),e[Cr]=t.current,qs(e.nodeType===8?e.parentNode:e),new Jp(t)};En.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(ue(188)):(e=Object.keys(e).join(","),Error(ue(268,e)));return e=V0(t),e=e===null?null:e.stateNode,e};En.flushSync=function(e){return No(e)};En.hydrate=function(e,t,n){if(!Ou(t))throw Error(ue(200));return Du(null,e,t,!0,n)};En.hydrateRoot=function(e,t,n){if(!Qp(e))throw Error(ue(405));var r=n!=null&&n.hydratedSources||null,o=!1,i="",s=bx;if(n!=null&&(n.unstable_strictMode===!0&&(o=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=xx(t,null,e,1,n??null,o,!1,i,s),e[Cr]=t.current,qs(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)};En.render=function(e,t,n){if(!Ou(t))throw Error(ue(200));return Du(null,e,t,!1,n)};En.unmountComponentAtNode=function(e){if(!Ou(e))throw Error(ue(40));return e._reactRootContainer?(No(function(){Du(null,null,e,!1,function(){e._reactRootContainer=null,e[Cr]=null})}),!0):!1};En.unstable_batchedUpdates=Zp;En.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Ou(n))throw Error(ue(200));if(e==null||e._reactInternals===void 0)throw Error(ue(38));return Du(e,t,n,!1,r)};En.version="18.3.1-next-f1338f8080-20240426";function Sx(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Sx)}catch(e){console.error(e)}}Sx(),S0.exports=En;var Af=S0.exports,gg=Af;Bd.createRoot=gg.createRoot,Bd.hydrateRoot=gg.hydrateRoot;var FC=Object.defineProperty,kx=(e,t)=>{for(var n in t)FC(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 Wo=d.createContext(!1),Nf=({children:e})=>u.jsx(Wo.Provider,{value:!0,children:e}),Ex=d.createContext({setError:()=>{},clearError:()=>{}}),yg=()=>{try{return typeof __webpack_module__>"u"?null:__webpack_module__.hot??null}catch{return null}};class $C extends he.Component{constructor(){super(...arguments);Oe(this,"state",{hasError:!1});Oe(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=yg();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=yg();r&&r.removeStatusHandler(n)}render(){return this.state.hasError?null:this.props.children}}var Ki=d.createContext({compositions:[],folders:[],currentCompositionMetadata:null,canvasContent:null}),va=d.createContext({registerComposition:()=>{},unregisterComposition:()=>{},registerFolder:()=>{},unregisterFolder:()=>{},setCanvasContent:()=>{},onlyRenderComposition:null}),wa=d.createContext({getNonce:()=>0}),Ml=0;try{typeof __webpack_module__<"u"&&__webpack_module__.hot&&__webpack_module__.hot.addStatusHandler(e=>{e==="idle"&&Ml++})}catch{}var zu=()=>{const t=d.useContext(wa).getNonce(),n=d.useRef(t);n.current=t;const r=d.useRef([[Ml,t]]),o=d.useCallback(()=>(Ml!==r.current[r.current.length-1][0]&&(r.current=[...r.current,[Ml,n.current]]),r.current),[r]);return d.useMemo(()=>({get:o}),[o])};function Yi(e){return!!e}var Cx=()=>/^([a-zA-Z0-9-\u4E00-\u9FFF])+$/g,Ix=e=>e.match(Cx()),_C=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(!Ix(e))throw new Error(`Folder name can only contain a-z, A-Z, 0-9 and -. You passed ${e}`)},MC=`Folder name must match ${String(Cx())}`,Lf=d.createContext({folderName:null,parentName:null}),AC=e=>{const{name:t,children:n}=e,r=d.useContext(Lf),{registerFolder:o,unregisterFolder:i}=d.useContext(va),s=zu(),a=e.stack??null;_C(t);const l=[r.parentName,r.folderName].filter(Yi),c=l.length===0?null:l.join("/"),f=d.useMemo(()=>({folderName:t,parentName:c}),[t,c]);return d.useEffect(()=>(o(t,c,s.get(),a),()=>{i(t,c)}),[t,r.folderName,c,o,i,s,a]),u.jsx(Lf.Provider,{value:f,children:n})};function vg(){return["NOD","E_EN","V"].join("")}var wg=()=>["e","nv"].join(""),Nn=()=>{const e=typeof window<"u"&&window.remotion_isPlayer,t=typeof window<"u"&&typeof window.process<"u"&&typeof window.process.env<"u"&&(window.process[wg()][vg()]==="test"||window.process[wg()][vg()]==="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}},Of="remotion-date:",sa="remotion-file:",NC=({data:e,indent:t,staticBase:n})=>{let r=!1,o=!1,i=!1,s=!1;try{return{serializedString:JSON.stringify(e,function(l,c){const f=this[l];return f instanceof Date?(r=!0,`${Of}${f.toISOString()}`):f instanceof Map?(i=!0,c):f instanceof Set?(s=!0,c):typeof f=="string"&&n!==null&&f.startsWith(n)?(o=!0,`${sa}${f.replace(n+"/","")}`):c},t),customDateUsed:r,customFileUsed:o,mapUsed:i,setUsed:s}}catch(a){throw new Error("Could not serialize the passed input props to JSON: "+a.message)}},Tx=e=>JSON.parse(e,(t,n)=>typeof n=="string"&&n.startsWith(Of)?new Date(n.replace(Of,"")):typeof n=="string"&&n.startsWith(sa)?`${window.remotion_staticBase}/${n.replace(sa,"")}`:n),LC=e=>Tx(NC({data:e,indent:2,staticBase:window.remotion_staticBase}).serializedString),Df=e=>Nn().isStudio?LC(e):e,jx=d.createContext(!1),OC=({children:e})=>u.jsx(jx.Provider,{value:!0,children:e}),eh=()=>d.useContext(jx),Nr=({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}`))},DC=(e,t)=>{const{style:n,...r}=e,o=d.useMemo(()=>({position:"absolute",top:Nr({className:r.className,classPrefix:["top-","inset-"],type:"prefix"})?void 0:0,left:Nr({className:r.className,classPrefix:["left-","inset-"],type:"prefix"})?void 0:0,right:Nr({className:r.className,classPrefix:["right-","inset-"],type:"prefix"})?void 0:0,bottom:Nr({className:r.className,classPrefix:["bottom-","inset-"],type:"prefix"})?void 0:0,width:Nr({className:r.className,classPrefix:["w-"],type:"prefix"})?void 0:"100%",height:Nr({className:r.className,classPrefix:["h-"],type:"prefix"})?void 0:"100%",display:Nr({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:Nr({className:r.className,classPrefix:["flex-row","flex-col","flex-row-reverse","flex-col-reverse"],type:"exact"})?void 0:"column",...n}),[r.className,n]);return u.jsx("div",{ref:t,style:o,...r})},kn=d.forwardRef(DC),zC={transform:"rotate(90deg)"},xg=40,BC={color:"white",fontSize:14,fontFamily:"sans-serif"},WC={justifyContent:"center",alignItems:"center"},VC=()=>u.jsxs(kn,{style:WC,id:"remotion-comp-loading",children:[u.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
+ `}),u.jsx("svg",{width:xg,height:xg,viewBox:"-100 -100 400 400",style:zC,children:u.jsx("path",{fill:"#555",stroke:"#555",strokeWidth:"100",strokeLinejoin:"round",d:"M 2 172 a 196 100 0 0 0 195 5 A 196 240 0 0 0 100 2.259 A 196 240 0 0 0 2 172 z"})}),u.jsxs("p",{style:BC,children:["Resolving ","<Suspense>","..."]})]}),hn=null,zf=()=>{if(!hn){if(typeof document>"u")throw new Error("Tried to call an API that only works in the browser from outside the browser");hn=document.createElement("div"),hn.style.position="absolute",hn.style.top="0px",hn.style.left="0px",hn.style.right="0px",hn.style.bottom="0px",hn.style.width="100%",hn.style.height="100%",hn.style.display="flex",hn.style.flexDirection="column";const e=document.createElement("div");e.style.position="fixed",e.style.top="-999999px",e.appendChild(hn),document.body.appendChild(e)}return hn},Bf=()=>"remotion_inputPropsOverride"+window.location.origin,Rx=()=>{if(typeof localStorage>"u")return null;const e=localStorage.getItem(Bf());return e?JSON.parse(e):null},HC=e=>{if(!(typeof localStorage>"u")){if(e===null){localStorage.removeItem(Bf());return}localStorage.setItem(Bf(),JSON.stringify(e))}},bg=!1,UC=()=>{bg||(bg=!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()"))},ZC=()=>{if(typeof window>"u")return UC(),{};if(Nn().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=Rx();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?Tx(t):{}},th=d.createContext({props:{},updateProps:()=>{throw new Error("Not implemented")}}),KC=he.createRef(),Px=({children:e})=>{const[t,n]=he.useState({}),r=d.useCallback(({defaultProps:i,id:s,newProps:a})=>{n(l=>({...l,[s]:typeof a=="function"?a(l[s]??i):a}))},[]),o=d.useMemo(()=>({props:t,updateProps:r}),[t,r]);return u.jsx(th.Provider,{value:o,children:e})},Fx=he.createContext(null),pt=()=>{const e=d.useContext(Fx),[t]=d.useState(()=>Nn());return e??t};function cu(e,t,n){if(typeof e!="number")throw new Error(`The "${t}" prop ${n} must be a number, but you passed a value of type ${typeof e}`);if(isNaN(e))throw new TypeError(`The "${t}" prop ${n} must not be NaN, but is NaN.`);if(!Number.isFinite(e))throw new TypeError(`The "${t}" prop ${n} must be finite, but is ${e}.`);if(e%1!==0)throw new TypeError(`The "${t}" prop ${n} must be an integer, but is ${e}.`);if(e<=0)throw new TypeError(`The "${t}" prop ${n} must be positive, but got ${e}.`)}function Bu(e,t){const{allowFloats:n,component:r}=t;if(typeof e>"u")throw new Error(`The "durationInFrames" prop ${r} is missing.`);if(typeof e!="number")throw new Error(`The "durationInFrames" prop ${r} must be a number, but you passed a value of type ${typeof e}`);if(e<=0)throw new TypeError(`The "durationInFrames" prop ${r} must be positive, but got ${e}.`);if(!n&&e%1!==0)throw new TypeError(`The "durationInFrames" prop ${r} must be an integer, but got ${e}.`);if(!Number.isFinite(e))throw new TypeError(`The "durationInFrames" prop ${r} must be finite, but got ${e}.`)}function Wu(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 Vu=d.createContext(null),YC=d.createRef(),GC=e=>!!e.calculateMetadata,nh=e=>{const t=d.useContext(Vu),{props:n}=d.useContext(th),{compositions:r,canvasContent:o,currentCompositionMetadata:i}=d.useContext(Ki),s=(o==null?void 0:o.type)==="composition"?o.compositionId:null,a=e??s,l=r.find(p=>p.id===a),c=d.useMemo(()=>l?n[l.id]??{}:{},[n,l]),f=pt();return d.useMemo(()=>l?i?{type:"success",metadataSource:null,result:{...i,id:l.id,defaultProps:l.defaultProps??{}}}:GC(l)?!t||!t[l.id]?null:t[l.id]:(Bu(l.durationInFrames,{allowFloats:!1,component:`in <Composition id="${l.id}">`}),Wu(l.fps,`in <Composition id="${l.id}">`),cu(l.width,"width",`in <Composition id="${l.id}">`),cu(l.height,"height",`in <Composition id="${l.id}">`),{type:"success",metadataSource:null,result:{width:l.width,height:l.height,fps:l.fps,id:l.id,durationInFrames:l.durationInFrames,defaultProps:l.defaultProps??{},props:{...l.defaultProps??{},...c??{},...typeof window>"u"||f.isPlayer||!window.remotion_inputProps?{}:ZC()??{}},defaultCodec:null,defaultOutName:null,defaultVideoImageFormat:null,defaultPixelFormat:null,defaultProResProfile:null,defaultSampleRate:null}}):null,[l,t,i,c,f.isPlayer])},$x=e=>{const t=e.stack??"";return t.startsWith("Error:")?t:`${e.message}
55
+ ${t}`},XC=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 rh(e,t){let n;throw XC(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=$x(n)),n}function aa(e){return rh(typeof window<"u"?window:void 0,e)}var qC=["trace","verbose","info","warn","error"],Sg=e=>qC.indexOf(e),Hu=(e,t)=>Sg(e)<=Sg(t),xa=({args:e,logLevel:t,tag:n})=>{const r=[...e];return Nn().isRendering&&!Nn().isClientSideRendering&&r.unshift(Symbol.for(`__remotion_level_${t}`)),n&&Nn().isRendering&&!Nn().isClientSideRendering&&r.unshift(Symbol.for(`__remotion_tag_${n}`)),r},JC=(e,...t)=>{if(Hu(e.logLevel,"verbose"))return console.debug(...xa({args:t,logLevel:"verbose",tag:e.tag}))},QC=(e,...t)=>{if(Hu(e.logLevel,"trace"))return console.debug(...xa({args:t,logLevel:"trace",tag:e.tag}))},e2=(e,...t)=>{if(Hu(e.logLevel,"info"))return console.log(...xa({args:t,logLevel:"info",tag:e.tag}))},t2=(e,...t)=>{if(Hu(e.logLevel,"warn"))return console.warn(...xa({args:t,logLevel:"warn",tag:e.tag}))},n2=(e,...t)=>console.error(...xa({args:t,logLevel:"error",tag:e.tag})),jt={trace:QC,verbose:JC,info:e2,warn:t2,error:n2};typeof window<"u"&&(window.remotion_renderReady=!1,window.remotion_delayRenderTimeouts||(window.remotion_delayRenderTimeouts={}),window.remotion_delayRenderHandles=[]);var r2="The delayRender was called:",o2="Retries left: ",i2="- Rendering the frame will be retried.",s2="handle was cleared after",a2=3e4,_x=({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??a2)-2e3,l=((r==null?void 0:r.retries)??0)-(e.remotion_attempt-1);e.remotion_delayRenderTimeouts[o]={label:n??null,startTime:Date.now(),timeout:setTimeout(()=>{const c=["A delayRender()",n?`"${n}"`:null,`was called but not cleared after ${a}ms. See https://remotion.dev/docs/timeout for help.`,l>0?o2+l:null,l>0?i2:null,r2,i].filter(Yi).join(" ");t.isClientSideRendering?e.remotion_cancelledError=$x(Error(c)):rh(e,Error(c))},a)}}return e.remotion_renderReady=!1,o},l2=(e,t)=>typeof window>"u"?Math.random():_x({scope:window,environment:Nn(),label:e??null,options:{}}),Mx=({scope:e,handle:t,environment:n,logLevel:r})=>{if(typeof t>"u")throw new TypeError("The continueRender() method must be called with a parameter that is the return value of delayRender(). No value was passed.");if(typeof t!="number")throw new TypeError("The parameter passed into continueRender() must be the return value of delayRender() which is a number. Got: "+JSON.stringify(t));const o=e.remotion_delayRenderHandles.includes(t),i=e.remotion_delayRenderTimeouts[t];if(o&&n.isRendering&&i){const{label:s,startTime:a,timeout:l}=i;clearTimeout(l);const c=[s?`"${s}"`:"A handle",s2,`${Date.now()-a}ms`].filter(Yi).join(" ");jt.verbose({logLevel:r,tag:"delayRender()"},c),delete e.remotion_delayRenderTimeouts[t]}e.remotion_delayRenderHandles=e.remotion_delayRenderHandles.filter(s=>s!==t),e.remotion_delayRenderHandles.length===0&&(e.remotion_renderReady=!0)},u2=e=>{typeof window>"u"||Mx({scope:window,handle:e,environment:Nn(),logLevel:window.remotion_logLevel??"info"})},Vo=d.createContext({logLevel:"info",mountTime:0}),cr=()=>{const{logLevel:e}=d.useContext(Vo);if(e===null)throw new Error("useLogLevel must be used within a LogLevelProvider");return e},ba=()=>{const{mountTime:e}=d.useContext(Vo);if(e===null)throw new Error("useMountTime must be used within a LogLevelProvider");return e},Ax=d.createContext(null),Xn=()=>{const e=pt(),t=d.useContext(Ax)??(typeof window<"u"?window:void 0),n=cr(),r=d.useCallback((s,a)=>t?_x({scope:t,environment:e,label:s??null,options:a??{}}):Math.random(),[e,t]),o=d.useCallback(s=>{t&&Mx({scope:t,handle:s,environment:e,logLevel:n})},[e,n,t]),i=d.useCallback(s=>rh(t??(typeof window<"u"?window:void 0),s),[t]);return{delayRender:r,continueRender:o,cancelRender:i}},Nx=({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 he.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 he.lazy(e.lazyComponent)}throw new Error("You must pass either 'component' or 'lazyComponent'")},[e.lazyComponent])},Uu=()=>{const{canvasContent:e,compositions:t,currentCompositionMetadata:n}=d.useContext(Ki),r=t.find(i=>(e==null?void 0:e.type)==="composition"&&i.id===e.compositionId),o=nh((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])},Lx=()=>/^([a-zA-Z0-9-\u4E00-\u9FFF])+$/g,Ox=e=>e.match(Lx()),c2=e=>{if(!Ox(e))throw new Error(`Composition id can only contain a-z, A-Z, 0-9, CJK characters and -. You passed ${e}`)},d2=`Composition ID must match ${String(Lx())}`,f2=(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}"`:""}`)}},p2=()=>{const{continueRender:e,delayRender:t}=Xn();return d.useEffect(()=>{const n=t("Waiting for Root component to unsuspend");return()=>e(n)},[e,t]),null},h2=({width:e,height:t,fps:n,durationInFrames:r,id:o,defaultProps:i,schema:s,...a})=>{const l=d.useContext(va),{registerComposition:c,unregisterComposition:f}=l,p=Uu(),m=Nx({compProps:a,componentName:"Composition",noSuspense:!1}),y=zu(),w=eh(),x=pt(),S=d.useContext(Wo);if(typeof window<"u"&&(window.remotion_seenCompositionIds=Array.from(new Set([...window.remotion_seenCompositionIds??[],o]))),S)throw w?new Error("<Composition> was mounted inside the `component` that was passed to the <Player>. See https://remotion.dev/docs/wrong-composition-mount for help."):new Error("<Composition> mounted inside another composition. See https://remotion.dev/docs/wrong-composition-mount for help.");const{folderName:h,parentName:g}=d.useContext(Lf),v=a.stack??null,b="component"in a?a.component:null;d.useEffect(()=>{if(!o)throw new Error("No id for composition passed.");return c2(o),f2(i,"defaultProps",o),c({durationInFrames:r??void 0,fps:n??void 0,height:t??void 0,width:e??void 0,id:o,folderName:h,component:m,defaultProps:Df(i??{}),nonce:y.get(),parentFolderName:g,componentFromProps:b,schema:s??null,calculateMetadata:a.calculateMetadata??null,stack:v}),()=>{f(o)}},[r,n,t,m,o,h,i,e,y,g,b,s,a.calculateMetadata,v,c,f]);const k=nh(o),{setError:E,clearError:C}=d.useContext(Ex),I=d.useCallback(F=>{E(F)},[E]),j=d.useCallback(()=>{C()},[C]);if(x.isStudio&&p&&p.component===m&&p.id===o){const F=m;return k===null||k.type!=="success"&&k.type!=="success-and-refreshing"?null:Af.createPortal(u.jsx(Nf,{children:u.jsx($C,{onError:I,onClear:j,children:u.jsx(d.Suspense,{fallback:u.jsx(VC,{}),children:u.jsx(F,{...k.result.props??{}})})})}),zf())}if(x.isRendering&&p&&p.component===m&&p.id===o){const F=m;return k===null||k.type!=="success"&&k.type!=="success-and-refreshing"?null:Af.createPortal(u.jsx(Nf,{children:u.jsx(d.Suspense,{fallback:u.jsx(p2,{}),children:u.jsx(F,{...k.result.props??{}})})}),zf())}return null},du=e=>{const{onlyRenderComposition:t}=d.useContext(va);return t&&t!==e.id?null:u.jsx(h2,{...e})},Dx=[],zx=null,m2=()=>Dx,en=e=>{Dx.push(e)},g2=e=>{zx=e},y2=()=>zx,v2=e=>{const t=he.Children.toArray(e);if(t.length!==1)return null;const n=t[0];return!he.isValidElement(n)||typeof n.type!="function"&&typeof n.type!="object"?null:n.type},Rs="4.0.499",w2=()=>{if(typeof globalThis>"u")return;const e=()=>{globalThis.remotion_imported=Rs,typeof window<"u"&&(window.remotion_imported=Rs)},t=globalThis.remotion_imported||typeof window<"u"&&window.remotion_imported;if(t){if(t===Rs)return;if(typeof t=="string"&&t.includes("webcodecs")){e();return}throw new TypeError(`🚨 Multiple versions of Remotion detected: ${[Rs,typeof t=="string"?t:"an older version"].filter(Yi).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()},St=d.createContext(null),Wf={};kx(Wf,{useTimelineSetFrame:()=>Kx,useTimelinePosition:()=>fo,useTimelineContext:()=>co,usePlayingState:()=>Yx,usePlaybackRate:()=>ah,useAbsoluteTimelinePosition:()=>Zx,persistCurrentFrame:()=>Bx,getInitialFrameState:()=>Wx,getFrameForComposition:()=>Vx,clampFrameToCompositionRange:()=>Hx});function kg(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 x2(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 Ho=(e,t)=>{if(e===null)return Math.random();if(typeof e=="string")return kg(x2(e));if(typeof e=="number")return kg(e*1e10);throw new Error("random() argument must be a number or a string")},Gi=d.createContext({setFrame:()=>{throw new Error("default")},setPlaying:()=>{throw new Error("default")}}),Xi=d.createContext(null),oh=d.createContext(null),ih=d.createContext(null),b2=({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(Ho(null))),[c,f]=d.useState(()=>Wx()),p=t??c,{delayRender:m,continueRender:y}=Xn();typeof window<"u"&&d.useLayoutEffect(()=>{window.remotion_setFrame=(h,g,v)=>{window.remotion_attempt=v;const b=m(`Setting the current frame to ${h}`);let k=!0;f(E=>(E[g]??window.remotion_initialFrame)===h?(k=!1,E):{...E,[g]:h}),k?requestAnimationFrame(()=>y(b)):y(b)},window.remotion_isPlayer=!1},[y,m]);const w=d.useMemo(()=>({frame:p,playing:n,imperativePlaying:o,rootId:l,audioAndVideoTags:a}),[p,n,l]),x=d.useMemo(()=>({playbackRate:i,setPlaybackRate:s}),[i]),S=d.useMemo(()=>({setFrame:f,setPlaying:r}),[]);return u.jsx(ih.Provider,{value:w,children:u.jsx(oh.Provider,{value:x,children:u.jsx(Xi.Provider,{value:w,children:u.jsx(Gi.Provider,{value:S,children:e})})})})},sh=()=>"remotion.time-all",Bx=e=>{localStorage.setItem(sh(),JSON.stringify(e))},Wx=()=>{const e=localStorage.getItem(sh())??"{}";return JSON.parse(e)},Vx=e=>{const t=localStorage.getItem(sh())??"{}",n=JSON.parse(t);return n[e]!==void 0?Number(n[e]):typeof window>"u"?0:window.remotion_initialFrame??0},Hx=(e,t)=>Math.max(0,Math.min(Math.max(0,t-1),e)),Ux=e=>{const t=Uu(),n=pt();if(!t)return typeof window>"u"?0:window.remotion_initialFrame??0;const r=e.frame[t.id]??(n.isPlayer?0:Vx(t.id));return Hx(r,t.durationInFrames)},co=()=>{const e=d.useContext(Xi);if(e===null)throw new Error("TimelineContext is not available. This hook must be used inside a <Player> or the Remotion Studio.");return e},ah=()=>{const e=d.useContext(oh);if(e===null)throw new Error("PlaybackRateContext is not available. This hook must be used inside a <Player> or the Remotion Studio.");return e},fo=()=>{const e=co();return Ux(e)},Zx=()=>{const e=d.useContext(ih);if(e===null)throw new Error("AbsoluteTimeContext is not available. This hook must be used inside a <Player> or the Remotion Studio.");return Ux(e)},Kx=()=>{const{setFrame:e}=d.useContext(Gi);return e},Yx=()=>{const{playing:e,imperativePlaying:t}=co(),{setPlaying:n}=d.useContext(Gi);return d.useMemo(()=>[e,n,t],[t,e,n])},Pt=()=>{const e=d.useContext(Wo),t=pt();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=fo(),r=d.useContext(St),o=r?r.cumulatedFrom+r.relativeFrom:0;return n-o},Zu=()=>{const e=d.useContext(St),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=Uu();return d.useMemo(()=>{if(!o)return null;const{id:i,durationInFrames:s,fps:a,height:l,width:c,defaultProps:f,props:p,defaultCodec:m,defaultOutName:y,defaultVideoImageFormat:w,defaultPixelFormat:x,defaultProResProfile:S,defaultSampleRate:h}=o;return{id:i,width:t??c,height:n??l,fps:a,durationInFrames:r??s,defaultProps:f,props:p,defaultCodec:m,defaultOutName:y,defaultVideoImageFormat:w,defaultPixelFormat:x,defaultProResProfile:S,defaultSampleRate:h}},[r,n,t,o])},ht=()=>{const e=Zu(),t=d.useContext(Wo),n=eh();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},Sa=({frame:e,children:t,active:n=!0})=>{const r=Pt(),o=ht();if(typeof e>"u")throw new Error("The <Freeze /> component requires a 'frame' prop, but none was passed.");if(typeof e!="number")throw new Error(`The 'frame' prop of <Freeze /> must be a number, but is of type ${typeof e}`);if(Number.isNaN(e))throw new Error("The 'frame' prop of <Freeze /> must be a real number, but it is NaN.");if(!Number.isFinite(e))throw new Error(`The 'frame' prop of <Freeze /> must be a finite number, but it is ${e}.`);const i=d.useMemo(()=>{if(typeof n=="boolean")return n;if(typeof n=="function")return n(r)},[n,r]),s=co(),a=d.useContext(St),l=(a==null?void 0:a.relativeFrom)??0,c=d.useMemo(()=>i?{...s,playing:!1,imperativePlaying:{current:!1},frame:{[o.id]:e+l}}:s,[i,s,o.id,e,l]),f=d.useMemo(()=>a?i?{...a,cumulatedFrom:0}:a:null,[a,i]);return u.jsx(Xi.Provider,{value:c,children:u.jsx(St.Provider,{value:f,children:t})})},dr={"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}},S2=dr,Ku={"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}},po={"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"}},ho={"style.backgroundColor":{type:"color",default:"transparent",description:"Color"}},Gx={children:{type:"text-content",default:"",description:"Text",keyframable:!1}},qi={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}},Xx={...qi},qx={...dr,...ho,...po,...Xx},lh={type:"boolean",default:!1,description:"Hidden"},Jx={type:"hidden"},uh={type:"hidden"},k2=e=>({name:uh,...e}),ch={type:"number",default:void 0,min:1,step:1,hiddenFromList:!0},Qx={type:"number",default:0,step:1,hiddenFromList:!0},e1={type:"number",default:0,min:0,step:1,hiddenFromList:!0},dh={type:"number",default:null,step:1,hiddenFromList:!0},Rr={durationInFrames:ch,from:Qx,trimBefore:e1,freeze:dh,hidden:lh,name:uh,showInTimeline:Jx},Bi={...Rr,layout:{type:"enum",default:"absolute-fill",description:"Layout",variants:{"absolute-fill":qx,none:{}}}},E2={durationInFrames:ch,trimBefore:e1,freeze:dh,hidden:lh,name:uh,showInTimeline:Jx},C2={...E2,layout:Bi.layout},I2={...Bi,layout:{...Bi.layout,default:"none"}},Ji=he.createContext({registerSequence:()=>{throw new Error("SequenceManagerContext not initialized")},unregisterSequence:()=>{throw new Error("SequenceManagerContext not initialized")},sequences:[]}),Yu=he.createContext({current:[]}),wr=e=>`${e.absolutePath}\0${e.nodePath.join(".")}\0${e.sequenceKeys.join(".")}\0${e.effectKeys.map(t=>t.join(".")).join(".")}`,Gu=he.createContext({propStatuses:{}}),Xu=he.createContext({current:{}}),qu=he.createContext({getDragOverrides:()=>{throw new Error("VisualModeDragOverridesContext not initialized")},getEffectDragOverrides:()=>{throw new Error("VisualModeDragOverridesContext not initialized")}}),t1=he.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")}}),od=(e,t)=>`${wr(e)}.effects.${t}`,T2=({children:e})=>{const[t,n]=d.useState([]),r=d.useRef(t);r.current=t;const[o,i]=d.useState({}),s=d.useRef(o);s.current=o;const[a,l]=d.useState({}),[c,f]=d.useState({}),p=d.useRef(c);p.current=c;const m=d.useCallback((j,F,L)=>{i(V=>({...V,[wr(j)]:{...V[wr(j)],[F]:L}}))},[]),y=d.useCallback(j=>{i(F=>{const L=wr(j);if(!F[L])return F;const V={...F};return delete V[L],V})},[]),w=d.useCallback((j,F,L,V)=>{l(M=>{const $=od(j,F);return{...M,[$]:{...M[$],[L]:V}}})},[]),x=d.useCallback((j,F)=>{l(L=>{const V=od(j,F);if(!L[V])return L;const M={...L};return delete M[V],M})},[]),S=d.useCallback((j,F)=>{f(L=>{const V=wr(j),M=L[V],$=F(M);return M===$?L:{...L,[V]:$}})},[]),h=d.useCallback(j=>{n(F=>[...F,j])},[]),g=d.useCallback(j=>{n(F=>F.filter(L=>L.id!==j))},[]),v=d.useMemo(()=>({registerSequence:h,sequences:t,unregisterSequence:g}),[h,t,g]),b=d.useCallback(j=>o[wr(j)]??{},[o]),k=d.useCallback((j,F)=>a[od(j,F)]??{},[a]),E=d.useMemo(()=>({propStatuses:c}),[c]),C=d.useMemo(()=>({getDragOverrides:b,getEffectDragOverrides:k}),[b,k]),I=d.useMemo(()=>({setDragOverrides:m,clearDragOverrides:y,setEffectDragOverrides:w,clearEffectDragOverrides:x,setPropStatuses:S}),[m,y,w,x,S]);return u.jsx(Yu.Provider,{value:r,children:u.jsx(Ji.Provider,{value:v,children:u.jsx(Xu.Provider,{value:p,children:u.jsx(Gu.Provider,{value:E,children:u.jsx(qu.Provider,{value:C,children:u.jsx(t1.Provider,{value:I,children:e})})})})})})},Ju=d.createContext(!1),j2=({children:e})=>u.jsx(Ju.Provider,{value:!0,children:e}),n1=({children:e})=>u.jsx(Ju.Provider,{value:!1,children:e}),R2=()=>{if(!he.useContext(Ju))throw new Error("This component must be inside a <Series /> component.")},r1=d.createContext({premountFramesRemaining:0}),P2=!1,ka=e=>e??P2,Ea=({from:e,durationInFrames:t,premountFor:n,postmountFor:r,style:o,styleWhilePremounted:i,styleWhilePostmounted:s,hideWhilePremounted:a})=>{const l=d.useContext(r1),c=Pt()-l.premountFramesRemaining,f=pt(),{fps:p}=ht(),m=n??0,y=r??0,w=Math.ceil(e+t-1),x=!f.isRendering&&c<e&&c>=e-m,S=!f.isRendering&&c>w&&c<=w+y,h=x||S,g=x?e:S?e+t-1:0,v=d.useMemo(()=>h?{...o,...a==="opacity"?{opacity:0}:{display:"none"},pointerEvents:"none",...x?i:{},...S?s:{}}:o,[h,a,S,x,o,s,i]);return{effectivePremountFor:m,effectivePostmountFor:y,premountingActive:x,postmountingActive:S,isPremountingOrPostmounting:h,freezeFrame:g,premountingStyle:v}},F2=(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},$2=4,_2=.001,M2=1e-7,A2=10,Ps=11,Xa=1/(Ps-1),N2=typeof Float32Array=="function";function o1(e,t){return 1-3*t+3*e}function i1(e,t){return 3*t-6*e}function s1(e){return 3*e}function fu(e,t,n){return((o1(t,n)*e+i1(t,n))*e+s1(t))*e}function a1(e,t,n){return 3*o1(t,n)*e*e+2*i1(t,n)*e+s1(t)}function L2({aX:e,_aA:t,_aB:n,mX1:r,mX2:o}){let i,s,a=0,l=t,c=n;do s=l+(c-l)/2,i=fu(s,r,o)-e,i>0?c=s:l=s;while(Math.abs(i)>M2&&++a<A2);return s}function O2(e,t,n,r){let o=t;for(let i=0;i<$2;++i){const s=a1(o,n,r);if(s===0)return o;const a=fu(o,n,r)-e;o-=a/s}return o}function l1(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=N2?new Float32Array(Ps):new Array(Ps);if(e!==t||n!==r)for(let s=0;s<Ps;++s)o[s]=fu(s*Xa,e,n);function i(s){let a=0,l=1;const c=Ps-1;for(;l!==c&&o[l]<=s;++l)a+=Xa;--l;const f=(s-o[l])/(o[l+1]-o[l]),p=a+f*Xa,m=a1(p,e,n);return m>=_2?O2(s,p,e,n):m===0?p:L2({aX:s,_aA:a,_aB:a+Xa,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:fu(i(a),t,r)}}var D2=e=>Math.round(e*1e6)/1e6,z2=new Set(["deg","rad","grad","turn"]),u1=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"]),c1=/^([+-]?(?:\d+\.?\d*|\.\d+))([a-zA-Z%]+)?$/,d1=new Set(["left","center","right","top","bottom"]),bi=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:"%"}}],gs={value:50,unit:"%"},Eg=e=>String(D2(e)),B2=(e,t)=>{const n=c1.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(z2.has(r))return{kind:"rotate",value:o,unit:r};if(u1.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`)},f1=({component:e,value:t,allowPercentage:n})=>{const r=c1.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||!u1.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}},id=(e,t)=>{const n=e.toLowerCase();return d1.has(n)?{type:"keyword",keyword:n}:{type:"length-percentage",parsed:f1({component:e,value:t,allowPercentage:!0})}},W2=(e,t,n)=>{const r=[];for(const o of bi(e))for(const i of bi(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]},V2=(e,t)=>{if(e.length===1){const a=id(e[0],t);return a.type==="length-percentage"?[a.parsed,gs]:a.keyword==="top"||a.keyword==="bottom"?[gs,bi(a.keyword)[0].value]:[bi(a.keyword)[0].value,gs]}const n=id(e[0],t),r=id(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 W2(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[bi(o.keyword)[0].value,i]}return o.keyword==="top"||o.keyword==="bottom"?[i,bi(o.keyword)[0].value]:s?[gs,i]:[i,gs]},H2=(e,t)=>{const[n,r]=V2(t.slice(0,2),e),o=t[2]===void 0?{value:0,unit:null}:f1({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}},U2=e=>{var o,i,s,a,l,c;if(typeof e=="number"){if(!Number.isFinite(e))throw new Error(`outputRange must contain only finite numbers, but got [${e}]`);return{kind:"scale",values:[e,e,1],units:[null,null,null],dimensions:1}}const t=e.trim().split(/\s+/);if(t.length<1||t.length>3||t[0]==="")throw new TypeError(`String outputRange values must contain 1 to 3 components, but got "${e}"`);if(t.some(f=>d1.has(f.toLowerCase())))return H2(e,t);const n=t.map(f=>B2(f,e)),[{kind:r}]=n;for(const f of n)if(f.kind!==r)throw new TypeError(`Cannot interpolate "${e}" because it mixes ${r} and ${f.kind} values`);if(r==="scale"){const f=n[0].value,p=((o=n[1])==null?void 0:o.value)??f,m=((i=n[2])==null?void 0:i.value)??1;return{kind:r,values:[f,p,m],units:[null,null,null],dimensions:n.length}}return{kind:r,values:[n[0].value,((s=n[1])==null?void 0:s.value)??0,((a=n[2])==null?void 0:a.value)??0],units:[n[0].unit,((l=n[1])==null?void 0:l.unit)??null,((c=n[2])==null?void 0:c.unit)??null],dimensions:n.length}},Z2=({kind:e,values:t,units:n,dimensions:r})=>e==="scale"?t.slice(0,r).map(o=>Eg(o)).join(" "):t.slice(0,r).map((o,i)=>`${Eg(o)}${n[i]}`).join(" "),Cg=e=>e===0?0:Math.sign(e)*e*e,K2=e=>e===0?0:Math.sign(e)*Math.sqrt(Math.abs(e));function Y2(e,t,n,r){const{extrapolateLeft:o,extrapolateRight:i,easing:s,output:a}=r;let l=e;const[c,f]=t,[p,m]=n;if(l<c){if(o==="identity")return l;if(o==="clamp")l=c;else if(o==="wrap"){const y=f-c;l=((l-c)%y+y)%y+c}}if(l>f){if(i==="identity")return l;if(i==="clamp")l=f;else if(i==="wrap"){const y=f-c;l=((l-c)%y+y)%y+c}}if(p===m)return p;if(l=(l-c)/(f-c),l=s(l),a==="perceptual-scale"){const y=Cg(p),w=Cg(m);l=K2(l*(w-y)+y)}else l=l*(m-p)+p;return l}function G2(e,t){let n;for(n=1;n<t.length-1&&!(t[n]>=e);++n);return n-1}var X2=e=>e,q2=e=>e??"linear",p1=e=>e.remotionShouldExtendRight===!0,Ig=({easing:e,segmentIndex:t})=>e===void 0?X2:typeof e=="function"?e:e[t],Tg=({input:e,inputRange:t,outputRange:n,easing:r,extrapolateLeft:o,extrapolateRight:i,output:s})=>Y2(e,t,n,{easing:r,extrapolateLeft:o,extrapolateRight:e>t[1]&&i==="clamp"&&p1(r)?"extend":i,output:s}),fh=({input:e,inputRange:t,outputRange:n,options:r})=>{const o=q2(r==null?void 0:r.output);if(t.length===1)return n[0];const i=r==null?void 0:r.easing;let s="extend";(r==null?void 0:r.extrapolateLeft)!==void 0&&(s=r.extrapolateLeft);let a="extend";(r==null?void 0:r.extrapolateRight)!==void 0&&(a=r.extrapolateRight);const l=(r==null?void 0:r.posterize)===void 0?e:Math.floor(e/r.posterize)*r.posterize,c=G2(l,t),f=Ig({easing:i,segmentIndex:c});let p=Tg({input:l,inputRange:[t[c],t[c+1]],outputRange:[n[c],n[c+1]],easing:f,extrapolateLeft:s,extrapolateRight:a,output:o});for(let m=0;m<c;m++){const y=Ig({easing:i,segmentIndex:m});if(!p1(y))continue;const w=t[m+1];if(l<=w)continue;const x=Tg({input:l,inputRange:[t[m],w],outputRange:[n[m],n[m+1]],easing:y,extrapolateLeft:s,extrapolateRight:"extend",output:o});p+=x-n[m+1]}return p},J2=({input:e,inputRange:t,outputRange:n,options:r})=>{var c;const o=n.map(U2),i=(c=o[0])==null?void 0:c.kind;if(i===void 0)throw new Error("outputRange must have at least 1 element");for(const f of o)if(f.kind!==i)throw new TypeError(`Cannot interpolate ${i} values with ${f.kind} values`);const s=Math.max(...o.map(f=>f.dimensions)),a=[null,null,null];if(i!=="scale")for(let f=0;f<s;f++){for(const p of o){const m=p.units[f];if(m!==null){if(a[f]===null){a[f]=m;continue}if(a[f]!==m)throw new TypeError(`Cannot interpolate ${i} values with different units on axis ${f+1}: ${a[f]} and ${m}`)}}if(a[f]===null)throw new TypeError(`Cannot interpolate ${i} values because axis ${f+1} has no unit`)}const l=[0,0,0];for(let f=0;f<s;f++)l[f]=fh({input:e,inputRange:t,outputRange:o.map(p=>p.values[f]),options:r});return Z2({kind:i,values:l,units:a,dimensions:s})},Q2=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},eI=({input:e,inputRange:t,outputRange:n,options:r})=>{const o=Q2(n);return new Array(o).fill(!0).map((i,s)=>fh({input:e,inputRange:t,outputRange:n.map(a=>a[s]),options:r}))};function tI(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 jg(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 nI(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 rI(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 oI(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 Qi(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(jg("inputRange",t),tI(t),nI(r==null?void 0:r.easing,t.length),rI(r==null?void 0:r.posterize),oI(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 J2({input:e,inputRange:t,outputRange:n,options:r})}if(n.every(i=>Array.isArray(i)))return eI({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 jg("outputRange",n),fh({input:e,inputRange:t,outputRange:n,options:r})}var iI=({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}`)},sI=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)}},aI={damping:10,mass:1,stiffness:100,overshootClamping:!1},sd={};function lI({animation:e,now:t,config:n}){const{toValue:r,lastTimestamp:o,current:i,velocity:s}=e,a=Math.min(t-o,64);if(n.damping<=0)throw new Error("Spring damping must be greater than 0, otherwise the spring() animation will never end, causing an infinite loop.");const l=n.damping,c=n.mass,f=n.stiffness,p=[r,o,i,s,l,c,f,t].join("-");if(sd[p])return sd[p];const m=-s,y=r-i,w=l/(2*Math.sqrt(f*c)),x=Math.sqrt(f/c),S=x*Math.sqrt(1-w**2),h=a/1e3,g=Math.sin(S*h),v=Math.cos(S*h),b=Math.exp(-w*x*h),k=b*(g*((m+w*x*y)/S)+y*v),E=r-k,C=w*x*k-b*(v*(m+w*x*y)-S*y*g),I=Math.exp(-x*h),j=r-I*(y+(m+x*y)*h),F=I*(m*(h*x-1)+h*y*x*x),L={toValue:r,prevPosition:i,lastTimestamp:t,current:w<1?E:j,velocity:w<1?C:F};return sd[p]=L,L}var ad={};function h1({frame:e,fps:t,config:n={}}){const i=[e,t,n.damping,n.mass,n.overshootClamping,n.stiffness].join("-");if(ad[i])return ad[i];let s={lastTimestamp:0,current:0,toValue:1,velocity:0,prevPosition:0};const a=Math.max(0,e),l=a%1;for(let c=0;c<=Math.floor(a);c++){c===Math.floor(a)&&(c+=l);const f=c/t*1e3;s=lI({animation:s,now:f,config:{...aI,...n}})}return ad[i]=s,s}var ld=new Map;function m1({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(ld.has(r))return ld.get(r);Wu(e,"to the measureSpring() function");let o=0,i=0;const s=()=>h1({fps:e,frame:o,config:t});let a=s();const l=()=>Math.abs(a.current-a.toValue);let c=l();for(;c>=n;)o++,a=s(),c=l();i=o;for(let f=0;f<20;f++)o++,a=s(),c=l(),c>=n&&(f=0,i=o+1);return ld.set(r,i),i}function Vf({frame:e,fps:t,config:n={},from:r=0,to:o=1,durationInFrames:i,durationRestThreshold:s,delay:a=0,reverse:l=!1}){sI(i),iI({frame:e,durationInFrames:1/0,allowFloats:!0}),Wu(t,"to spring()");const c=l||typeof i<"u",f=c?m1({fps:t,config:n,threshold:s}):void 0,p=c?{get:()=>f}:{get:()=>{throw new Error("did not calculate natural duration, this is an error with Remotion. Please report")}},y=(l?(i??p.get())-e:e)+(l?a:-a),w=i===void 0?y:y/(i/p.get());if(i&&y>i)return o;const x=h1({fps:t,frame:w,config:n}),S=n.overshootClamping?o>=r?Math.min(x.current,o):Math.max(x.current,o):x.current;return r===0&&o===1?S:Qi(S,[0,1],[r,o])}var Rg=e=>Math.min(1,Math.max(0,e)),ys=30;class pu{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 pu.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=Rg(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:Vf(t?{fps:ys,frame:i*m1({fps:ys,config:r,threshold:n}),config:r}:{fps:ys,frame:i*ys,config:r,durationInFrames:ys,durationRestThreshold:n}),{remotionShouldExtendRight:t})}static bounce(t){const n=Rg(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 l1(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 Wn="[-+]?\\d*\\.?\\d+",qa=Wn+"%";function Ja(...e){return"\\(\\s*("+e.join(")\\s*,\\s*(")+")\\s*\\)"}var Qa="(?:none|[-+]?\\d*\\.?\\d+(?:%|deg|rad|grad|turn)?)";function vs(e){return new RegExp(e+"\\(\\s*("+Qa+")\\s+("+Qa+")\\s+("+Qa+")(?:\\s*\\/\\s*("+Qa+"))?\\s*\\)")}function uI(){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"+Ja(Wn,Wn,Wn)),e.rgba=new RegExp("rgba"+Ja(Wn,Wn,Wn,Wn)),e.hsl=new RegExp("hsl"+Ja(Wn,qa,qa)),e.hsla=new RegExp("hsla"+Ja(Wn,qa,qa,Wn)),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=vs("oklch"),e.oklab=vs("oklab"),e.lab=vs("lab"),e.lch=vs("lch"),e.hwb=vs("hwb")),e}function Fi(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 Pg(e,t,n){const r=n<.5?n*(1+t):n+t-n*t,o=2*n-r,i=Fi(o,r,e+1/3),s=Fi(o,r,e),a=Fi(o,r,e-1/3);return Math.round(i*255)<<24|Math.round(s*255)<<16|Math.round(a*255)<<8}function Qo(e){const t=Number.parseInt(e,10);return t<0?0:t>255?255:t}function Fg(e){return(Number.parseFloat(e)%360+360)%360/360}function $g(e){const t=Number.parseFloat(e);return t<0?0:t>1?255:Math.round(t*255)}function el(e){const t=Number.parseFloat(e);return t<0?0:t>100?1:t/100}function Pn(e,t){return e==="none"?0:e.endsWith("%")?Number.parseFloat(e)/100*t:Number.parseFloat(e)}function ud(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 ws(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 $i(e){return e<=.0031308?12.92*e:1.055*e**(1/2.4)-.055}function tl(e){return Math.max(0,Math.min(1,e))}function xs(e,t,n,r){const o=Math.round(tl(e)*255),i=Math.round(tl(t)*255),s=Math.round(tl(n)*255),a=Math.round(tl(r)*255);return(o<<24|i<<16|s<<8|a)>>>0}function _g(e,t,n){const r=e+.3963377774*t+.2158037573*n,o=e-.1055613458*t-.0638541728*n,i=e-.0894841775*t-1.291485548*n,s=r*r*r,a=o*o*o,l=i*i*i,c=4.0767416621*s-3.3077115913*a+.2309699292*l,f=-1.2684380046*s+2.6097574011*a-.3413193965*l,p=-.0041960863*s-.7034186147*a+1.707614701*l;return[$i(c),$i(f),$i(p)]}function Mg(e,t,n){const r=.008856451679035631,o=24389/27,i=.95047,s=1,a=1.08883,l=(e+16)/116,c=t/500+l,f=l-n/200,p=c*c*c,m=f*f*f,y=p>r?p:(116*c-16)/o,w=e>o*r?((e+16)/116)**3:e/o,x=m>r?m:(116*f-16)/o,S=y*i,h=w*s,g=x*a,v=3.2404542*S-1.5371385*h-.4985314*g,b=-.969266*S+1.8760108*h+.041556*g,k=.0556434*S-.2040259*h+1.0572252*g;return[$i(v),$i(b),$i(k)]}function cI(e,t,n){if(t+n>=1){const c=t/(t+n);return[c,c,c]}const r=1,o=0,i=Fi(o,r,e+1/3),s=Fi(o,r,e),a=Fi(o,r,e-1/3),l=1-t-n;return[i*l+t,s*l+t,a*l+t]}var Ag={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 dI(e){const t=uI();let n;if(t.hex6&&(n=t.hex6.exec(e)))return Number.parseInt(n[1]+"ff",16)>>>0;if(Ag[e]!==void 0)return Ag[e];if(t.rgb&&(n=t.rgb.exec(e)))return(Qo(n[1])<<24|Qo(n[2])<<16|Qo(n[3])<<8|255)>>>0;if(t.rgba&&(n=t.rgba.exec(e)))return(Qo(n[1])<<24|Qo(n[2])<<16|Qo(n[3])<<8|$g(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(Pg(Fg(n[1]),el(n[2]),el(n[3]))|255)>>>0;if(t.hsla&&(n=t.hsla.exec(e)))return(Pg(Fg(n[1]),el(n[2]),el(n[3]))|$g(n[4]))>>>0;if(t.oklch&&(n=t.oklch.exec(e))){const r=Pn(n[1],1),o=Pn(n[2],.4),i=ud(n[3]),s=ws(n[4]),a=i*Math.PI/180,[l,c,f]=_g(r,o*Math.cos(a),o*Math.sin(a));return xs(l,c,f,s)}if(t.oklab&&(n=t.oklab.exec(e))){const r=Pn(n[1],1),o=Pn(n[2],.4),i=Pn(n[3],.4),s=ws(n[4]),[a,l,c]=_g(r,o,i);return xs(a,l,c,s)}if(t.lab&&(n=t.lab.exec(e))){const r=Pn(n[1],100),o=Pn(n[2],125),i=Pn(n[3],125),s=ws(n[4]),[a,l,c]=Mg(r,o,i);return xs(a,l,c,s)}if(t.lch&&(n=t.lch.exec(e))){const r=Pn(n[1],100),o=Pn(n[2],150),i=ud(n[3]),s=ws(n[4]),a=i*Math.PI/180,[l,c,f]=Mg(r,o*Math.cos(a),o*Math.sin(a));return xs(l,c,f,s)}if(t.hwb&&(n=t.hwb.exec(e))){const r=ud(n[1]),o=Pn(n[2],1),i=Pn(n[3],1),s=ws(n[4]),[a,l,c]=cI(r/360,o,i);return xs(a,l,c,s)}throw new Error(`invalid color string ${e} provided`)}var Ng=e=>(e>>24&255)/255,fI=e=>e>>16&255,pI=e=>e>>8&255,hI=e=>e&255,mI=(e,t,n,r)=>`rgba(${e}, ${t}, ${n}, ${r})`;function gI(e){const t=dI(e);return(t<<24|t>>>8)>>>0}var yI=(e,t,n,r)=>{const[o,i,s,a]=[fI,pI,hI,Ng].map(l=>{const c=Qi(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===Ng?Number(c.toFixed(3)):Math.round(c)});return mI(o,i,s,a)},vI=(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=>gI(i));return yI(e,t,o,r)},Lg=({easing:e,forceSpringAllowTail:t})=>{switch(e.type){case"linear":return pu.linear;case"spring":return pu.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 l1(e.x1,e.y1,e.x2,e.y2);default:throw new TypeError(`Unsupported easing: ${JSON.stringify(e)}`)}},Ca=({frame:e,forceSpringAllowTail:t,status:n})=>{const{keyframes:r,easing:o,clamping:i,interpolationFunction:s}=n;if(r.length===0)return null;const a=[...r].sort((f,p)=>f.frame-p.frame),l=a.map(f=>f.frame),c=a.map(f=>f.value);if(s==="interpolateColors"){if(!c.every(f=>typeof f=="string"))return null;if(r.length===1)return c[0];try{return vI(e,l,c,{easing:o.map(f=>Lg({easing:f,forceSpringAllowTail:t})),posterize:n.posterize})}catch{return null}}if(s!=="interpolate")return null;try{return Qi(e,l,c,{easing:o.map(f=>Lg({easing:f,forceSpringAllowTail:t})),extrapolateLeft:i.left,extrapolateRight:i.right,output:n.output,posterize:n.posterize})}catch{return null}},Qu=({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=Ca({forceSpringAllowTail:null,frame:t,status:e.status});return n===null?{type:"none"}:{type:"resolved",value:n}},g1=({propStatus:e,dragOverrideValue:t,defaultValue:n,frame:r=null,shouldResortToDefaultValueIfUndefined:o=!1})=>{const i=Qu({dragOverrideValue:t,frame:r});return i.type==="resolved"&&i.value!==void 0?i.value:e.status==="keyframed"?r!==null?Ca({forceSpringAllowTail:null,frame:r,status:e}):o?n:void 0:e.codeValue===void 0&&o?n:e.codeValue},ph=d.createContext({overrideIdToNodePathMappings:{}}),wI=d.createContext({setOverrideIdToNodePath:()=>{throw new Error("OverrideIdsToNodePathsSettersContext not initialized")}}),xI=({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=Qu({dragOverrideValue:s,frame:r});a.type==="resolved"&&(o[i]=a.value)}return{params:o,effectKey:e.definition.calculateKey(o)}},bI=(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=Ca({forceSpringAllowTail:null,frame:t,status:i});s!==null&&(n[o]=s,r=!0)}}return r?n:null},Ia=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)},y1=({propStatuses:e,nodePath:t,effectIndex:n})=>{const r=e[wr(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"}},v1=(e,t)=>{const n=e[wr(t)];if(n&&n.canUpdate)return n.props},Ta=({effects:e,overrideId:t})=>{const n=d.useRef(null),{propStatuses:r}=d.useContext(Gu),{getEffectDragOverrides:o}=d.useContext(qu),i=Pt(),{overrideIdToNodePathMappings:s}=d.useContext(ph),a=n.current,l=t?s[t]??null:null,c=e.map((m,y)=>{if(l===null)return{descriptor:m,params:m.params,effectKey:m.effectKey};const w=y1({propStatuses:r,nodePath:l,effectIndex:y}),x=w.type==="can-update-effect"?bI(w.props,i):null,S=o(l,y),h=Object.keys(S).length===0?null:S,{params:g,effectKey:v}=xI({descriptor:m,propStatusOverrides:x,dragOverrides:h,frame:i});return{descriptor:m,params:g,effectKey:v}});if(a!==null&&a.length===c.length&&a.every((m,y)=>m.definition===c[y].descriptor.definition&&m.effectKey===c[y].effectKey))return a;const p=c.map(({descriptor:m,params:y,effectKey:w})=>({definition:m.definition,effectKey:w,params:y,memoized:!0}));return n.current=p,p},hh=(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,hh(s,t))}else n[r]=o}return n},mh=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=mh(i);for(const a of Object.keys(s))n(a,s[a])}}return t},w1=({schema:e,key:t,value:n})=>{const r=e[t];if(!r)throw new Error("Key "+JSON.stringify(t)+" not found in schema");if(typeof n!="string")throw new Error("Value must be a string, but is "+JSON.stringify(n));if(r.type!=="enum")throw new Error("Key "+JSON.stringify(t)+" is not an enum");if(!r.variants[n])throw new Error("Value for "+JSON.stringify(t)+" must be one of "+Object.keys(r.variants).map(a=>JSON.stringify(a)).join(", ")+", got "+JSON.stringify(n));const i=Object.keys(r.variants).filter(a=>a!==n),s=new Set;for(const a of i){const l=r.variants[a],c=Object.keys(l);for(const f of c)s.add(f)}return[...s]},Og={type:"linear"},SI=({insertedKeyframeIndex:e,easingLength:t,keyframeCount:n})=>!(e>0&&e<n-1)||t===0?null:Math.min(e-1,t-1),kI=e=>({type:"static",value:e}),EI=({status:e,frame:t,value:n})=>{const r=e.keyframes.findIndex(s=>s.frame===t),o=r===-1?[...e.keyframes,{frame:t,value:n}].sort((s,a)=>s.frame-a.frame):e.keyframes.map((s,a)=>a===r?{frame:t,value:n}:s),i=[...e.easing];if(r===-1){const s=o.findIndex(c=>c.frame===t),a=SI({insertedKeyframeIndex:s,easingLength:i.length,keyframeCount:o.length}),l=a===null?Og:i[a];i.splice(s,0,l)}for(;i.length<o.length-1;)i.push(Og);return i.length>o.length-1&&(i.length=o.length-1),{type:"keyframed",status:{...e,keyframes:o,easing:i}}},CI=e=>{if((e==null?void 0:e.type)==="static")return e.value},II=e=>e!==null&&e.status==="keyframed",x1=(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=x1(r,t);if(o)return o}},b1=({schema:e,currentValue:t,overrideValues:n,propStatus:r,frame:o})=>{var a;const i={},s=new Set;for(const l of Object.keys(t)){const c=(r==null?void 0:r[l])??null,f=x1(e,l);if((f==null?void 0:f.type)==="hidden")continue;let p;if(c===null)p=t[l];else if(II(c))if((f==null?void 0:f.type)==="array"||(f==null?void 0:f.keyframable)===!1)p=t[l];else{const m=Qu({dragOverrideValue:n[l],frame:o});m.type==="resolved"?p=m.value:o!==null?p=Ca({forceSpringAllowTail:null,frame:o,status:c})??t[l]:p=t[l]}else c.status==="computed"?p=t[l]:p=g1({propStatus:c,dragOverrideValue:n[l],defaultValue:f==null?void 0:f.default,frame:o,shouldResortToDefaultValueIfUndefined:!1});(f==null?void 0:f.type)==="asset"&&typeof p=="string"&&p.startsWith(sa)&&(p=`${window.remotion_staticBase}/${p.slice(sa.length)}`),p===void 0&&s.add(l),i[l]=p}for(const l of Object.keys(n))if(((a=e[l])==null?void 0:a.type)==="enum"){const c=w1({schema:e,key:l,value:i[l]});for(const f of c)s.add(f)}return{merged:i,propsToDelete:s}},S1=(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},k1=({flatSchema:e,key:t,props:n})=>{var o;const r=S1(n,t);if(!(((o=e[t])==null?void 0:o.type)==="text-content"&&typeof r!="string"))return r},TI=(e,t,n)=>{const r={};for(const o of t)r[o]=n?k1({flatSchema:n,key:o,props:e}):S1(e,o);return r},jI=(e,t)=>Object.keys(hh(e,n=>t[n])),RI=({flatSchema:e,props:t,valuesDotNotation:n,schemaKeys:r,propsToDelete:o})=>{var a;const i={...t};for(const l of r){const c=n[l];if(((a=e[l])==null?void 0:a.type)==="text-content"&&c===void 0)continue;const f=l.split(".");if(f.length===1){i[l]=c;continue}let p=i;for(let m=0;m<f.length-1;m++){const y=f[m];typeof p[y]=="object"&&p[y]!==null?p[y]={...p[y]}:p[y]={},p=p[y]}p[f[f.length-1]]=c}const s=new Set([...o].filter(l=>{var c;return!(((c=e[l])==null?void 0:c.type)==="text-content"&&n[l]===void 0)}));return F2(i,s),i},Dg={},Pr=({Component:e,componentName:t,componentIdentity:n,schema:r,supportsEffects:o})=>{const i=k2(r),s=mh(i),a=Object.keys(s),l=d.forwardRef((c,f)=>{const p=pt();if(!p.isStudio||p.isReadOnlyStudio||p.isRendering)return he.createElement(e,{...c,controls:null,ref:f});const{propStatuses:m}=d.useContext(Gu),{getDragOverrides:y}=d.useContext(qu),w=d.useContext(ph),x=Pt();if(c.controls)return he.createElement(e,{...c,ref:f});const[S]=d.useState(()=>{const{stack:j}=c;if(!j)return String(Math.random());const F=Dg[j];if(F)return F;const L=String(Math.random());return Dg[j]=L,L}),h=w.overrideIdToNodePathMappings[S]??null,g=a.map(j=>k1({flatSchema:s,key:j,props:c})),v=d.useMemo(()=>TI(c,a,s),g),b=d.useMemo(()=>({schema:i,currentRuntimeValueDotNotation:v,overrideId:S,supportsEffects:o,componentIdentity:n,componentName:t}),[v,S]),{merged:k,propsToDelete:E}=d.useMemo(()=>b1({schema:i,currentValue:v,overrideValues:h===null?{}:y(h),propStatus:h===null?void 0:v1(m,h),frame:x}),[v,y,h,m,x]),C=jI(i,k),I=RI({flatSchema:s,props:c,valuesDotNotation:k,schemaKeys:C,propsToDelete:E});return he.createElement(e,{...I,controls:b,ref:f})});return l.displayName=`withInteractivitySchema(${e.displayName||e.name||"Component"})`,l},cd=[],PI=({from:e=0,trimBefore:t=0,freeze:n,durationInFrames:r=1/0,children:o,name:i,height:s,width:a,showInTimeline:l=!0,hidden:c=!1,controls:f,_remotionInternalEffects:p,_remotionInternalLoopDisplay:m,_remotionInternalStack:y,_remotionInternalDocumentationLink:w,_remotionInternalSingleChildComponent:x,_remotionInternalPremountDisplay:S,_remotionInternalPostmountDisplay:h,_remotionInternalIsMedia:g,outlineRef:v,...b},k)=>{const{layout:E="absolute-fill"}=b,[C]=d.useState(()=>String(Math.random())),I=d.useContext(St),{rootId:j}=co(),F=I?I.cumulatedFrom+I.relativeFrom:0,L=zu();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 V=fo(),M=ht(),$=e-t,D=((I==null?void 0:I.absoluteFrom)??0)+$,H=I?Math.min(I.durationInFrames-$,r):r,P=Math.max(0,Math.min(M.durationInFrames-e,H)),{registerSequence:T,unregisterSequence:W}=d.useContext(Ji),R=d.useRef(null),Z=b.layout==="none"?v??null:v??R,Q=d.useMemo(()=>(I==null?void 0:I.premounting)||!!b._remotionInternalIsPremounting,[b._remotionInternalIsPremounting,I==null?void 0:I.premounting]),_=d.useMemo(()=>(I==null?void 0:I.postmounting)||!!b._remotionInternalIsPostmounting,[b._remotionInternalIsPostmounting,I==null?void 0:I.postmounting]),N=F+$,z=I?I.cumulatedFrom+I.relativeFrom:0,ne=I?z-I.cumulatedNegativeFrom:0,J=Math.max(0,ne,N),U=N-J,G=d.useMemo(()=>({absoluteFrom:D,cumulatedFrom:F,relativeFrom:$,cumulatedNegativeFrom:U,durationInFrames:P,parentFrom:(I==null?void 0:I.relativeFrom)??0,id:C,height:s??(I==null?void 0:I.height)??null,width:a??(I==null?void 0:I.width)??null,premounting:Q,postmounting:_,premountDisplay:S??null,postmountDisplay:h??null}),[F,D,$,P,I,C,s,a,Q,_,S,h,U]),K=d.useMemo(()=>i??"",[i]),le=w??"https://www.remotion.dev/docs/sequence",Y=pt(),ie=d.useContext(Ju),ke=(b==null?void 0:b.stack)??null,O=d.useRef(null);O.current=y??ke;const X=typeof n=="number"?n:null,se=t===0?null:t,oe=(I==null?void 0:I.cumulatedNegativeFrom)??0,de=g&&g.type!=="image"?g.data.startMediaFrom+oe-U:null,fe=g&&g.type!=="image"?g.data.startMediaFrom+oe:null,Ce=g&&g.type!=="image"&&fe!==null?X===null?null:fe+(m?X%m.durationInFrames:X)*g.data.playbackRate:null;d.useEffect(()=>{if(Y.isStudio)return g?(g.type==="image"?T({type:"image",controls:f??null,effects:p??cd,displayName:K,documentationLink:le,duration:P,from:e,trimBefore:se,id:C,loopDisplay:m,nonce:L.get(),parent:(I==null?void 0:I.id)??null,postmountDisplay:h??null,premountDisplay:S??null,rootId:j,showInTimeline:l,src:g.src,getStack:()=>O.current,refForOutline:Z??null,isInsideSeries:ie,frozenFrame:X,singleChildComponent:x??null}):T({type:g.type,controls:f??null,effects:p??cd,displayName:K,documentationLink:le,doesVolumeChange:g.data.doesVolumeChange,duration:P,from:e,trimBefore:se,id:C,loopDisplay:m,nonce:L.get(),parent:(I==null?void 0:I.id)??null,playbackRate:g.data.playbackRate,postmountDisplay:h??null,premountDisplay:S??null,rootId:j,showInTimeline:l,src:g.data.src,getStack:()=>O.current,startMediaFrom:de??g.data.startMediaFrom,mediaFrameAtSequenceZero:fe,volume:g.data.volumes,refForOutline:Z??null,isInsideSeries:ie,frozenFrame:X,frozenMediaFrame:Ce,singleChildComponent:x??null}),()=>{W(C)}):(T({from:e,trimBefore:se,duration:P,id:C,displayName:K,documentationLink:le,parent:(I==null?void 0:I.id)??null,type:"sequence",rootId:j,showInTimeline:l,nonce:L.get(),loopDisplay:m,getStack:()=>O.current,premountDisplay:S??null,postmountDisplay:h??null,controls:f??null,effects:p??cd,refForOutline:Z??null,isInsideSeries:ie,frozenFrame:X,singleChildComponent:x??null}),()=>{W(C)})},[r,C,i,T,K,W,I==null?void 0:I.id,P,j,e,t,se,l,L,m,S,h,Y.isStudio,f,p,g,le,Z,ie,X,de,fe,Ce,x]);const Te=Math.ceil(F+e+r-1),Re=V<F+e||V>Te?null:o,xe=Re===null||typeof n>"u"||n===null?Re:u.jsx(Sa,{frame:n,children:Re}),be=b.layout==="none"?void 0:b.style,pe=d.useCallback(Ie=>{R.current=Ie,typeof k=="function"?k(Ie):k&&(k.current=Ie)},[k]),Le=d.useMemo(()=>({flexDirection:void 0,...a?{width:a}:{},...s?{height:s}:{},...be??{}}),[s,be,a]);if(k!==null&&E==="none")throw new TypeError('It is not supported to pass both a `ref` and `layout="none"` to <Sequence />.');return c?null:u.jsx(St.Provider,{value:G,children:xe===null?null:b.layout==="none"?xe:u.jsx(kn,{ref:pe,style:Le,className:b.className,children:xe})})},FI=d.forwardRef(PI),$I=(e,t)=>{if(e.layout==="none")throw new Error('`<Sequence>` with `premountFor` and `postmountFor` props does not support layout="none"');const{style:n,from:r=0,durationInFrames:o=1/0,premountFor:i=0,postmountFor:s=0,styleWhilePremounted:a,styleWhilePostmounted:l,...c}=e,{freezeFrame:f,isPremountingOrPostmounting:p,postmountingActive:m,premountingActive:y,premountingStyle:w}=Ea({from:r,durationInFrames:o,premountFor:i,postmountFor:s,style:n??null,styleWhilePremounted:a??null,styleWhilePostmounted:l??null,hideWhilePremounted:"opacity"});return u.jsx(Sa,{frame:f,active:p,children:u.jsx(ec,{ref:t,from:r,durationInFrames:o,style:w??void 0,_remotionInternalPremountDisplay:i,_remotionInternalPostmountDisplay:s,_remotionInternalIsPremounting:y,_remotionInternalIsPostmounting:m,...c})})},_I=d.forwardRef($I),MI=(e,t)=>{const n=pt(),{fps:r}=ht();if(e.layout!=="none"&&!n.isRendering){const o=e.premountFor;if(o||e.postmountFor)return u.jsx(_I,{ref:t,...e,premountFor:o})}return u.jsx(FI,{...e,ref:t})},ec=d.forwardRef(MI),E1=ec,Ft=Pr({Component:ec,componentName:"<Sequence>",componentIdentity:"dev.remotion.remotion.Sequence",schema:Bi,supportsEffects:!1});Pr({Component:ec,componentName:"<Sequence>",componentIdentity:null,schema:C2,supportsEffects:!1});var C1=(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)}},AI="https://remotion.dev/docs/troubleshooting/webgl2-context",I1=(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 ${AI}`,NI=e=>new Error(I1("WebGL",e)),T1=e=>new Error(I1("WebGL2",e));class LI{constructor(t,n){Oe(this,"width");Oe(this,"height");Oe(this,"pairs",new Map);Oe(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 T1("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 OI=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},nl=null,DI=()=>nl||(nl=(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()})(),nl),j1=(e,t)=>({pool:new LI(e,t),setupCache:new WeakMap,cleanupRegistry:[],currentRunId:0}),Hf=e=>{e.currentRunId++;for(const t of e.cleanupRegistry)t.definition.cleanup(t.state)},zI=(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},ja=async({state:e,source:t,effects:n,output:r,width:o,height:i})=>{const s=++e.currentRunId,a=()=>e.currentRunId!==s,l=n.filter(S=>!S.params.disabled),c=OI(l);let f=t,p=null;if(c.length===0){if(t===r)return!0;const S=r.getContext("2d");if(!S)throw new Error("Failed to acquire 2D context for output canvas");return S.clearRect(0,0,o,i),S.drawImage(f,0,0,o,i),!0}let m=!1;for(const S of c)if(S.backend==="webgpu"){m=!0;break}const y=m?await DI():null;if(a())return!1;let w=!0;for(let S=0;S<c.length;S++){const h=c[S],[g,v]=e.pool.getPair(h.backend);let b=g;for(const E of h.effects){const C=E.definition,I=zI(e,C,b);C.apply({source:f,target:b,state:I,params:E.params,width:o,height:i,gpuDevice:y,flipSourceY:h.backend==="webgl2"?w:!1}),h.backend==="webgl2"&&(w=!0,e.pool.assertContextNotLost(b)),f=b,b=b===g?v:g}p=f??p;const k=c[S+1];if(k&&k.backend!==h.backend&&p)if(h.backend==="2d"&&k.backend==="webgl2")f=p,w=!0;else{const E=await createImageBitmap(p);if(a())return E.close(),!1;f=E,k.backend==="webgl2"&&(w=!1)}}if(!p)return!0;const x=r.getContext("2d");if(!x)throw new Error("Failed to acquire 2D context for output canvas");return x.clearRect(0,0,o,i),x.drawImage(p,0,0,o,i),!0},Ra=()=>{const e=d.useRef(null),t=d.useRef(null);return d.useEffect(()=>()=>{e.current&&Hf(e.current)},[]),d.useMemo(()=>({get:(n,r)=>((!t.current||t.current.width!==n||t.current.height!==r)&&(e.current&&Hf(e.current),e.current=j1(n,r),t.current={width:n,height:r}),e.current)}),[])},BI=({width:e,height:t,fit:n,className:r,style:o,effects:i,...s},a)=>{const l=d.useRef(null),c=Ra(),f=d.useMemo(()=>typeof document>"u"?null:document.createElement("canvas"),[]),p=d.useCallback(m=>{const y=l.current,w=e??m.displayWidth,x=t??m.displayHeight;if(!y)throw new Error("Canvas ref is not set");if(!f)throw new Error("Source canvas is not available");f.width=w,f.height=x;const S=f.getContext("2d");if(!S)throw new Error("Could not get 2d context for source canvas");return S.drawImage(m,...C1(n,{height:m.displayHeight,width:m.displayWidth},{width:w,height:x})),y.width=w,y.height=x,ja({state:c.get(w,x),source:f,effects:i,output:y,width:w,height:x})},[c,i,n,t,f,e]);return d.useImperativeHandle(a,()=>({draw:p,getCanvas:()=>{if(!l.current)throw new Error("Canvas ref is not set");return l.current},clear:()=>{var y;const m=(y=l.current)==null?void 0:y.getContext("2d");if(!m)throw new Error("Could not get 2d context");m.clearRect(0,0,l.current.width,l.current.height)}}),[p]),u.jsx("canvas",{ref:l,className:r,style:o,...s})},WI=he.forwardRef(BI),R1=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}},VI=5,zg=({loopBehavior:e,durationFound:t,timeInSec:n})=>e==="loop"?t?n%t:n:Math.min(n,t||1/0),HI=async({resolvedSrc:e,signal:t,requestInit:n,currentTime:r,initialLoopBehavior:o})=>{const{decoder:i,selectedTrack:s}=await R1({resolvedSrc:e,signal:t,requestInit:n,contentType:null}),a=[];let l=null;const c=async y=>{const w=a.find(S=>S.frameIndex===y);if(w&&w.frame)return w;const x=await i.decode({frameIndex:y,completeFramesOnly:!0});return w?w.frame=x.image:a.push({frame:x.image,frameIndex:y,timeInSeconds:x.image.timestamp/1e6}),{frame:x.image,frameIndex:y,timeInSeconds:x.image.timestamp/1e6}},f=y=>{const x=a.filter(S=>S.frame).sort((S,h)=>{const g=Math.abs(S.timeInSeconds-y),v=Math.abs(h.timeInSeconds-y);return g-v});for(let S=0;S<x.length;S++){if(S<VI)continue;const h=x[S];h.frame=null}},p=async({timeInSec:y,loopBehavior:w})=>{const x=zg({durationFound:l,loopBehavior:w,timeInSec:y}),h=a.filter(v=>v.timeInSeconds<=x).map(v=>v.frameIndex).reduce((v,b)=>Math.max(v,b),0);let g=h;for(;;){const v=await c(g);if(g++,!v.frame)throw new Error("No frame found");if(!v.frame.duration||(g===s.frameCount&&l===null&&(l=(v.frame.timestamp+v.frame.duration)/1e6),v.timeInSeconds>x||g===s.frameCount))break}s.frameCount-h<3&&w==="loop"&&await c(0),f(x)};return await p({timeInSec:r,loopBehavior:o}),await p({timeInSec:r,loopBehavior:o}),{close:()=>{var y;for(const w of a)(y=w.frame)==null||y.close(),w.frame=null;i.close()},getFrame:async(y,w)=>{if(l!==null&&y>l&&w==="clear-after-finish")return null;const x=zg({loopBehavior:w,durationFound:l,timeInSec:y});await p({timeInSec:x,loopBehavior:w});const h=a.filter(g=>g.frame).reduce((g,v)=>{const b=Math.abs(g.timeInSeconds-x),k=Math.abs(v.timeInSeconds-x);return b<k?g:v});if(!h.frame)throw new Error("No frame found");return h},frameCount:s.frameCount}},UI=({frame:e,playbackRate:t,fps:n})=>e*t/n,ZI=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})},KI=e=>typeof window>"u"?e:new URL(e,window.origin).href,YI={src:{type:"asset",default:void 0,description:"Source",keyframable:!1},...Rr,...qi,playbackRate:{type:"number",min:0,max:10,step:.1,default:1,description:"Playback rate",hiddenFromList:!1,keyframable:!1},...dr,...ho,...po},GI=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},P1=d.forwardRef(({src:e,width:t,height:n,onError:r,loopBehavior:o="loop",playbackRate:i=1,fit:s="fill",requestInit:a,effects:l,controls:c,...f},p)=>{const m=KI(e),[y,w]=d.useState(null),{delayRender:x,continueRender:S}=Xn(),[h]=d.useState(()=>x(`Rendering <AnimatedImage/> with src="${m}"`)),g=Pt(),{fps:v}=ht(),b=UI({frame:g,playbackRate:i,fps:v}),k=d.useRef(b);k.current=b;const E=ZI(a),C=d.useRef(a);C.current=a;const I=d.useRef(null),j=Ta({effects:l,overrideId:(c==null?void 0:c.overrideId)??null});d.useImperativeHandle(p,()=>{var V;const L=(V=I.current)==null?void 0:V.getCanvas();if(!L)throw new Error("Canvas ref is not set");return L},[]);const[F]=d.useState(()=>o);return d.useEffect(()=>{const L=new AbortController;let V=!1,M=!1;const $=()=>{M||(M=!0,S(h))};return HI({resolvedSrc:m,signal:L.signal,requestInit:C.current,currentTime:k.current,initialLoopBehavior:F}).then(D=>{if(V){D.close();return}w(D),$()}).catch(D=>{if(!V){if(D.name==="AbortError"){$();return}r?(r==null||r(D),$()):aa(D)}}),()=>{V=!0,L.abort(),$()}},[m,h,r,E,F,S]),d.useEffect(()=>()=>{y==null||y.close()},[y]),d.useLayoutEffect(()=>{if(!y)return;const L=x(`Rendering frame at ${b} of <AnimatedImage src="${e}"/>`);let V=!1;return y.getFrame(b,o).then(async M=>{var D,H;if(V)return;if(M===null){(D=I.current)==null||D.clear(),S(L);return}await((H=I.current)==null?void 0:H.draw(M.frame))&&!V&&S(L)}).catch(M=>{V||(r?(r(M),S(L)):aa(M))}),()=>{V=!0,S(L)}},[b,y,o,r,e,S,x,j,s,t,n]),u.jsx(WI,{ref:I,width:t,height:n,fit:s,effects:j,...f})});P1.displayName="AnimatedImageContent";var XI=({src:e,width:t,height:n,onError:r,fit:o,playbackRate:i,loopBehavior:s,id:a,className:l,style:c,durationInFrames:f,from:p,premountFor:m,postmountFor:y,styleWhilePremounted:w,styleWhilePostmounted:x,requestInit:S,effects:h=[],controls:g,ref:v,...b})=>{const k=d.useRef(null),E=Ia(h);d.useImperativeHandle(v,()=>k.current,[]);const{effectivePostmountFor:C,effectivePremountFor:I,freezeFrame:j,isPremountingOrPostmounting:F,postmountingActive:L,premountingActive:V,premountingStyle:M}=Ea({from:p??0,durationInFrames:f??1/0,premountFor:m??null,postmountFor:y??null,style:c??null,styleWhilePremounted:w??null,styleWhilePostmounted:x??null,hideWhilePremounted:"display-none"}),$=GI(b),D={src:e,width:t,height:n,onError:r,fit:o,playbackRate:i,loopBehavior:s,id:a,className:l,style:M??void 0,requestInit:S,...$};return u.jsx(Sa,{frame:j,active:F,children:u.jsx(Ft,{layout:"none",from:p??0,durationInFrames:f??1/0,name:"<AnimatedImage>",_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/animatedimage",controls:g,_remotionInternalEffects:E,_remotionInternalPremountDisplay:I||null,_remotionInternalPostmountDisplay:C||null,_remotionInternalIsPremounting:V,_remotionInternalIsPostmounting:L,...b,outlineRef:k,children:u.jsx(P1,{...D,ref:k,effects:h,controls:g})})})},F1=Pr({Component:XI,componentName:"<AnimatedImage>",componentIdentity:"dev.remotion.remotion.AnimatedImage",schema:YI,supportsEffects:!0});F1.displayName="AnimatedImage";en(F1);var qI={type:"boolean",default:!1,description:"Disabled"},JI=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:qI,...e.schema}};return(i={})=>(n(i),{definition:r,params:i,effectKey:r.calculateKey(i),memoized:!1})},QI=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.')},eT=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")},$1=e=>{e.type==="artifact"&&(QI(e.filename),e.contentType!=="thumbnail"&&eT(e.content))},Uo=d.createContext({registerRenderAsset:()=>{},unregisterRenderAsset:()=>{},renderAssets:[]}),tT=({children:e,collectAssets:t})=>{const[n,r]=d.useState([]),o=d.useRef([]),i=d.useCallback(l=>{$1(l),o.current=[...o.current,l],r(o.current)},[]);t&&d.useImperativeHandle(t,()=>({collectAssets:()=>{const l=o.current;return o.current=[],r([]),l}}),[]);const s=d.useCallback(l=>{o.current=o.current.filter(c=>c.id!==l),r(o.current)},[]);d.useLayoutEffect(()=>{typeof window<"u"&&(window.remotion_collectAssets=()=>{const l=o.current;return o.current=[],r([]),l})},[]);const a=d.useMemo(()=>({registerRenderAsset:i,unregisterRenderAsset:s,renderAssets:n}),[n,i,s]);return u.jsx(Uo.Provider,{value:a,children:e})},ur=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,tc=({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))},_1=d.createContext(null),nT=()=>he.useContext(_1),nc=({durationInFrames:e,times:t=1/0,children:n,name:r,showInTimeline:o,...i})=>{const s=Pt(),{durationInFrames:a}=ht();if(Bu(e,{component:"of the <Loop /> component",allowFloats:!0}),typeof t!="number")throw new TypeError(`You passed to "times" an argument of type ${typeof t}, but it must be a number.`);if(t!==1/0&&t%1!==0)throw new TypeError(`The "times" prop of a loop must be an integer, but got ${t}.`);if(t<0)throw new TypeError(`The "times" prop of a loop must be at least 0, but got ${t}`);const l=Math.ceil(a/e),c=Math.min(l,t),f=i.layout==="none"?void 0:i.style,p=e*(c-1),y=Math.floor(s/e)*e,w=Math.min(y,p),x=d.useMemo(()=>({numberOfTimes:Math.min(a/e,t),startOffset:-w,durationInFrames:e}),[a,e,w,t]),S=d.useMemo(()=>({iteration:Math.floor(s/e),durationInFrames:e}),[s,e]);return u.jsx(_1.Provider,{value:S,children:u.jsx(Ft,{durationInFrames:e,from:w,name:r??"<Loop>",_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/loop",_remotionInternalLoopDisplay:x,layout:i.layout,style:f,showInTimeline:o,children:n})})};nc.useLoop=nT;var Ut=({logLevel:e,tag:t,message:n,mountTime:r})=>{const o=[r?Date.now()-r+"ms ":null,t].filter(Boolean).join(" ");jt.trace({logLevel:e,tag:null},`[${o}]`,n)},rc=d.createContext({}),Bg={},dd=[],M1=({children:e})=>{const[t,n]=d.useState(()=>Bg);return d.useEffect(()=>{const r=()=>{n(Bg)};return dd.push(r),()=>{dd=dd.filter(o=>o!==r)}},[]),u.jsx(rc.Provider,{value:t,children:e})},A1=e=>{const t=e.indexOf("#");return t===-1?null:t},rT=e=>{const t=A1(e);return t===null?e:e.slice(0,t)},Zo=e=>{const t=d.useContext(rc),n=A1(e),r=rT(e);return t[r]?n!==null?t[r]+e.slice(n):t[r]:e},oc=(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`)},oT=(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.")},iT=(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.")},ic=({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"?iT(n,r):(typeof e<"u"||typeof t<"u")&&oT(e,t)},sc=({startFrom:e,endAt:t,trimBefore:n,trimAfter:r})=>({trimBeforeValue:n??e??void 0,trimAfterValue:r??t??void 0}),sT=(e,t)=>{switch(t.type){case"got-duration":{const n=ur(t.src);return e[n]===t.durationInSeconds?e:{...e,[n]:t.durationInSeconds}}default:return e}},gh=d.createContext({durations:{},setDurations:()=>{throw new Error("context missing")}}),N1=({children:e})=>{const[t,n]=d.useReducer(sT,{}),r=d.useMemo(()=>({durations:t,setDurations:n}),[t]);return u.jsx(gh.Provider,{value:r,children:e})},yh=({crossOrigin:e,requestsVideoFrame:t,isClientSideRendering:n})=>{if(e!=null)return e;if(n||t)return"anonymous"},hu=({mediaRef:e,mediaType:t,onAutoPlayError:n,logLevel:r,mountTime:o,reason:i,isPlayer:s})=>{const{current:a}=e;if(!a)return;Ut({logLevel:r,tag:"play",message:`Attempting to play ${a.src}. Reason: ${i}`,mountTime:o});const l=a.play();l.catch&&l.catch(c=>{if(a&&!c.message.includes("request was interrupted by a call to pause")&&!c.message.includes("The operation was aborted.")&&!c.message.includes("The fetching process for the media resource was aborted by the user agent")&&!c.message.includes("request was interrupted by a new load request")&&!c.message.includes("because the media was removed from the document")&&!(c.message.includes("user didn't interact with the document")&&a.muted)&&(console.log(`Could not play ${t} due to following error: `,c),!a.muted)){if(n){n();return}t==="video"&&s&&(jt.info({logLevel:r,tag:"<"+t+">"},"The video will be muted and we'll retry playing it."),jt.info({logLevel:r,tag:"<"+t+">"},"Use onAutoPlayError() to handle this error yourself."),a.muted=!0,a.play())}})},vh=({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}}},Wg=!1,aT=e=>{Wg||(Wg=!0,typeof window<"u"&&jt.warn({logLevel:e,tag:null},"AudioContext is not supported in this browser"))},lT=({logLevel:e,latencyHint:t,audioEnabled:n,sampleRate:r})=>{const o=pt(),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 aT(e),null;const a=new AudioContext({latencyHint:t,sampleRate:r}),l=a.createGain();l.connect(a.destination),jt.trace({logLevel:e,tag:"audio"},"Creating new audio context"),a.suspend();let c=null;return{audioContext:a,gainNode:l,getState:()=>{const y=a.state;return c==="running"&&y!=="running"?"suspended-to-running":c==="suspended"&&y!=="suspended"?"running-to-suspended":y},resume:()=>{c="running";const y=a.resume();return y.finally(()=>{c==="running"&&(c=null)}),y},suspend:()=>{c="suspended";const y=a.suspend();return y.finally(()=>{c==="suspended"&&(c=null)}),y}}},[e,t,o.isRendering,n,r])},uT=(e,t)=>new Promise(n=>{const r=e.currentTime,i=e.getOutputTimestamp().performanceTime,s=performance.now(),a=()=>{var p;const{currentTime:l}=e,c=e.getOutputTimestamp(),f=performance.now()-s;if(i!==void 0&&c.performanceTime!==void 0&&c.performanceTime>i&&c.contextTime!==void 0&&c.contextTime>r){jt.verbose({logLevel:t,tag:"audio"},`waitUntilActuallyResumed: getOutputTimestamp.performanceTime advanced from ${i.toFixed(6)} to ${c.performanceTime.toFixed(6)} after ${f.toFixed(1)}ms. currentTime=${l.toFixed(6)} (advanced by ${(l-r).toFixed(6)}), getOutputTimestamp.performanceTime=${((p=c.performanceTime)==null?void 0:p.toFixed(1))??"undefined"}`),n();return}requestAnimationFrame(a)};requestAnimationFrame(a)}),fd="data:audio/mp3;base64,/+MYxAAJcAV8AAgAABn//////+/gQ5BAMA+D4Pg+BAQBAEAwD4Pg+D4EBAEAQDAPg++hYBH///hUFQVBUFREDQNHmf///////+MYxBUGkAGIMAAAAP/29Xt6lUxBTUUzLjEwMFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV/+MYxDUAAANIAAAAAFVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV",cT=(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},dT=(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,es=d.createContext(null),ac=d.createContext(null),fT=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}`)},L1=({children:e,audioLatencyHint:t,audioEnabled:n,previewSampleRate:r})=>{const o=cr(),i=r??48e3;d.useEffect(()=>{typeof window>"u"||(window.remotion_sampleRate=i)},[i]);const s=lT({logLevel:o,latencyHint:t,audioEnabled:n,sampleRate:i}),a=d.useRef(!1),l=d.useRef(null),c=d.useMemo(()=>({value:0}),[]),f=d.useRef([]),p=d.useMemo(()=>({dispatch:b=>{f.current.forEach(k=>k(b))},subscribe:b=>(f.current.push(b),{remove:()=>{f.current=f.current.filter(k=>k!==b)}})}),[]),m=d.useRef({scheduledEndTime:null,mediaEndTime:null}),y=d.useRef(new Map),w=d.useCallback(b=>{y.current.delete(b)},[]),x=d.useMemo(()=>({node:b,mediaTimestamp:k,sourceOffset:E,scheduledTime:C,duration:I,offset:j,originalUnloopedMediaTimestamp:F})=>{if(!s)throw new Error("Audio context not found");const L=s.getState();if(L==="closed")return{type:"not-started",reason:"audio context is closed"};const V=fT(L);I>0&&(V?y.current.set(b,{scheduledTime:C,offset:j,duration:I}):b.start(C,j,I));const M=C+I/b.playbackRate.value,$=k+j-E,D=$+I,H=s.audioContext.baseLatency+s.audioContext.outputLatency,P=C-s.audioContext.currentTime,T=m.current,W=T.scheduledEndTime!==null&&Math.abs(C-T.scheduledEndTime)>.001,R=T.mediaEndTime!==null&&Math.abs($-T.mediaEndTime)>.001;return jt.verbose({logLevel:o,tag:"audio-scheduling"},"scheduled %c%s%c %s %c%s%c %s %c%s%c %s %s %s %s %s",W?"color: red; font-weight: bold":"",C.toFixed(4),"",M.toFixed(4),R?"color: red; font-weight: bold":"",$.toFixed(4),"",D.toFixed(4),I<0||P<0?"color: red; font-weight: bold":"color: blue; font-weight: bold",I<0?"missed "+Math.abs(j).toFixed(2)+"s":Math.abs(P).toFixed(2)+(P<0?" delay":" ahead"),"","current="+s.audioContext.currentTime.toFixed(4),"offset="+j.toFixed(4),"latency="+H.toFixed(4),"state="+s.audioContext.state,F!==$?"original_ts="+F.toFixed(4):"","action="+(V?"schedule":"start"),""),T.scheduledEndTime=M,T.mediaEndTime=D,I>0?{type:"started",scheduledTime:C}:{type:"not-started",reason:"missed "+Math.abs(j).toFixed(2)+"s"}},[s,o]),S=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),y.current.forEach((k,E)=>{E.start(k.scheduledTime,k.offset,k.duration)}),y.current.clear();const b=s.resume();return l.current=new Promise(k=>{uT(s.audioContext,o).then(k),b.catch(E=>{jt.warn({logLevel:o,tag:"audio"},"AudioContext resume rejected, continuing without audio sync",E),k()})}).finally(()=>{l.current=null}),b.catch(()=>{})},[s,o]),h=d.useCallback(()=>l.current,[]),g=d.useCallback(()=>!s||!a.current?Promise.resolve():(a.current=!1,s.suspend()),[s]),v=d.useMemo(()=>({audioContext:(s==null?void 0:s.audioContext)??null,getAudioContextState:()=>(s==null?void 0:s.getState())??null,gainNode:(s==null?void 0:s.gainNode)??null,audioSyncAnchor:c,audioSyncAnchorEmitter:p,scheduleAudioNode:x,resume:S,suspend:g,getIsResumingAudioContext:h,unscheduleAudioNode:w}),[s,c,p,x,S,g,h,w]);return u.jsx(es.Provider,{value:v,children:e})},O1=({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=cr(),i=ba(),s=pt(),a=d.useContext(es),l=(a==null?void 0:a.audioContext)??null,c=a==null?void 0:a.resume,[f]=d.useState(()=>new Array(t).fill(!0).map(()=>{const b=d.createRef();return{id:Math.random(),ref:b,mediaElementSourceNode:vh({audioContext:l,ref:b})}}));for(const{mediaElementSourceNode:b}of f)b==null||b.setAudioContext(l);(he.useInsertionEffect??he.useLayoutEffect)(()=>()=>{requestAnimationFrame(()=>{f.forEach(({mediaElementSourceNode:b})=>{b==null||b.cleanup()})})},[f]);const m=d.useRef(new Array(t).fill(!1)),y=d.useCallback(()=>{f.forEach(({ref:b,id:k})=>{var I;const E=(I=n.current)==null?void 0:I.find(j=>j.id===k),{current:C}=b;if(C){if(E===void 0){C.src!==fd&&(C.src=fd);return}if(!E)throw new TypeError("Expected audio data to be there");Object.keys(E.props).forEach(j=>{dT(j,E.props[j],C[j])&&(C[j]=E.props[j])})}})},[f]),w=d.useCallback(b=>{var H,P;const{aud:k,audioId:E,premounting:C,postmounting:I}=b,j=(H=n.current)==null?void 0:H.find(T=>T.audioId===E);if(j)return j;const F=m.current.findIndex(T=>T===!1);if(F===-1)throw new Error(`Tried to simultaneously mount ${t+1} <Html5Audio /> tags at the same time. With the current settings, the maximum amount of <Html5Audio /> tags is limited to ${t} at the same time. Remotion pre-mounts silent audio tags to help avoid browser autoplay restrictions. See https://remotion.dev/docs/player/autoplay#using-the-numberofsharedaudiotags-prop for more information on how to increase this limit.`);const{id:L,ref:V,mediaElementSourceNode:M}=f[F],$=[...m.current];$[F]=L,m.current=$;const D={props:k,id:L,el:V,audioId:E,mediaElementSourceNode:M,premounting:C,audioMounted:!!V.current,postmounting:I,cleanupOnMediaTagUnmount:()=>{}};return(P=n.current)==null||P.push(D),y(),D},[t,f,y]),x=d.useCallback(b=>{var C;const k=[...m.current],E=f.findIndex(I=>I.id===b);if(E===-1)throw new TypeError(`Unknown audio ref ${b}; refs: ${f.map(I=>I.id).join(", ")}`);k[E]=!1,m.current=k,n.current=(C=n.current)==null?void 0:C.filter(I=>I.id!==b),y()},[f,y]),S=d.useCallback(({aud:b,audioId:k,id:E,premounting:C,postmounting:I})=>{var F;let j=!1;n.current=(F=n.current)==null?void 0:F.map(L=>{const V=!!L.el.current;return L.audioMounted!==V&&(j=!0),L.id===E?cT(b,L.props)&&L.premounting===C&&L.postmounting===I?L.audioMounted===V?L:{...L,audioMounted:V}:(j=!0,{...L,props:b,premounting:C,postmounting:I,audioId:k,audioMounted:V}):L.audioMounted===V?L:{...L,audioMounted:V}}),j&&y()},[y]),h=d.useCallback(()=>{f.forEach(b=>{const k=n.current.find(E=>E.el===b.ref);k!=null&&k.premounting||hu({mediaRef:b.ref,mediaType:"audio",onAutoPlayError:null,logLevel:o,mountTime:i,reason:"playing all audios",isPlayer:s.isPlayer})}),c==null||c()},[o,i,f,s.isPlayer,c]),g=d.useMemo(()=>({registerAudio:w,unregisterAudio:x,updateAudio:S,playAllAudios:h,numberOfAudioTags:t}),[t,h,w,x,S]),v=d.useMemo(()=>f.map(({id:b,ref:k})=>u.jsx("audio",{ref:k,preload:"metadata",src:fd},b)),[f]);return u.jsxs(ac.Provider,{value:g,children:[v,e]})},pT=({aud:e,audioId:t,premounting:n,postmounting:r})=>{var l;const o=d.useContext(es),i=d.useContext(ac),[s]=d.useState(()=>{if(i&&i.numberOfAudioTags>0)return i.registerAudio({aud:e,audioId:t,premounting:n,postmounting:r});const c=he.createRef(),f=vh({audioContext:(o==null?void 0:o.audioContext)??null,ref:c});return{el:c,id:Math.random(),props:e,audioId:t,mediaElementSourceNode:f,premounting:n,audioMounted:!!c.current,postmounting:r,cleanupOnMediaTagUnmount:()=>{f==null||f.cleanup()}}});(l=s.mediaElementSourceNode)==null||l.setAudioContext((o==null?void 0:o.audioContext)??null);const a=he.useInsertionEffect??he.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},hT=1e-5,mu=(e,t)=>Math.abs(e-t)<hT,D1=(e,t)=>Math.round(e/t*100)/100,Uf=()=>typeof window>"u"||!/AppleWebKit/.test(window.navigator.userAgent)?!1:!window.navigator.userAgent.includes("Chrome/"),lc=()=>typeof window>"u"?!1:/iP(ad|od|hone)/i.test(window.navigator.userAgent)&&Uf(),mT=e=>lc()&&e.startsWith("blob:"),Zf=({actualFrom:e,fps:t})=>D1(Math.max(0,-e),t),Kf=({duration:e,fps:t})=>D1(e,t),gT=({actualSrc:e,actualFrom:t,duration:n,fps:r})=>{if(mT(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=${Zf({actualFrom:t,fps:r})}`;return Number.isFinite(n)?`${i},${Kf({duration:n,fps:r})}`:i},yT=({prevStartFrom:e,newStartFrom:t,prevDuration:n,newDuration:r,fps:o})=>{const i=Zf({actualFrom:e,fps:o}),s=Zf({actualFrom:t,fps:o}),a=Kf({duration:n,fps:o}),l=Kf({duration:r,fps:o});return!(s<i||l>a)},vT=({actualSrc:e,actualFrom:t,duration:n,fps:r})=>{const o=d.useRef(t),i=d.useRef(n),s=d.useRef(e);return(!yT({prevStartFrom:o.current,newStartFrom:t,prevDuration:i.current,newDuration:n,fps:r})||e!==s.current)&&(o.current=t,i.current=n,s.current=e),gT({actualSrc:s.current,actualFrom:o.current,duration:i.current,fps:r})},Vg=!1,wT=e=>{Vg||(Vg=!0,jt.warn({logLevel:e,tag:null},"In Safari, setting a volume and a playback rate at the same time is buggy."),jt.warn({logLevel:e,tag:null},"In Desktop Safari, only volumes <= 1 will be applied."),jt.warn({logLevel:e,tag:null},e,"In Mobile Safari, the volume will be ignored and set to 1 if a playbackRate is set."))},z1=({mediaRef:e,volume:t,logLevel:n,source:r,shouldUseWebAudioApi:o})=>{var m,y,w;const i=d.useRef(null),s=d.useRef(t);s.current=t;const a=d.useContext(es);if(!a)throw new Error("useAmplification must be used within a SharedAudioContext");const{audioContext:l,gainNode:c}=a;if(typeof window<"u"&&d.useLayoutEffect(()=>{var S,h;if(!l||!e.current||!o)return;if(e.current.playbackRate!==1&&Uf()){wT(n);return}if(!r||!c)return;const x=new GainNode(l,{gain:s.current});return r.attemptToConnect(),r.get().connect(x),x.connect(c),i.current={gainNode:x},jt.trace({logLevel:n,tag:null},`Starting to amplify ${(S=e.current)==null?void 0:S.src}. Gain = ${s.current}, playbackRate = ${(h=e.current)==null?void 0:h.playbackRate}`),()=>{i.current=null,x.disconnect(),r.get().disconnect()}},[n,e,l,r,o,c]),i.current){const x=t;mu(i.current.gainNode.gain.value,x)||(i.current.gainNode.gain.value=x,jt.trace({logLevel:n,tag:null},`Setting gain to ${x} for ${(m=e.current)==null?void 0:m.src}`))}return(Uf()&&e.current&&((y=e.current)==null?void 0:y.playbackRate)!==1||!o)&&e.current&&!mu(t,(w=e.current)==null?void 0:w.volume)&&(e.current.volume=Math.min(t,1)),i},Lo=()=>{const e=d.useContext(St);return(e==null?void 0:e.cumulatedNegativeFrom)??0},ts=e=>{const t=nc.useLoop(),n=Pt(),r=Lo();return e==="repeat"||t===null?n+r:n+r+t.durationInFrames*t.iteration},B1=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]},xT=({compositionDurationInFrames:e,playbackRate:t,trimBefore:n,trimAfter:r,parentSequenceDurationInFrames:o,loop:i})=>{if(i)return e;const s=tc({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},Ko=({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)},Hg={},bT=e=>{Hg[e]||(console.warn(e),Hg[e]=!0)},W1=({volume:e,mediaVolume:t,mediaType:n,src:r,displayName:o,trimBefore:i,trimAfter:s,playbackRate:a,sequenceDurationInFrames:l,mediaStartsAt:c,loop:f})=>{if(!r)throw new Error("No src passed");const p=d.useContext(St),[m]=d.useState(()=>e),y=xT({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,y+c))).fill(!0).map((b,k)=>Ko({frame:k+c,volume:e,mediaVolume:t})).join(","),[y,c,e,t]);d.useEffect(()=>{typeof e=="number"&&e!==m&&bT(`Remotion: The ${n} with src ${r} has changed it's volume. Prefer the callback syntax for setting volume to get better timeline display: https://www.remotion.dev/docs/audio/volume`)},[m,n,r,e]);const x=typeof e=="function",S=zu(),{rootId:h}=co(),g=0-c+(i??0);return d.useMemo(()=>({volumes:w,duration:y,doesVolumeChange:x,nonce:S,rootId:h,finalDisplayName:o??B1(r),startMediaFrom:g,src:r,playbackRate:a}),[w,y,x,S,h,o,r,g,a])},wh=({volume:e,mediaVolume:t,src:n,mediaType:r,playbackRate:o,displayName:i,id:s,getStack:a,showInTimeline:l,premountDisplay:c,postmountDisplay:f,loopDisplay:p,documentationLink:m,refForOutline:y})=>{const w=d.useContext(St),x=Lo(),{registerSequence:S,unregisterSequence:h}=d.useContext(Ji),{durationInFrames:g}=ht(),v=Lo(),{volumes:b,duration:k,doesVolumeChange:E,nonce:C,rootId:I,finalDisplayName:j}=W1({volume:e,mediaVolume:t,mediaType:r,src:n,displayName:i,trimAfter:void 0,trimBefore:void 0,playbackRate:o,sequenceDurationInFrames:g,mediaStartsAt:v,loop:!1}),{isStudio:F}=pt();d.useEffect(()=>{var L,V;if(!n)throw new Error("No src passed");if(!(!F&&((V=(L=window.process)==null?void 0:L.env)==null?void 0:V.NODE_ENV)!=="test")&&l)return S({type:r,src:n,id:s,duration:k,from:0,trimBefore:null,parent:(w==null?void 0:w.id)??null,displayName:j,documentationLink:m,rootId:I,volume:b,showInTimeline:!0,nonce:C.get(),startMediaFrom:0-x,mediaFrameAtSequenceZero:null,doesVolumeChange:E,loopDisplay:p,playbackRate:o,getStack:a,premountDisplay:c,postmountDisplay:f,controls:null,effects:[],refForOutline:y,isInsideSeries:!1,frozenFrame:null,frozenMediaFrame:null}),()=>{h(s)}},[k,s,w,n,S,h,b,E,C,r,x,o,a,l,c,f,p,m,I,j,F,y])},ST=(e,t)=>{const[n,r]=d.useState([]),[o,i]=d.useState([]),[s,a]=d.useState([]),c=pt().isRendering,f=d.useRef(!1),p=d.useCallback(w=>{if(c)return{unblock:()=>{}};let x=!1;return r(S=>[...S,w]),{unblock:()=>{x||(x=!0,r(S=>{const h=S.filter(g=>g!==w);return h.length===S.length?S:h}))}}},[c]),m=d.useCallback(w=>(i(x=>[...x,w]),{remove:()=>{i(x=>x.filter(S=>S!==w))}}),[]),y=d.useCallback(w=>(a(x=>[...x,w]),{remove:()=>{a(x=>x.filter(S=>S!==w))}}),[]);return d.useEffect(()=>{c||n.length>0&&!f.current&&(f.current=!0,o.forEach(w=>w()),Ut({logLevel:e,message:"Player is entering buffer state",mountTime:t,tag:"player"}))},[n]),typeof window<"u"&&d.useLayoutEffect(()=>{c||n.length===0&&f.current&&(f.current=!1,s.forEach(w=>w()),Ut({logLevel:e,message:"Player is exiting buffer state",mountTime:t,tag:"player"}))},[n]),d.useMemo(()=>({addBlock:p,listenForBuffering:m,listenForResume:y,buffering:f}),[p,f,m,y])},ns=he.createContext(null),V1=({children:e})=>{const{logLevel:t,mountTime:n}=d.useContext(Vo),r=ST(t??"info",n);return u.jsx(ns.Provider,{value:r,children:e})},H1=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},uc=()=>{const e=d.useContext(ns),t=cr(),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");jt.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,jt.trace({logLevel:t,tag:"[buffer-state]"},"Removing buffer handle"),r())}}}}),[n,t])},kT=()=>/^((?!chrome|android).)*safari/i.test(window.navigator.userAgent),ET=({mediaRef:e,mediaType:t,onVariableFpsVideoDetected:n,pauseWhenBuffering:r,logLevel:o,mountTime:i})=>{const s=d.useRef(!1),{delayPlayback:a}=uc(),l=d.useCallback(c=>{var w;if(t!=="video"||!r)return;const f=e.current;if(!f)return;if(f.readyState>=f.HAVE_FUTURE_DATA&&!kT()){Ut({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){Ut({logLevel:o,message:"Not using buffer until first frame, because requestVideoFrameCallback is not supported",mountTime:i,tag:"buffer"});return}s.current=!0,Ut({logLevel:o,message:`Buffering ${(w=e.current)==null?void 0:w.src} until the first frame is received`,mountTime:i,tag:"buffer"});const p=a(),m=()=>{p.unblock(),f.removeEventListener("ended",m,{once:!0}),f.removeEventListener("pause",m,{once:!0}),s.current=!1},y=()=>{m()};f.requestVideoFrameCallback((x,S)=>{Math.abs(S.mediaTime-c)>.5&&n(),m()}),f.addEventListener("ended",y,{once:!0}),f.addEventListener("pause",y,{once:!0}),f.addEventListener("canplay",y,{once:!0})},[a,o,e,t,i,n,r]);return d.useMemo(()=>({isBuffering:()=>s.current,bufferUntilFirstFrame:l}),[l])},CT=e=>{const{duration:t,currentTime:n,paused:r,ended:o,desiredUnclampedTime:i,mediaTagTime:s,mediaTagLastUpdate:a,rvcTime:l,rvcLastUpdate:c,isVariableFpsVideo:f,acceptableTimeShift:p,lastSeekDueToShift:m,playing:y,playbackRate:w,mediaTagBufferingOrStalled:x,playerBuffering:S,absoluteFrame:h,onlyWarnForMediaSeekingError:g,isPremounting:v,isPostmounting:b,pauseWhenBuffering:k}=e,E=!Number.isNaN(t)&&Number.isFinite(t)?Math.min(t,i):i,C=Math.abs(E-s),I=l?Math.abs(E-l):null,j=c&&l>a?I:C,F=I&&!f?j:C;if(F>p&&m!==E)return{type:"seek-due-to-shift",shouldBeTime:E,why:`because time shift is too big. shouldBeTime = ${E}, isTime = ${s}, requestVideoCallbackTime = ${l}, timeShift = ${F}${f?", isVariableFpsVideo = true":""}, isPremounting = ${v}, isPostmounting = ${b}, pauseWhenBuffering = ${k}`,bufferUntilFirstFrame:y&&w>0,playReason:y&&r?"player is playing but media tag is paused, and just seeked":null,warnAboutNonSeekable:!g};const L=y?.15:.01,V=Math.abs(n-E)>L;if(!y||S&&!x)return{type:"seek-if-not-playing",shouldBeTime:E,why:V?`not playing or something else is buffering. time offset is over seek threshold (${L})`:null};if(!y||S)return{type:"none"};const $=r&&!o;if($||h===0){const H=$?"media tag is paused":"absolute frame is 0";return{type:"play-and-seek",shouldBeTime:E,why:V?`is over timeshift threshold (threshold = ${L}) and ${H}`:null,playReason:`player is playing and ${H}`,bufferUntilFirstFrame:!f&&w>0}}return{type:"none"}},IT=e=>{var r,o;const t=he.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=lc()?Number(t.toFixed(1)):t;return Ut({logLevel:n,tag:"seek",message:`Seeking from ${e.currentTime} to ${i}. src= ${e.src} Reason: ${r}`,mountTime:o}),e.currentTime=i,i},TT=({element:e,shouldBuffer:t,isPremounting:n,isPostmounting:r,logLevel:o,mountTime:i,src:s})=>{const a=uc(),[l,c]=d.useState(!1);return d.useEffect(()=>{let f=[];const{current:p}=e;if(!p||!t)return;if(n||r){if((n||r)&&p.readyState<p.HAVE_FUTURE_DATA&&!navigator.userAgent.includes("Firefox/")){Ut({logLevel:o,message:`Calling .load() on ${p.src} because readyState is ${p.readyState} and it is not Firefox. Element is premounted ${p.playbackRate}`,tag:"load",mountTime:i});const x=p.playbackRate;p.load(),p.playbackRate=x}return}const m=x=>{let S=!1;f.forEach(h=>{h(x),S=!0}),f=[],c(h=>(h&&(S=!0),!1)),S&&Ut({logLevel:o,message:`Unmarking as buffering: ${p.src}. Reason: ${x}`,tag:"buffer",mountTime:i})},y=x=>{c(!0),Ut({logLevel:o,message:`Marking as buffering: ${p.src}. Reason: ${x}`,tag:"buffer",mountTime:i});const{unblock:S}=a.delayPlayback(),h=()=>{m('"canplay" was fired'),w()},g=()=>{m('"error" event was occurred'),w()};p.addEventListener("canplay",h,{once:!0}),f.push(()=>{p.removeEventListener("canplay",h)}),p.addEventListener("error",g,{once:!0}),f.push(()=>{p.removeEventListener("error",g)}),f.push(v=>{Ut({logLevel:o,message:`Unblocking ${p.src} from buffer. Reason: ${v}`,tag:"buffer",mountTime:i}),S()})},w=()=>{if(p.readyState<p.HAVE_FUTURE_DATA){if(y(`readyState is ${p.readyState}, which is less than HAVE_FUTURE_DATA`),!navigator.userAgent.includes("Firefox/")){Ut({logLevel:o,message:`Calling .load() on ${s} because readyState is ${p.readyState} and it is not Firefox. ${p.playbackRate}`,tag:"load",mountTime:i});const x=p.playbackRate;p.load(),p.playbackRate=x}}else{const x=()=>{y('"waiting" event was fired')};p.addEventListener("waiting",x),f.push(()=>{p.removeEventListener("waiting",x)})}};return w(),()=>{m("element was unmounted or prop changed")}},[a,s,e,n,r,o,t,i]),l},jT=({mediaRef:e,mediaType:t,lastSeek:n,onVariableFpsVideoDetected:r})=>{const o=d.useRef(null);return d.useEffect(()=>{const{current:i}=e;if(i)o.current={time:i.currentTime,lastUpdate:performance.now()};else{o.current=null;return}if(t!=="video"){o.current=null;return}const s=i;if(!s.requestVideoFrameCallback)return;let a=()=>{};const l=()=>{if(!s)return;const c=s.requestVideoFrameCallback((f,p)=>{if(o.current!==null){const m=Math.abs(o.current.time-p.mediaTime),y=Math.abs(n.current===null?1/0:p.mediaTime-n.current);m>.5&&y>.5&&p.mediaTime>o.current.time&&r()}o.current={time:p.mediaTime,lastUpdate:performance.now()},l()});a=()=>{s.cancelVideoFrameCallback(c),a=()=>{}}};return l(),()=>{a()}},[n,e,t,r]),o},U1=({frame:e,playbackRate:t,startFrom:n})=>Qi(e,[-1,n,n+1],[-1,n,n+t]),Z1=({fps:e,frame:t,playbackRate:n,startFrom:r})=>{const o=U1({frame:t,playbackRate:n,startFrom:r}),i=1e3/e;return o*i/1e3},Ug={},RT=(e,t)=>{if(e===null||e.seekable.length===0||e.seekable.length>1||Ug[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),Ug[e.src]=!0}},K1=({mediaRef:e,src:t,mediaType:n,playbackRate:r,preservePitch:o=!0,onlyWarnForMediaSeekingError:i,acceptableTimeshift:s,pauseWhenBuffering:a,isPremounting:l,isPostmounting:c,onAutoPlayError:f})=>{const{playbackRate:p}=ah(),m=Pt(),y=fo(),[w]=Yx(),x=d.useContext(ns),{fps:S}=ht(),h=Lo(),g=d.useRef(null),v=d.useRef(null),b=cr(),k=ba();if(!x)throw new Error("useMediaPlayback must be used inside a <BufferingContext>");const E=d.useRef({}),C=d.useCallback(()=>{t&&(E.current[t]||(jt.verbose({logLevel:b,tag:null},`Detected ${t} as a variable FPS video. Disabling buffering while seeking.`),E.current[t]=!0))},[b,t]),I=jT({mediaRef:e,mediaType:n,lastSeek:v,onVariableFpsVideoDetected:C}),j=IT(e),F=Z1({frame:m,playbackRate:r,startFrom:-h,fps:S}),L=TT({element:e,shouldBuffer:a,isPremounting:l,isPostmounting:c,logLevel:b,mountTime:k,src:t??null}),{bufferUntilFirstFrame:V,isBuffering:M}=ET({mediaRef:e,mediaType:n,onVariableFpsVideoDetected:C,pauseWhenBuffering:a,logLevel:b,mountTime:k}),$=r*p,D=(()=>{var Z;return(Z=e.current)!=null&&Z.duration?Math.min(e.current.duration,s??.65):s??.65})(),H=H1(x);d.useEffect(()=>{var R,Z,Q,_,N;if((R=e.current)!=null&&R.paused)return;if(!w){Ut({logLevel:b,tag:"pause",message:`Pausing ${(Z=e.current)==null?void 0:Z.src} because ${l?"media is premounting":c?"media is postmounting":"Player is not playing"}`,mountTime:k}),(Q=e.current)==null||Q.pause();return}const T=L||M();x.buffering.current&&!T&&(Ut({logLevel:b,tag:"pause",message:`Pausing ${(_=e.current)==null?void 0:_.src} because player is buffering but media tag is not`,mountTime:k}),(N=e.current)==null||N.pause())},[M,L,x,H,l,b,e,n,k,w,c]);const P=pt();d.useLayoutEffect(()=>{const T=Math.max(0,$);e.current&&e.current.playbackRate!==T&&(e.current.playbackRate=T),e.current&&e.current.preservesPitch!==o&&(e.current.preservesPitch=o)},[e,$,o]),d.useEffect(()=>{var Z,Q;const T=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 ${T} element.`);const{current:W}=e,R=CT({duration:W.duration,currentTime:W.currentTime,paused:W.paused,ended:W.ended,desiredUnclampedTime:F,mediaTagTime:j.current.time,mediaTagLastUpdate:j.current.lastUpdate,rvcTime:((Z=I.current)==null?void 0:Z.time)??null,rvcLastUpdate:((Q=I.current)==null?void 0:Q.lastUpdate)??null,isVariableFpsVideo:!!E.current[t],acceptableTimeShift:D,lastSeekDueToShift:g.current,playing:w,playbackRate:$,mediaTagBufferingOrStalled:L||M(),playerBuffering:x.buffering.current,absoluteFrame:y,onlyWarnForMediaSeekingError:i,isPremounting:l,isPostmounting:c,pauseWhenBuffering:a});if(R.type!=="none"){if(R.type==="seek-due-to-shift"){v.current=Al({mediaRef:W,time:R.shouldBeTime,logLevel:b,why:R.why,mountTime:k}),g.current=v.current,R.bufferUntilFirstFrame&&V(R.shouldBeTime),R.playReason!==null&&hu({mediaRef:e,mediaType:n,onAutoPlayError:f,logLevel:b,mountTime:k,reason:R.playReason,isPlayer:P.isPlayer}),R.warnAboutNonSeekable&&RT(W);return}if(R.type==="seek-if-not-playing"){R.why!==null&&(v.current=Al({mediaRef:W,time:R.shouldBeTime,logLevel:b,why:R.why,mountTime:k}));return}R.why!==null&&(v.current=Al({mediaRef:W,time:R.shouldBeTime,logLevel:b,why:R.why,mountTime:k})),hu({mediaRef:e,mediaType:n,onAutoPlayError:f,logLevel:b,mountTime:k,reason:R.playReason,isPlayer:P.isPlayer}),R.bufferUntilFirstFrame&&V(R.shouldBeTime)}},[y,D,V,x.buffering,I,b,F,M,L,e,n,i,$,w,t,f,l,c,a,k,j,P.isPlayer])},Y1=({mediaRef:e,id:t,mediaType:n,onAutoPlayError:r,isPremounting:o,isPostmounting:i})=>{const{audioAndVideoTags:s,imperativePlaying:a}=co(),l=cr(),c=ba(),f=pt();d.useEffect(()=>{const p={id:t,play:m=>{if(a.current&&!(o||i))return hu({mediaRef:e,mediaType:n,onAutoPlayError:r,logLevel:l,mountTime:c,reason:m,isPlayer:f.isPlayer})}};return s.current.push(p),()=>{s.current=s.current.filter(m=>m.id!==t)}},[s,t,e,n,r,a,o,i,l,c,f.isPlayer])},xh=d.createContext({playerMuted:!1,mediaVolume:1}),bh=d.createContext({setPlayerMuted:()=>{throw new Error("default")},setMediaVolume:()=>{throw new Error("default")}}),Sh=()=>{const{mediaVolume:e}=d.useContext(xh),{setMediaVolume:t}=d.useContext(bh);return d.useMemo(()=>[e,t],[e,t])},kh=()=>{const{playerMuted:e}=d.useContext(xh),{setPlayerMuted:t}=d.useContext(bh);return d.useMemo(()=>[e,t],[e,t])},rs=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.`)},PT=(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=cr(),{volume:o,muted:i,playbackRate:s,preservePitch:a,shouldPreMountAudioTags:l,src:c,onDuration:f,acceptableTimeShiftInSeconds:p,_remotionInternalNeedsDurationCalculation:m,_remotionInternalNativeLoopPassed:y,_remotionInternalStack:w,allowAmplificationDuringRender:x,name:S,pauseWhenBuffering:h,showInTimeline:g,loopVolumeCurveBehavior:v,stack:b,crossOrigin:k,delayRenderRetries:E,delayRenderTimeoutInMilliseconds:C,toneFrequency:I,useWebAudioApi:j,onError:F,onNativeError:L,audioStreamIndex:V,...M}=e,[$]=Sh(),[D]=kh(),H=ts(v??"repeat");if(!c)throw new TypeError("No 'src' was passed to <Html5Audio>.");const P=Zo(c),T=d.useContext(St),[W]=d.useState(()=>String(Math.random())),R=Ko({frame:H,volume:o,mediaVolume:$});rs(R);const Z=yh({crossOrigin:k,requestsVideoFrame:!1,isClientSideRendering:!1}),Q=d.useMemo(()=>({muted:i||D||R<=0,src:P,loop:y,crossOrigin:Z,...M}),[y,D,i,M,P,R,Z]),_=d.useMemo(()=>`audio-${Ho(c??"")}-${T==null?void 0:T.relativeFrom}-${T==null?void 0:T.cumulatedFrom}-${T==null?void 0:T.durationInFrames}-muted:${e.muted}-loop:${e.loop}`,[c,T==null?void 0:T.relativeFrom,T==null?void 0:T.cumulatedFrom,T==null?void 0:T.durationInFrames,e.muted,e.loop]),{el:N,mediaElementSourceNode:z,cleanupOnMediaTagUnmount:ne}=pT({aud:Q,audioId:_,premounting:!!(T!=null&&T.premounting),postmounting:!!(T!=null&&T.postmounting)}),J=d.useCallback(()=>w??null,[w]);wh({volume:o,mediaVolume:$,src:c,mediaType:"audio",playbackRate:s??1,displayName:S??null,id:W,getStack:J,showInTimeline:g,premountDisplay:(T==null?void 0:T.premountDisplay)??null,postmountDisplay:(T==null?void 0:T.postmountDisplay)??null,loopDisplay:void 0,documentationLink:"https://www.remotion.dev/docs/html5-audio",refForOutline:null}),K1({mediaRef:N,src:c,mediaType:"audio",playbackRate:s??1,preservePitch:a,onlyWarnForMediaSeekingError:!1,acceptableTimeshift:p??null,isPremounting:!!(T!=null&&T.premounting),isPostmounting:!!(T!=null&&T.postmounting),pauseWhenBuffering:h,onAutoPlayError:null}),Y1({id:W,isPostmounting:!!(T!=null&&T.postmounting),isPremounting:!!(T!=null&&T.premounting),mediaRef:N,mediaType:"audio",onAutoPlayError:null}),z1({logLevel:r,mediaRef:N,source:z,volume:R,shouldUseWebAudioApi:j??!1}),(he.useInsertionEffect??he.useLayoutEffect)(()=>()=>{requestAnimationFrame(()=>{ne()})},[ne]),d.useImperativeHandle(t,()=>N.current,[N]);const G=d.useRef(f);return G.current=f,d.useEffect(()=>{var Y;const{current:K}=N;if(!K)return;if(K.duration){(Y=G.current)==null||Y.call(G,K.src,K.duration);return}const le=()=>{var ie;(ie=G.current)==null||ie.call(G,K.src,K.duration)};return K.addEventListener("loadedmetadata",le),()=>{K.removeEventListener("loadedmetadata",le)}},[N,c]),n?null:u.jsx("audio",{ref:N,preload:"metadata",crossOrigin:Z,...Q})},G1=d.forwardRef(PT),FT=(e,t)=>{const n=d.useRef(null),{volume:r,playbackRate:o,allowAmplificationDuringRender:i,onDuration:s,toneFrequency:a,_remotionInternalNeedsDurationCalculation:l,_remotionInternalNativeLoopPassed:c,acceptableTimeShiftInSeconds:f,name:p,onNativeError:m,delayRenderRetries:y,delayRenderTimeoutInMilliseconds:w,loopVolumeCurveBehavior:x,pauseWhenBuffering:S,audioStreamIndex:h,preservePitch:g,...v}=e,b=fo(),k=ts(x??"repeat"),E=Pt(),C=d.useContext(St),{registerRenderAsset:I,unregisterRenderAsset:j}=d.useContext(Uo),{delayRender:F,continueRender:L}=Xn(),V=d.useMemo(()=>`audio-${Ho(e.src??"")}-${C==null?void 0:C.relativeFrom}-${C==null?void 0:C.cumulatedFrom}-${C==null?void 0:C.durationInFrames}`,[e.src,C==null?void 0:C.relativeFrom,C==null?void 0:C.cumulatedFrom,C==null?void 0:C.durationInFrames]),M=Ko({volume:r,frame:k,mediaVolume:1});rs(M),d.useImperativeHandle(t,()=>n.current,[]),d.useEffect(()=>{if(!e.src)throw new Error("No src passed");if(window.remotion_audioEnabled&&!e.muted&&!(M<=0))return I({type:"audio",src:ur(e.src),id:V,frame:b,volume:M,mediaFrame:E,playbackRate:e.playbackRate??1,toneFrequency:a??1,audioStartFrame:Math.max(0,-((C==null?void 0:C.cumulatedNegativeFrom)??0)),audioStreamIndex:h??0}),()=>j(V)},[e.muted,e.src,I,b,V,j,M,k,E,o,e.playbackRate,a,C==null?void 0:C.cumulatedNegativeFrom,h]);const{src:$}=e,D=t||l;return d.useLayoutEffect(()=>{var W,R;if(((R=(W=window.process)==null?void 0:W.env)==null?void 0:R.NODE_ENV)==="test"||!D)return;const H=F("Loading <Html5Audio> duration with src="+$,{retries:y??void 0,timeoutInMilliseconds:w??void 0}),{current:P}=n,T=()=>{P!=null&&P.duration&&s(P.src,P.duration),L(H)};return P!=null&&P.duration?(s(P.src,P.duration),L(H)):P==null||P.addEventListener("loadedmetadata",T,{once:!0}),()=>{P==null||P.removeEventListener("loadedmetadata",T),L(H)}},[$,s,D,y,w,L,F]),D?u.jsx("audio",{ref:n,...v,onError:m}):null},$T=d.forwardRef(FT),_T=(e,t)=>{const n=d.useContext(ac),r=e,{startFrom:o,endAt:i,trimBefore:s,trimAfter:a,name:l,stack:c,pauseWhenBuffering:f,showInTimeline:p,onError:m,freeze:y,...w}=r,{loop:x,freeze:S,...h}=r,{fps:g}=ht(),v=pt(),b=ka(f);if(v.isClientSideRendering)throw new Error("<Html5Audio> is not supported in @remotion/web-renderer. Use <Audio> from @remotion/media instead. See https://remotion.dev/docs/client-side-rendering/limitations");if(typeof y<"u")throw new TypeError('The "freeze" prop is not supported on <Html5Audio />. Use <Sequence freeze={...}> to freeze media playback.');const{durations:k,setDurations:E}=d.useContext(gh);if(typeof e.src!="string")throw new TypeError(`The \`<Html5Audio>\` tag requires a string for \`src\`, but got ${JSON.stringify(e.src)} instead.`);const C=Zo(e.src),I=d.useCallback(M=>{console.log(M.currentTarget.error);const $=`Could not play audio with src ${C}: ${M.currentTarget.error}. See https://remotion.dev/docs/media-playback-error for help.`;if(x){if(m){m(new Error($));return}aa(new Error($))}else m==null||m(new Error($)),console.warn($)},[x,m,C]),j=d.useCallback((M,$)=>{E({type:"got-duration",durationInSeconds:$,src:M})},[E]),F=k[ur(C)]??k[ur(e.src)];ic({startFrom:o,endAt:i,trimBefore:s,trimAfter:a});const{trimBeforeValue:L,trimAfterValue:V}=sc({startFrom:o,endAt:i,trimBefore:s,trimAfter:a});if(x&&F!==void 0){if(!Number.isFinite(F))return u.jsx(Nl,{...h,ref:t,_remotionInternalNativeLoopPassed:!0});const M=F*g;return u.jsx(nc,{layout:"none",durationInFrames:tc({trimAfter:V,mediaDurationInFrames:M,playbackRate:e.playbackRate??1,trimBefore:L}),children:u.jsx(Nl,{...h,ref:t,_remotionInternalNativeLoopPassed:!0})})}return typeof L<"u"||typeof V<"u"?u.jsx(Ft,{layout:"none",from:0-(L??0),showInTimeline:!1,durationInFrames:V,name:l,children:u.jsx(Nl,{_remotionInternalNeedsDurationCalculation:!!x,pauseWhenBuffering:b,...w,ref:t})}):(oc({playbackRate:e.playbackRate,preservePitch:e.preservePitch,volume:e.volume},"Html5Audio"),v.isRendering?u.jsx($T,{onDuration:j,...e,ref:t,onNativeError:I,_remotionInternalNeedsDurationCalculation:!!x}):u.jsx(G1,{_remotionInternalNativeLoopPassed:e._remotionInternalNativeLoopPassed??!1,_remotionInternalStack:c??null,shouldPreMountAudioTags:n!==null&&n.numberOfAudioTags>0,...e,ref:t,onNativeError:I,onDuration:j,pauseWhenBuffering:b,_remotionInternalNeedsDurationCalculation:!!x,showInTimeline:p??!0}))},Nl=d.forwardRef(_T);en(Nl);var MT=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},AT={...Rr,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},...dr,...ho,...po},NT=({color:e,width:t,height:n,effects:r=[],className:o,style:i,pixelDensity:s,overrideId:a,reference:l})=>{const{delayRender:c,continueRender:f,cancelRender:p}=Xn(),m=MT(s),y=Math.ceil(t*m),w=Math.ceil(n*m),[x,S]=d.useState(null),h=Ta({effects:r,overrideId:a??null}),g=d.useMemo(()=>{if(typeof document>"u")return null;const E=document.createElement("canvas");return E.width=1,E.height=1,E},[]),v=Ra(),b=d.useCallback(E=>{S(E),typeof l=="function"?l(E):l&&(l.current=E)},[l]);d.useEffect(()=>{if(!x||!g)return;const E=c("Solid effect chain");if(!v)return f(E),()=>{f(E)};const C=g.getContext("2d",{colorSpace:"srgb"});if(!C){p(new Error("Failed to acquire 2D context for <Solid> source"));return}return C.clearRect(0,0,1,1),e!==void 0&&(C.fillStyle=e,C.fillRect(0,0,1,1)),ja({state:v.get(y,w),source:g,effects:h,output:x,width:y,height:w}).then(I=>{I&&f(E)}).catch(I=>{p(I)}),()=>{f(E)}},[e,x,g,v,y,w,c,f,p,h]);const k=d.useMemo(()=>({width:t,height:n,...i??{}}),[n,i,t]);return u.jsx("canvas",{ref:b,width:y,height:w,className:o,style:k})},LT=d.forwardRef(({effects:e=[],controls:t,color:n,height:r,width:o,className:i,durationInFrames:s,style:a,name:l,from:c,trimBefore:f,freeze:p,hidden:m,showInTimeline:y,pixelDensity:w,...x},S)=>{const h=Ia(e),g=d.useRef(null);return d.useImperativeHandle(S,()=>g.current,[]),u.jsx(Ft,{layout:"none",from:c,trimBefore:f,freeze:p,hidden:m,showInTimeline:y,controls:t,_remotionInternalEffects:h,durationInFrames:s,name:l??"<Solid>",outlineRef:g,_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/solid",...x,children:u.jsx(NT,{reference:g,overrideId:(t==null?void 0:t.overrideId)??null,color:n,height:r,width:o,className:i,style:a,effects:e,pixelDensity:w})})}),X1=Pr({Component:LT,componentName:"<Solid>",componentIdentity:"dev.remotion.remotion.Solid",schema:AT,supportsEffects:!0});X1.displayName="Solid";en(X1);var rl=null,q1=()=>{if(rl!==null)return rl;if(typeof document>"u")return!1;const e=document.createElement("canvas"),t=e.getContext("2d");return rl=typeof(t==null?void 0:t.drawElementImage)=="function"&&typeof e.requestPaint=="function"&&typeof e.captureElementImage=="function"&&"transferControlToOffscreen"in HTMLCanvasElement.prototype,rl},OT="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 DT(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 zT(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 ol=e=>e instanceof DOMException&&e.name==="InvalidStateError",Zg="HtmlInCanvas: Expected the element to be inside the viewport during rendering, but Chrome had no cached paint record for it.",Kg=({target:e,width:t,height:n})=>{e.width!==t&&(e.width=t),e.height!==n&&(e.height=n)},BT=({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()},Yg=d.createContext(null),J1=d.forwardRef(({width:e,height:t,effects:n,children:r,onPaint:o,onInit:i,pixelDensity:s,controls:a,style:l},c)=>{const f=d.useContext(Yg);DT(e,t);const p=zT(s),m=Math.ceil(e*p),y=Math.ceil(t*p),{delayRender:w,continueRender:x,cancelRender:S}=Xn(),{isClientSideRendering:h,isRendering:g}=pt(),v=!g||h,b=o===void 0&&i===void 0;q1()||S(new Error(OT));const k=d.useRef(null),E=d.useRef(null),C=d.useRef(null),I=`${e}x${t}@${p}-${b?"direct":"offscreen"}`,j=d.useCallback(N=>{k.current=N,typeof c=="function"?c(N):c&&(c.current=N)},[c]),F=Ra(),L=Ta({effects:n,overrideId:(a==null?void 0:a.overrideId)??null}),V=d.useRef(L);V.current=L;const M=d.useRef(o);M.current=o;const $=d.useRef(i);$.current=i;const D=d.useRef(!1),H=d.useRef(null),P=d.useRef(!1),T=d.useRef(f);T.current=f;const W=d.useCallback(async()=>{var ne;const N=C.current;if(!N)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");Kg({target:z,width:m,height:y});try{const J=k.current;if(!J)throw new Error("Canvas not found");const U=w("onPaint");if(!D.current){const K=$.current;if(!K)D.current=!0;else{let le;try{le=J.captureElementImage(N)}catch(Y){if(ol(Y)&&v){x(U);return}throw ol(Y)?new Error(Zg):Y}D.current=!0;try{if(z instanceof HTMLCanvasElement)throw new Error("HtmlInCanvas: onInit requires an OffscreenCanvas paint target");const Y=await K({canvas:z,element:N,elementImage:le,pixelDensity:p});if(typeof Y!="function")throw new Error("HtmlInCanvas: when `onInit` is provided, it must return a cleanup function, or a Promise that resolves to one.");P.current?Y():H.current=Y}finally{le.close()}}}let G;try{G=J.captureElementImage(N)}catch(K){if(ol(K)&&v){x(U);return}throw ol(K)?new Error(Zg):K}try{const K=M.current;if(K){if(z instanceof HTMLCanvasElement)throw new Error("HtmlInCanvas: onPaint requires an OffscreenCanvas paint target");const le=K({canvas:z,element:N,elementImage:G,pixelDensity:p});le&&await le}else BT({canvas:z,element:N,elementImage:G,pixelDensity:p});await ja({state:F.get(m,y),source:z,effects:V.current,output:z,width:m,height:y})}finally{G.close()}(ne=T.current)==null||ne.requestParentPaint(),x(U)}catch(J){S(J)}},[y,m,F,x,S,w,p,v]);d.useLayoutEffect(()=>{const N=k.current;if(!N)throw new Error("Canvas not found");N.layoutSubtree=!0;const z=b?N:N.transferControlToOffscreen();return E.current=z,Kg({target:z,width:m,height:y}),D.current=!1,P.current=!1,N.addEventListener("paint",W),()=>{var ne;N.removeEventListener("paint",W),E.current=null,D.current=!1,P.current=!0,(ne=H.current)==null||ne.call(H),H.current=null}},[W,S,m,y,b]);const R=d.useRef(!1);d.useLayoutEffect(()=>{var z;if(!R.current){R.current=!0;return}const N=k.current;N&&((z=N.requestPaint)==null||z.call(N))},[o,L]),d.useLayoutEffect(()=>{const N=k.current;if(!N)return;const z=w("waiting for first paint after canvas resize");return N.addEventListener("paint",()=>{x(z)},{once:!0}),()=>{x(z)}},[e,t,x,w,I]);const Z=d.useMemo(()=>({width:e,height:t}),[e,t]),Q=d.useMemo(()=>({width:e,height:t,...l??{}}),[t,l,e]),_=d.useMemo(()=>({requestParentPaint:()=>{var N,z;(z=(N=k.current)==null?void 0:N.requestPaint)==null||z.call(N)}}),[]);return u.jsx(Yg.Provider,{value:_,children:u.jsx("canvas",{ref:j,width:m,height:y,style:Q,children:u.jsx("div",{ref:C,style:Z,children:r})},I)})});J1.displayName="HtmlInCanvasContent";var Q1=d.forwardRef(({width:e,height:t,effects:n=[],children:r,onPaint:o,onInit:i,pixelDensity:s,controls:a,style:l,durationInFrames:c,name:f,...p},m)=>{const y=Ia(n),w=d.useRef(null),x=d.useCallback(S=>{w.current=S,typeof m=="function"?m(S):m&&(m.current=S)},[m]);return u.jsx(Ft,{durationInFrames:c,name:f??"<HtmlInCanvas>",_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/remotion/html-in-canvas",controls:a,_remotionInternalEffects:y,outlineRef:w,layout:"none",...p,children:u.jsx(J1,{ref:x,width:e,height:t,effects:n,onPaint:o,onInit:i,pixelDensity:s,controls:a,style:l,children:r})})});Q1.displayName="HtmlInCanvas";var WT={...Rr,pixelDensity:{type:"number",min:1,max:3,step:.1,default:1,description:"Pixel density",hiddenFromList:!1},...dr,...ho,...po},VT=Pr({Component:Q1,componentName:"<HtmlInCanvas>",componentIdentity:"dev.remotion.remotion.HtmlInCanvas",schema:WT,supportsEffects:!0}),eb=Object.assign(VT,{isSupported:q1});eb.displayName="HtmlInCanvas";en(eb);function Sr(e){return e.startsWith("data:")&&e.length>100?e.slice(0,60)+"...["+e.length+" chars total]":e}var HT={...Rr,...qi,fit:{type:"enum",default:"fill",description:"Fit",variants:{fill:{},contain:{},cover:{}}},...dr,...ho,...po},UT=()=>{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},ZT=({src:e,signal:t})=>new Promise((n,r)=>{const o=new Image;let i=!1;function s(){o.onload=null,o.onerror=null}function a(c){i||(i=!0,s(),c())}function l(){a(()=>r(UT()))}if(o.onload=()=>{var c;Promise.resolve((c=o.decode)==null?void 0:c.call(o)).catch(()=>{}).then(()=>{const f=o.naturalWidth||o.width,p=o.naturalHeight||o.height;if(f<=0||p<=0){a(()=>r(new Error(`Could not determine dimensions for <CanvasImage> with src="${Sr(e)}"`)));return}a(()=>n({element:o,width:f,height:p}))})},o.onerror=()=>{a(()=>r(new Error(`Could not load <CanvasImage> with src="${Sr(e)}"`)))},t.addEventListener("abort",l,{once:!0}),t.aborted){l();return}o.crossOrigin="anonymous",o.src=e});function KT(e){return 1e3*2**(e-1)}var YT=({onFrame:e})=>{if(typeof requestAnimationFrame>"u")return e(),()=>{};const t=requestAnimationFrame(e);return()=>cancelAnimationFrame(t)},tb=d.forwardRef(({src:e,width:t,height:n,fit:r="fill",effects:o,controls:i,onError:s,className:a,style:l,id:c,pauseWhenLoading:f,maxRetries:p=2,delayRenderRetries:m,delayRenderTimeoutInMilliseconds:y,refForOutline:w,...x},S)=>{const{delayRender:h,continueRender:g,cancelRender:v}=Xn(),{delayPlayback:b}=uc(),[k,E]=d.useState(null),[C,I]=d.useState(null),j=Zo(e),F=Ra(),L=Ta({effects:o,overrideId:(i==null?void 0:i.overrideId)??null}),V=d.useContext(St),M=d.useRef(null),[$,D]=d.useState(!1),H=!!(V!=null&&V.premounting),P=!!(V!=null&&V.postmounting),T=d.useCallback(({markAsReady:Z})=>{const Q=M.current;!Q||Q.continued||(Q.continued=!0,Z&&D(!1),g(Q.handle),M.current=null)},[g]),W=d.useMemo(()=>typeof document>"u"?null:document.createElement("canvas"),[]),R=d.useCallback(Z=>{E(Z),w&&(w.current=Z),typeof S=="function"?S(Z):S&&(S.current=Z)},[S,w]);return d.useLayoutEffect(()=>{if(!(!f||!$||H||P))return b().unblock},[b,$,P,H,f]),d.useLayoutEffect(()=>{const Z=h(`Rendering <CanvasImage> with src="${Sr(j)}"`,{retries:m??void 0,timeoutInMilliseconds:y??void 0}),Q=new AbortController;let _=!1,N=0,z=null;I(null),D(!0),M.current={handle:Z,continued:!1};const ne=()=>{ZT({src:j,signal:Q.signal}).then(J=>{_||I(J)}).catch(J=>{if(J.name==="AbortError"){T({markAsReady:!1});return}if(N++,N<=p){const U=KT(N);console.warn(`Could not load <CanvasImage> with src="${Sr(j)}", retrying in ${U}ms`),z=setTimeout(()=>{_||ne()},U)}else s?(s(J),T({markAsReady:!0})):v(J)})};return ne(),()=>{_=!0,z!==null&&clearTimeout(z),Q.abort(),T({markAsReady:!1})}},[j,v,T,h,m,y,p,s]),d.useLayoutEffect(()=>{if(!C||!k||!W)return;const Z=h(`Applying effects to <CanvasImage> with src="${Sr(j)}"`);let Q=!1,_=!1,N=()=>{};const z=()=>{_||(_=!0,g(Z))},ne=t??C.width,J=n??C.height,U=W.getContext("2d",{colorSpace:"srgb"});return U?(W.width=ne,W.height=J,k.width=ne,k.height=J,U.clearRect(0,0,ne,J),U.drawImage(C.element,...C1(r,{width:C.width,height:C.height},{width:ne,height:J})),ja({state:F.get(ne,J),source:W,effects:L,output:k,width:ne,height:J}).then(G=>{G&&!Q&&(N=YT({onFrame:()=>{Q||(z(),T({markAsReady:!0}))}}))}).catch(G=>{Q||(s?(s(G),z(),T({markAsReady:!0})):v(G))}),()=>{Q=!0,N(),z()}):(v(new Error("Could not get 2D context for <CanvasImage> source canvas")),z(),()=>{z()})},[j,v,F,g,T,h,r,n,C,L,s,k,W,t]),u.jsx("canvas",{...x,ref:R,width:t,height:n,className:a,style:l,id:c})});tb.displayName="CanvasImageContent";var GT=d.forwardRef(({src:e,width:t,height:n,fit:r,effects:o=[],className:i,style:s,id:a,onError:l,pauseWhenLoading:c,maxRetries:f,delayRenderRetries:p,delayRenderTimeoutInMilliseconds:m,durationInFrames:y,from:w,trimBefore:x,freeze:S,premountFor:h,postmountFor:g,styleWhilePremounted:v,styleWhilePostmounted:b,hidden:k,name:E,showInTimeline:C,stack:I,controls:j,_remotionInternalDocumentationLink:F,outlineRef:L,...V},M)=>{if(!e)throw new Error('No "src" prop was passed to <CanvasImage>.');const $=Ia(o),D=d.useRef(null);d.useImperativeHandle(M,()=>D.current,[]);const{effectivePostmountFor:H,effectivePremountFor:P,freezeFrame:T,isPremountingOrPostmounting:W,postmountingActive:R,premountingActive:Z,premountingStyle:Q}=Ea({from:w??0,durationInFrames:y??1/0,premountFor:h??null,postmountFor:g??null,style:s??null,styleWhilePremounted:v??null,styleWhilePostmounted:b??null,hideWhilePremounted:"display-none"});return u.jsx(Sa,{frame:T,active:W,children:u.jsx(Ft,{layout:"none",from:w??0,trimBefore:x,durationInFrames:y??1/0,freeze:S,hidden:k,showInTimeline:C??!0,name:E??"<CanvasImage>",_remotionInternalDocumentationLink:F??"https://www.remotion.dev/docs/canvasimage",controls:j,_remotionInternalEffects:$,_remotionInternalIsMedia:{type:"image",src:e},_remotionInternalStack:I,_remotionInternalPremountDisplay:P||null,_remotionInternalPostmountDisplay:H||null,_remotionInternalIsPremounting:Z,_remotionInternalIsPostmounting:R,outlineRef:L??D,children:u.jsx(tb,{ref:D,src:e,width:t,height:n,fit:r,effects:o,controls:j,className:i,style:Q??void 0,id:a,onError:l,pauseWhenLoading:c,maxRetries:f,delayRenderRetries:p,delayRenderTimeoutInMilliseconds:m,refForOutline:L??null,...V})})})}),Eh=Pr({Component:GT,componentName:"<CanvasImage>",componentIdentity:"dev.remotion.remotion.CanvasImage",schema:HT,supportsEffects:!0});Eh.displayName="CanvasImage";en(Eh);var XT=({onLoad:e,onError:t,delayRenderRetries:n,delayRenderTimeoutInMilliseconds:r,...o},i)=>{const{delayRender:s,continueRender:a}=Xn(),[l]=d.useState(()=>s(`Loading <IFrame> with source ${o.src}`,{retries:n??void 0,timeoutInMilliseconds:r??void 0})),c=d.useCallback(p=>{a(l),e==null||e(p)},[l,e,a]),f=d.useCallback(p=>{a(l),t?t(p):console.error("Error loading iframe:",p,"Handle the event using the onError() prop to make this message disappear.")},[l,t,a]);return u.jsx("iframe",{referrerPolicy:"strict-origin-when-cross-origin",...o,ref:i,onError:f,onLoad:c})};d.forwardRef(XT);function qT(e){return 1e3*2**(e-1)}var JT=({onError:e,maxRetries:t=2,src:n,pauseWhenLoading:r,delayRenderRetries:o,delayRenderTimeoutInMilliseconds:i,onImageFrame:s,crossOrigin:a,decoding:l,ref:c,refForOutline:f,...p})=>{const m=d.useRef(null),y=d.useRef({}),{delayPlayback:w}=uc(),x=d.useContext(St),[S,h]=d.useState(!1),g=d.useCallback($=>{m.current=$,f.current=$,typeof c=="function"?c($):c&&(c.current=$)},[c,f]),v=Zo(n),b=d.useCallback($=>{if(!m.current)return;const D=m.current.src;setTimeout(()=>{var P;if(!m.current)return;const H=(P=m.current)==null?void 0:P.src;H===D&&(m.current.removeAttribute("src"),m.current.setAttribute("src",H))},$)},[]),{delayRender:k,continueRender:E,cancelRender:C}=Xn(),I=!!(x!=null&&x.premounting),j=!!(x!=null&&x.postmounting),F=d.useCallback($=>{var D,H,P,T,W,R,Z;if(y.current){if(y.current[(D=m.current)==null?void 0:D.src]=(y.current[(H=m.current)==null?void 0:H.src]??0)+1,e&&(y.current[(P=m.current)==null?void 0:P.src]??0)>t){e($);return}if((y.current[(T=m.current)==null?void 0:T.src]??0)<=t){const Q=qT(y.current[(W=m.current)==null?void 0:W.src]??0);console.warn(`Could not load image with source ${Sr((R=m.current)==null?void 0:R.src)}, retrying again in ${Q}ms`),b(Q);return}try{C("Error loading image with src: "+Sr((Z=m.current)==null?void 0:Z.src))}catch{}}},[C,t,e,b]);typeof window<"u"&&(d.useLayoutEffect(()=>{if(!(!r||!S||I||j))return w().unblock},[w,S,j,I,r]),d.useLayoutEffect(()=>{var T,W;if(((W=(T=window.process)==null?void 0:T.env)==null?void 0:W.NODE_ENV)==="test"){m.current&&(m.current.src=v);return}const{current:$}=m;if(!$)return;h(!0);const D=k("Loading <Img> with src="+Sr(v),{retries:o??void 0,timeoutInMilliseconds:i??void 0});let H=!1;const P=()=>{var R,Z,Q;if(H){E(D);return}(y.current[(R=m.current)==null?void 0:R.src]??0)>0&&(delete y.current[(Z=m.current)==null?void 0:Z.src],console.info(`Retry successful - ${Sr((Q=m.current)==null?void 0:Q.src)} is now loaded`)),$&&(s==null||s($)),h(!1),E(D)};if(!m.current){P();return}return $.src=v,$.decode().then(P).catch(R=>{console.warn(R),$.complete&&$.naturalWidth>0&&$.naturalHeight>0?P():$.addEventListener("load",P)}),()=>{H=!0,$.removeEventListener("load",P),E(D)}},[v,o,i,s,E,k]));const{isClientSideRendering:L,isRendering:V}=pt(),M=yh({crossOrigin:a,requestsVideoFrame:!1,isClientSideRendering:L});return u.jsx("img",{...p,ref:g,crossOrigin:M,onError:F,decoding:V?"sync":l})},QT=({hidden:e,name:t,stack:n,showInTimeline:r,src:o,from:i,trimBefore:s,durationInFrames:a,freeze:l,premountFor:c,postmountFor:f,style:p,styleWhilePremounted:m,styleWhilePostmounted:y,controls:w,outlineRef:x,...S})=>{if(!o)throw new Error('No "src" prop was passed to <Img>.');const{effectivePostmountFor:h,effectivePremountFor:g,freezeFrame:v,isPremountingOrPostmounting:b,postmountingActive:k,premountingActive:E,premountingStyle:C}=Ea({from:i??0,durationInFrames:a??1/0,premountFor:c??null,postmountFor:f??null,style:p??null,styleWhilePremounted:m??null,styleWhilePostmounted:y??null,hideWhilePremounted:"display-none"});return u.jsx(Sa,{frame:v,active:b,children:u.jsx(Ft,{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:g||null,_remotionInternalPostmountDisplay:h||null,_remotionInternalIsPremounting:E,_remotionInternalIsPostmounting:k,name:t??"<Img>",controls:w,showInTimeline:r??!0,hidden:e,outlineRef:x,children:u.jsx(JT,{src:o,refForOutline:x,style:C??void 0,...S})})})},ej=Eh,tj={src:{type:"asset",default:void 0,description:"Source",keyframable:!1},...Rr,...qi,...dr,...ho,...po},nj=new Set(["alt","crossOrigin","decoding","fetchPriority","loading","onError","onImageFrame","onLoad","sizes","srcSet","useMap"]),rj=e=>Object.keys(e).filter(t=>e[t]!==void 0&&nj.has(t)),oj=e=>e.map(t=>`"${t}"`).join(", "),ij=({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=rj(e);if(t!=null&&o.unshift("ref"),o.length!==0)throw new Error(`The ${oj(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"}.`)},sj=e=>{const t=e==null?void 0:e.objectFit;if(t==="fill"||t==="contain"||t==="cover")return t},aj=({effects:e=[],ref:t,hidden:n,name:r,stack:o,showInTimeline:i,src:s,from:a,trimBefore:l,durationInFrames:c,freeze:f,premountFor:p,postmountFor:m,styleWhilePremounted:y,styleWhilePostmounted:w,controls:x,width:S,height:h,className:g,style:v,id:b,pauseWhenLoading:k,maxRetries:E,delayRenderRetries:C,delayRenderTimeoutInMilliseconds:I,...j})=>{const F=d.useRef(null),L=ka(k);if(e.length===0)return u.jsx(QT,{...j,ref:t,hidden:n,name:r,stack:o,showInTimeline:i,src:s,from:a,trimBefore:l,durationInFrames:c,freeze:f,premountFor:p,postmountFor:m,styleWhilePremounted:y,styleWhilePostmounted:w,controls:x,width:S,height:h,className:g,style:v,id:b,pauseWhenLoading:L,maxRetries:E,delayRenderRetries:C,delayRenderTimeoutInMilliseconds:I,outlineRef:F});if(!s)throw new Error('No "src" prop was passed to <Img>.');ij({props:j,ref:t,width:S,height:h});const V=typeof S=="number"?S:void 0,M=typeof h=="number"?h:void 0,$=j,D=sj(v)??"fill";return u.jsx(ej,{src:s,width:V,height:M,fit:D,effects:e,className:g,style:v,id:b,pauseWhenLoading:L,maxRetries:E,delayRenderRetries:C,delayRenderTimeoutInMilliseconds:I,from:a,trimBefore:l,durationInFrames:c,freeze:f,premountFor:p,postmountFor:m,styleWhilePremounted:y,styleWhilePostmounted:w,hidden:n,name:r??"<Img>",showInTimeline:i,stack:o,_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/img",controls:x,outlineRef:F,...$})},cc=Pr({Component:aj,componentName:"<Img>",componentIdentity:"dev.remotion.remotion.Img",schema:tj,supportsEffects:!0});en(cc);var lj=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}`)},nb=({packageName:e,componentName:t})=>`${lj(e)}.${t}`,Ch={...Rr,...dr},uj={...Ch,...ho},rb={...uj,...po},cj={...rb,...Ku,...Gx},dj={...Ch,...Ku,...Gx},fj=(e,t)=>{typeof e=="function"?e(t):e&&(e.current=t)},ob=e=>{const t=Pr(e);return en(t),t},gu=(e,t,n)=>{const r=d.forwardRef((i,s)=>{const{durationInFrames:a,from:l,trimBefore:c,freeze:f,hidden:p,name:m,showInTimeline:y,stack:w,controls:x,...S}=i,h=d.useRef(null),g=d.useCallback(v=>{h.current=v,fj(s,v)},[s]);return u.jsx(Ft,{layout:"none",from:l??0,trimBefore:c,durationInFrames:a??1/0,freeze:f,hidden:p,name:m??t,showInTimeline:y??!0,controls:x,_remotionInternalStack:w,_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/interactive",outlineRef:h,children:he.createElement(e,{...S,ref:g})})});r.displayName=t;const o=ob({Component:r,componentName:t,componentIdentity:nb({packageName:"remotion",componentName:t.slice(1,-1)}),schema:n,supportsEffects:!1});return o.displayName=t,o},We=(e,t)=>gu(e,t,cj),ei=(e,t)=>gu(e,t,Ch),zr={baseSchema:Rr,transformSchema:dr,textSchema:Ku,backgroundSchema:ho,borderSchema:po,premountSchema:qi,sequenceSchema:Bi,withSchema:ob,_internalMakeRemotionComponentIdentity:nb,A:We("a","<Interactive.A>"),Article:We("article","<Interactive.Article>"),Aside:We("aside","<Interactive.Aside>"),Button:We("button","<Interactive.Button>"),Circle:ei("circle","<Interactive.Circle>"),Code:We("code","<Interactive.Code>"),Div:We("div","<Interactive.Div>"),Ellipse:ei("ellipse","<Interactive.Ellipse>"),Em:We("em","<Interactive.Em>"),Footer:We("footer","<Interactive.Footer>"),G:ei("g","<Interactive.G>"),H1:We("h1","<Interactive.H1>"),H2:We("h2","<Interactive.H2>"),H3:We("h3","<Interactive.H3>"),H4:We("h4","<Interactive.H4>"),H5:We("h5","<Interactive.H5>"),H6:We("h6","<Interactive.H6>"),Header:We("header","<Interactive.Header>"),Label:We("label","<Interactive.Label>"),Li:We("li","<Interactive.Li>"),Line:ei("line","<Interactive.Line>"),Main:We("main","<Interactive.Main>"),Nav:We("nav","<Interactive.Nav>"),Ol:We("ol","<Interactive.Ol>"),P:We("p","<Interactive.P>"),Path:ei("path","<Interactive.Path>"),Pre:We("pre","<Interactive.Pre>"),Rect:ei("rect","<Interactive.Rect>"),Section:We("section","<Interactive.Section>"),Small:We("small","<Interactive.Small>"),Span:We("span","<Interactive.Span>"),Strong:We("strong","<Interactive.Strong>"),Svg:gu("svg","<Interactive.Svg>",rb),Text:gu("text","<Interactive.Text>",dj),Ul:We("ul","<Interactive.Ul>")},pj=async({resolvedSrc:e,signal:t,requestInit:n,contentType:r})=>{const{decoder:o,selectedTrack:i}=await R1({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()}},ib=he.createRef(),hj=({children:e,onlyRenderComposition:t,currentCompositionMetadata:n,initialCompositions:r,initialCanvasContent:o})=>{const[i,s]=d.useState([]),[a,l]=d.useState(o),[c,f]=d.useState(r),p=d.useRef(c),m=d.useCallback(v=>{f(b=>{const k=v(b);return p.current=k,k})},[]),y=d.useCallback(v=>{m(b=>{if(b.find(k=>k.id===v.id))throw new Error(`Multiple composition with id ${v.id} are registered.`);return[...b,v]})},[m]),w=d.useCallback(v=>{f(b=>b.filter(k=>k.id!==v))},[]),x=d.useCallback((v,b,k,E)=>{s(C=>[...C,{name:v,parent:b,nonce:k,stack:E}])},[]),S=d.useCallback((v,b)=>{s(k=>k.filter(E=>!(E.name===v&&E.parent===b)))},[]);d.useImperativeHandle(ib,()=>({getCompositions:()=>p.current}),[]);const h=d.useMemo(()=>({registerComposition:y,unregisterComposition:w,registerFolder:x,unregisterFolder:S,setCanvasContent:l,onlyRenderComposition:t}),[y,x,w,S,t]),g=d.useMemo(()=>({compositions:c,folders:i,currentCompositionMetadata:n,canvasContent:a}),[c,i,n,a]);return u.jsx(Ki.Provider,{value:g,children:u.jsx(va.Provider,{value:h,children:e})})},sb={};kx(sb,{makeDefaultPreviewCSS:()=>gj,injectCSS:()=>mj,OBJECTFIT_CONTAIN_CLASS_NAME:()=>la});var il={},mj=e=>{if(typeof document>"u")return()=>{};if(il[e])return()=>{};const t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");return n.appendChild(document.createTextNode(e)),t.prepend(n),il[e]=n,()=>{const r=il[e];r&&(r.parentNode&&r.parentNode.removeChild(r),delete il[e])}},la="__remotion_objectfitcontain",gj=(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} .${la} {
66
+ object-fit: contain;
67
+ }
68
+ `:`
69
+ * {
70
+ box-sizing: border-box;
71
+ }
72
+ body {
73
+ margin: 0;
74
+ background-color: ${t};
75
+ }
76
+ .${la} {
77
+ object-fit: contain;
78
+ }
79
+ `,ab="__remotion-studio-container",yj=()=>document.getElementById(ab),vj=he.createContext(null),wj=null,pd=[],xj=()=>wj,bj=e=>(pd.push(e),()=>{pd=pd.filter(t=>t!==e)}),Ih=d.createContext(null),Sj=()=>{const e=d.useContext(Ih);return!e||e.videoEnabled===null?window.remotion_videoEnabled:e.videoEnabled},kj=()=>{const e=d.useContext(Ih);return!e||e.audioEnabled===null?window.remotion_audioEnabled:e.audioEnabled},Ej=({children:e,videoEnabled:t,audioEnabled:n})=>{const r=d.useMemo(()=>({videoEnabled:t,audioEnabled:n}),[t,n]);return u.jsx(Ih.Provider,{value:r,children:e})},Cj=({children:e,numberOfAudioTags:t,logLevel:n,audioLatencyHint:r,previewSampleRate:o,videoEnabled:i,audioEnabled:s,frameState:a})=>{const l=d.useMemo(()=>{let f=0;return{getNonce:()=>f++}},[]),c=d.useMemo(()=>({logLevel:n,mountTime:Date.now()}),[n]);return u.jsx(Vo.Provider,{value:c,children:u.jsx(wa.Provider,{value:l,children:u.jsx(b2,{frameState:a,children:u.jsx(Ej,{videoEnabled:i,audioEnabled:s,children:u.jsx(Px,{children:u.jsx(M1,{children:u.jsx(T2,{children:u.jsx(N1,{children:u.jsx(V1,{children:u.jsx(L1,{audioLatencyHint:r,audioEnabled:s,previewSampleRate:o,children:u.jsx(O1,{numberOfAudioTags:t,children:e})})})})})})})})})})})},Gg=["h264","h265","vp8","vp9","av1","mp3","aac","wav","prores","h264-mkv","h264-ts","gif"];function Ij(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(!Gg.includes(e))throw new Error(`The "${n}" prop ${t} must be one of ${Gg.join(", ")}, but you passed ${e}.`)}}var Tj=({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;cu(l,"width",e!=null&&e.width?s:a);const c=(e==null?void 0:e.height)??r??void 0;cu(c,"height",e!=null&&e.height?s:a);const f=(e==null?void 0:e.fps)??n??null;Wu(f,e!=null&&e.fps?s:a);const p=(e==null?void 0:e.durationInFrames)??i??null;Bu(p,{allowFloats:!1,component:`of the "<Composition />" component with the id "${t}"`});const m=e==null?void 0:e.defaultCodec;Ij(m,s,"defaultCodec");const y=e==null?void 0:e.defaultOutName,w=e==null?void 0:e.defaultVideoImageFormat,x=e==null?void 0:e.defaultPixelFormat,S=e==null?void 0:e.defaultProResProfile,h=e==null?void 0:e.defaultSampleRate;return{width:l,height:c,fps:f,durationInFrames:p,defaultCodec:m,defaultOutName:y,defaultVideoImageFormat:w,defaultPixelFormat:x,defaultProResProfile:S,defaultSampleRate:h}},Xg=({calculated:e,compositionDurationInFrames:t,compositionFps:n,compositionHeight:r,compositionId:o,compositionWidth:i,defaultProps:s,originalProps:a})=>{const l=Tj({calculated:e,compositionDurationInFrames:t,compositionFps:n,compositionHeight:r,compositionWidth:i,compositionId:o});return{metadataSource:{durationInFrames:(e==null?void 0:e.durationInFrames)===void 0?"composition":"calculate-metadata",fps:(e==null?void 0:e.fps)===void 0?"composition":"calculate-metadata",height:(e==null?void 0:e.height)===void 0?"composition":"calculate-metadata",width:(e==null?void 0:e.width)===void 0?"composition":"calculate-metadata"},videoConfig:{...l,id:o,defaultProps:Df(s??{}),props:Df((e==null?void 0:e.props)??a),defaultCodec:l.defaultCodec??null,defaultOutName:l.defaultOutName??null,defaultVideoImageFormat:l.defaultVideoImageFormat??null,defaultPixelFormat:l.defaultPixelFormat??null,defaultProResProfile:l.defaultProResProfile??null,defaultSampleRate:l.defaultSampleRate??null}}},lb=({calculateMetadata:e,signal:t,defaultProps:n,inputProps:r,compositionId:o,compositionDurationInFrames:i,compositionFps:s,compositionHeight:a,compositionWidth:l})=>{const c=e?e({defaultProps:n,props:r,abortSignal:t,compositionId:o,isRendering:Nn().isRendering}):null;return c!==null&&typeof c=="object"&&"then"in c?c.then(f=>Xg({calculated:f,compositionDurationInFrames:i,compositionFps:s,compositionHeight:a,compositionWidth:l,compositionId:o,defaultProps:n,originalProps:r})):Xg({calculated:c,compositionDurationInFrames:i,compositionFps:s,compositionHeight:a,compositionWidth:l,compositionId:o,defaultProps:n,originalProps:r})},ub=e=>{const t=lb(e);return typeof t=="object"&&"then"in t?t.then(({videoConfig:n})=>n):t.videoConfig},jj=e=>{try{return{type:"success",result:lb(e)}}catch(t){return{type:"error",error:t}}},Rj=e=>{try{return{type:"success",result:ub(e)}}catch(t){return{type:"error",error:t}}},Pj=he.createContext(()=>{}),Fj=()=>{if(Nn().isRendering){const e=window.remotion_envVariables;return e?{...JSON.parse(e),NODE_ENV:"production"}:{}}return{NODE_ENV:"production"}},$j=()=>{const e=Fj();window.process||(window.process={}),window.process.env||(window.process.env={}),Object.keys(e).forEach(t=>{window.process.env[t]=e[t]})},_j=he.createContext(null),Mj=d.createContext({setSize:()=>{},size:{size:"auto",translation:{x:0,y:0}}}),Aj=({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)},Nj=he.createContext(null),Lj=({src:e,transparent:t,currentTime:n,toneMapped:r})=>`http://localhost:${window.remotion_proxyPort}/proxy?src=${encodeURIComponent(ur(e))}&time=${encodeURIComponent(Math.max(0,n))}&transparent=${String(t)}&toneMapped=${String(r)}`,Oj=({onError:e,volume:t,playbackRate:n,src:r,muted:o,allowAmplificationDuringRender:i,transparent:s,toneMapped:a,toneFrequency:l,name:c,loopVolumeCurveBehavior:f,delayRenderRetries:p,delayRenderTimeoutInMilliseconds:m,onVideoFrame:y,crossOrigin:w,audioStreamIndex:x,preservePitch:S,...h})=>{const g=fo(),v=Pt(),b=ts(f),k=Zu(),E=d.useContext(St),C=Lo(),{registerRenderAsset:I,unregisterRenderAsset:j}=d.useContext(Uo);if(!r)throw new TypeError("No `src` was passed to <OffthreadVideo>.");const F=d.useMemo(()=>`offthreadvideo-${Ho(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(!k)throw new Error("No video config found");const L=Ko({volume:t,frame:b,mediaVolume:1});rs(L),d.useEffect(()=>{if(!r)throw new Error("No src passed");if(window.remotion_audioEnabled&&!o&&!(L<=0))return I({type:"video",src:ur(r),id:F,frame:g,volume:L,mediaFrame:v,playbackRate:n,toneFrequency:l,audioStartFrame:Math.max(0,-((E==null?void 0:E.cumulatedNegativeFrom)??0)),audioStreamIndex:x}),()=>j(F)},[o,r,I,F,j,L,v,g,n,l,E==null?void 0:E.cumulatedNegativeFrom,x]);const V=d.useMemo(()=>U1({frame:v,playbackRate:n||1,startFrom:-C})/k.fps,[v,C,n,k.fps]),M=d.useMemo(()=>Lj({src:r,currentTime:V,transparent:s,toneMapped:a}),[a,V,r,s]),[$,D]=d.useState(null),{delayRender:H,continueRender:P}=Xn();d.useLayoutEffect(()=>{if(!window.remotion_videoEnabled)return;const Z=[];D(null);const Q=new AbortController,_=H(`Fetching ${M} from server`,{retries:p??void 0,timeoutInMilliseconds:m??void 0});return(async()=>{try{const z=await fetch(M,{signal:Q.signal,cache:"no-store"});if(z.status!==200){if(z.status===500){const U=await z.json();if(U.error){const G=U.error.replace(/^Error: /,"");throw new Error(G)}}throw new Error(`Server returned status ${z.status} while fetching ${M}`)}const ne=await z.blob(),J=URL.createObjectURL(ne);Z.push(()=>URL.revokeObjectURL(J)),D({src:J,handle:_})}catch(z){if(z.message.includes("aborted")){P(_);return}if(Q.signal.aborted){P(_);return}z.message.includes("Failed to fetch")&&(z=new Error(`Failed to fetch ${M}. This could be caused by Chrome rejecting the request because the disk space is low. Consider increasing the disk size of your environment.`,{cause:z})),e?e(z):aa(z)}})(),Z.push(()=>{Q.signal.aborted||Q.abort()}),()=>{Z.forEach(z=>z())}},[M,p,m,e,P,H]);const T=d.useCallback(()=>{e?e==null||e(new Error("Failed to load image with src "+$)):aa("Failed to load image with src "+$)},[$,e]),W=d.useMemo(()=>[la,h.className].filter(Yi).join(" "),[h.className]),R=d.useCallback(Z=>{y&&y(Z)},[y]);return!$||!window.remotion_videoEnabled?null:(P($.handle),u.jsx(cc,{src:$.src,delayRenderRetries:p,delayRenderTimeoutInMilliseconds:m,onImageFrame:R,...h,onError:T,className:W}))},cb=({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 Si extends Error{constructor({message:n,src:r}){super(n);Oe(this,"src");this.name="MediaPlaybackError",this.src=r}}var Dj=(e,t)=>{const n=d.useContext(es);if(!n)throw new Error("SharedAudioContext not found");const r=d.useRef(null),o=d.useMemo(()=>n.audioContext?vh({audioContext:n.audioContext,ref:r}):null,[n.audioContext]);(he.useInsertionEffect??he.useLayoutEffect)(()=>()=>{requestAnimationFrame(()=>{o==null||o.cleanup()})},[o]);const{volume:s,muted:a,playbackRate:l,preservePitch:c,onlyWarnForMediaSeekingError:f,src:p,onDuration:m,acceptableTimeShift:y,acceptableTimeShiftInSeconds:w,toneFrequency:x,name:S,_remotionInternalNativeLoopPassed:h,_remotionInternalStack:g,style:v,pauseWhenBuffering:b,showInTimeline:k,loopVolumeCurveBehavior:E,onError:C,onAutoPlayError:I,onVideoFrame:j,crossOrigin:F,delayRenderRetries:L,delayRenderTimeoutInMilliseconds:V,allowAmplificationDuringRender:M,useWebAudioApi:$,audioStreamIndex:D,...H}=e,P=ts(E??"repeat"),{fps:T,durationInFrames:W}=ht(),R=d.useContext(St),Z=cr(),Q=ba(),[_]=d.useState(()=>String(Math.random()));if(typeof y<"u")throw new Error("acceptableTimeShift has been removed. Use acceptableTimeShiftInSeconds instead.");const[N]=Sh(),[z]=kh(),ne=Ko({frame:P,volume:s,mediaVolume:N});rs(ne);const J=d.useCallback(()=>g??null,[g]);wh({volume:s,mediaVolume:N,mediaType:"video",src:p,playbackRate:e.playbackRate??1,displayName:S??null,id:_,getStack:J,showInTimeline:k,premountDisplay:(R==null?void 0:R.premountDisplay)??null,postmountDisplay:(R==null?void 0:R.postmountDisplay)??null,loopDisplay:void 0,documentationLink:f?"https://www.remotion.dev/docs/offthreadvideo":"https://www.remotion.dev/docs/html5-video",refForOutline:r}),K1({mediaRef:r,src:p,mediaType:"video",playbackRate:e.playbackRate??1,preservePitch:c,onlyWarnForMediaSeekingError:f,acceptableTimeshift:w??null,isPremounting:!!(R!=null&&R.premounting),isPostmounting:!!(R!=null&&R.postmounting),pauseWhenBuffering:b,onAutoPlayError:I??null}),Y1({id:_,isPostmounting:!!(R!=null&&R.postmounting),isPremounting:!!(R!=null&&R.premounting),mediaRef:r,mediaType:"video",onAutoPlayError:I??null}),z1({logLevel:Z,mediaRef:r,volume:ne,source:o,shouldUseWebAudioApi:$??!1});const U=R?R.relativeFrom:0,G=R?Math.min(R.durationInFrames,W):W,K=Zo(p),le=vT({actualSrc:K,actualFrom:U,duration:G,fps:T});d.useImperativeHandle(t,()=>r.current,[]),d.useState(()=>Ut({logLevel:Z,message:`Mounting video with source = ${le}, v=${Rs}, user agent=${typeof navigator>"u"?"server":navigator.userAgent}`,tag:"video",mountTime:Q})),d.useEffect(()=>{const{current:O}=r;if(!O)return;const X=()=>{var se;if(O.error){if(console.error("Error occurred in video",O==null?void 0:O.error),C){const oe=new Si({message:`Code ${O.error.code}: ${O.error.message}`,src:p});C(oe);return}throw new Si({message:`The browser threw an error while playing the video ${p}: Code ${O.error.code} - ${(se=O==null?void 0:O.error)==null?void 0:se.message}. See https://remotion.dev/docs/media-playback-error for help. Pass an onError() prop to handle the error.`,src:p})}else{if(C){const oe=new Si({message:`The browser threw an error while playing the video ${p}`,src:p});C(oe);return}throw new Si({message:"The browser threw an error while playing the video",src:p})}};return O.addEventListener("error",X,{once:!0}),()=>{O.removeEventListener("error",X)}},[C,p]);const Y=d.useRef(m);Y.current=m,cb({ref:r,onVideoFrame:j}),d.useEffect(()=>{var se;const{current:O}=r;if(!O)return;if(O.duration){(se=Y.current)==null||se.call(Y,p,O.duration);return}const X=()=>{var oe;(oe=Y.current)==null||oe.call(Y,p,O.duration)};return O.addEventListener("loadedmetadata",X),()=>{O.removeEventListener("loadedmetadata",X)}},[p]),d.useEffect(()=>{const{current:O}=r;O&&(lc()?O.preload="metadata":O.preload="auto")},[]);const ie=d.useMemo(()=>({...v}),[v]),ke=yh({crossOrigin:F,requestsVideoFrame:!!j,isClientSideRendering:!1});return u.jsx("video",{...H,ref:r,muted:a||z||ne<=0,playsInline:!0,src:le,loop:h,style:ie,disableRemotePlayback:!0,crossOrigin:ke,controls:!1})},Th=d.forwardRef(Dj),jh=e=>{const{startFrom:t,endAt:n,trimBefore:r,trimAfter:o,name:i,pauseWhenBuffering:s,stack:a,showInTimeline:l,...c}=e,f=pt(),p=ka(s);if(f.isClientSideRendering)throw new Error("<OffthreadVideo> is not supported in @remotion/web-renderer. Use <Video> from @remotion/media instead. See https://remotion.dev/docs/client-side-rendering/limitations");const m=d.useCallback(()=>{},[]);if(typeof e.src!="string")throw new TypeError(`The \`<OffthreadVideo>\` tag requires a string for \`src\`, but got ${JSON.stringify(e.src)} instead.`);ic({startFrom:t,endAt:n,trimBefore:r,trimAfter:o});const{trimBeforeValue:y,trimAfterValue:w}=sc({startFrom:t,endAt:n,trimBefore:r,trimAfter:o});if(typeof y<"u"||typeof w<"u")return u.jsx(Ft,{layout:"none",from:0-(y??0),showInTimeline:!1,durationInFrames:w,name:i,children:u.jsx(jh,{pauseWhenBuffering:p,...c,trimAfter:void 0,name:void 0,showInTimeline:l,trimBefore:void 0,stack:void 0,startFrom:void 0,endAt:void 0})});if(oc(e,"Video"),f.isRendering)return u.jsx(Oj,{pauseWhenBuffering:p,...c,trimAfter:void 0,name:void 0,showInTimeline:l,trimBefore:void 0,stack:void 0,startFrom:void 0,endAt:void 0});const{transparent:x,toneMapped:S,onAutoPlayError:h,onVideoFrame:g,crossOrigin:v,delayRenderRetries:b,delayRenderTimeoutInMilliseconds:k,...E}=c;return u.jsx(Th,{_remotionInternalStack:a??null,onDuration:m,onlyWarnForMediaSeekingError:!0,pauseWhenBuffering:p,showInTimeline:l??!0,onAutoPlayError:h??void 0,onVideoFrame:g??null,crossOrigin:v,...E,_remotionInternalNativeLoopPassed:!1})},db=({src:e,acceptableTimeShiftInSeconds:t,allowAmplificationDuringRender:n,audioStreamIndex:r,crossOrigin:o,delayRenderRetries:i,delayRenderTimeoutInMilliseconds:s,loopVolumeCurveBehavior:a,muted:l,name:c,onAutoPlayError:f,onError:p,onVideoFrame:m,pauseWhenBuffering:y,playbackRate:w,preservePitch:x,showInTimeline:S,style:h,toneFrequency:g,toneMapped:v,transparent:b,trimAfter:k,trimBefore:E,useWebAudioApi:C,volume:I,_remotionInternalNativeLoopPassed:j,endAt:F,stack:L,startFrom:V,imageFormat:M,...$})=>{if(M)throw new TypeError("The `<OffthreadVideo>` tag does no longer accept `imageFormat`. Use the `transparent` prop if you want to render a transparent video.");return u.jsx(jh,{acceptableTimeShiftInSeconds:t,allowAmplificationDuringRender:n??!0,audioStreamIndex:r??0,crossOrigin:o,delayRenderRetries:i,delayRenderTimeoutInMilliseconds:s,loopVolumeCurveBehavior:a??"repeat",muted:l??!1,name:c,onAutoPlayError:f??null,onError:p,onVideoFrame:m,pauseWhenBuffering:ka(y),playbackRate:w??1,preservePitch:x,toneFrequency:g??1,showInTimeline:S??!0,src:e,stack:L,startFrom:V,_remotionInternalNativeLoopPassed:j??!1,endAt:F,style:h,toneMapped:v??!0,transparent:b??!1,trimAfter:k,trimBefore:E,useWebAudioApi:C??!1,volume:I,...$})};en(db);var zj="remotion_staticFilesChanged";function Bj(){const e=he.useContext(Ki),t=he.useContext(Xi),n=he.useContext(Gi),r=he.useContext(St),o=he.useContext(wa),i=he.useContext(Wo),s=he.useContext(rc),a=he.useContext(Vu),l=he.useContext(Uo),c=he.useContext(Ji),f=he.useContext(Yu),p=he.useContext(Xu),m=he.useContext(ns),y=he.useContext(Vo);return d.useMemo(()=>({compositionManagerCtx:e,timelineContext:t,setTimelineContext:n,sequenceContext:r,nonceContext:o,canUseRemotionHooksContext:i,preloadContext:s,resolveCompositionContext:a,renderAssetManagerContext:l,sequenceManagerContext:c,sequenceManagerRefContext:f,visualModePropStatusesRefContext:p,bufferManagerContext:m,logLevelContext:y}),[e,o,r,n,t,i,s,a,l,c,f,p,m,y])}var Wj=e=>{const{children:t,contexts:n}=e;return u.jsx(Vo.Provider,{value:n.logLevelContext,children:u.jsx(Wo.Provider,{value:n.canUseRemotionHooksContext,children:u.jsx(wa.Provider,{value:n.nonceContext,children:u.jsx(rc.Provider,{value:n.preloadContext,children:u.jsx(Ki.Provider,{value:n.compositionManagerCtx,children:u.jsx(Yu.Provider,{value:n.sequenceManagerRefContext,children:u.jsx(Ji.Provider,{value:n.sequenceManagerContext,children:u.jsx(Xu.Provider,{value:n.visualModePropStatusesRefContext,children:u.jsx(Uo.Provider,{value:n.renderAssetManagerContext,children:u.jsx(Vu.Provider,{value:n.resolveCompositionContext,children:u.jsx(Xi.Provider,{value:n.timelineContext,children:u.jsx(Gi.Provider,{value:n.setTimelineContext,children:u.jsx(St.Provider,{value:n.sequenceContext,children:u.jsx(ns.Provider,{value:n.bufferManagerContext,children:t})})})})})})})})})})})})})})},Vj=d.createRef(),we={MaxMediaCacheSizeContext:vj,useUnsafeVideoConfig:Zu,useFrameForVolumeProp:ts,useTimelinePosition:fo,useAbsoluteTimelinePosition:Zx,evaluateVolume:Ko,getAbsoluteSrc:ur,getAnimatedImageDurationInSeconds:pj,getAssetDisplayName:B1,Timeline:Wf,validateMediaTrimProps:ic,validateMediaProps:oc,resolveTrimProps:sc,VideoForPreview:Th,CompositionManager:Ki,CompositionSetters:va,VisualModePropStatusesContext:Gu,VisualModePropStatusesRefContext:Xu,VisualModeDragOverridesContext:qu,VisualModeSettersContext:t1,SequenceManager:Ji,SequenceManagerRefContext:Yu,SequenceStackTracesUpdateContext:Pj,baseSchema:Rr,sequenceSchema:Bi,SequenceWithoutSchema:E1,sequenceStyleSchema:qx,sequenceVisualStyleSchema:S2,sequencePremountSchema:Xx,textSchema:Ku,transformSchema:dr,premountSchema:qi,flattenActiveSchema:hh,getFlatSchemaWithAllKeys:mh,RemotionRootContexts:Cj,CompositionManagerProvider:hj,useVideo:Uu,getRoot:xj,useMediaVolumeState:Sh,usePlayerMutedState:kh,useMediaInTimeline:wh,useLazyComponent:Nx,truthy:Yi,SequenceContext:St,PremountContext:r1,usePremounting:Ea,useRemotionContexts:Bj,RemotionContextProvider:Wj,CSSUtils:sb,setupEnvVariables:$j,MediaVolumeContext:xh,SetMediaVolumeContext:bh,getRemotionEnvironment:Nn,SharedAudioContext:es,SharedAudioContextProvider:L1,SharedAudioTagsContext:ac,SharedAudioTagsContextProvider:O1,invalidCompositionErrorMessage:d2,invalidFolderNameErrorMessage:MC,calculateMediaDuration:tc,isCompositionIdValid:Ox,isFolderNameValid:Ix,getPreviewDomElement:yj,compositionsRef:ib,portalNode:zf,waitForRoot:bj,SetTimelineContext:Gi,CanUseRemotionHooksProvider:Nf,CanUseRemotionHooks:Wo,PrefetchProvider:M1,DurationsContextProvider:N1,IsPlayerContextProvider:OC,useIsPlayer:eh,EditorPropsProvider:Px,EditorPropsContext:th,usePreload:Zo,NonceContext:wa,resolveVideoConfig:ub,resolveVideoConfigOrCatch:Rj,resolveVideoConfigWithMetadataOrCatch:jj,ResolveCompositionContext:Vu,useResolvedVideoConfig:nh,resolveCompositionsRef:YC,REMOTION_STUDIO_CONTAINER_ELEMENT:ab,RenderAssetManager:Uo,persistCurrentFrame:Bx,usePlaybackRate:ah,useTimelineContext:co,useTimelineSetFrame:Kx,isIosSafari:lc,WATCH_REMOTION_STATIC_FILES:zj,addSequenceStackTraces:en,useMediaStartsAt:Lo,BufferingProvider:V1,BufferingContextReact:ns,getComponentsToAddStacksTo:m2,getSequenceComponent:y2,getSingleChildComponent:v2,CurrentScaleContext:_j,PixelDensityContext:Nj,PreviewSizeContext:Mj,calculateScale:Aj,validateRenderAsset:$1,Log:jt,LogLevelContext:Vo,useLogLevel:cr,playbackLogging:Ut,timeValueRef:KC,compositionSelectorRef:Vj,RemotionEnvironmentContext:Fx,warnAboutTooHighVolume:rs,AudioForPreview:G1,OBJECTFIT_CONTAIN_CLASS_NAME:la,InnerOffthreadVideo:jh,useBasicMediaInTimeline:W1,getInputPropsOverride:Rx,setInputPropsOverride:HC,useVideoEnabled:Sj,useAudioEnabled:kj,useIsPlayerBuffering:H1,TimelinePosition:Wf,DelayRenderContextType:Ax,TimelineContext:Xi,PlaybackRateContext:oh,AbsoluteTimeContext:ih,RenderAssetManagerProvider:tT,getEffectiveVisualModeValue:g1,CompositionRenderErrorContext:Ex,useEffectChainState:Ra,createEffectChainState:j1,cleanupEffectChainState:Hf,runEffectChain:ja,useMemoizedEffects:Ta,useMemoizedEffectDefinitions:Ia,createEffect:JI,createWebGLContextError:NI,createWebGL2ContextError:T1,computeEffectiveSchemaValuesDotNotation:b1,interpolateKeyframedStatus:Ca,makeStaticDragOverride:kI,makeKeyframedDragOverride:EI,resolveDragOverrideValue:Qu,getStaticDragOverrideValue:CI,OverrideIdsToNodePathsGettersContext:ph,OverrideIdsToNodePathsSettersContext:wI,findPropsToDelete:w1,makeSequencePropsSubscriptionKey:wr,getPropStatusesCtx:v1,getEffectPropStatusesCtx:y1,hiddenField:lh,durationInFramesField:ch,freezeField:dh,fromField:Qx},fb=e=>he.Children.toArray(e).reduce((n,r)=>r.type===he.Fragment?n.concat(fb(r.props.children)):(n.push(r),n),[]),Hj={durationInFrames:zr.baseSchema.durationInFrames,name:zr.sequenceSchema.name,hidden:zr.sequenceSchema.hidden,showInTimeline:zr.sequenceSchema.showInTimeline,freeze:zr.baseSchema.freeze,trimBefore:zr.sequenceSchema.trimBefore,layout:zr.sequenceSchema.layout},Uj=d.forwardRef(({offset:e=0,className:t="",stack:n=null,_remotionInternalRender:r=null,...o},i)=>(R2(),r?r({...o,offset:e,className:t||void 0,stack:n},i):u.jsx(n1,{children:o.children}))),pb=zr.withSchema({Component:Uj,componentName:"<Series.Sequence>",componentIdentity:"dev.remotion.remotion.Series.Sequence",schema:Hj,supportsEffects:!1}),Zj=E1,qg=({durationInFrames:e,offset:t,index:n,childrenLength:r})=>{const o=`index = ${n}, duration = ${e}`;(n!==r-1||e!==1/0)&&Bu(e,{component:"of a <Series.Sequence /> component",allowFloats:!0});const i=t??0;if(Number.isNaN(i))throw new TypeError(`The "offset" property of a <Series.Sequence /> must not be NaN, but got NaN (${o}).`);if(!Number.isFinite(i))throw new TypeError(`The "offset" property of a <Series.Sequence /> must be finite, but got ${i} (${o}).`);if(i%1!==0)throw new TypeError(`The "offset" property of a <Series.Sequence /> must be finite, but got ${i} (${o}).`);return i},Kj=e=>{const t=d.useMemo(()=>{const n=fb(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!==pb)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 qg({durationInFrames:l.props.durationInFrames,offset:l.props.offset,index:o,childrenLength:n.length}),he.cloneElement(l,{_remotionInternalRender:(c,f)=>{const p=c.durationInFrames,{durationInFrames:m,children:y,offset:w,controls:x,stack:S,from:h,name:g,...v}=c,b=qg({durationInFrames:p,offset:w,index:o,childrenLength:n.length}),k=i+b,E=i+p+b;return u.jsxs(u.Fragment,{children:[u.jsx(Zj,{ref:f,name:g||"<Series.Sequence>",_remotionInternalDocumentationLink:g?void 0:"https://www.remotion.dev/docs/series",_remotionInternalStack:S??void 0,controls:x??void 0,from:k,durationInFrames:p,...v,children:u.jsx(n1,{children:y})}),r(o+1,E)]})}})};return r(0,0)},[e.children]);return u.jsx(j2,{children:u.jsx(Ft,{layout:"none",name:"<Series>",_remotionInternalDocumentationLink:"https://www.remotion.dev/docs/series",...e,children:t})})},Yj=Object.assign(Pr({Component:Kj,componentName:"<Series>",componentIdentity:"dev.remotion.remotion.Series",schema:I2,supportsEffects:!1}),{Sequence:pb});en(Yj);var Gj={"%3A":":","%2F":"/","%3F":"?","%23":"#","%5B":"[","%5D":"]","%40":"@","%21":"!","%24":"$","%26":"&","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";"},Jg={},Xj=e=>{Jg[e]||(console.warn(e),Jg[e]=!0)},qj=e=>{for(const t of Object.keys(Gj))if(e.includes(t))return{containsHex:!0,hexCode:t};return{containsHex:!1}},Yf=e=>e.startsWith("/")?Yf(e.substring(1)):e,Jj=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}/${Yf(e)}`}return`/${Yf(e)}`},Qj=e=>e.split("/").map(o=>encodeURIComponent(o)).join("/"),dc=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=qj(e);t.containsHex&&Xj(`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=Qj(e),r=Jj(n);return r.startsWith("/")?r:`/${r}`},eR=e=>{const t={...e,durationInFrames:1,fps:1};return he.createElement(du,t)};en(eR);var Qg=e=>Math.round(e*1e5)/1e5,hd=({element:e,desiredTime:t,logLevel:n,mountTime:r})=>{if(mu(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((c,f)=>{const p=f.expectedDisplayTime-c;if(p<=0){l(f.mediaTime);return}setTimeout(()=>{l(f.mediaTime)},p+150)})}),a=new Promise(l=>{const c=()=>{l()};e.addEventListener("seeked",c,{once:!0}),i=()=>{e.removeEventListener("seeked",c)}});return{wait:Promise.all([s,a]).then(([l])=>l),cancel:()=>{i==null||i(),e.cancelVideoFrameCallback(o)}}},tR=({element:e,desiredTime:t,fps:n,logLevel:r,mountTime:o})=>{const i=1/n/2;let s=()=>{};return Number.isFinite(e.duration)&&e.currentTime>=e.duration&&t>=e.duration?{prom:Promise.resolve(),cancel:()=>{}}:{prom:new Promise((l,c)=>{const f=hd({element:e,desiredTime:t+i,logLevel:r,mountTime:o});f.wait.then(p=>{if(Math.abs(t-p)<=i)return l();const y=t>p?1:-1,w=hd({element:e,desiredTime:p+i*y,logLevel:r,mountTime:o});s=w.cancel,w.wait.then(x=>{const S=Math.abs(t-x);if(Qg(S)<=Qg(i))return l();const h=hd({element:e,desiredTime:t+i,logLevel:r,mountTime:o});return s=h.cancel,h.wait.then(()=>{l()}).catch(g=>{c(g)})}).catch(x=>{c(x)})}),s=f.cancel}),cancel:()=>{s()}}},nR=({onError:e,volume:t,allowAmplificationDuringRender:n,playbackRate:r,onDuration:o,toneFrequency:i,name:s,acceptableTimeShiftInSeconds:a,delayRenderRetries:l,delayRenderTimeoutInMilliseconds:c,loopVolumeCurveBehavior:f,audioStreamIndex:p,onVideoFrame:m,preservePitch:y,...w},x)=>{const S=fo(),h=Pt(),g=ts(f??"repeat"),v=Zu(),b=d.useRef(null),k=d.useContext(St),E=Lo(),C=pt(),I=cr(),j=ba(),{delayRender:F,continueRender:L}=Xn(),{registerRenderAsset:V,unregisterRenderAsset:M}=d.useContext(Uo),$=d.useMemo(()=>`video-${Ho(w.src??"")}-${k==null?void 0:k.cumulatedFrom}-${k==null?void 0:k.relativeFrom}-${k==null?void 0:k.durationInFrames}`,[w.src,k==null?void 0:k.cumulatedFrom,k==null?void 0:k.relativeFrom,k==null?void 0:k.durationInFrames]);if(!v)throw new Error("No video config found");const D=Ko({volume:t,frame:g,mediaVolume:1});rs(D),d.useEffect(()=>{if(!w.src)throw new Error("No src passed");if(!w.muted&&!(D<=0)&&window.remotion_audioEnabled)return V({type:"video",src:ur(w.src),id:$,frame:S,volume:D,mediaFrame:h,playbackRate:r??1,toneFrequency:i??1,audioStartFrame:Math.max(0,-((k==null?void 0:k.cumulatedNegativeFrom)??0)),audioStreamIndex:p??0}),()=>M($)},[w.muted,w.src,V,$,M,D,h,S,r,i,k==null?void 0:k.cumulatedNegativeFrom,p]),d.useImperativeHandle(x,()=>b.current,[]),cb({ref:b,onVideoFrame:m}),d.useEffect(()=>{var _,N;if(!window.remotion_videoEnabled)return;const{current:P}=b;if(!P)return;const T=Z1({frame:h,playbackRate:r||1,startFrom:-E,fps:v.fps}),W=F(`Rendering <Html5Video /> with src="${w.src}" at time ${T}`,{retries:l??void 0,timeoutInMilliseconds:c??void 0});if(((N=(_=window.process)==null?void 0:_.env)==null?void 0:N.NODE_ENV)==="test"){L(W);return}if(mu(P.currentTime,T)){if(P.readyState>=2){L(W);return}const z=()=>{L(W)};return P.addEventListener("loadeddata",z,{once:!0}),()=>{P.removeEventListener("loadeddata",z)}}const R=()=>{L(W)},Z=tR({element:P,desiredTime:T,fps:v.fps,logLevel:I,mountTime:j});Z.prom.then(()=>{L(W)}),P.addEventListener("ended",R,{once:!0});const Q=()=>{var z;if(P!=null&&P.error){if(console.error("Error occurred in video",P==null?void 0:P.error),e)return;throw new Si({message:`The browser threw an error while playing the video ${w.src}: Code ${P.error.code} - ${(z=P==null?void 0:P.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 Si({message:"The browser threw an error",src:w.src})};return P.addEventListener("error",Q,{once:!0}),()=>{Z.cancel(),P.removeEventListener("ended",R),P.removeEventListener("error",Q),L(W)}},[g,w.src,r,v.fps,h,E,e,l,c,I,j,L,F]);const{src:H}=w;return C.isRendering&&d.useLayoutEffect(()=>{var R,Z;if(((Z=(R=window.process)==null?void 0:R.env)==null?void 0:Z.NODE_ENV)==="test")return;const P=F("Loading <Html5Video> duration with src="+H,{retries:l??void 0,timeoutInMilliseconds:c??void 0}),{current:T}=b,W=()=>{T!=null&&T.duration&&o(H,T.duration),L(P)};return T!=null&&T.duration?(o(H,T.duration),L(P)):T==null||T.addEventListener("loadedmetadata",W,{once:!0}),()=>{T==null||T.removeEventListener("loadedmetadata",W),L(P)}},[H,o,l,c,L,F]),u.jsx("video",{ref:b,disableRemotePlayback:!0,...w})},rR=d.forwardRef(nR),oR=(e,t)=>{const{startFrom:n,endAt:r,trimBefore:o,trimAfter:i,name:s,pauseWhenBuffering:a,stack:l,_remotionInternalNativeLoopPassed:c,showInTimeline:f,onAutoPlayError:p,onVideoFrame:m,...y}=e,{loop:w,...x}=e,{fps:S}=ht(),h=pt(),g=ka(a);if(h.isClientSideRendering)throw new Error("<Html5Video> is not supported in @remotion/web-renderer. Use <Video> from @remotion/media instead. See https://remotion.dev/docs/client-side-rendering/limitations");const{durations:v,setDurations:b}=d.useContext(gh);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 k=Zo(e.src),E=d.useCallback((F,L)=>{b({type:"got-duration",durationInSeconds:L,src:F})},[b]),C=v[ur(k)]??v[ur(e.src)];ic({startFrom:n,endAt:r,trimBefore:o,trimAfter:i});const{trimBeforeValue:I,trimAfterValue:j}=sc({startFrom:n,endAt:r,trimBefore:o,trimAfter:i});if(w&&C!==void 0){if(!Number.isFinite(C))return u.jsx(Ll,{...x,ref:t,stack:l,_remotionInternalNativeLoopPassed:!0});const F=C*S;return u.jsx(nc,{durationInFrames:tc({trimAfter:j,mediaDurationInFrames:F,playbackRate:e.playbackRate??1,trimBefore:I}),layout:"none",name:s,showInTimeline:!1,children:u.jsx(Ll,{...x,ref:t,stack:l,_remotionInternalNativeLoopPassed:!0})})}return typeof I<"u"||typeof j<"u"?u.jsx(Ft,{layout:"none",from:0-(I??0),showInTimeline:!1,durationInFrames:j===void 0?void 0:j/(e.playbackRate??1),name:s,children:u.jsx(Ll,{pauseWhenBuffering:g,onVideoFrame:m,...y,ref:t,stack:l})}):(oc({playbackRate:e.playbackRate,preservePitch:e.preservePitch,volume:e.volume},"Html5Video"),h.isRendering?u.jsx(rR,{onDuration:E,onVideoFrame:m??null,...y,ref:t}):u.jsx(Th,{onlyWarnForMediaSeekingError:!1,...y,ref:t,onVideoFrame:m??null,pauseWhenBuffering:g,onDuration:E,_remotionInternalStack:l??null,_remotionInternalNativeLoopPassed:c??!1,showInTimeline:f??!0,onAutoPlayError:p??void 0}))},Ll=d.forwardRef(oR);en(Ll);w2();var iR={},sR=new Proxy(iR,{get(e,t){return t==="Bundling"||t==="Rendering"||t==="Log"||t==="Puppeteer"||t==="Output"?sR:()=>{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)}}});Ft.displayName="Sequence";en(Ft);g2(Ft);en(du);en(AC);typeof window<"u"&&(window.remotion_renderReady=!1,window.remotion_delayRenderTimeouts||(window.remotion_delayRenderTimeouts={}),window.remotion_delayRenderHandles=[]);var aR={"style.transformOrigin":{type:"transform-origin",step:1,default:"50% 50%",description:"Transform origin"},"style.translate":{type:"translate",step:1,default:"0px 0px",description:"Offset"},"style.scale":{type:"scale",max:100,step:.01,default:1,description:"Scale",defaultKeyframeOutput:"perceptual-scale"},"style.rotate":{type:"rotation-css",step:1,default:"0deg",description:"Rotation"},"style.opacity":{type:"number",min:0,max:1,step:.01,default:1,description:"Opacity",hiddenFromList:!1}},lR={"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"}},uR={"style.backgroundColor":{type:"color",default:"transparent",description:"Color"}},cR={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}},dR={...cR},fR={...aR,...uR,...lR,...dR},pR={layout:{type:"enum",default:"absolute-fill",description:"Layout",variants:{"absolute-fill":fR,none:{}}}};({...pR.layout});var hR=(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 mR(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 gR(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 yR(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 fc={validateFps:yR,validateDimension:mR,validateDurationInFrames:gR,validateDefaultAndInputProps:hR};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 Mt=25,Gf=16,vR=()=>u.jsx("svg",{width:Mt,height:Mt,viewBox:"0 0 25 25",fill:"none",children:u.jsx("path",{d:"M8 6.375C7.40904 8.17576 7.06921 10.2486 7.01438 12.3871C6.95955 14.5255 7.19163 16.6547 7.6875 18.5625C9.95364 18.2995 12.116 17.6164 14.009 16.5655C15.902 15.5147 17.4755 14.124 18.6088 12.5C17.5158 10.8949 15.9949 9.51103 14.1585 8.45082C12.3222 7.3906 10.2174 6.68116 8 6.375Z",fill:"white",stroke:"white",strokeWidth:"6.25",strokeLinejoin:"round"})}),wR=()=>u.jsxs("svg",{viewBox:"0 0 100 100",width:Mt,height:Mt,children:[u.jsx("rect",{x:"25",y:"20",width:"20",height:"60",fill:"#fff",ry:"5",rx:"5"}),u.jsx("rect",{x:"55",y:"20",width:"20",height:"60",fill:"#fff",ry:"5",rx:"5"})]}),xR=({isFullscreen:e})=>{const r=e?0:3,o=e?6*1.6:6/2,i=e?6*1.6:6*2;return u.jsxs("svg",{viewBox:"0 0 32 32",height:Gf,width:Gf,children:[u.jsx("path",{d:`
81
+ M ${r} ${i}
82
+ L ${o} ${o}
83
+ L ${i} ${r}
84
+ `,stroke:"#fff",strokeWidth:6,fill:"none"}),u.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"}),u.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"}),u.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"})]})},bR=()=>u.jsx("svg",{width:Mt,height:Mt,viewBox:"0 0 24 24",children:u.jsx("path",{d:"M3.63 3.63a.996.996 0 000 1.41L7.29 8.7 7 9H4c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1h3l3.29 3.29c.63.63 1.71.18 1.71-.71v-4.17l4.18 4.18c-.49.37-1.02.68-1.6.91-.36.15-.58.53-.58.92 0 .72.73 1.18 1.39.91.8-.33 1.55-.77 2.22-1.31l1.34 1.34a.996.996 0 101.41-1.41L5.05 3.63c-.39-.39-1.02-.39-1.42 0zM19 12c0 .82-.15 1.61-.41 2.34l1.53 1.53c.56-1.17.88-2.48.88-3.87 0-3.83-2.4-7.11-5.78-8.4-.59-.23-1.22.23-1.22.86v.19c0 .38.25.71.61.85C17.18 6.54 19 9.06 19 12zm-8.71-6.29l-.17.17L12 7.76V6.41c0-.89-1.08-1.33-1.71-.7zM16.5 12A4.5 4.5 0 0014 7.97v1.79l2.48 2.48c.01-.08.02-.16.02-.24z",fill:"#fff"})}),SR=()=>u.jsx("svg",{width:Mt,height:Mt,viewBox:"0 0 24 24",children:u.jsx("path",{d:"M3 10v4c0 .55.45 1 1 1h3l3.29 3.29c.63.63 1.71.18 1.71-.71V6.41c0-.89-1.08-1.34-1.71-.71L7 9H4c-.55 0-1 .45-1 1zm13.5 2A4.5 4.5 0 0014 7.97v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 4.45v.2c0 .38.25.71.6.85C17.18 6.53 19 9.06 19 12s-1.82 5.47-4.4 6.5c-.36.14-.6.47-.6.85v.2c0 .63.63 1.07 1.21.85C18.6 19.11 21 15.84 21 12s-2.4-7.11-5.79-8.4c-.58-.23-1.21.22-1.21.85z",fill:"#fff"})}),ey="__remotion_buffering_indicator",ty="__remotion_buffering_animation",kR={width:Mt,height:Mt,overflow:"hidden",lineHeight:"normal",fontSize:"inherit"},ER={width:14,height:14,overflow:"hidden",lineHeight:"normal",fontSize:"inherit"},CR=({type:e})=>{const t=e==="player"?kR:ER;return u.jsxs(u.Fragment,{children:[u.jsx("style",{type:"text/css",children:`
97
+ @keyframes ${ty} {
98
+ 0% {
99
+ rotate: 0deg;
100
+ }
101
+ 100% {
102
+ rotate: 360deg;
103
+ }
104
+ }
105
+
106
+ .${ey} {
107
+ animation: ${ty} 1s linear infinite;
108
+ }
109
+ `}),u.jsx("div",{style:t,children:u.jsx("svg",{viewBox:e==="player"?"0 0 22 22":"0 0 18 18",style:t,className:ey,children:u.jsx("path",{d:e==="player"?"M 11 4 A 7 7 0 0 1 15.1145 16.66312":"M 9 2 A 7 7 0 0 1 13.1145 14.66312",stroke:"white",strokeLinecap:"round",fill:"none",strokeWidth:3})})})]})},IR=({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},hb=({previewSize:e,compositionWidth:t,compositionHeight:n,canvasSize:r})=>{const o=we.calculateScale({canvasSize:r,compositionHeight:n,compositionWidth:t,previewSize:e}),i=0-(1-o)/2,s=i*t,a=i*n,l=t*o,c=n*o,f=r.width/2-l/2,p=r.height/2-c/2;return{centerX:f,centerY:p,xCorrection:s,yCorrection:a,scale:o}},mb=({config:e,style:t,canvasSize:n,overflowVisible:r,layout:o})=>e?{position:"relative",overflow:r?"visible":"hidden",...IR({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}:{},gb=({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"}:{},yb=({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"}},vb=he.createContext(void 0),wb=he.createContext(void 0);class TR{constructor(){Oe(this,"listeners",{ended:[],error:[],pause:[],play:[],ratechange:[],scalechange:[],seeked:[],timeupdate:[],frameupdate:[],fullscreenchange:[],volumechange:[],mutechange:[],waiting:[],resume:[]});Oe(this,"dispatchSeek",t=>{this.dispatchEvent("seeked",{frame:t})});Oe(this,"dispatchVolumeChange",t=>{this.dispatchEvent("volumechange",{volume:t})});Oe(this,"dispatchPause",()=>{this.dispatchEvent("pause",void 0)});Oe(this,"dispatchPlay",()=>{this.dispatchEvent("play",void 0)});Oe(this,"dispatchEnded",()=>{this.dispatchEvent("ended",void 0)});Oe(this,"dispatchRateChange",t=>{this.dispatchEvent("ratechange",{playbackRate:t})});Oe(this,"dispatchScaleChange",t=>{this.dispatchEvent("scalechange",{scale:t})});Oe(this,"dispatchError",t=>{this.dispatchEvent("error",{error:t})});Oe(this,"dispatchTimeUpdate",t=>{this.dispatchEvent("timeupdate",t)});Oe(this,"dispatchFrameUpdate",t=>{this.dispatchEvent("frameupdate",t)});Oe(this,"dispatchFullscreenChange",t=>{this.dispatchEvent("fullscreenchange",t)});Oe(this,"dispatchMuteChange",t=>{this.dispatchEvent("mutechange",t)});Oe(this,"dispatchWaiting",t=>{this.dispatchEvent("waiting",t)});Oe(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 jR{constructor(){Oe(this,"listeners",{error:[],waiting:[],resume:[]});Oe(this,"dispatchError",t=>{this.dispatchEvent("error",{error:t})});Oe(this,"dispatchWaiting",t=>{this.dispatchEvent("waiting",t)});Oe(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 xb=e=>{const t=d.useContext(we.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])},RR=({children:e,currentPlaybackRate:t})=>{const[n]=d.useState(()=>new TR);if(!d.useContext(we.BufferingContextReact))throw new Error("BufferingContextReact not found");return d.useEffect(()=>{t&&n.dispatchRateChange(t)},[n,t]),xb(n),u.jsx(vb.Provider,{value:n,children:e})},Rh=(e,t)=>{const[n,r]=d.useState(!1);return d.useEffect(()=>{const{current:o}=e;if(!o)return;let i;const s=()=>{t&&(clearTimeout(i),i=setTimeout(()=>{r(!1)},t===!0?3e3:t))},a=()=>{r(!0),s()},l=()=>{r(!1),clearTimeout(i)},c=()=>{r(!0),s()};return o.addEventListener("mouseenter",a),o.addEventListener("mouseleave",l),o.addEventListener("mousemove",c),()=>{o.removeEventListener("mouseenter",a),o.removeEventListener("mouseleave",l),o.removeEventListener("mousemove",c),clearTimeout(i)}},[t,e]),n},pc=()=>{const[e,t,n]=we.Timeline.usePlayingState(),[r,o]=d.useState(!1),i=we.Timeline.useTimelinePosition(),s=d.useRef(i),a=we.Timeline.useTimelineSetFrame(),l=we.Timeline.useTimelineSetFrame(),c=d.useContext(we.SharedAudioContext),f=d.useContext(we.SharedAudioTagsContext),{audioAndVideoTags:p}=we.useTimelineContext(),m=d.useRef(i);m.current=i;const y=we.useVideo(),w=we.useUnsafeVideoConfig(),x=d.useContext(vb),S=((w==null?void 0:w.durationInFrames)??1)-1,h=i===S,g=i===0;if(!x)throw new TypeError("Expected Player event emitter context");const v=d.useContext(we.BufferingContextReact);if(!v)throw new Error("Missing the buffering context. Most likely you have a Remotion version mismatch.");const{buffering:b}=v,k=d.useCallback(P=>{const T=w?we.TimelinePosition.clampFrameToCompositionRange(P,w.durationInFrames):Math.max(0,P);y!=null&&y.id&&l(W=>({...W,[y.id]:T})),m.current=T,x.dispatchSeek(T)},[w,x,l,y==null?void 0:y.id]),E=d.useCallback(P=>{n.current||(o(!0),h&&k(0),c==null||c.resume(),f&&f.numberOfAudioTags>0&&P&&f.playAllAudios(),p.current.forEach(T=>T.play("player play() was called and playing audio from a click")),n.current=!0,t(!0),s.current=m.current,x.dispatchPlay())},[n,h,c,f,t,x,k,p]),C=d.useCallback(()=>{n.current&&(n.current=!1,t(!1),x.dispatchPause(),c==null||c.suspend())},[x,n,t,c]),I=d.useCallback(()=>{n.current&&(n.current=!1,m.current=s.current,w&&(l(P=>({...P,[w.id]:s.current})),t(!1),x.dispatchPause()))},[w,x,n,t,l]),j=y==null?void 0:y.id,F=d.useCallback(P=>{if(!j)return null;n.current||a(T=>{const W=T[j]??window.remotion_initialFrame??0,R=Math.max(0,W-P);return W===R?T:{...T,[j]:R}})},[n,a,j]),L=d.useCallback(P=>{if(!j)return null;n.current||a(T=>{const W=T[j]??window.remotion_initialFrame??0,R=Math.min(S,W+P);return W===R?T:{...T,[j]:R}})},[j,n,S,a]),V=d.useCallback(P=>{n.current?C():E(P)},[n,C,E]),M=d.useCallback(()=>n.current,[n]),$=d.useCallback(()=>m.current,[m]),D=d.useCallback(()=>b.current,[b]);return d.useMemo(()=>({frameBack:F,frameForward:L,isLastFrame:h,emitter:x,playing:e,play:E,pause:C,seek:k,isFirstFrame:g,getCurrentFrame:$,isPlaying:M,isBuffering:D,pauseAndReturnToPlayStart:I,hasPlayed:r,toggle:V}),[x,F,L,r,g,h,$,C,I,E,e,k,V,M,D])},PR=({browserMediaControlsBehavior:e,videoConfig:t,playbackRate:n})=>{const{playing:r,pause:o,play:i,emitter:s,getCurrentFrame:a,seek:l}=pc(),c=d.useRef(!1);d.useEffect(()=>{r&&(c.current=!0)},[r]),d.useEffect(()=>{navigator.mediaSession&&e.mode!=="do-nothing"&&(r?navigator.mediaSession.playbackState="playing":c.current&&(navigator.mediaSession.playbackState="paused"))},[e.mode,r]),d.useEffect(()=>{if(!navigator.mediaSession||e.mode==="do-nothing")return;const f=()=>{t&&navigator.mediaSession&&navigator.mediaSession.setPositionState({duration:t.durationInFrames/t.fps,playbackRate:n,position:a()/t.fps})};return s.addEventListener("timeupdate",f),()=>{s.removeEventListener("timeupdate",f)}},[e.mode,s,a,n,t]),d.useEffect(()=>{if(navigator.mediaSession&&e.mode!=="do-nothing")return navigator.mediaSession.setActionHandler("play",()=>{e.mode==="register-media-session"&&i()}),navigator.mediaSession.setActionHandler("pause",()=>{e.mode==="register-media-session"&&o()}),navigator.mediaSession.setActionHandler("seekto",f=>{e.mode==="register-media-session"&&f.seekTime!==void 0&&t&&l(Math.round(f.seekTime*t.fps))}),navigator.mediaSession.setActionHandler("seekbackward",()=>{e.mode==="register-media-session"&&t&&l(Math.max(0,Math.round((a()-10)*t.fps)))}),navigator.mediaSession.setActionHandler("seekforward",()=>{e.mode==="register-media-session"&&t&&l(Math.max(t.durationInFrames-1,Math.round((a()+10)*t.fps)))}),navigator.mediaSession.setActionHandler("previoustrack",()=>{e.mode==="register-media-session"&&l(0)}),()=>{navigator.mediaSession.metadata=null,navigator.mediaSession.setActionHandler("play",null),navigator.mediaSession.setActionHandler("pause",null),navigator.mediaSession.setActionHandler("seekto",null),navigator.mediaSession.setActionHandler("seekbackward",null),navigator.mediaSession.setActionHandler("seekforward",null),navigator.mediaSession.setActionHandler("previoustrack",null)}},[e.mode,a,o,i,l,t])},FR=({time:e,currentFrame:t,playbackSpeed:n,fps:r,actualLastFrame:o,actualFirstFrame:i,framesAdvanced:s,shouldLoop:a})=>{const c=(n<0?Math.ceil:Math.floor)(e*n/(1e3/r))-s,f=c+t,p=t>o||t<i,m=f>o||f<i,y=!a&&m&&!p;return n>0?m?{nextFrame:i,framesToAdvance:c,hasEnded:y}:{nextFrame:f,framesToAdvance:c,hasEnded:y}:m?{nextFrame:o,framesToAdvance:c,hasEnded:y}:{nextFrame:f,framesToAdvance:c,hasEnded:y}},ny=()=>typeof document>"u"?!1:document.visibilityState==="hidden",$R=()=>{const e=d.useRef(ny());return d.useEffect(()=>{const t=()=>{e.current=ny()};return document.addEventListener("visibilitychange",t),()=>{document.removeEventListener("visibilitychange",t)}},[]),e},_R=.1,ry=({audioContext:e,audioSyncAnchor:t,absoluteTimeInSeconds:n,globalPlaybackRate:r,logLevel:o,force:i})=>{const s=e.currentTime-n/r,a=s-t.value,{outputLatency:l}=e,c=l===0?.3:l,f=e.baseLatency+c;return Math.abs(a)<_R+f&&!i||Math.abs(a)<Number.EPSILON?!1:(we.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)},MR=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}`)},AR=({loop:e,playbackRate:t,moveToBeginningWhenEnded:n,inFrame:r,outFrame:o,browserMediaControlsBehavior:i,getCurrentFrame:s,muted:a})=>{const l=we.useUnsafeVideoConfig(),c=we.Timeline.useTimelinePosition(),{playing:f,pause:p,emitter:m,isPlaying:y}=pc(),w=we.Timeline.useTimelineSetFrame(),x=d.useContext(we.SharedAudioContext),S=we.useLogLevel(),h=$R(),g=d.useRef(0),v=d.useContext(we.BufferingContextReact);if(!v)throw new Error("Missing the buffering context. Most likely you have a Remotion version mismatch.");PR({browserMediaControlsBehavior:i,playbackRate:t,videoConfig:l}),d.useLayoutEffect(()=>{if(!x||!x.audioContext||!l||a)return;ry({audioContext:x.audioContext,audioSyncAnchor:x.audioSyncAnchor,absoluteTimeInSeconds:c/l.fps,globalPlaybackRate:t,logLevel:S,force:!1})&&x.audioSyncAnchorEmitter.dispatch("changed")},[l,c,S,t,x,a]),d.useLayoutEffect(()=>{const b=x==null?void 0:x.audioContext;if(!b||!l||a)return;const k=()=>{const E=x==null?void 0:x.getAudioContextState();E&&MR(E)&&ry({audioContext:b,audioSyncAnchor:x.audioSyncAnchor,absoluteTimeInSeconds:s()/l.fps,globalPlaybackRate:t,logLevel:S,force:!0})};return b==null||b.addEventListener("statechange",k),()=>{b==null||b.removeEventListener("statechange",k)}},[l,s,S,a,t,x]),d.useEffect(()=>{var M;if(!l)return;if(!f){(M=x==null?void 0:x.suspend)==null||M.call(x);return}let b=!1,k=null,E=performance.now(),C=0;const I=()=>{k!==null&&(k.type==="raf"?cancelAnimationFrame(k.id):clearTimeout(k.id))},j=()=>{b=!0,I()},F=()=>{var Z,Q;if(b)return;if(!y()){(Z=x==null?void 0:x.suspend)==null||Z.call(x);return}!a&&!v.buffering.current&&((Q=x==null?void 0:x.resume)==null||Q.call(x));const $=performance.now()-E,D=o??l.durationInFrames-1,H=r??0,P=s(),{nextFrame:T,framesToAdvance:W,hasEnded:R}=FR({time:$,currentFrame:P,playbackSpeed:t,fps:l.fps,actualFirstFrame:H,actualLastFrame:D,framesAdvanced:C,shouldLoop:e});if(C+=W,T!==s()&&(!R||n)&&!v.buffering.current&&w(_=>({..._,[l.id]:T})),R){j(),p(),m.dispatchEnded();return}L()},L=()=>{var D,H;const $=((D=x==null?void 0:x.getIsResumingAudioContext)==null?void 0:D.call(x))??null;if($!==null&&!a){$.then(()=>{E=performance.now(),C=0,L()});return}if(v.buffering.current){a||(H=x==null?void 0:x.suspend)==null||H.call(x);const P=v.listenForResume(()=>{P.remove(),E=performance.now(),C=0,L()});return}if(h.current){k={type:"timeout",id:setTimeout(F,1e3/l.fps)};return}k={type:"raf",id:requestAnimationFrame(F)}};L();const V=()=>{document.visibilityState!=="visible"&&(I(),F())};return window.addEventListener("visibilitychange",V),()=>{window.removeEventListener("visibilitychange",V),j()}},[l,e,p,f,w,m,t,r,o,n,h,s,v,y,x,S,a]),d.useEffect(()=>{const b=performance.now(),k=b-g.current;if(k>=250){m.dispatchTimeUpdate({frame:c}),g.current=b;return}const E=setTimeout(()=>{m.dispatchTimeUpdate({frame:c}),g.current=performance.now()},250-k);return()=>clearTimeout(E)},[m,c]),d.useEffect(()=>{m.dispatchFrameUpdate({frame:c})},[m,c])},md=[],gd=e=>e?"current"in e?e.current:e:null,Ph=(e,t)=>{const[n,r]=d.useState(()=>{const s=gd(e);if(!s)return null;const a=s.getClientRects();return a[0]?{width:a[0].width,height:a[0].height,left:a[0].x,top:a[0].y,windowSize:{height:window.innerHeight,width:window.innerWidth}}:null}),o=d.useMemo(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(s=>{const{contentRect:a,target:l}=s[0],c=l.getClientRects();if(!(c!=null&&c[0])){r(null);return}const f=a.width===0?1:c[0].width/a.width,p=a.height===0?1:c[0].height/a.height,m=t.shouldApplyCssTransforms||f===0?c[0].width:c[0].width*(1/f),y=t.shouldApplyCssTransforms||p===0?c[0].height:c[0].height*(1/p);r(w=>w&&w.width===m&&w.height===y&&w.left===c[0].x&&w.top===c[0].y&&w.windowSize.height===window.innerHeight&&w.windowSize.width===window.innerWidth?w:{width:m,height:y,left:c[0].x,top:c[0].y,windowSize:{height:window.innerHeight,width:window.innerWidth}})}),[t.shouldApplyCssTransforms]),i=d.useCallback(()=>{const s=gd(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=gd(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(()=>(md.push(i),()=>{md=md.filter(s=>s!==i)}),[i]),d.useMemo(()=>n?{...n,refresh:i}:null,[n,i])},Fh=e=>e??"__remotion-player",NR={display:"flex",justifyContent:"center",alignItems:"center",flex:1,height:"100%",width:"100%"};class bb extends he.Component{constructor(){super(...arguments);Oe(this,"state",{hasError:null})}static getDerivedStateFromError(n){return{hasError:n}}componentDidCatch(n){this.props.onError(n)}render(){return this.state.hasError?u.jsx("div",{style:NR,children:this.props.errorFallback({error:this.state.hasError})}):this.props.children}}var LR=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}},yd={backgroundColor:"red",position:"absolute",padding:12,fontFamily:"Arial"},OR=["28d262b44cc61fa750f1686b16ad0604dabfe193fbc263eec05c89b7ad4c2cd6","4db1b0a94be33165dfefcb3ba03d04c7a2666dd27c496d3dc9fa41858e94925e","fbc48530bbf245da790f63675e84e06bab38c3b114fab07eb350025119922bdc","7baf10a8932757b1b3a22b3fce10a048747ac2f8eaf638603487e3705b07eb83","8a6c21a598d8c667272b5207c051b85997bf5b45d5fb712378be3f27cd72c6a6","a2f7aaac9c50a9255e7fc376110c4e0bfe153722dc66ed3c5d3bf2a135f65518"],oy=!1,DR=()=>{const[e,t]=he.useState(!1);return d.useEffect(()=>{oy||(oy=!0,LR().then(n=>{n&&OR.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,yd,{zIndex:"9999",cssText:`${yd.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?u.jsx("div",{style:yd,className:"warning-banner",children:u.jsx("a",{style:{color:"white"},href:"https://github.com/remotion-dev/remotion/pull/4589",children:"Remotion Unlicensed – Contact hi@remotion.dev"})}):null},iy=({playing:e,buffering:t})=>e&&t?u.jsx(CR,{type:"player"}):e?u.jsx(wR,{}):u.jsx(vR,{}),ti=12,sy=5,zR=({volume:e,isVertical:t,onBlur:n,inputRef:r,setVolume:o})=>{const i=d.useMemo(()=>{const m={paddingLeft:5,height:Mt,width:To,display:"inline-flex",alignItems:"center"};return t?{...m,position:"absolute",transform:`rotate(-90deg) translateX(${To/2+Mt/2}px)`}:{...m}},[t]),s=typeof he.useId>"u"?"volume-slider":he.useId(),[a]=d.useState(()=>`__remotion-volume-slider-${Ho(s)}`.replace(".","")),l=d.useCallback(p=>{o(parseFloat(p.target.value))},[o]),c=d.useMemo(()=>{const p={WebkitAppearance:"none",backgroundColor:"rgba(255, 255, 255, 0.5)",borderRadius:sy/2,cursor:"pointer",height:sy,width:To,backgroundImage:`linear-gradient(
114
+ to right,
115
+ white ${e*100}%, rgba(255, 255, 255, 0) ${e*100}%
116
+ )`};return t?{...p,bottom:Mt+To/2}:p},[t,e]),f=`
117
+ .${a}::-webkit-slider-thumb {
118
+ -webkit-appearance: none;
119
+ background-color: white;
120
+ border-radius: ${ti/2}px;
121
+ box-shadow: 0 0 2px black;
122
+ height: ${ti}px;
123
+ width: ${ti}px;
124
+ }
125
+
126
+ .${a}::-moz-range-thumb {
127
+ -webkit-appearance: none;
128
+ background-color: white;
129
+ border-radius: ${ti/2}px;
130
+ box-shadow: 0 0 2px black;
131
+ height: ${ti}px;
132
+ width: ${ti}px;
133
+ }
134
+ `;return u.jsxs("div",{style:i,children:[u.jsx("style",{dangerouslySetInnerHTML:{__html:f}}),u.jsx("input",{ref:r,"aria-label":"Change volume",className:a,max:1,min:0,onBlur:n,onChange:l,step:.01,type:"range",value:e,style:c})]})},BR=e=>u.jsx(zR,{...e}),To=100,WR=({displayVerticalVolumeSlider:e,renderMuteButton:t,renderVolumeSlider:n})=>{const[r,o]=we.usePlayerMutedState(),[i,s]=we.useMediaVolumeState(),[a,l]=d.useState(!1),c=d.useRef(null),f=d.useRef(null),p=Rh(c,!1),m=d.useCallback(()=>{setTimeout(()=>{f.current&&document.activeElement!==f.current&&l(!1)},10)},[]),y=i===0,w=d.useCallback(()=>{if(y){s(1),o(!1);return}o(b=>!b)},[y,o,s]),x=d.useMemo(()=>({display:"inline-flex",background:"none",border:"none",justifyContent:"center",alignItems:"center",touchAction:"none",...e&&{position:"relative"}}),[e]),S=d.useMemo(()=>({display:"inline",width:Mt,height:Mt,cursor:"pointer",appearance:"none",background:"none",border:"none",padding:0}),[]),h=d.useCallback(({muted:b,volume:k})=>{const E=b||k===0;return u.jsx("button",{"aria-label":E?"Unmute sound":"Mute sound",title:E?"Unmute sound":"Mute sound",onClick:w,onBlur:m,onFocus:()=>l(!0),style:S,type:"button",children:E?u.jsx(bR,{}):u.jsx(SR,{})})},[m,w,S]),g=d.useMemo(()=>t?t({muted:r,volume:i}):h({muted:r,volume:i}),[r,i,h,t]),v=d.useMemo(()=>(a||p)&&!r&&!we.isIosSafari()?(n??BR)({isVertical:e,volume:i,onBlur:()=>l(!1),inputRef:f,setVolume:s}):null,[e,a,p,r,i,n,s]);return u.jsxs("div",{ref:c,style:x,children:[g,v]})};function VR(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 HR=35,UR=70,ZR={height:30,paddingRight:15,paddingLeft:12,display:"flex",flexDirection:"row",alignItems:"center"},KR={width:22,display:"flex",alignItems:"center"},YR={width:14,height:14,color:"black"},GR=()=>u.jsx("svg",{viewBox:"0 0 512 512",style:YR,children:u.jsx("path",{fill:"currentColor",d:"M435.848 83.466L172.804 346.51l-96.652-96.652c-4.686-4.686-12.284-4.686-16.971 0l-28.284 28.284c-4.686 4.686-4.686 12.284 0 16.971l133.421 133.421c4.686 4.686 12.284 4.686 16.971 0l299.813-299.813c4.686-4.686 4.686-12.284 0-16.971l-28.284-28.284c-4.686-4.686-12.284-4.686-16.97 0z"})}),XR=e=>{const t=e.toString();return t.includes(".")?t:t+".0"},qR=({rate:e,onSelect:t,selectedRate:n,keyboardSelectedRate:r})=>{const o=d.useCallback(p=>{p.stopPropagation(),p.preventDefault(),t(e)},[t,e]),[i,s]=d.useState(!1),a=d.useCallback(()=>{s(!0)},[]),l=d.useCallback(()=>{s(!1)},[]),c=r===e,f=d.useMemo(()=>({...ZR,backgroundColor:i||c?"#eee":"transparent"}),[i,c]);return u.jsxs("div",{onPointerEnter:a,onPointerLeave:l,tabIndex:0,style:f,onClick:o,children:[u.jsx("div",{style:KR,children:e===n?u.jsx(GR,{}):null}),XR(e),"x"]},e)},JR=({setIsComponentVisible:e,playbackRates:t,canvasSize:n})=>{const{setPlaybackRate:r,playbackRate:o}=we.usePlaybackRate(),[i,s]=d.useState(o);d.useEffect(()=>{const c=f=>{if(f.preventDefault(),f.key==="ArrowUp"){const p=t.findIndex(m=>m===i);if(p===0)return;s(p===-1?t[0]:t[p-1])}else if(f.key==="ArrowDown"){const p=t.findIndex(m=>m===i);if(p===t.length-1)return;s(p===-1?t[t.length-1]:t[p+1])}else f.key==="Enter"&&(r(i),e(!1))};return window.addEventListener("keydown",c),()=>{window.removeEventListener("keydown",c)}},[t,i,r,e]);const a=d.useCallback(c=>{r(c),e(!1)},[e,r]),l=d.useMemo(()=>({position:"absolute",right:0,width:125,maxHeight:n.height-UR-HR,bottom:35,background:"#fff",borderRadius:4,overflow:"auto",color:"black",textAlign:"left"}),[n.height]);return u.jsx("div",{style:l,children:t.map(c=>u.jsx(qR,{selectedRate:o,onSelect:a,rate:c,keyboardSelectedRate:i},c))})},QR={fontSize:13,fontWeight:"bold",color:"white",border:"2px solid white",borderRadius:20,paddingLeft:8,paddingRight:8,paddingTop:2,paddingBottom:2},Xf={appearance:"none",backgroundColor:"transparent",border:"none",cursor:"pointer",paddingLeft:0,paddingRight:0,paddingTop:6,paddingBottom:6,height:37,display:"inline-flex",marginBottom:0,marginTop:0,alignItems:"center"},eP={...Xf,position:"relative"},tP=({playbackRates:e,canvasSize:t})=>{const{ref:n,isComponentVisible:r,setIsComponentVisible:o}=VR(!1),{playbackRate:i}=we.usePlaybackRate(),s=d.useCallback(a=>{a.stopPropagation(),a.preventDefault(),o(l=>!l)},[o]);return u.jsx("div",{ref:n,children:u.jsxs("button",{type:"button","aria-label":"Change playback rate",style:eP,onClick:s,children:[u.jsxs("div",{style:QR,children:[i,"x"]}),r&&u.jsx(JR,{canvasSize:t,playbackRates:e,setIsComponentVisible:o})]})})},ay=(e,t,n)=>Math.round(Qi(e,[0,n],[0,t-1],{extrapolateLeft:"clamp",extrapolateRight:"clamp"})),ki=5,bs=12,qf=4,nP={userSelect:"none",WebkitUserSelect:"none",paddingTop:qf,paddingBottom:qf,boxSizing:"border-box",cursor:"pointer",position:"relative",touchAction:"none"},rP={height:ki,backgroundColor:"rgba(255, 255, 255, 0.25)",width:"100%",borderRadius:ki/2},oP=e=>{let t=e;for(;t.parentElement;)t=t.parentElement;return t},iP=({durationInFrames:e,onSeekEnd:t,onSeekStart:n,inFrame:r,outFrame:o})=>{const i=d.useRef(null),s=Rh(i,!1),a=Ph(i,{triggerOnWindowResize:!0,shouldApplyCssTransforms:!0}),{seek:l,play:c,pause:f,playing:p}=pc(),m=we.Timeline.useTimelinePosition(),[y,w]=d.useState({dragging:!1}),x=(a==null?void 0:a.width)??0,S=d.useCallback(E=>{var j;if(E.button!==0)return;const C=(j=i.current)==null?void 0:j.getBoundingClientRect().left,I=ay(E.clientX-C,e,x);f(),l(I),w({dragging:!0,wasPlaying:p}),n()},[e,x,f,l,p,n]),h=d.useCallback(E=>{var j;if(!a)throw new Error("Player has no size");if(!y.dragging)return;const C=(j=i.current)==null?void 0:j.getBoundingClientRect().left,I=ay(E.clientX-C,e,a.width);l(I)},[y.dragging,e,l,a]),g=d.useCallback(()=>{w({dragging:!1}),y.dragging&&(y.wasPlaying?c():f(),t())},[y,t,f,c]);d.useEffect(()=>{if(!y.dragging)return;const E=oP(i.current);return E.addEventListener("pointermove",h),E.addEventListener("pointerup",g),()=>{E.removeEventListener("pointermove",h),E.removeEventListener("pointerup",g)}},[y.dragging,h,g]);const v=d.useMemo(()=>({height:bs,width:bs,borderRadius:bs/2,position:"absolute",top:qf-bs/2+5/2,backgroundColor:"white",left:Math.max(0,m/Math.max(1,e-1)*x-bs/2),boxShadow:"0 0 2px black",opacity:Number(s||y.dragging)}),[s,y.dragging,e,m,x]),b=d.useMemo(()=>({height:ki,backgroundColor:"rgba(255, 255, 255, 1)",width:(m-(r??0))/(e-1)*x,marginLeft:(r??0)/(e-1)*x,borderRadius:ki/2}),[e,m,r,x]),k=d.useMemo(()=>({height:ki,backgroundColor:"rgba(255, 255, 255, 0.25)",width:((o??e-1)-(r??0))/(e-1)*100+"%",marginLeft:(r??0)/(e-1)*100+"%",borderRadius:ki/2,position:"absolute"}),[e,r,o]);return u.jsxs("div",{ref:i,onPointerDown:S,style:nP,children:[u.jsxs("div",{style:rP,children:[u.jsx("div",{style:k}),u.jsx("div",{style:b})]}),u.jsx("div",{style:v})]})},ly=e=>{const t=Math.floor(e/60),n=Math.floor(e-t*60);return`${String(t)}:${String(n).padStart(2,"0")}`},sP=({durationInFrames:e,maxTimeLabelWidth:t,fps:n})=>{const r=we.Timeline.useTimelinePosition(),o=d.useMemo(()=>({color:"white",fontFamily:"sans-serif",fontSize:14,maxWidth:t===null?void 0:t,overflow:"hidden",textOverflow:"ellipsis"}),[t]),s=r===e-1?r+1:r;return u.jsxs("div",{style:o,children:[ly(s/n)," / ",ly(e/n)]})},aP=10,Jf=12,lP=({allowFullscreen:e,playerWidth:t})=>d.useMemo(()=>{const r=Mt,o=Mt,i=e?Gf:0,s=o+r+i+Jf*2+aP*2,a=t-s,l=Math.max(a,0),c=l-To,p=(c<To?l:c)+s+To,m=t<p;return{maxTimeLabelWidth:l===0?null:l,displayVerticalVolumeSlider:m}},[e,t]),uP=[0,.013,.049,.104,.175,.259,.352,.45,.55,.648,.741,.825,.896,.951,.987],cP=[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],dP=1/.7,fP={boxSizing:"border-box",position:"absolute",bottom:0,width:"100%",paddingTop:40,paddingBottom:10,backgroundImage:`linear-gradient(to bottom,${uP.map((e,t)=>`hsla(0, 0%, 0%, ${e}) ${cP[t]*dP}%`).join(", ")}, hsl(0, 0%, 0%) 100%)`,backgroundSize:"auto 145px",display:"flex",paddingRight:Jf,paddingLeft:Jf,flexDirection:"column",transition:"opacity 0.3s"},pP={display:"flex",flexDirection:"row",width:"100%",alignItems:"center",justifyContent:"center",userSelect:"none",WebkitUserSelect:"none"},hP={display:"flex",flexDirection:"row",userSelect:"none",WebkitUserSelect:"none",alignItems:"center"},Ss={width:12},mP={height:8},gP={flex:1},yP={},vP=({durationInFrames:e,isFullscreen:t,fps:n,showVolumeControls:r,onFullscreenButtonClick:o,allowFullscreen:i,onExitFullscreenButtonClick:s,spaceKeyToPlayOrPause:a,onSeekEnd:l,onSeekStart:c,inFrame:f,outFrame:p,initiallyShowControls:m,canvasSize:y,renderPlayPauseButton:w,renderFullscreenButton:x,alwaysShowControls:S,showPlaybackRateControl:h,containerRef:g,buffering:v,hideControlsWhenPointerDoesntMove:b,onPointerDown:k,onDoubleClick:E,renderMuteButton:C,renderVolumeSlider:I,playing:j,toggle:F,renderCustomControls:L})=>{const V=d.useRef(null),[M,$]=d.useState(!1),D=Rh(g,b),{maxTimeLabelWidth:H,displayVerticalVolumeSlider:P}=lP({allowFullscreen:i,playerWidth:(y==null?void 0:y.width)??0}),[T,W]=d.useState(()=>{if(typeof m=="boolean")return m;if(typeof m=="number"){if(m%1!==0)throw new Error("initiallyShowControls must be an integer or a boolean");if(Number.isNaN(m))throw new Error("initiallyShowControls must not be NaN");if(!Number.isFinite(m))throw new Error("initiallyShowControls must be finite");if(m<=0)throw new Error("initiallyShowControls must be a positive integer");return m}throw new TypeError("initiallyShowControls must be a number or a boolean")}),R=d.useMemo(()=>({...fP,opacity:Number(D||!j||T||S)}),[D,T,j,S]);d.useEffect(()=>{V.current&&a&&V.current.focus({preventScroll:!0})},[j,a]),d.useEffect(()=>{$((typeof document<"u"&&(document.fullscreenEnabled||document.webkitFullscreenEnabled))??!1)},[]),d.useEffect(()=>{if(T===!1)return;const U=setTimeout(()=>{W(!1)},T===!0?2e3:T);return()=>{clearInterval(U)}},[T]);const Z=d.useMemo(()=>{if(h===!0)return[.5,.8,1,1.2,1.5,1.8,2,2.5,3];if(Array.isArray(h)){for(const J of h){if(typeof J!="number")throw new Error("Every item in showPlaybackRateControl must be a number");if(J<=0)throw new Error("Every item in showPlaybackRateControl must be positive")}return h}return null},[h]),Q=L?L():null,_=d.useRef(null),N=d.useRef(null),z=d.useCallback(J=>{(J.target===_.current||J.target===N.current)&&(k==null||k(J))},[k]),ne=d.useCallback(J=>{(J.target===_.current||J.target===N.current)&&(E==null||E(J))},[E]);return u.jsxs("div",{ref:_,style:R,onPointerDown:z,onDoubleClick:ne,children:[u.jsxs("div",{ref:N,style:pP,children:[u.jsxs("div",{style:hP,children:[u.jsx("button",{ref:V,type:"button",style:Xf,onClick:F,"aria-label":j?"Pause video":"Play video",title:j?"Pause video":"Play video",children:w===null?u.jsx(iy,{buffering:v,playing:j}):w({playing:j,isBuffering:v})??u.jsx(iy,{buffering:v,playing:j})}),r?u.jsxs(u.Fragment,{children:[u.jsx("div",{style:Ss}),u.jsx(WR,{renderMuteButton:C,renderVolumeSlider:I,displayVerticalVolumeSlider:P})]}):null,u.jsx("div",{style:Ss}),u.jsx(sP,{durationInFrames:e,fps:n,maxTimeLabelWidth:H}),u.jsx("div",{style:Ss})]}),u.jsx("div",{style:gP}),Q,Q&&Z&&y?u.jsx("div",{style:Ss}):null,Z&&y&&u.jsx(tP,{canvasSize:y,playbackRates:Z}),Z&&M&&i?u.jsx("div",{style:Ss}):null,u.jsx("div",{style:yP,children:M&&i?u.jsx("button",{type:"button","aria-label":t?"Exit fullscreen":"Enter Fullscreen",title:t?"Exit fullscreen":"Enter Fullscreen",style:Xf,onClick:t?s:o,children:x===null?u.jsx(xR,{isFullscreen:t}):x({isFullscreen:t})}):null})]}),u.jsx("div",{style:mP}),u.jsx(iP,{onSeekEnd:l,onSeekStart:c,durationInFrames:e,inFrame:f,outFrame:p})]})},Sb=typeof document>"u",wP=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}}},xP=e=>new Promise(t=>setTimeout(t,e)),bP=()=>{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])},SP=(e,t,n)=>{const r=bP(),o=d.useCallback(async l=>{if(l instanceof PointerEvent?l.pointerType==="touch":l.nativeEvent.pointerType==="touch"){e(l);return}r.clearPendingPromises();const c=wP(xP(200));r.appendPendingPromise(c);try{await c.promise,r.removePendingPromise(c),e(l)}catch(f){const p=f;if(r.removePendingPromise(c),!p.isCanceled)throw p.error}},[r,e]),i=d.useCallback(()=>{document.addEventListener("pointerup",l=>{o(l)},{once:!0})},[o]),s=d.useCallback(()=>{r.clearPendingPromises(),t()},[r,t]);return d.useMemo(()=>n?{handlePointerDown:i,handleDoubleClick:s}:{handlePointerDown:e,handleDoubleClick:()=>{}},[n,s,i,e])},Qf=he.version.split(".")[0];if(Qf==="0")throw new Error(`Version ${Qf} of "react" is not supported by Remotion`);var kP=parseInt(Qf,10)>=18,EP=({controls:e,style:t,loop:n,autoPlay:r,allowFullscreen:o,inputProps:i,clickToPlay:s,showVolumeControls:a,doubleClickToFullscreen:l,spaceKeyToPlayOrPause:c,errorFallback:f,playbackRate:p,renderLoading:m,renderPoster:y,className:w,moveToBeginningWhenEnded:x,showPosterWhenUnplayed:S,showPosterWhenEnded:h,showPosterWhenPaused:g,showPosterWhenBuffering:v,showPosterWhenBufferingAndPaused:b,inFrame:k,outFrame:E,initiallyShowControls:C,renderFullscreen:I,renderPlayPauseButton:j,renderMuteButton:F,renderVolumeSlider:L,renderCustomControls:V,alwaysShowControls:M,showPlaybackRateControl:$,posterFillMode:D,bufferStateDelayInMilliseconds:H,hideControlsWhenPointerDoesntMove:P,overflowVisible:T,browserMediaControlsBehavior:W,overrideInternalClassName:R,noSuspense:Z},Q)=>{const _=we.useUnsafeVideoConfig(),N=we.useVideo(),z=d.useRef(null),ne=Ph(z,{triggerOnWindowResize:!1,shouldApplyCssTransforms:!1}),[J,U]=d.useState(!1),[G,K]=d.useState(r),[le,Y]=d.useState(()=>!1),[ie,ke]=d.useState(!1),O=d.useMemo(()=>typeof document>"u"?!1:!!(document.fullscreenEnabled||document.webkitFullscreenEnabled),[]),X=pc(),se=X.toggle,{playerMuted:oe,mediaVolume:de}=d.useContext(we.MediaVolumeContext);d.useEffect(()=>{X.emitter.dispatchVolumeChange(de)},[X.emitter,de]);const fe=oe||de===0;d.useEffect(()=>{X.emitter.dispatchMuteChange({isMuted:fe})},[X.emitter,fe]),AR({loop:n,playbackRate:p,moveToBeginningWhenEnded:x,inFrame:k,outFrame:E,getCurrentFrame:X.getCurrentFrame,browserMediaControlsBehavior:W,muted:fe}),d.useEffect(()=>{J&&!X.playing&&(U(!1),X.play())},[J,X]),d.useEffect(()=>{const{current:B}=z;if(!B)return;const te=()=>{const me=document.fullscreenElement===B||document.webkitFullscreenElement===B;Y(me)};return document.addEventListener("fullscreenchange",te),document.addEventListener("webkitfullscreenchange",te),()=>{document.removeEventListener("fullscreenchange",te),document.removeEventListener("webkitfullscreenchange",te)}},[]);const Ce=d.useCallback(B=>{se(B)},[se]),Te=d.useCallback(()=>{if(!o)throw new Error("allowFullscreen is false");if(!O)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,O]),Re=d.useCallback(()=>{document.webkitExitFullscreen?document.webkitExitFullscreen():document.exitFullscreen()},[]);d.useEffect(()=>{const{current:B}=z;if(!B)return;const te=()=>{const me=document.webkitFullscreenElement??document.fullscreenElement;me&&me===z.current?X.emitter.dispatchFullscreenChange({isFullscreen:!0}):X.emitter.dispatchFullscreenChange({isFullscreen:!1})};return B.addEventListener("webkitfullscreenchange",te),B.addEventListener("fullscreenchange",te),()=>{B.removeEventListener("webkitfullscreenchange",te),B.removeEventListener("fullscreenchange",te)}},[X.emitter]);const xe=(_==null?void 0:_.durationInFrames)??1,be=d.useMemo(()=>!_||!ne?null:hb({canvasSize:ne,compositionHeight:_.height,compositionWidth:_.width,previewSize:"auto"}),[ne,_]),pe=(be==null?void 0:be.scale)??1,Le=d.useRef(!1);d.useEffect(()=>{if(!Le.current){Le.current=!0;return}X.emitter.dispatchScaleChange(pe)},[X.emitter,pe]);const{setMediaVolume:Ie,setPlayerMuted:Ye}=d.useContext(we.SetMediaVolumeContext),[ze,dt]=d.useState(!1);d.useEffect(()=>{let B=null,te=!1;const me=()=>{te=!1,requestAnimationFrame(()=>{H===0?dt(!0):B=setTimeout(()=>{te||dt(!0)},H)})},ve=()=>{requestAnimationFrame(()=>{te=!0,dt(!1),B&&clearTimeout(B)})};return X.emitter.addEventListener("waiting",me),X.emitter.addEventListener("resume",ve),()=>{X.emitter.removeEventListener("waiting",me),X.emitter.removeEventListener("resume",ve),dt(!1),B&&clearTimeout(B),te=!0}},[H,X.emitter]),d.useImperativeHandle(Q,()=>{const B={play:X.play,pause:()=>{U(!1),X.pause()},toggle:Ce,getContainerNode:()=>z.current,getCurrentFrame:X.getCurrentFrame,isPlaying:X.isPlaying,seekTo:te=>{const me=xe-1,ve=Math.max(0,Math.min(me,te));X.isPlaying()&&(U(ve!==me||n),X.pause()),ve===me&&!n&&X.emitter.dispatchEnded(),X.seek(ve)},isFullscreen:()=>{const{current:te}=z;return te?document.fullscreenElement===te||document.webkitFullscreenElement===te:!1},requestFullscreen:Te,exitFullscreen:Re,getVolume:()=>oe?0:de,setVolume:te=>{if(typeof te!="number")throw new TypeError(`setVolume() takes a number, got value of type ${typeof te}`);if(isNaN(te))throw new TypeError("setVolume() got a number that is NaN. Volume must be between 0 and 1.");if(te<0||te>1)throw new TypeError(`setVolume() got a number that is out of range. Must be between 0 and 1, got ${te}`);Ie(te)},isMuted:()=>fe,mute:()=>{Ye(!0)},unmute:()=>{Ye(!1)},getScale:()=>pe,pauseAndReturnToPlayStart:()=>{X.pauseAndReturnToPlayStart()}};return Object.assign(X.emitter,B)},[xe,Re,n,oe,fe,de,X,Te,Ye,Ie,Ce,pe]);const Nt=N?N.component:null,kt=d.useMemo(()=>mb({canvasSize:ne,config:_,style:t,overflowVisible:T,layout:be}),[ne,_,be,T,t]),pr=d.useMemo(()=>yb({config:_,layout:be,scale:pe,overflowVisible:T}),[_,be,T,pe]),os=d.useMemo(()=>gb({config:_,layout:be,scale:pe,overflowVisible:T}),[_,be,T,pe]),mo=X.pause,Fr=X.emitter.dispatchError,qn=d.useCallback(B=>{mo(),Fr(B)},[Fr,mo]),Go=d.useCallback(B=>{B.stopPropagation(),Te()},[Te]),go=d.useCallback(B=>{B.stopPropagation(),Re()},[Re]),yo=d.useCallback(B=>{(B instanceof MouseEvent?B.button===2:B.nativeEvent.button)||Ce(B)},[Ce]),Xo=d.useCallback(()=>{ke(!0)},[]),Lt=d.useCallback(()=>{ke(!1)},[]),hr=d.useCallback(()=>{le?Re():Te()},[Re,le,Te]),{handlePointerDown:Kt,handleDoubleClick:Ot}=SP(yo,hr,l&&o&&O);d.useEffect(()=>{G&&(X.play(),K(!1))},[G,X]);const In=d.useMemo(()=>m?m({height:kt.height,width:kt.width,isBuffering:ze}):null,[kt.height,kt.width,m,ze]),at=d.useMemo(()=>({type:"scale",scale:pe}),[pe]);if(!_)return null;const Tn=y?y({height:D==="player-size"?kt.height:_.height,width:D==="player-size"?kt.width:_.width,isBuffering:ze}):null;if(Tn===void 0)throw new TypeError("renderPoster() must return a React element, but undefined was returned");const $r=Tn&&[g&&!X.isPlaying()&&!ie,h&&X.isLastFrame&&!X.isPlaying(),S&&!X.hasPlayed&&!X.isPlaying(),v&&ze&&X.isPlaying(),b&&ze&&!X.isPlaying()].some(Boolean),{left:Jn,top:vo,width:jn,height:qo,...tn}=pr,A=u.jsxs(u.Fragment,{children:[u.jsxs("div",{style:pr,onPointerDown:s?Kt:void 0,onDoubleClick:l?Ot:void 0,children:[u.jsxs("div",{style:os,className:Fh(R),children:[Nt?u.jsx(bb,{onError:qn,errorFallback:f,children:u.jsx(we.CurrentScaleContext.Provider,{value:at,children:u.jsx(Nt,{...(N==null?void 0:N.props)??{},...i??{}})})}):null,$r&&D==="composition-size"?u.jsx("div",{style:{...tn,width:_.width,height:_.height},onPointerDown:s?Kt:void 0,onDoubleClick:l?Ot:void 0,children:Tn}):null]}),u.jsx(DR,{})]}),$r&&D==="player-size"?u.jsx("div",{style:pr,onPointerDown:s?Kt:void 0,onDoubleClick:l?Ot:void 0,children:Tn}):null,e?u.jsx(vP,{fps:_.fps,playing:X.playing,toggle:X.toggle,durationInFrames:_.durationInFrames,containerRef:z,onFullscreenButtonClick:Go,isFullscreen:le,allowFullscreen:o,showVolumeControls:a,onExitFullscreenButtonClick:go,spaceKeyToPlayOrPause:c,onSeekEnd:Lt,onSeekStart:Xo,inFrame:k,outFrame:E,initiallyShowControls:C,canvasSize:ne,renderFullscreenButton:I,renderPlayPauseButton:j,alwaysShowControls:M,showPlaybackRateControl:$,buffering:ze,hideControlsWhenPointerDoesntMove:P,onDoubleClick:l?Ot:void 0,onPointerDown:s?Kt:void 0,renderMuteButton:F,renderVolumeSlider:L,renderCustomControls:V}):null]});return Z||Sb&&!kP?u.jsx("div",{ref:z,style:kt,className:w,children:A}):u.jsx("div",{ref:z,style:kt,className:w,children:u.jsx(d.Suspense,{fallback:In,children:A})})},CP=d.forwardRef(EP),kb="remotion.volumePreference",IP=(e,t,n)=>{if(!(typeof window>"u"))try{window.localStorage.setItem(n??kb,String(e))}catch(r){we.Log.error({logLevel:t,tag:null},"Could not persist volume",r)}},TP=e=>{if(typeof window>"u")return 1;try{const t=window.localStorage.getItem(e??kb);return t?Number(t):1}catch{return 1}},$h="player-comp",Eb=({children:e,timelineContext:t,playbackRateContext:n,fps:r,compositionHeight:o,compositionWidth:i,durationInFrames:s,component:a,numberOfSharedAudioTags:l,initiallyMuted:c,logLevel:f,audioLatencyHint:p,sampleRate:m,volumePersistenceKey:y,initialVolume:w,inputProps:x,audioEnabled:S})=>{const h=w===void 0,g=d.useMemo(()=>({compositions:[{component:a,durationInFrames:s,height:o,width:i,fps:r,id:$h,nonce:[[0,777]],folderName:null,parentFolderName:null,schema:null,calculateMetadata:null,stack:null}],folders:[],currentCompositionMetadata:{defaultCodec:null,defaultOutName:null,defaultPixelFormat:null,defaultProResProfile:null,defaultSampleRate:null,defaultVideoImageFormat:null,durationInFrames:s,fps:r,height:o,width:i,props:x},canvasContent:{type:"composition",compositionId:"player-comp"}}),[a,s,o,i,r,x]),[v,b]=d.useState(()=>c),[k,E]=d.useState(()=>h?TP(y??null):w),C=d.useMemo(()=>({playerMuted:v,mediaVolume:k}),[v,k]),I=d.useRef(!1),j=I.current||S&&!v&&k>0;I.current=j;const F=d.useCallback($=>{E($),h&&IP($,f,y??null)},[h,f,y]),L=d.useMemo(()=>({setPlayerMuted:b,setMediaVolume:F}),[F]),V=d.useMemo(()=>({logLevel:f,mountTime:Date.now()}),[f]),M=d.useMemo(()=>({isPlayer:!0,isRendering:!1,isStudio:!1,isClientSideRendering:!1,isReadOnlyStudio:!1}),[]);return u.jsx(we.RemotionEnvironmentContext.Provider,{value:M,children:u.jsx(we.LogLevelContext.Provider,{value:V,children:u.jsx(we.CanUseRemotionHooksProvider,{children:u.jsx(we.AbsoluteTimeContext.Provider,{value:t,children:u.jsx(we.PlaybackRateContext.Provider,{value:n,children:u.jsx(we.TimelineContext.Provider,{value:t,children:u.jsx(we.CompositionManager.Provider,{value:g,children:u.jsx(we.PrefetchProvider,{children:u.jsx(we.DurationsContextProvider,{children:u.jsx(we.MediaVolumeContext.Provider,{value:C,children:u.jsx(we.SetMediaVolumeContext.Provider,{value:L,children:u.jsx(we.BufferingProvider,{children:u.jsx(we.SharedAudioContextProvider,{audioLatencyHint:p,audioEnabled:j,previewSampleRate:m,children:u.jsx(we.SharedAudioTagsContextProvider,{numberOfAudioTags:l,children:e})})})})})})})})})})})})})})},uy=!1,jP=(e,t)=>{e||uy||(uy=!0,we.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."))},cy=(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},RP=({inFrame:e,durationInFrames:t,outFrame:n})=>{const r=cy(e,"inFrame"),o=cy(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)}},PP=({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)}`)}},FP=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.")}},$P=fc.validateFps,dy=fc.validateDimension,_P=fc.validateDurationInFrames,MP=fc.validateDefaultAndInputProps,AP=e=>"component"in e?e.component:null,NP=({durationInFrames:e,compositionHeight:t,compositionWidth:n,fps:r,inputProps:o,style:i,controls:s=!1,loop:a=!1,autoPlay:l=!1,showVolumeControls:c=!0,allowFullscreen:f=!0,clickToPlay:p,doubleClickToFullscreen:m=!1,spaceKeyToPlayOrPause:y=!0,moveToBeginningWhenEnded:w=!0,numberOfSharedAudioTags:x=5,errorFallback:S=()=>"⚠️",playbackRate:h=1,renderLoading:g,className:v,showPosterWhenUnplayed:b,showPosterWhenEnded:k,showPosterWhenPaused:E,showPosterWhenBuffering:C,showPosterWhenBufferingAndPaused:I,initialFrame:j,renderPoster:F,inFrame:L,outFrame:V,initiallyShowControls:M,renderFullscreenButton:$,renderPlayPauseButton:D,renderVolumeSlider:H,renderCustomControls:P,alwaysShowControls:T=!1,initiallyMuted:W=!1,showPlaybackRateControl:R=!1,posterFillMode:Z="player-size",bufferStateDelayInMilliseconds:Q,hideControlsWhenPointerDoesntMove:_=!0,overflowVisible:N=!1,renderMuteButton:z,browserMediaControlsBehavior:ne,overrideInternalClassName:J,logLevel:U="info",noSuspense:G,acknowledgeRemotionLicense:K,audioLatencyHint:le="playback",sampleRate:Y=48e3,volumePersistenceKey:ie,initialVolume:ke,...O},X)=>{if(typeof window<"u"&&(window.remotion_isPlayer=!0),O.defaultProps!==void 0)throw new Error("The <Player /> component does not accept `defaultProps`, but some were passed. Use `inputProps` instead.");const se=AP(O);if((se==null?void 0:se.type)===du)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(se===du)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(()=>jP(!!K,U));const oe=we.useLazyComponent({compProps:O,componentName:"Player",noSuspense:!!G});PP({initialFrame:j,durationInFrames:e});const[de,fe]=d.useState(()=>({[$h]:j??0})),[Ce,Te]=d.useState(!1),[Re]=d.useState("player-comp"),xe=d.useRef(null),be=d.useRef([]),pe=d.useRef(!1),[Le,Ie]=d.useState(h);if(typeof t!="number")throw new TypeError(`'compositionHeight' must be a number but got '${typeof t}' instead`);if(typeof n!="number")throw new TypeError(`'compositionWidth' must be a number but got '${typeof n}' instead`);if(dy(t,"compositionHeight","of the <Player /> component"),dy(n,"compositionWidth","of the <Player /> component"),_P(e,{component:"of the <Player/> component",allowFloats:!1}),$P(r,"as a prop of the <Player/> component",!1),MP(o,"inputProps",null),RP({durationInFrames:e,inFrame:L,outFrame:V}),typeof s!="boolean"&&typeof s<"u")throw new TypeError(`'controls' must be a boolean or undefined but got '${typeof s}' instead`);if(typeof l!="boolean"&&typeof l<"u")throw new TypeError(`'autoPlay' must be a boolean or undefined but got '${typeof l}' instead`);if(typeof a!="boolean"&&typeof a<"u")throw new TypeError(`'loop' must be a boolean or undefined but got '${typeof a}' instead`);if(typeof m!="boolean"&&typeof m<"u")throw new TypeError(`'doubleClickToFullscreen' must be a boolean or undefined but got '${typeof m}' instead`);if(typeof c!="boolean"&&typeof c<"u")throw new TypeError(`'showVolumeControls' must be a boolean or undefined but got '${typeof c}' instead`);if(typeof f!="boolean"&&typeof f<"u")throw new TypeError(`'allowFullscreen' must be a boolean or undefined but got '${typeof f}' instead`);if(typeof p!="boolean"&&typeof p<"u")throw new TypeError(`'clickToPlay' must be a boolean or undefined but got '${typeof p}' instead`);if(typeof y!="boolean"&&typeof y<"u")throw new TypeError(`'spaceKeyToPlayOrPause' must be a boolean or undefined but got '${typeof y}' instead`);if(typeof Y!="number"||!Number.isFinite(Y)||Number.isNaN(Y)||Y<=0||Y%1!==0)throw new TypeError(`'sampleRate' must be a positive integer but got '${Y}' instead`);if(typeof ke<"u"&&typeof ke!="number")throw new TypeError(`'initialVolume' must be a number or undefined but got '${typeof ke}' instead`);if(typeof ke=="number"&&(!Number.isFinite(ke)||Number.isNaN(ke)||ke<0||ke>1))throw new TypeError(`'initialVolume' must be between 0 and 1 but got '${ke}' instead`);if(typeof x!="number"||x%1!==0||!Number.isFinite(x)||Number.isNaN(x)||x<0)throw new TypeError(`'numberOfSharedAudioTags' must be an integer but got '${x}' instead`);FP(Le),d.useEffect(()=>{Ie(h)},[h]),d.useImperativeHandle(X,()=>xe.current,[]),d.useState(()=>{we.playbackLogging({logLevel:U,message:`[player] Mounting <Player>. User agent = ${typeof navigator>"u"?"server":navigator.userAgent}`,tag:"player",mountTime:Date.now()})});const Ye=d.useMemo(()=>({frame:de,playing:Ce,rootId:Re,imperativePlaying:pe,audioAndVideoTags:be}),[de,Ce,Re]),ze=d.useMemo(()=>({playbackRate:Le,setPlaybackRate:Ie}),[Le]),dt=d.useMemo(()=>({setFrame:fe,setPlaying:Te}),[fe]);typeof window<"u"&&d.useLayoutEffect(()=>{we.CSSUtils.injectCSS(we.CSSUtils.makeDefaultPreviewCSS(`.${Fh(J)}`,"#fff"))},[J]);const Nt=d.useMemo(()=>o??{},[o]),kt=d.useMemo(()=>ne??{mode:"prevent-media-session"},[ne]);return u.jsx(we.IsPlayerContextProvider,{children:u.jsx(Eb,{timelineContext:Ye,playbackRateContext:ze,component:oe,compositionHeight:t,compositionWidth:n,durationInFrames:e,fps:r,numberOfSharedAudioTags:x,initiallyMuted:W,logLevel:U,audioLatencyHint:le,sampleRate:Y,volumePersistenceKey:ie,initialVolume:ke,inputProps:Nt,audioEnabled:!0,children:u.jsx(we.SetTimelineContext.Provider,{value:dt,children:u.jsx(RR,{currentPlaybackRate:Le,children:u.jsx(CP,{ref:xe,posterFillMode:Z,renderLoading:g,autoPlay:!!l,loop:!!a,controls:!!s,errorFallback:S,style:i,inputProps:Nt,allowFullscreen:!!f,moveToBeginningWhenEnded:!!w,clickToPlay:typeof p=="boolean"?p:!!s,showVolumeControls:!!c,doubleClickToFullscreen:!!m,spaceKeyToPlayOrPause:!!y,playbackRate:Le,className:v??void 0,showPosterWhenUnplayed:!!b,showPosterWhenEnded:!!k,showPosterWhenPaused:!!E,showPosterWhenBuffering:!!C,showPosterWhenBufferingAndPaused:!!I,renderPoster:F,inFrame:L??null,outFrame:V??null,initiallyShowControls:M??!0,renderFullscreen:$??null,renderPlayPauseButton:D??null,renderMuteButton:z??null,renderVolumeSlider:H??null,renderCustomControls:P??null,alwaysShowControls:T,showPlaybackRateControl:R,bufferStateDelayInMilliseconds:Q??300,hideControlsWhenPointerDoesntMove:_,overflowVisible:N,browserMediaControlsBehavior:kt,overrideInternalClassName:J??void 0,noSuspense:!!G})})})})})},LP=d.forwardRef,OP=LP(NP),DP=()=>{const e=d.useContext(wb);if(!e)throw new TypeError("Expected Player event emitter context");return d.useMemo(()=>({emitter:e}),[e])},ep=he.version.split(".")[0];if(ep==="0")throw new Error(`Version ${ep} of "react" is not supported by Remotion`);var zP=parseInt(ep,10)>=18,BP=({style:e,inputProps:t,errorFallback:n,renderLoading:r,className:o,overflowVisible:i,noSuspense:s,overrideInternalClassName:a},l)=>{const c=we.useUnsafeVideoConfig(),f=we.useVideo(),p=d.useRef(null),m=Ph(p,{triggerOnWindowResize:!1,shouldApplyCssTransforms:!1}),y=d.useMemo(()=>!c||!m?null:hb({canvasSize:m,compositionHeight:c.height,compositionWidth:c.width,previewSize:"auto"}),[m,c]),w=(y==null?void 0:y.scale)??1,x=DP();xb(x.emitter),d.useImperativeHandle(l,()=>{const I={getContainerNode:()=>p.current,getScale:()=>w};return Object.assign(x.emitter,I)},[w,x.emitter]);const S=f?f.component:null,h=d.useMemo(()=>mb({config:c,style:e,canvasSize:m,overflowVisible:i,layout:y}),[m,c,y,i,e]),g=d.useMemo(()=>yb({config:c,layout:y,scale:w,overflowVisible:i}),[c,y,i,w]),v=d.useMemo(()=>gb({config:c,layout:y,scale:w,overflowVisible:i}),[c,y,i,w]),b=d.useCallback(I=>{x.emitter.dispatchError(I)},[x.emitter]),k=d.useMemo(()=>r?r({height:h.height,width:h.width,isBuffering:!1}):null,[h.height,h.width,r]),E=d.useMemo(()=>({type:"scale",scale:w}),[w]);if(!c)return null;const C=u.jsx("div",{style:g,children:u.jsx("div",{style:v,className:Fh(a),children:S?u.jsx(bb,{onError:b,errorFallback:n,children:u.jsx(we.CurrentScaleContext.Provider,{value:E,children:u.jsx(S,{...(f==null?void 0:f.props)??{},...t??{}})})}):null})});return s||Sb&&!zP?u.jsx("div",{ref:p,style:h,className:o,children:C}):u.jsx("div",{ref:p,style:h,className:o,children:u.jsx(d.Suspense,{fallback:k,children:C})})},WP=d.forwardRef(BP),VP=({frameToDisplay:e,style:t,inputProps:n,compositionHeight:r,compositionWidth:o,durationInFrames:i,fps:s,className:a,errorFallback:l=()=>"⚠️",renderLoading:c,overflowVisible:f=!1,overrideInternalClassName:p,logLevel:m="info",noSuspense:y,...w},x)=>{typeof window<"u"&&d.useLayoutEffect(()=>{window.remotion_isPlayer=!0},[]);const[S]=d.useState(()=>String(Ho(null))),h=d.useRef(null),g=d.useMemo(()=>({playing:!1,frame:{[$h]:e},rootId:S,imperativePlaying:{current:!1},audioAndVideoTags:{current:[]}}),[e,S]),v=d.useMemo(()=>({playbackRate:1,setPlaybackRate:()=>{throw new Error("thumbnail")}}),[]);d.useImperativeHandle(x,()=>h.current,[]);const b=we.useLazyComponent({compProps:w,componentName:"Thumbnail",noSuspense:!!y}),[k]=d.useState(()=>new jR),E=d.useMemo(()=>n??{},[n]);return u.jsx(we.IsPlayerContextProvider,{children:u.jsx(Eb,{timelineContext:g,playbackRateContext:v,component:b,compositionHeight:r,compositionWidth:o,durationInFrames:i,fps:s,numberOfSharedAudioTags:0,initiallyMuted:!0,logLevel:m,audioLatencyHint:"playback",sampleRate:48e3,inputProps:E,audioEnabled:!1,children:u.jsx(wb.Provider,{value:k,children:u.jsx(WP,{ref:h,className:a,errorFallback:l,inputProps:E,renderLoading:c,style:t,overflowVisible:f,overrideInternalClassName:p,noSuspense:!!y})})})})},HP=d.forwardRef;HP(VP);const _i=[1,1.5,2,4];function fy(e){return _i.find(t=>t>e+1e-9)??_i[_i.length-1]}function UP(e,t){switch(t){case"L":return e.playing&&e.rate>0?{rate:fy(e.rate),playing:!0}:{rate:_i[0],playing:!0};case"J":return e.playing&&e.rate<0?{rate:-fy(-e.rate),playing:!0}:{rate:-_i[0],playing:!0};case"K":return{rate:_i[0],playing:!e.playing}}}function hc(e,t,n){const r=Math.round(e*n),o=Math.round(t*n);return{from:r,durationInFrames:Math.max(1,o-r)}}function ZP(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 KP(e,t,n,r){const o=t?t.scale:n,i=[];let s=!1;for(let a=0;a<e.length;a++){const l=e[a-1],c=l?e[a].srcIn-l.srcOut:0;a>0&&c>=r&&(s=!s);const f=t?t.allowed[a]!==!1:!0;i.push(s&&f?o:1)}return i}const YP=({src:e,spans:t,punchInScale:n=1.07,punch:r=null,punchThresholdSec:o=.15,audioFadeSec:i=.01,background:s="black"})=>{const{fps:a}=ht(),l=d.useMemo(()=>KP(t,r,n,o),[t,r,n,o]),c=Math.max(1,Math.round(i*a));return u.jsx(kn,{style:{backgroundColor:s},children:t.map((f,p)=>{const{from:m,durationInFrames:y}=hc(f.outIn,f.outOut,a);return u.jsx(Ft,{from:m,durationInFrames:y,premountFor:a,children:u.jsx(kn,{style:{transform:`scale(${l[p]})`},children:u.jsx(db,{src:e,trimBefore:Math.round(f.srcIn*a),trimAfter:Math.round(f.srcOut*a),style:{width:"100%",height:"100%",objectFit:"cover",objectPosition:"var(--ossclip-obj-x, 50%) var(--ossclip-obj-y, 50%)"},volume:w=>Math.max(0,Math.min(1,(w+1)/c,(y-w)/c))})})},p)})})};function ee(e,t,n){function r(a,l){var c;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(c=a._zod).traits??(c.traits=new Set),a._zod.traits.add(e),t(a,l);for(const f in s.prototype)f in a||Object.defineProperty(a,f,{value:s.prototype[f].bind(a)});a._zod.constr=s,a._zod.def=l}const o=(n==null?void 0:n.Parent)??Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function s(a){var l;const c=n!=null&&n.Parent?new i:this;r(c,a),(l=c._zod).deferred??(l.deferred=[]);for(const f of c._zod.deferred)f();return c}return Object.defineProperty(s,"init",{value:r}),Object.defineProperty(s,Symbol.hasInstance,{value:a=>{var l,c;return n!=null&&n.Parent&&a instanceof n.Parent?!0:(c=(l=a==null?void 0:a._zod)==null?void 0:l.traits)==null?void 0:c.has(e)}}),Object.defineProperty(s,"name",{value:e}),s}class ua extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const Cb={};function io(e){return Cb}function Ib(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 GP(e,t){return typeof t=="bigint"?t.toString():t}function Tb(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function _h(e){return e==null}function Mh(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function XP(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 Ah(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function ks(e){return JSON.stringify(e)}const jb=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function tp(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const qP=Tb(()=>{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 yu(e){if(tp(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(tp(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}const JP=new Set(["string","number","symbol"]);function Pa(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Yo(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 Se(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 QP(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const eF={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 tF(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 Yo(e,{...e._zod.def,shape:n,checks:[]})}function nF(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 Yo(e,{...e._zod.def,shape:n,checks:[]})}function rF(e,t){if(!yu(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 Ah(this,"shape",r),r},checks:[]};return Yo(e,n)}function oF(e,t){return Yo(e,{...e._zod.def,get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return Ah(this,"shape",n),n},catchall:t._zod.def.catchall,checks:[]})}function iF(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 Yo(t,{...t._zod.def,shape:o,checks:[]})}function sF(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 Yo(t,{...t._zod.def,shape:o,checks:[]})}function Bs(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 jo(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function sl(e){return typeof e=="string"?e:e==null?void 0:e.message}function so(e,t,n){var o,i,s,a,l,c;const r={...e,path:e.path??[]};if(!e.message){const f=sl((s=(i=(o=e.inst)==null?void 0:o._zod.def)==null?void 0:i.error)==null?void 0:s.call(i,e))??sl((a=t==null?void 0:t.error)==null?void 0:a.call(t,e))??sl((l=n.customError)==null?void 0:l.call(n,e))??sl((c=n.localeError)==null?void 0:c.call(n,e))??"Invalid input";r.message=f}return delete r.inst,delete r.continue,t!=null&&t.reportInput||delete r.input,r}function Nh(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function ca(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const Rb=(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,GP,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Pb=ee("$ZodError",Rb),Fb=ee("$ZodError",Rb,{Parent:Error});function aF(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 lF(e,t){const n=t||function(i){return i.message},r={_errors:[]},o=i=>{for(const s of i.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(a=>o({issues:a}));else if(s.code==="invalid_key")o({issues:s.issues});else if(s.code==="invalid_element")o({issues:s.issues});else if(s.path.length===0)r._errors.push(n(s));else{let a=r,l=0;for(;l<s.path.length;){const c=s.path[l];l===s.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(s))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return o(e),r}const uF=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 ua;if(s.issues.length){const a=new((o==null?void 0:o.Err)??e)(s.issues.map(l=>so(l,i,io())));throw jb(a,o==null?void 0:o.callee),a}return s.value},cF=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=>so(l,i,io())));throw jb(a,o==null?void 0:o.callee),a}return s.value},$b=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 ua;return i.issues.length?{success:!1,error:new(e??Pb)(i.issues.map(s=>so(s,o,io())))}:{success:!0,data:i.value}},dF=$b(Fb),_b=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=>so(s,o,io())))}:{success:!0,data:i.value}},fF=_b(Fb),pF=/^[cC][^\s-]{8,}$/,hF=/^[0-9a-z]+$/,mF=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,gF=/^[0-9a-vA-V]{20}$/,yF=/^[A-Za-z0-9]{27}$/,vF=/^[a-zA-Z0-9_-]{21}$/,wF=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,xF=/^([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})$/,py=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)$/,bF=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,SF="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function kF(){return new RegExp(SF,"u")}const EF=/^(?:(?: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])$/,CF=/^(([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})$/,IF=/^((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])$/,TF=/^(([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])$/,jF=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Mb=/^[A-Za-z0-9_-]*$/,RF=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,PF=/^\+(?:[0-9]){6,14}[0-9]$/,Ab="(?:(?:\\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])))",FF=new RegExp(`^${Ab}$`);function Nb(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 $F(e){return new RegExp(`^${Nb(e)}$`)}function _F(e){const t=Nb({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(`^${Ab}T(?:${r})$`)}const MF=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}$`)},AF=/^\d+$/,NF=/^-?\d+(?:\.\d+)?/i,LF=/true|false/i,OF=/^[^A-Z]*$/,DF=/^[^a-z]*$/,un=ee("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Lb={number:"number",bigint:"bigint",object:"date"},Ob=ee("$ZodCheckLessThan",(e,t)=>{un.init(e,t);const n=Lb[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})}}),Db=ee("$ZodCheckGreaterThan",(e,t)=>{un.init(e,t);const n=Lb[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})}}),zF=ee("$ZodCheckMultipleOf",(e,t)=>{un.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):XP(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})}}),BF=ee("$ZodCheckNumberFormat",(e,t)=>{var s;un.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]=eF[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=AF)}),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})}}),WF=ee("$ZodCheckMaxLength",(e,t)=>{var n;un.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!_h(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=Nh(o);r.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),VF=ee("$ZodCheckMinLength",(e,t)=>{var n;un.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!_h(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=Nh(o);r.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),HF=ee("$ZodCheckLengthEquals",(e,t)=>{var n;un.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!_h(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=Nh(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})}}),mc=ee("$ZodCheckStringFormat",(e,t)=>{var n,r;un.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=()=>{})}),UF=ee("$ZodCheckRegex",(e,t)=>{mc.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})}}),ZF=ee("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=OF),mc.init(e,t)}),KF=ee("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=DF),mc.init(e,t)}),YF=ee("$ZodCheckIncludes",(e,t)=>{un.init(e,t);const n=Pa(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(o=>{const i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),GF=ee("$ZodCheckStartsWith",(e,t)=>{un.init(e,t);const n=new RegExp(`^${Pa(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),XF=ee("$ZodCheckEndsWith",(e,t)=>{un.init(e,t);const n=new RegExp(`.*${Pa(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),qF=ee("$ZodCheckOverwrite",(e,t)=>{un.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class JF{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 QF={major:4,minor:0,patch:0},Je=ee("$ZodType",(e,t)=>{var o;var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=QF;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const i of r)for(const s of i._zod.onattach)s(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),(o=e._zod.deferred)==null||o.push(()=>{e._zod.run=e._zod.parse});else{const i=(s,a,l)=>{let c=Bs(s),f;for(const p of a){if(p._zod.def.when){if(!p._zod.def.when(s))continue}else if(c)continue;const m=s.issues.length,y=p._zod.check(s);if(y instanceof Promise&&(l==null?void 0:l.async)===!1)throw new ua;if(f||y instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await y,s.issues.length!==m&&(c||(c=Bs(s,m)))});else{if(s.issues.length===m)continue;c||(c=Bs(s,m))}}return f?f.then(()=>s):s};e._zod.run=(s,a)=>{const l=e._zod.parse(s,a);if(l instanceof Promise){if(a.async===!1)throw new ua;return l.then(c=>i(c,r,a))}return i(l,r,a)}}e["~standard"]={validate:i=>{var s;try{const a=dF(e,i);return a.success?{value:a.data}:{issues:(s=a.error)==null?void 0:s.issues}}catch{return fF(e,i).then(l=>{var c;return l.success?{value:l.data}:{issues:(c=l.error)==null?void 0:c.issues}})}},vendor:"zod",version:1}}),Lh=ee("$ZodString",(e,t)=>{var n;Je.init(e,t),e._zod.pattern=[...((n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)??[]].pop()??MF(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=ee("$ZodStringFormat",(e,t)=>{mc.init(e,t),Lh.init(e,t)}),e$=ee("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=xF),Qe.init(e,t)}),t$=ee("$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=py(r))}else t.pattern??(t.pattern=py());Qe.init(e,t)}),n$=ee("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=bF),Qe.init(e,t)}),r$=ee("$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:RF.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})}}}),o$=ee("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=kF()),Qe.init(e,t)}),i$=ee("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=vF),Qe.init(e,t)}),s$=ee("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=pF),Qe.init(e,t)}),a$=ee("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=hF),Qe.init(e,t)}),l$=ee("$ZodULID",(e,t)=>{t.pattern??(t.pattern=mF),Qe.init(e,t)}),u$=ee("$ZodXID",(e,t)=>{t.pattern??(t.pattern=gF),Qe.init(e,t)}),c$=ee("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=yF),Qe.init(e,t)}),d$=ee("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=_F(t)),Qe.init(e,t)}),f$=ee("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=FF),Qe.init(e,t)}),p$=ee("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=$F(t)),Qe.init(e,t)}),h$=ee("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=wF),Qe.init(e,t)}),m$=ee("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=EF),Qe.init(e,t),e._zod.onattach.push(n=>{const r=n._zod.bag;r.format="ipv4"})}),g$=ee("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=CF),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})}}}),y$=ee("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=IF),Qe.init(e,t)}),v$=ee("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=TF),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 zb(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const w$=ee("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=jF),Qe.init(e,t),e._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64"}),e._zod.check=n=>{zb(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function x$(e){if(!Mb.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return zb(n)}const b$=ee("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Mb),Qe.init(e,t),e._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64url"}),e._zod.check=n=>{x$(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),S$=ee("$ZodE164",(e,t)=>{t.pattern??(t.pattern=PF),Qe.init(e,t)});function k$(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 E$=ee("$ZodJWT",(e,t)=>{Qe.init(e,t),e._zod.check=n=>{k$(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Bb=ee("$ZodNumber",(e,t)=>{Je.init(e,t),e._zod.pattern=e._zod.bag.pattern??NF,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}}),C$=ee("$ZodNumber",(e,t)=>{BF.init(e,t),Bb.init(e,t)}),I$=ee("$ZodBoolean",(e,t)=>{Je.init(e,t),e._zod.pattern=LF,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}}),T$=ee("$ZodUnknown",(e,t)=>{Je.init(e,t),e._zod.parse=n=>n}),j$=ee("$ZodNever",(e,t)=>{Je.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function hy(e,t,n){e.issues.length&&t.issues.push(...jo(n,e.issues)),t.value[n]=e.value}const R$=ee("$ZodArray",(e,t)=>{Je.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const i=[];for(let s=0;s<o.length;s++){const a=o[s],l=t.element._zod.run({value:a,issues:[]},r);l instanceof Promise?i.push(l.then(c=>hy(c,n,s))):hy(l,n,s)}return i.length?Promise.all(i).then(()=>n):n}});function al(e,t,n){e.issues.length&&t.issues.push(...jo(n,e.issues)),t.value[n]=e.value}function my(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(...jo(n,e.issues)):e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}const P$=ee("$ZodObject",(e,t)=>{Je.init(e,t);const n=Tb(()=>{const p=Object.keys(t.shape);for(const y of p)if(!(t.shape[y]instanceof Je))throw new Error(`Invalid element at key "${y}": expected a Zod schema`);const m=QP(t.shape);return{shape:t.shape,keys:p,keySet:new Set(p),numKeys:p.length,optionalKeys:new Set(m)}});qe(e._zod,"propValues",()=>{const p=t.shape,m={};for(const y in p){const w=p[y]._zod;if(w.values){m[y]??(m[y]=new Set);for(const x of w.values)m[y].add(x)}}return m});const r=p=>{const m=new JF(["shape","payload","ctx"]),y=n.value,w=g=>{const v=ks(g);return`shape[${v}]._zod.run({ value: input[${v}], issues: [] }, ctx)`};m.write("const input = payload.value;");const x=Object.create(null);let S=0;for(const g of y.keys)x[g]=`key_${S++}`;m.write("const newResult = {}");for(const g of y.keys)if(y.optionalKeys.has(g)){const v=x[g];m.write(`const ${v} = ${w(g)};`);const b=ks(g);m.write(`
137
+ if (${v}.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
+ ${v}.issues.map((iss) => ({
145
+ ...iss,
146
+ path: iss.path ? [${b}, ...iss.path] : [${b}],
147
+ }))
148
+ );
149
+ }
150
+ } else if (${v}.value === undefined) {
151
+ if (${b} in input) newResult[${b}] = undefined;
152
+ } else {
153
+ newResult[${b}] = ${v}.value;
154
+ }
155
+ `)}else{const v=x[g];m.write(`const ${v} = ${w(g)};`),m.write(`
156
+ if (${v}.issues.length) payload.issues = payload.issues.concat(${v}.issues.map(iss => ({
157
+ ...iss,
158
+ path: iss.path ? [${ks(g)}, ...iss.path] : [${ks(g)}]
159
+ })));`),m.write(`newResult[${ks(g)}] = ${v}.value`)}m.write("payload.value = newResult;"),m.write("return payload;");const h=m.compile();return(g,v)=>h(p,g,v)};let o;const i=tp,s=!Cb.jitless,l=s&&qP.value,c=t.catchall;let f;e._zod.parse=(p,m)=>{f??(f=n.value);const y=p.value;if(!i(y))return p.issues.push({expected:"object",code:"invalid_type",input:y,inst:e}),p;const w=[];if(s&&l&&(m==null?void 0:m.async)===!1&&m.jitless!==!0)o||(o=r(t.shape)),p=o(p,m);else{p.value={};const v=f.shape;for(const b of f.keys){const k=v[b],E=k._zod.run({value:y[b],issues:[]},m),C=k._zod.optin==="optional"&&k._zod.optout==="optional";E instanceof Promise?w.push(E.then(I=>C?my(I,p,b,y):al(I,p,b))):C?my(E,p,b,y):al(E,p,b)}}if(!c)return w.length?Promise.all(w).then(()=>p):p;const x=[],S=f.keySet,h=c._zod,g=h.def.type;for(const v of Object.keys(y)){if(S.has(v))continue;if(g==="never"){x.push(v);continue}const b=h.run({value:y[v],issues:[]},m);b instanceof Promise?w.push(b.then(k=>al(k,p,v))):al(b,p,v)}return x.length&&p.issues.push({code:"unrecognized_keys",keys:x,input:y,inst:e}),w.length?Promise.all(w).then(()=>p):p}});function gy(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=>so(i,r,io())))}),t}const F$=ee("$ZodUnion",(e,t)=>{Je.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=>Mh(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=>gy(s,n,e,r)):gy(i,n,e,r)}}),$$=ee("$ZodIntersection",(e,t)=>{Je.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,i=t.left._zod.run({value:o,issues:[]},r),s=t.right._zod.run({value:o,issues:[]},r);return i instanceof Promise||s instanceof Promise?Promise.all([i,s]).then(([l,c])=>yy(n,l,c)):yy(n,i,s)}});function np(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(yu(e)&&yu(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=np(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=np(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 yy(e,t,n){if(t.issues.length&&e.issues.push(...t.issues),n.issues.length&&e.issues.push(...n.issues),Bs(e))return e;const r=np(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 _$=ee("$ZodRecord",(e,t)=>{Je.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!yu(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const i=[];if(t.keyType._zod.values){const s=t.keyType._zod.values;n.value={};for(const l of s)if(typeof l=="string"||typeof l=="number"||typeof l=="symbol"){const c=t.valueType._zod.run({value:o[l],issues:[]},r);c instanceof Promise?i.push(c.then(f=>{f.issues.length&&n.issues.push(...jo(l,f.issues)),n.value[l]=f.value})):(c.issues.length&&n.issues.push(...jo(l,c.issues)),n.value[l]=c.value)}let a;for(const l in o)s.has(l)||(a=a??[],a.push(l));a&&a.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:a})}else{n.value={};for(const s of Reflect.ownKeys(o)){if(s==="__proto__")continue;const a=t.keyType._zod.run({value:s,issues:[]},r);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(a.issues.length){n.issues.push({origin:"record",code:"invalid_key",issues:a.issues.map(c=>so(c,r,io())),input:s,path:[s],inst:e}),n.value[a.value]=a.value;continue}const l=t.valueType._zod.run({value:o[s],issues:[]},r);l instanceof Promise?i.push(l.then(c=>{c.issues.length&&n.issues.push(...jo(s,c.issues)),n.value[a.value]=c.value})):(l.issues.length&&n.issues.push(...jo(s,l.issues)),n.value[a.value]=l.value)}}return i.length?Promise.all(i).then(()=>n):n}}),M$=ee("$ZodEnum",(e,t)=>{Je.init(e,t);const n=Ib(t.entries);e._zod.values=new Set(n),e._zod.pattern=new RegExp(`^(${n.filter(r=>JP.has(typeof r)).map(r=>typeof r=="string"?Pa(r):r.toString()).join("|")})$`),e._zod.parse=(r,o)=>{const i=r.value;return e._zod.values.has(i)||r.issues.push({code:"invalid_value",values:n,input:i,inst:e}),r}}),A$=ee("$ZodLiteral",(e,t)=>{Je.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map(n=>typeof n=="string"?Pa(n):n?n.toString():String(n)).join("|")})$`),e._zod.parse=(n,r)=>{const o=n.value;return e._zod.values.has(o)||n.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),n}}),N$=ee("$ZodTransform",(e,t)=>{Je.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 ua;return n.value=o,n}}),L$=ee("$ZodOptional",(e,t)=>{Je.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(`^(${Mh(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)}),O$=ee("$ZodNullable",(e,t)=>{Je.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(`^(${Mh(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)}),D$=ee("$ZodDefault",(e,t)=>{Je.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=>vy(i,t)):vy(o,t)}});function vy(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const z$=ee("$ZodPrefault",(e,t)=>{Je.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))}),B$=ee("$ZodNonOptional",(e,t)=>{Je.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=>wy(i,e)):wy(o,e)}});function wy(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 W$=ee("$ZodCatch",(e,t)=>{Je.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=>so(s,r,io()))},input:n.value}),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(i=>so(i,r,io()))},input:n.value}),n.issues=[]),n)}}),V$=ee("$ZodPipe",(e,t)=>{Je.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=>xy(i,t,r)):xy(o,t,r)}});function xy(e,t,n){return Bs(e)?e:t.out._zod.run({value:e.value,issues:e.issues},n)}const H$=ee("$ZodReadonly",(e,t)=>{Je.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(by):by(o)}});function by(e){return e.value=Object.freeze(e.value),e}const U$=ee("$ZodCustom",(e,t)=>{un.init(e,t),Je.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=>Sy(i,n,r,e));Sy(o,n,r,e)}});function Sy(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(ca(o))}}class Wb{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 Z$(){return new Wb}const Fs=Z$();function K$(e,t){return new e({type:"string",...Se(t)})}function Y$(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Se(t)})}function ky(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Se(t)})}function G$(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Se(t)})}function X$(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Se(t)})}function q$(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Se(t)})}function J$(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Se(t)})}function Q$(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Se(t)})}function e_(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Se(t)})}function t_(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Se(t)})}function n_(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Se(t)})}function r_(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Se(t)})}function o_(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Se(t)})}function i_(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Se(t)})}function s_(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Se(t)})}function a_(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Se(t)})}function l_(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Se(t)})}function u_(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Se(t)})}function c_(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Se(t)})}function d_(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Se(t)})}function f_(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Se(t)})}function p_(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Se(t)})}function h_(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Se(t)})}function m_(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Se(t)})}function g_(e,t){return new e({type:"string",format:"date",check:"string_format",...Se(t)})}function y_(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Se(t)})}function v_(e,t){return new e({type:"string",format:"duration",check:"string_format",...Se(t)})}function w_(e,t){return new e({type:"number",checks:[],...Se(t)})}function x_(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Se(t)})}function b_(e,t){return new e({type:"boolean",...Se(t)})}function S_(e){return new e({type:"unknown"})}function k_(e,t){return new e({type:"never",...Se(t)})}function Ey(e,t){return new Ob({check:"less_than",...Se(t),value:e,inclusive:!1})}function vd(e,t){return new Ob({check:"less_than",...Se(t),value:e,inclusive:!0})}function Cy(e,t){return new Db({check:"greater_than",...Se(t),value:e,inclusive:!1})}function wd(e,t){return new Db({check:"greater_than",...Se(t),value:e,inclusive:!0})}function Iy(e,t){return new zF({check:"multiple_of",...Se(t),value:e})}function Vb(e,t){return new WF({check:"max_length",...Se(t),maximum:e})}function vu(e,t){return new VF({check:"min_length",...Se(t),minimum:e})}function Hb(e,t){return new HF({check:"length_equals",...Se(t),length:e})}function E_(e,t){return new UF({check:"string_format",format:"regex",...Se(t),pattern:e})}function C_(e){return new ZF({check:"string_format",format:"lowercase",...Se(e)})}function I_(e){return new KF({check:"string_format",format:"uppercase",...Se(e)})}function T_(e,t){return new YF({check:"string_format",format:"includes",...Se(t),includes:e})}function j_(e,t){return new GF({check:"string_format",format:"starts_with",...Se(t),prefix:e})}function R_(e,t){return new XF({check:"string_format",format:"ends_with",...Se(t),suffix:e})}function Fa(e){return new qF({check:"overwrite",tx:e})}function P_(e){return Fa(t=>t.normalize(e))}function F_(){return Fa(e=>e.trim())}function $_(){return Fa(e=>e.toLowerCase())}function __(){return Fa(e=>e.toUpperCase())}function M_(e,t,n){return new e({type:"array",element:t,...Se(n)})}function A_(e,t,n){return new e({type:"custom",check:"custom",fn:t,...Se(n)})}class Ty{constructor(t){this.counter=0,this.metadataRegistry=(t==null?void 0:t.metadata)??Fs,this.target=(t==null?void 0:t.target)??"draft-2020-12",this.unrepresentable=(t==null?void 0:t.unrepresentable)??"throw",this.override=(t==null?void 0:t.override)??(()=>{}),this.io=(t==null?void 0:t.io)??"output",this.seen=new Map}process(t,n={path:[],schemaPath:[]}){var p,m,y;var r;const o=t._zod.def,i={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},s=this.seen.get(t);if(s)return s.count++,n.schemaPath.includes(t)&&(s.cycle=n.path),s.schema;const a={schema:{},count:1,cycle:void 0,path:n.path};this.seen.set(t,a);const l=(m=(p=t._zod).toJSONSchema)==null?void 0:m.call(p);if(l)a.schema=l;else{const w={...n,schemaPath:[...n.schemaPath,t],path:n.path},x=t._zod.parent;if(x)a.ref=x,this.process(x,w),this.seen.get(x).isParent=!0;else{const S=a.schema;switch(o.type){case"string":{const h=S;h.type="string";const{minimum:g,maximum:v,format:b,patterns:k,contentEncoding:E}=t._zod.bag;if(typeof g=="number"&&(h.minLength=g),typeof v=="number"&&(h.maxLength=v),b&&(h.format=i[b]??b,h.format===""&&delete h.format),E&&(h.contentEncoding=E),k&&k.size>0){const C=[...k];C.length===1?h.pattern=C[0].source:C.length>1&&(a.schema.allOf=[...C.map(I=>({...this.target==="draft-7"?{type:"string"}:{},pattern:I.source}))])}break}case"number":{const h=S,{minimum:g,maximum:v,format:b,multipleOf:k,exclusiveMaximum:E,exclusiveMinimum:C}=t._zod.bag;typeof b=="string"&&b.includes("int")?h.type="integer":h.type="number",typeof C=="number"&&(h.exclusiveMinimum=C),typeof g=="number"&&(h.minimum=g,typeof C=="number"&&(C>=g?delete h.minimum:delete h.exclusiveMinimum)),typeof E=="number"&&(h.exclusiveMaximum=E),typeof v=="number"&&(h.maximum=v,typeof E=="number"&&(E<=v?delete h.maximum:delete h.exclusiveMaximum)),typeof k=="number"&&(h.multipleOf=k);break}case"boolean":{const h=S;h.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema");break}case"null":{S.type="null";break}case"any":break;case"unknown":break;case"undefined":{if(this.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema");break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"never":{S.not={};break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{const h=S,{minimum:g,maximum:v}=t._zod.bag;typeof g=="number"&&(h.minItems=g),typeof v=="number"&&(h.maxItems=v),h.type="array",h.items=this.process(o.element,{...w,path:[...w.path,"items"]});break}case"object":{const h=S;h.type="object",h.properties={};const g=o.shape;for(const k in g)h.properties[k]=this.process(g[k],{...w,path:[...w.path,"properties",k]});const v=new Set(Object.keys(g)),b=new Set([...v].filter(k=>{const E=o.shape[k]._zod;return this.io==="input"?E.optin===void 0:E.optout===void 0}));b.size>0&&(h.required=Array.from(b)),((y=o.catchall)==null?void 0:y._zod.def.type)==="never"?h.additionalProperties=!1:o.catchall?o.catchall&&(h.additionalProperties=this.process(o.catchall,{...w,path:[...w.path,"additionalProperties"]})):this.io==="output"&&(h.additionalProperties=!1);break}case"union":{const h=S;h.anyOf=o.options.map((g,v)=>this.process(g,{...w,path:[...w.path,"anyOf",v]}));break}case"intersection":{const h=S,g=this.process(o.left,{...w,path:[...w.path,"allOf",0]}),v=this.process(o.right,{...w,path:[...w.path,"allOf",1]}),b=E=>"allOf"in E&&Object.keys(E).length===1,k=[...b(g)?g.allOf:[g],...b(v)?v.allOf:[v]];h.allOf=k;break}case"tuple":{const h=S;h.type="array";const g=o.items.map((k,E)=>this.process(k,{...w,path:[...w.path,"prefixItems",E]}));if(this.target==="draft-2020-12"?h.prefixItems=g:h.items=g,o.rest){const k=this.process(o.rest,{...w,path:[...w.path,"items"]});this.target==="draft-2020-12"?h.items=k:h.additionalItems=k}o.rest&&(h.items=this.process(o.rest,{...w,path:[...w.path,"items"]}));const{minimum:v,maximum:b}=t._zod.bag;typeof v=="number"&&(h.minItems=v),typeof b=="number"&&(h.maxItems=b);break}case"record":{const h=S;h.type="object",h.propertyNames=this.process(o.keyType,{...w,path:[...w.path,"propertyNames"]}),h.additionalProperties=this.process(o.valueType,{...w,path:[...w.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema");break}case"enum":{const h=S,g=Ib(o.entries);g.every(v=>typeof v=="number")&&(h.type="number"),g.every(v=>typeof v=="string")&&(h.type="string"),h.enum=g;break}case"literal":{const h=S,g=[];for(const v of o.values)if(v===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof v=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");g.push(Number(v))}else g.push(v);if(g.length!==0)if(g.length===1){const v=g[0];h.type=v===null?"null":typeof v,h.const=v}else g.every(v=>typeof v=="number")&&(h.type="number"),g.every(v=>typeof v=="string")&&(h.type="string"),g.every(v=>typeof v=="boolean")&&(h.type="string"),g.every(v=>v===null)&&(h.type="null"),h.enum=g;break}case"file":{const h=S,g={type:"string",format:"binary",contentEncoding:"binary"},{minimum:v,maximum:b,mime:k}=t._zod.bag;v!==void 0&&(g.minLength=v),b!==void 0&&(g.maxLength=b),k?k.length===1?(g.contentMediaType=k[0],Object.assign(h,g)):h.anyOf=k.map(E=>({...g,contentMediaType:E})):Object.assign(h,g);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{const h=this.process(o.innerType,w);S.anyOf=[h,{type:"null"}];break}case"nonoptional":{this.process(o.innerType,w),a.ref=o.innerType;break}case"success":{const h=S;h.type="boolean";break}case"default":{this.process(o.innerType,w),a.ref=o.innerType,S.default=JSON.parse(JSON.stringify(o.defaultValue));break}case"prefault":{this.process(o.innerType,w),a.ref=o.innerType,this.io==="input"&&(S._prefault=JSON.parse(JSON.stringify(o.defaultValue)));break}case"catch":{this.process(o.innerType,w),a.ref=o.innerType;let h;try{h=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}S.default=h;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{const h=S,g=t._zod.pattern;if(!g)throw new Error("Pattern not found in template literal");h.type="string",h.pattern=g.source;break}case"pipe":{const h=this.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;this.process(h,w),a.ref=h;break}case"readonly":{this.process(o.innerType,w),a.ref=o.innerType,S.readOnly=!0;break}case"promise":{this.process(o.innerType,w),a.ref=o.innerType;break}case"optional":{this.process(o.innerType,w),a.ref=o.innerType;break}case"lazy":{const h=t._zod.innerType;this.process(h,w),a.ref=h;break}case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}}}}const c=this.metadataRegistry.get(t);return c&&Object.assign(a.schema,c),this.io==="input"&&vt(t)&&(delete a.schema.examples,delete a.schema.default),this.io==="input"&&a.schema._prefault&&((r=a.schema).default??(r.default=a.schema._prefault)),delete a.schema._prefault,this.seen.get(t).schema}emit(t,n){var f,p,m,y,w,x;const r={cycles:(n==null?void 0:n.cycles)??"ref",reused:(n==null?void 0:n.reused)??"inline",external:(n==null?void 0:n.external)??void 0},o=this.seen.get(t);if(!o)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=S=>{var k;const h=this.target==="draft-2020-12"?"$defs":"definitions";if(r.external){const E=(k=r.external.registry.get(S[0]))==null?void 0:k.id,C=r.external.uri??(j=>j);if(E)return{ref:C(E)};const I=S[1].defId??S[1].schema.id??`schema${this.counter++}`;return S[1].defId=I,{defId:I,ref:`${C("__shared")}#/${h}/${I}`}}if(S[1]===o)return{ref:"#"};const v=`#/${h}/`,b=S[1].schema.id??`__schema${this.counter++}`;return{defId:b,ref:v+b}},s=S=>{if(S[1].schema.$ref)return;const h=S[1],{ref:g,defId:v}=i(S);h.def={...h.schema},v&&(h.defId=v);const b=h.schema;for(const k in b)delete b[k];b.$ref=g};if(r.cycles==="throw")for(const S of this.seen.entries()){const h=S[1];if(h.cycle)throw new Error(`Cycle detected: #/${(f=h.cycle)==null?void 0:f.join("/")}/<root>
160
+
161
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const S of this.seen.entries()){const h=S[1];if(t===S[0]){s(S);continue}if(r.external){const v=(p=r.external.registry.get(S[0]))==null?void 0:p.id;if(t!==S[0]&&v){s(S);continue}}if((m=this.metadataRegistry.get(S[0]))==null?void 0:m.id){s(S);continue}if(h.cycle){s(S);continue}if(h.count>1&&r.reused==="ref"){s(S);continue}}const a=(S,h)=>{const g=this.seen.get(S),v=g.def??g.schema,b={...v};if(g.ref===null)return;const k=g.ref;if(g.ref=null,k){a(k,h);const E=this.seen.get(k).schema;E.$ref&&h.target==="draft-7"?(v.allOf=v.allOf??[],v.allOf.push(E)):(Object.assign(v,E),Object.assign(v,b))}g.isParent||this.override({zodSchema:S,jsonSchema:v,path:g.path??[]})};for(const S of[...this.seen.entries()].reverse())a(S[0],{target:this.target});const l={};if(this.target==="draft-2020-12"?l.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?l.$schema="http://json-schema.org/draft-07/schema#":console.warn(`Invalid target: ${this.target}`),(y=r.external)!=null&&y.uri){const S=(w=r.external.registry.get(t))==null?void 0:w.id;if(!S)throw new Error("Schema is missing an `id` property");l.$id=r.external.uri(S)}Object.assign(l,o.def);const c=((x=r.external)==null?void 0:x.defs)??{};for(const S of this.seen.entries()){const h=S[1];h.def&&h.defId&&(c[h.defId]=h.def)}r.external||Object.keys(c).length>0&&(this.target==="draft-2020-12"?l.$defs=c:l.definitions=c);try{return JSON.parse(JSON.stringify(l))}catch{throw new Error("Error converting schema to JSON.")}}}function N_(e,t){if(e instanceof Wb){const r=new Ty(t),o={};for(const a of e._idmap.entries()){const[l,c]=a;r.process(c)}const i={},s={registry:e,uri:t==null?void 0:t.uri,defs:o};for(const a of e._idmap.entries()){const[l,c]=a;i[l]=r.emit(c,{...t,external:s})}if(Object.keys(o).length>0){const a=r.target==="draft-2020-12"?"$defs":"definitions";i.__shared={[a]:o}}return{schemas:i}}const n=new Ty(t);return n.process(e),n.emit(e,t)}function vt(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const o=e._zod.def;switch(o.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return vt(o.element,n);case"object":{for(const i in o.shape)if(vt(o.shape[i],n))return!0;return!1}case"union":{for(const i of o.options)if(vt(i,n))return!0;return!1}case"intersection":return vt(o.left,n)||vt(o.right,n);case"tuple":{for(const i of o.items)if(vt(i,n))return!0;return!!(o.rest&&vt(o.rest,n))}case"record":return vt(o.keyType,n)||vt(o.valueType,n);case"map":return vt(o.keyType,n)||vt(o.valueType,n);case"set":return vt(o.valueType,n);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return vt(o.innerType,n);case"lazy":return vt(o.getter(),n);case"default":return vt(o.innerType,n);case"prefault":return vt(o.innerType,n);case"custom":return!1;case"transform":return!0;case"pipe":return vt(o.in,n)||vt(o.out,n);case"success":return!1;case"catch":return!1}throw new Error(`Unknown schema type: ${o.type}`)}const L_=ee("ZodISODateTime",(e,t)=>{d$.init(e,t),st.init(e,t)});function O_(e){return m_(L_,e)}const D_=ee("ZodISODate",(e,t)=>{f$.init(e,t),st.init(e,t)});function z_(e){return g_(D_,e)}const B_=ee("ZodISOTime",(e,t)=>{p$.init(e,t),st.init(e,t)});function W_(e){return y_(B_,e)}const V_=ee("ZodISODuration",(e,t)=>{h$.init(e,t),st.init(e,t)});function H_(e){return v_(V_,e)}const U_=(e,t)=>{Pb.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>lF(e,n)},flatten:{value:n=>aF(e,n)},addIssue:{value:n=>e.issues.push(n)},addIssues:{value:n=>e.issues.push(...n)},isEmpty:{get(){return e.issues.length===0}}})},gc=ee("ZodError",U_,{Parent:Error}),Z_=uF(gc),K_=cF(gc),Y_=$b(gc),G_=_b(gc),ct=ee("ZodType",(e,t)=>(Je.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)=>Yo(e,n,r),e.brand=()=>e,e.register=(n,r)=>(n.add(e,r),e),e.parse=(n,r)=>Z_(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>Y_(e,n,r),e.parseAsync=async(n,r)=>K_(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>G_(e,n,r),e.spa=e.safeParseAsync,e.refine=(n,r)=>e.check(BM(n,r)),e.superRefine=n=>e.check(WM(n)),e.overwrite=n=>e.check(Fa(n)),e.optional=()=>Py(e),e.nullable=()=>Fy(e),e.nullish=()=>Py(Fy(e)),e.nonoptional=n=>_M(e,n),e.array=()=>rt(e),e.or=n=>yc([e,n]),e.and=n=>SM(e,n),e.transform=n=>$y(e,TM(n)),e.default=n=>PM(e,n),e.prefault=n=>$M(e,n),e.catch=n=>AM(e,n),e.pipe=n=>$y(e,n),e.readonly=()=>OM(e),e.describe=n=>{const r=e.clone();return Fs.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){var n;return(n=Fs.get(e))==null?void 0:n.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Fs.get(e);const r=e.clone();return Fs.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),Ub=ee("_ZodString",(e,t)=>{Lh.init(e,t),ct.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(E_(...r)),e.includes=(...r)=>e.check(T_(...r)),e.startsWith=(...r)=>e.check(j_(...r)),e.endsWith=(...r)=>e.check(R_(...r)),e.min=(...r)=>e.check(vu(...r)),e.max=(...r)=>e.check(Vb(...r)),e.length=(...r)=>e.check(Hb(...r)),e.nonempty=(...r)=>e.check(vu(1,...r)),e.lowercase=r=>e.check(C_(r)),e.uppercase=r=>e.check(I_(r)),e.trim=()=>e.check(F_()),e.normalize=(...r)=>e.check(P_(...r)),e.toLowerCase=()=>e.check($_()),e.toUpperCase=()=>e.check(__())}),X_=ee("ZodString",(e,t)=>{Lh.init(e,t),Ub.init(e,t),e.email=n=>e.check(Y$(q_,n)),e.url=n=>e.check(Q$(J_,n)),e.jwt=n=>e.check(h_(pM,n)),e.emoji=n=>e.check(e_(Q_,n)),e.guid=n=>e.check(ky(jy,n)),e.uuid=n=>e.check(G$(ll,n)),e.uuidv4=n=>e.check(X$(ll,n)),e.uuidv6=n=>e.check(q$(ll,n)),e.uuidv7=n=>e.check(J$(ll,n)),e.nanoid=n=>e.check(t_(eM,n)),e.guid=n=>e.check(ky(jy,n)),e.cuid=n=>e.check(n_(tM,n)),e.cuid2=n=>e.check(r_(nM,n)),e.ulid=n=>e.check(o_(rM,n)),e.base64=n=>e.check(d_(cM,n)),e.base64url=n=>e.check(f_(dM,n)),e.xid=n=>e.check(i_(oM,n)),e.ksuid=n=>e.check(s_(iM,n)),e.ipv4=n=>e.check(a_(sM,n)),e.ipv6=n=>e.check(l_(aM,n)),e.cidrv4=n=>e.check(u_(lM,n)),e.cidrv6=n=>e.check(c_(uM,n)),e.e164=n=>e.check(p_(fM,n)),e.datetime=n=>e.check(O_(n)),e.date=n=>e.check(z_(n)),e.time=n=>e.check(W_(n)),e.duration=n=>e.check(H_(n))});function ge(e){return K$(X_,e)}const st=ee("ZodStringFormat",(e,t)=>{Qe.init(e,t),Ub.init(e,t)}),q_=ee("ZodEmail",(e,t)=>{n$.init(e,t),st.init(e,t)}),jy=ee("ZodGUID",(e,t)=>{e$.init(e,t),st.init(e,t)}),ll=ee("ZodUUID",(e,t)=>{t$.init(e,t),st.init(e,t)}),J_=ee("ZodURL",(e,t)=>{r$.init(e,t),st.init(e,t)}),Q_=ee("ZodEmoji",(e,t)=>{o$.init(e,t),st.init(e,t)}),eM=ee("ZodNanoID",(e,t)=>{i$.init(e,t),st.init(e,t)}),tM=ee("ZodCUID",(e,t)=>{s$.init(e,t),st.init(e,t)}),nM=ee("ZodCUID2",(e,t)=>{a$.init(e,t),st.init(e,t)}),rM=ee("ZodULID",(e,t)=>{l$.init(e,t),st.init(e,t)}),oM=ee("ZodXID",(e,t)=>{u$.init(e,t),st.init(e,t)}),iM=ee("ZodKSUID",(e,t)=>{c$.init(e,t),st.init(e,t)}),sM=ee("ZodIPv4",(e,t)=>{m$.init(e,t),st.init(e,t)}),aM=ee("ZodIPv6",(e,t)=>{g$.init(e,t),st.init(e,t)}),lM=ee("ZodCIDRv4",(e,t)=>{y$.init(e,t),st.init(e,t)}),uM=ee("ZodCIDRv6",(e,t)=>{v$.init(e,t),st.init(e,t)}),cM=ee("ZodBase64",(e,t)=>{w$.init(e,t),st.init(e,t)}),dM=ee("ZodBase64URL",(e,t)=>{b$.init(e,t),st.init(e,t)}),fM=ee("ZodE164",(e,t)=>{S$.init(e,t),st.init(e,t)}),pM=ee("ZodJWT",(e,t)=>{E$.init(e,t),st.init(e,t)}),Zb=ee("ZodNumber",(e,t)=>{Bb.init(e,t),ct.init(e,t),e.gt=(r,o)=>e.check(Cy(r,o)),e.gte=(r,o)=>e.check(wd(r,o)),e.min=(r,o)=>e.check(wd(r,o)),e.lt=(r,o)=>e.check(Ey(r,o)),e.lte=(r,o)=>e.check(vd(r,o)),e.max=(r,o)=>e.check(vd(r,o)),e.int=r=>e.check(Ry(r)),e.safe=r=>e.check(Ry(r)),e.positive=r=>e.check(Cy(0,r)),e.nonnegative=r=>e.check(wd(0,r)),e.negative=r=>e.check(Ey(0,r)),e.nonpositive=r=>e.check(vd(0,r)),e.multipleOf=(r,o)=>e.check(Iy(r,o)),e.step=(r,o)=>e.check(Iy(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 ce(e){return w_(Zb,e)}const hM=ee("ZodNumberFormat",(e,t)=>{C$.init(e,t),Zb.init(e,t)});function Ry(e){return x_(hM,e)}const mM=ee("ZodBoolean",(e,t)=>{I$.init(e,t),ct.init(e,t)});function qt(e){return b_(mM,e)}const gM=ee("ZodUnknown",(e,t)=>{T$.init(e,t),ct.init(e,t)});function Wi(){return S_(gM)}const yM=ee("ZodNever",(e,t)=>{j$.init(e,t),ct.init(e,t)});function Kb(e){return k_(yM,e)}const vM=ee("ZodArray",(e,t)=>{R$.init(e,t),ct.init(e,t),e.element=t.element,e.min=(n,r)=>e.check(vu(n,r)),e.nonempty=n=>e.check(vu(1,n)),e.max=(n,r)=>e.check(Vb(n,r)),e.length=(n,r)=>e.check(Hb(n,r)),e.unwrap=()=>e.element});function rt(e,t){return M_(vM,e,t)}const wM=ee("ZodObject",(e,t)=>{P$.init(e,t),ct.init(e,t),qe(e,"shape",()=>t.shape),e.keyof=()=>fr(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Wi()}),e.loose=()=>e.clone({...e._zod.def,catchall:Wi()}),e.strict=()=>e.clone({...e._zod.def,catchall:Kb()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>rF(e,n),e.merge=n=>oF(e,n),e.pick=n=>tF(e,n),e.omit=n=>nF(e,n),e.partial=(...n)=>iF(Gb,e,n[0]),e.required=(...n)=>sF(Xb,e,n[0])});function Ee(e,t){const n={type:"object",get shape(){return Ah(this,"shape",{...e}),this.shape},...Se(t)};return new wM(n)}const xM=ee("ZodUnion",(e,t)=>{F$.init(e,t),ct.init(e,t),e.options=t.options});function yc(e,t){return new xM({type:"union",options:e,...Se(t)})}const bM=ee("ZodIntersection",(e,t)=>{$$.init(e,t),ct.init(e,t)});function SM(e,t){return new bM({type:"intersection",left:e,right:t})}const Yb=ee("ZodRecord",(e,t)=>{_$.init(e,t),ct.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function Zn(e,t,n){return new Yb({type:"record",keyType:e,valueType:t,...Se(n)})}function kM(e,t,n){return new Yb({type:"record",keyType:yc([e,Kb()]),valueType:t,...Se(n)})}const rp=ee("ZodEnum",(e,t)=>{M$.init(e,t),ct.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 rp({...t,checks:[],...Se(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 rp({...t,checks:[],...Se(o),entries:i})}});function fr(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new rp({type:"enum",entries:n,...Se(t)})}const EM=ee("ZodLiteral",(e,t)=>{A$.init(e,t),ct.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function CM(e,t){return new EM({type:"literal",values:Array.isArray(e)?e:[e],...Se(t)})}const IM=ee("ZodTransform",(e,t)=>{N$.init(e,t),ct.init(e,t),e._zod.parse=(n,r)=>{n.addIssue=i=>{if(typeof i=="string")n.issues.push(ca(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(ca(s))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n)):(n.value=o,n)}});function TM(e){return new IM({type:"transform",transform:e})}const Gb=ee("ZodOptional",(e,t)=>{L$.init(e,t),ct.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Py(e){return new Gb({type:"optional",innerType:e})}const jM=ee("ZodNullable",(e,t)=>{O$.init(e,t),ct.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Fy(e){return new jM({type:"nullable",innerType:e})}const RM=ee("ZodDefault",(e,t)=>{D$.init(e,t),ct.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function PM(e,t){return new RM({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const FM=ee("ZodPrefault",(e,t)=>{z$.init(e,t),ct.init(e,t),e.unwrap=()=>e._zod.def.innerType});function $M(e,t){return new FM({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const Xb=ee("ZodNonOptional",(e,t)=>{B$.init(e,t),ct.init(e,t),e.unwrap=()=>e._zod.def.innerType});function _M(e,t){return new Xb({type:"nonoptional",innerType:e,...Se(t)})}const MM=ee("ZodCatch",(e,t)=>{W$.init(e,t),ct.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function AM(e,t){return new MM({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const NM=ee("ZodPipe",(e,t)=>{V$.init(e,t),ct.init(e,t),e.in=t.in,e.out=t.out});function $y(e,t){return new NM({type:"pipe",in:e,out:t})}const LM=ee("ZodReadonly",(e,t)=>{H$.init(e,t),ct.init(e,t)});function OM(e){return new LM({type:"readonly",innerType:e})}const DM=ee("ZodCustom",(e,t)=>{U$.init(e,t),ct.init(e,t)});function zM(e){const t=new un({check:"custom"});return t._zod.check=e,t}function BM(e,t={}){return A_(DM,e,t)}function WM(e){const t=zM(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(ca(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(ca(o))}},e(n.value,n)));return t}const vc=fr(["full-bleed","video-top","pip-bubble","graphic-only","blurred-behind","lower-third","split-left","split-right"]),wc=fr(["TitleCard","StatCard","RuleCard","StrikethroughReveal","FlowDiagram","TerminalMock","ChatMock","ScreenshotFrame","BulletList"]),Oh=Ee({startWord:ce().int().nonnegative(),endWord:ce().int().nonnegative()}),VM=Ee({id:ge(),anchor:Oh,layout:vc,component:wc,props:Zn(ge(),Wi()),overrides:Zn(ge(),Wi()).default({}),rationale:ge().optional()});Ee({id:ge(),kind:fr(["graphic","plain"]).optional(),kept:Ee({srcIn:ce().nonnegative(),srcOut:ce().nonnegative()}).optional(),anchor:Oh.optional(),layout:vc,component:wc.optional(),props:Zn(ge(),Wi()).optional(),startSec:ce().nonnegative(),endSec:ce().nonnegative(),graphicRect:Ee({x:ce(),y:ce(),w:ce(),h:ce()}).optional(),elements:Zn(ge(),Ee({dx:ce().optional(),dy:ce().optional(),scale:ce().positive().optional(),hidden:qt().optional()})).optional(),video:Ee({scale:ce().positive().max(4).optional(),dy:ce().optional(),dx:ce().optional(),autoZoom:qt().optional()}).optional(),pip:Ee({cornerRadius:ce().min(0).max(1).optional(),x:ce().min(0).max(1).optional(),y:ce().min(0).max(1).optional()}).optional(),captionY:ce().min(0).max(1).optional(),captionScale:ce().min(.2).max(3).optional(),pinned:qt().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'})});Ee({centerYFrac:ce().min(0).max(1),sizeFrac:ce().min(0).max(1).optional(),centerXFrac:ce().min(0).max(1).optional(),sourceAspect:ce().positive().optional(),subject:fr(["face","screen"]).optional()});const xc=Ee({bg:ge().default("#0B0B0E"),fg:ge().default("#FFFFFF"),accent:ge().default("#FFE14D"),muted:ge().default("#9A9AA3"),success:ge().default("#5FBF77"),cardBg:ge().default("#15151B"),cardBorder:ge().default("#2A2A33"),danger:ge().default("#FF5C5C"),radiusPx:ce().default(24),fontDisplay:ge().default("'Inter', 'Helvetica Neue', 'Arial Black', Arial, sans-serif"),fontMono:ge().default("'SF Mono', 'Cascadia Code', Consolas, monospace")}),HM=xc.parse({}),UM=Ee({eyebrow:ge().max(28).optional(),title:ge().min(1).max(48).describe("the claim WITHOUT the emphasis token — never repeat the emphasis here"),emphasis:ge().max(16).optional().describe("the number/punch token pulled OUT of the title (e.g. '861%') — not a duplicate of it"),sub:ge().max(64).optional()}),ZM=Ee({label:ge().min(1).max(28),value:ge().min(1).max(12),caption:ge().max(40).optional(),inverted:qt().default(!1)}),KM=Ee({kicker:ge().min(1).max(24),text:ge().min(1).max(40),struck:ge().max(40).optional()}),YM=Ee({lines:rt(Ee({text:ge().min(1).max(32),struck:qt().default(!1),mark:fr(["none","cross","check"]).default("none")})).min(1).max(4)}),GM=Ee({title:ge().max(28).optional(),items:rt(ge().min(1).max(36)).min(2).max(5)}),XM=Ee({nodes:rt(ge().min(1).max(16)).min(2).max(5),emphasizeLast:qt().default(!0)}),qM=Ee({windows:rt(Ee({title:ge().max(24),lines:rt(ge().max(40)).min(1).max(6)})).min(1).max(5),fanOut:ge().max(20).optional()}),JM=Ee({messages:rt(Ee({from:fr(["user","agent"]),text:ge().min(1).max(60)})).min(1).max(4),keyword:ge().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'.")}),QM=Ee({src:ge().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:ge().max(32).optional(),kenBurns:qt().default(!0)}),qb={TitleCard:{propsSchema:UM,defaultProps:{title:"TITLE"},defaultLayout:"pip-bubble",altLayouts:[],whenToUse:"The core claim or hook as big typography; use `emphasis` for a huge number or punch word."},StatCard:{propsSchema:ZM,defaultProps:{label:"METRIC",value:"+0%"},defaultLayout:"video-top",altLayouts:["blurred-behind"],whenToUse:"One striking metric (value like '+242%', '×3', '5s'); punchline in `caption`."},RuleCard:{propsSchema:KM,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:YM,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:XM,defaultProps:{nodes:["A","B"]},defaultLayout:"graphic-only",altLayouts:[],whenToUse:"A causal chain or pipeline as chips with arrows (TEAM → AI AGENTS → CHURN)."},TerminalMock:{propsSchema:qM,defaultProps:{windows:[{title:"terminal-01",lines:["$ run"]}]},defaultLayout:"graphic-only",altLayouts:[],whenToUse:"Anything about running code/processes/agents — stylized terminal windows."},ChatMock:{propsSchema:JM,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:QM,defaultProps:{},defaultLayout:"video-top",altLayouts:["blurred-behind"],whenToUse:"Reference to a document/PR/review — a framed screenshot look with a label chip."},BulletList:{propsSchema:GM,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 _y(e,t,n={}){const r=qb[e],o={...r.defaultProps,...t,...n},i=r.propsSchema.safeParse(o);return i.success?i.data:null}function e4(e){const t=qb[e];if(!t)return[];const n=N_(t.propsSchema),r=[];for(const[o,i]of Object.entries(n.properties??{})){if(Array.isArray(i.enum)&&i.enum.every(s=>typeof s=="string")){r.push({key:o,kind:"enum",options:i.enum});continue}i.type==="boolean"&&r.push({key:o,kind:"boolean",fallback:i.default===!0})}return r}const t4=Ee({text:ge(),start:ce().nonnegative(),end:ce().nonnegative(),conf:ce().min(0).max(1).optional()}),n4=Ee({language:ge().default("en"),words:rt(t4)}),r4=fr(["exact","light","standard","aggressive"]),Jb=fr(["silence","pause","filler","retake","user","clip"]),My=Ee({srcIn:ce().nonnegative(),srcOut:ce().nonnegative(),kind:fr(["keep","remove"]),reason:Jb.optional(),confidence:ce().min(0).max(1).optional()}),ul=Ee({start:ce(),end:ce()}),o4=Ee({silences:rt(ul),gaps:rt(ul),cuttable:rt(ul),breaths:rt(ul).default([]),fillers:rt(Ee({wordIndex:ce().int(),text:ge(),start:ce(),end:ce()}))}),i4=Ee({duration:ce().positive(),width:ce().int().positive(),height:ce().int().positive(),fps:ce().positive(),hasAudio:qt(),rotation:ce().int().optional()}),s4=Ee({width:ce().int().positive().default(1080),height:ce().int().positive().default(1920),fps:ce().positive().default(30)});Ee({version:CM(1),source:Ee({path:ge(),probe:i4,audioPath:ge().optional(),mezzaninePath:ge().optional(),face:Ee({centerXFrac:ce(),centerYFrac:ce(),sizeFrac:ce(),framesSampled:ce().int(),framesDetected:ce().int()}).nullable().optional()}),cleanup:r4,intent:ge().optional(),transcript:n4.optional(),repairs:rt(Ee({startWord:ce().int(),endWord:ce().int(),heard:ge(),correction:ge(),applied:qt(),rejected:ge().optional()})).optional(),analysis:o4.optional(),cutlist:rt(My).optional(),cutlistProposed:rt(My).optional(),clip:Ee({targetSec:ce().positive(),startWord:ce().int().nonnegative(),endWord:ce().int().nonnegative(),startSec:ce().nonnegative(),endSec:ce().nonnegative(),reason:ge()}).optional(),scenes:rt(VM).optional(),producer:Ee({provider:ge(),models:rt(ge()).default([]),cached:qt().default(!1),at:ge().optional()}).optional(),theme:xc.optional(),render:s4});const a4=Ee({dx:ce().optional(),dy:ce().optional(),scale:ce().positive().optional(),hidden:qt().optional()}),l4=yc([Ee({startSec:ce().finite().nonnegative(),endSec:ce().finite().nonnegative()}),Ee({srcStart:ce().finite().nonnegative(),srcEnd:ce().finite().nonnegative()}).refine(e=>e.srcEnd>e.srcStart,{message:"srcEnd must be after srcStart"})]);function Dh(e){return"srcStart"in e}const Qb=Ee({props:Zn(ge(),Wi()).default({}),elements:Zn(ge(),a4).default({}),timing:l4.optional(),component:wc.optional(),layout:vc.optional(),video:Ee({scale:ce().positive().max(4).optional(),dy:ce().optional(),dx:ce().optional(),autoZoom:qt().optional()}).optional(),pip:Ee({cornerRadius:ce().min(0).max(1).optional(),x:ce().min(0).max(1).optional(),y:ce().min(0).max(1).optional()}).optional(),captionY:ce().min(0).max(1).optional(),captionScale:ce().min(.2).max(3).optional(),graphicRect:Ee({x:ce().min(0).max(1),y:ce().min(0).max(1),w:ce().min(.08).max(1),h:ce().min(.05).max(1)}).optional(),anchor:Oh.optional(),hidden:qt().optional()}),u4=Ee({text:ge().min(1).max(80),was:ge()}),c4=Ee({fromKey:ge().regex(/^w\d+$/),toKey:ge().regex(/^w\d+$/),text:ge().min(1).max(400),was:ge()});function Ay(e,t,n){var r;return((r=e[t])==null?void 0:r.was)??n}function Ny(e,t,n,r){var o;return((o=e.find(i=>i.fromKey===t&&i.toKey===n))==null?void 0:o.was)??r}function eS(e){return String(Math.round(e*1e3))}const d4=yc([Ee({at:ce().finite().nonnegative().optional(),src:ce().finite().nonnegative().optional(),id:ge().min(1)}).refine(e=>e.at!==void 0||e.src!==void 0,{message:"a split needs `at` or `src`"}),ce().finite().nonnegative().transform(e=>({at:e,src:void 0,id:eS(e)}))]);function zh(e){return e.flatMap(t=>t.at!==void 0?[{at:t.at,id:t.id}]:[])}function f4(e,t){const n=[],r=[];for(const o of e)if(o.src!==void 0){const i=t.toOutput(o.src);if(i===null){r.push(`split "${o.id}" sits in removed material (source ${o.src.toFixed(3)}s) — inert until that material is kept again`);continue}n.push({at:i,id:o.id})}else o.at!==void 0&&n.push({at:o.at,id:o.id});return{points:n,reports:r}}function p4(e,t){const n=eS(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 h4=Ee({theme:xc.partial().default({}),captionsHidden:qt().optional(),scenes:Zn(ge(),Qb).default({}),captions:Zn(ge(),u4).default({}),captionWordsHidden:Zn(ge(),Ee({was:ge()})).default({}),captionRangeEdits:rt(c4).default([]),captionLineTiming:Zn(ge(),Ee({lead:ce().min(-30).max(30),tail:ce().min(-30).max(30)})).default({}),captionLineWindows:Zn(ge(),Ee({srcStart:ce(),srcEnd:ce()}).refine(e=>e.srcEnd-e.srcStart>=xu,{message:"caption window must be at least 50ms (MIN_CAPTION_SEC) wide, ordered start → end"})).default({}),splits:rt(d4).default([]),cuts:rt(Ee({startSec:ce().nonnegative(),endSec:ce().nonnegative(),src:Ee({startSec:ce().nonnegative(),endSec:ce().nonnegative()}).optional()})).default([]),cleanup:Ee({reasons:kM(Jb,qt()).default({}),kept:rt(Ee({srcIn:ce().nonnegative(),srcOut:ce().nonnegative()})).default([]),dismissed:rt(Ee({srcIn:ce().nonnegative(),srcOut:ce().nonnegative()})).default([])}).default({reasons:{},kept:[],dismissed:[]})}),m4=()=>h4.parse({});function g4(e,t){return _y(e,{},t)??_y(e,{},{})}function y4(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 v4(e,t){if(!Dh(e))return{startSec:e.startSec,endSec:e.endSec};const n=t.toOutput(e.srcStart),r=t.toOutput(e.srcEnd);return n===null||r===null?null:{startSec:n,endSec:r}}function Ly(e,t){const n=Object.keys(e.scenes).filter(i=>{var a;const s=(a=e.scenes[i])==null?void 0:a.timing;return s!==void 0&&Dh(s)});if(n.length===0)return{doc:e,reports:[]};const r=[],o={...e.scenes};for(const i of n){const s=o[i],a=v4(s.timing,t);if(a===null){const{timing:l,...c}=s;o[i]=c,r.push(`pinned timing for "${i}" is not in this cut — pin inert`);continue}o[i]={...s,timing:a}}return{doc:{...e,scenes:o},reports:r}}function Ol(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=y4(t.scenes,i.id);if(!s)return i;const a=s.component!==void 0&&s.component!==i.component,l=s.component??i.component,c=s.component!==void 0&&a?g4(s.component,s.props):{...i.props,...s.props},f=s.layout!==void 0&&s.layout!==i.layout,{graphicRect:p,...m}=i;return{...f?m:i,component:l,layout:s.layout??i.layout,props:c,...Object.keys(s.elements).length>0?{elements:s.elements}:{},...s.video?{video:s.video}:{},...s.pip?{pip:s.pip}:{},...s.captionY!==void 0?{captionY:s.captionY}:{},...s.captionScale!==void 0?{captionScale:s.captionScale}:{},...s.graphicRect?{graphicRect:s.graphicRect}:{},...s.timing&&!Dh(s.timing)&&!i.pinned?{startSec:s.timing.startSec,endSec:s.timing.endSec,pinned:!0}:{}}}),orphans:r}}const Vi=.3;function wu(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+Vi&&r.at<=s.endSec-Vi);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 tS(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 w4(e,t,n=zh(t.splits)){return tS(wu(e,n),t)}function x4(e,t){const n=new Map;for(const o of t)o.anchor&&n.set(o.id,o.anchor);const r={};for(const[o,i]of Object.entries(e.scenes)){const s=n.get(o);r[o]=s?{...i,anchor:s}:i}return{...e,scenes:r}}function yn(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 da(e){return/^\d+$/.test(e)}function He(e){return!e||!Number.isFinite(e.srcStart)?null:yn(e.srcStart)}const b4=8;function S4(e,t,n){var i,s;if(!da(e))return{to:e};const r=Number(e);if(((i=n[r])==null?void 0:i.text)===t.was)return Oy(n[r]);const o=[];for(let a=1;a<=b4;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"}:Oy(n[o[0]])}function Oy(e){const t=He(e);return t===null?{to:null,reason:"unanchorable"}:{to:t}}function k4(e,t){const n=t.flatMap(a=>a.words),r={},o=[],i=Object.entries(e).map(([a,l])=>({key:a,edit:l,legacy:da(a),claim:S4(a,l,n)})),s=new Map;for(const a of i){if(a.claim.to===null)continue;const l=s.get(a.claim.to);l?l.push(a):s.set(a.claim.to,[a])}for(const a of i){if(a.claim.to===null){o.push({key:a.key,was:a.edit.was,reason:a.claim.reason});continue}const l=s.get(a.claim.to),c=l.length===1?l[0]:l.find(f=>!f.legacy);if(c===a){r[a.claim.to]=a.edit;continue}o.push({key:a.key,was:a.edit.was,reason:c===void 0?"collision":"superseded"})}return{edits:r,unresolved:o}}function E4(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 nS(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 C4(e,t,n,r){const o=e.map(l=>l.length+1),i=o.reduce((l,c)=>l+c,0),s=[];let a=t;for(let l=0;l<e.length;l++){const c=(n-t)*o[l]/i,f=l===e.length-1?n:a+c;s.push({text:e[l],start:a,end:f,srcStart:r[l]}),a=f}return s}function rS(e,t){const n=[];if(t.length===0)return{lines:[...e],dropped:n};let r=[...e];const o=new Set,i=new Set;for(const s of t){const a=`${s.fromKey}..${s.toKey}`,l=[];for(let M=0;M<r.length;M++)for(let $=0;$<r[M].words.length;$++)l.push({line:M,word:$,w:r[M].words[$]});const c=l.findIndex(M=>He(M.w)===s.fromKey);if(o.has(a)||i.has(s.fromKey)){n.push({key:a,expected:s.was,found:c===-1?null:l[c].w.text,reason:"duplicate-anchor"});continue}if(c===-1){n.push({key:a,expected:s.was,found:null});continue}let f=-1;for(let M=c;M<l.length;M++)if(He(l[M].w)===s.toKey){f=M;break}if(f===-1){n.push({key:a,expected:s.was,found:null});continue}const p=l.slice(c,f+1),m=p.map(M=>M.w.text).join(" ").normalize("NFC");if(m!==s.was.normalize("NFC")){n.push({key:a,expected:s.was,found:m});continue}const y=s.text.trim().split(/\s+/).filter(Boolean);if(y.length===0){n.push({key:a,expected:s.was,found:m});continue}o.add(a);for(const M of p){const $=He(M.w);$!==null&&i.add($)}if(y.length===p.length){const M=new Map(p.map(($,D)=>[`${$.line}:${$.word}`,y[D]]));r=r.map(($,D)=>({...$,words:$.words.map((H,P)=>{const T=M.get(`${D}:${P}`);return T===void 0?H:{...H,text:T}})}));continue}const w=[],x=new Map;for(const M of p){const $=x.get(M.line);$?($.last=M.word,$.words.push(M.w)):(w.push(M.line),x.set(M.line,{first:M.word,last:M.word,words:[M.w]}))}const S=w.map(M=>x.get(M).words.reduce(($,D)=>$+(D.end-D.start),0)),h=S.reduce((M,$)=>M+$,0),g=h>0?S:S.map(()=>1),v=h>0?h:S.length,b=g.map(M=>y.length*M/v),k=b.map(M=>Math.floor(M));let E=y.length-k.reduce((M,$)=>M+$,0);const C=b.map((M,$)=>({i:$,rem:M-Math.floor(M)})).sort((M,$)=>$.rem-M.rem||M.i-$.i);for(let M=0;E>0;M=(M+1)%C.length)k[C[M].i]++,E--;const I=p[0].w.srcStart,j=p[p.length-1].w.srcStart,F=y.map((M,$)=>y.length===1?I:I+(j-I)*$/(y.length-1));let L=0;const V=[];for(let M=0;M<r.length;M++){const $=r[M],D=x.get(M);if(!D){V.push($);continue}const H=k[w.indexOf(M)],P=y.slice(L,L+H),T=F.slice(L,L+H);L+=H;const W=H===0?[]:C4(P,D.words[0].start,D.words[D.words.length-1].end,T),R=[...$.words.slice(0,D.first),...W,...$.words.slice(D.last+1)];R.length!==0&&V.push({...$,words:R})}r=V}return{lines:r,dropped:n}}function oS(e,t){const n=[];if(Object.keys(t).length===0)return{lines:[...e],dropped:n};const r=new Set,o=[];for(const i of e){const s=[];for(const m of i.words){const y=He(m),w=y===null?void 0:t[y];if(y===null||!w){s.push(m);continue}if(r.has(y)){n.push({key:y,expected:w.was,found:m.text,reason:"duplicate-anchor"}),s.push(m);continue}if(r.add(y),m.text!==w.was){n.push({key:y,expected:w.was,found:m.text}),s.push(m);continue}}if(s.length===i.words.length){o.push(i);continue}if(s.length===0)continue;const a=i.words[i.words.length-1],l=s[0],c=s[s.length-1],f=l===i.words[0]?i.start:l.start,p=c===a?i.end:Math.max(c.end,c.end+(i.end-a.end));o.push({words:s,start:f,end:p})}for(const[i,s]of Object.entries(t))r.has(i)||n.push({key:i,expected:s.was,found:null});return{lines:o,dropped:n}}const xu=.05;function iS(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 sS(e,t){const n=[],r=e.length;if(r===0){for(const f of Object.keys(t))n.push({key:f,expected:"",found:null});return{lines:[],dropped:n}}if(Object.keys(t).length===0)return{lines:[...e],dropped:n};const o=e.map(f=>f.start),i=e.map(f=>f.end),s=new Set;for(let f=0;f<r;f++){const p=e[f],m=He(p.words[0]),y=m===null?void 0:t[m];if(!(m===null||!y)){if(s.has(m)){n.push({key:m,expected:"",found:p.words[0].text,reason:"duplicate-anchor"});continue}s.add(m),i[f]=p.end+y.tail,f+1<r&&e[f+1].start===p.end&&(o[f+1]=i[f]),o[f]=p.start+y.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]+xu),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]-xu),a)}const c=e.map((f,p)=>{const m=o[p],y=i[p];return m===f.start&&y===f.end?f:{...f,start:m,end:y,words:iS(f.words,f.start,f.end,m,y)}});for(const f of Object.keys(t))s.has(f)||n.push({key:f,expected:"",found:null});return{lines:c,dropped:n}}function aS(e,t,n){const r=[];if(e.length===0){for(const s of Object.keys(t))r.push({key:s,expected:"",found:null});return{lines:[],dropped:r}}if(Object.keys(t).length===0)return{lines:[...e],dropped:r};const o=new Set,i=e.map(s=>{const a=He(s.words[0]),l=a===null?void 0:t[a];if(a===null||!l)return s;if(o.has(a))return r.push({key:a,expected:"",found:s.words[0].text,reason:"duplicate-anchor"}),s;o.add(a);const c=n.toOutputClamped(l.srcStart),f=Math.max(n.toOutputClamped(l.srcEnd),c+xu);return c===s.start&&f===s.end?s:{...s,start:c,end:f,words:iS(s.words,s.start,s.end,c,f)}});for(const s of Object.keys(t))o.has(s)||r.push({key:s,expected:"",found:null});return{lines:i,dropped:r}}function I4(e,t){return xc.parse({...e,...t.theme})}function Dy(e,t,n,r){const o=e.scenes[t]??Qb.parse({});return{...e,scenes:{...e.scenes,[t]:{...o,elements:{...o.elements,[n]:{...o.elements[n],...r}}}}}}function T4(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 j4(e,t,n){const r=e.scenes[t],o=r==null?void 0:r.elements[n];if(!r||!(o!=null&&o.hidden))return e;const{hidden:i,...s}=o,{[n]:a,...l}=r.elements,c=Object.keys(s).length>0?{...r.elements,[n]:s}:l;return{...e,scenes:{...e.scenes,[t]:{...r,elements:c}}}}function R4(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 P4(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 lS(e){const t=e.indexOf("@");return t===-1?e:e.slice(0,t)}const F4=.6;function $4(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 _4(e,t){const n=t.outputDurationSec,r=[...e].sort((f,p)=>f.startSec-p.startSec);if(n<=0)return r;const o=$4(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(y=>y>f.start+1e-9&&y<f.end-1e-9),m=[f.start,...p,f.end];for(let y=0;y<m.length-1;y++){const w=m[y],x=m[y+1];if(x-w<F4)continue;let S=0;for(let h=0;h<o.length;h++)o[h]<=w+1e-9&&(S=h);a.push({start:w,end:x,clip:S})}}const l=new Map,c=a.map(f=>{const p=l.get(f.clip)??0;return l.set(f.clip,p+1),{id:p===0?`take-${f.clip}`:`take-${f.clip}-${p}`,kind:"plain",layout:"full-bleed",startSec:f.start,endSec:f.end}});return[...r,...c].sort((f,p)=>f.startSec-p.startSec)}const M4=1.05;function A4(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 N4(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 bc{constructor(t){Oe(this,"spans");Oe(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 Fo(e){return new bc(e.map(t=>({srcIn:t.srcIn,srcOut:t.srcOut,kind:"keep"})))}function uS(e,t,n){return Math.abs(e.outputDuration-t.outputDuration)>n||e.spans.length!==t.spans.length?!1:e.spans.every((r,o)=>{const i=t.spans[o];return Math.abs(r.srcIn-i.srcIn)<=n&&Math.abs(r.srcOut-i.srcOut)<=n&&Math.abs(r.outIn-i.outIn)<=n&&Math.abs(r.outOut-i.outOut)<=n})}function zy(e,t){const n=o=>o.words;if(e.every(o=>n(o).every(i=>i.srcStart!==void 0)))return[...e];const r=Fo(t);return e.map(o=>({...o,words:n(o).map(i=>i.srcStart===void 0?{...i,srcStart:r.toSource(i.start)}:i)}))}const L4=/[\p{Script=Arabic}\p{Script=Hebrew}\p{Script=Syriac}\p{Script=Thaana}\p{Script=Nko}]/u,O4=new RegExp("\\p{L}","u");function Bh(e){for(const t of e){if(L4.test(t))return"rtl";if(O4.test(t))return"ltr"}return"ltr"}const fa="Noto Nastaliq Urdu",cS="fonts/NotoNastaliqUrdu-Bold.ttf";function D4(e){return e.some(t=>Bh(t.words.map(n=>n.text).join(" "))==="rtl")}const z4=1.5,By=.7;function B4(e,t={}){const n=[...t.breakpoints??[]].sort((r,o)=>r-o);return e.map((r,o)=>{if(r.end-r.start>=By)return r;let i=r.start+By;const s=e[o+1];s&&(i=Math.min(i,s.start));const a=n.find(l=>l>r.start+1e-6);return a!==void 0&&(i=Math.min(i,a)),t.maxEnd!==void 0&&(i=Math.min(i,t.maxEnd)),i<=r.end?r:{...r,end:i}})}function W4(e){return e?{maxWordsPerLine:6,maxLineDuration:2.4}:{maxWordsPerLine:3,maxLineDuration:1.2}}function V4(e,t,n={}){var m,y;const r=n.maxWordsPerLine??3,o=n.maxLineDuration??1.2,i=n.maxGap??.6,s=n.hold??.35,a=[...n.breakpoints??[]].sort((w,x)=>w-x),l=[];for(const w of e.words){const x=t.mapWord(w);if(x){const S=Math.max(x.start,x.end-z4);l.push({text:w.text,start:S,end:x.end,srcStart:w.start})}}const c=[];let f=[];const p=()=>{f.length!==0&&(c.push({words:f,start:f[0].start,end:f[f.length-1].end}),f=[])};for(const w of l){const x=((m=f[0])==null?void 0:m.start)??w.start,S=(y=f[f.length-1])==null?void 0:y.end,h=f.length>0&&a.some(g=>g>x+1e-6&&g<=w.start+1e-6);(f.length>=r||w.end-x>o||S!==void 0&&w.start-S>i||h)&&p(),f.push(w)}p();for(let w=0;w<c.length;w++){const x=c[w],S=c[w+1],h=x.words[x.words.length-1].end,g=a.find(b=>b>x.start+1e-6);let v=x.end+s;S&&(v=Math.min(v,S.start)),g!==void 0&&(v=Math.min(v,g)),x.end=Math.min(Math.max(v,h),t.outputDuration)}return B4(c,{breakpoints:a,maxEnd:t.outputDuration})}const dS=9,H4=new Set(["a","an","and","as","at","but","by","for","from","in","is","it","of","on","or","the","to","with","that","this","my","your","so","had","has","have","was","were","will","can","should","i"]);function U4(e,t=dS){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&&H4.has(s[s.length-1].toLowerCase().replace(/\W/g,""));)s.pop();return s.join(" ").replace(/[,;:—–-]+$/,"")}function Sc(e){return e!=="user"&&e!=="clip"}function Wh(e,t){if(!t)return[];const n=t.kept??[];return e.filter(r=>{var o;return r.kind==="remove"&&Sc(r.reason)&&(r.reason!==void 0&&((o=t.reasons)==null?void 0:o[r.reason])===!1||n.some(i=>i.srcIn<r.srcOut&&i.srcOut>r.srcIn))})}function Vh(e,t){const n=(t==null?void 0:t.dismissed)??[];return n.length===0?[]:e.filter(r=>r.kind==="remove"&&Sc(r.reason)&&n.some(o=>o.srcIn<r.srcOut&&o.srcOut>r.srcIn))}function Z4(e,t){const n=new Set([...Wh(e,t),...Vh(e,t)]);if(n.size===0)return[...e];const r=[];for(const o of e){const i=n.has(o)?{srcIn:o.srcIn,srcOut:o.srcOut,kind:"keep"}:o,s=r[r.length-1];if(s!==void 0&&s.kind==="keep"&&i.kind==="keep"){s.srcOut=i.srcOut;continue}r.push(i.kind==="keep"?{srcIn:i.srcIn,srcOut:i.srcOut,kind:"keep"}:i)}return r}function K4(e){return`take-kept-${Math.round(e*1e3)}`}const cl=.05;function Y4(e,t,n){const r=[...e],o=[];for(const i of t){const s=K4(i.srcIn),a=`kept range ${i.srcIn.toFixed(3)}–${i.srcOut.toFixed(3)}s`;if(r.some(h=>h.id===s||h.id.startsWith(`${s}@`)))continue;if(i.srcOut-i.srcIn<Vi){o.push(`${a} is shorter than ${Vi}s — shown in the lane only`);continue}const l=n.toOutput(i.srcIn),c=n.toOutput(i.srcOut);if(l===null||c===null||c<=l){o.push(`${a} is not in this cut — no block carved`);continue}const f=r.findIndex(h=>h.startSec<=l+1e-6&&h.endSec>l+1e-6),p=f===-1?void 0:r[f];if(p===void 0){if(r.some(k=>k.startSec<c-1e-6&&k.endSec>l+1e-6)){o.push(`${a} straddles existing cues — no block carved`);continue}const g=[...r].filter(k=>k.kind==="plain").sort((k,E)=>Math.abs(k.startSec-l)-Math.abs(E.startSec-l))[0],v={id:s,kind:"plain",layout:(g==null?void 0:g.layout)??"video-top",...(g==null?void 0:g.video)!==void 0?{video:g.video}:{},startSec:l,endSec:c,...i.dismissed===!0?{}:{kept:{srcIn:i.srcIn,srcOut:i.srcOut}}},b=r.findIndex(k=>k.startSec>=c-1e-6);r.splice(b===-1?r.length:b,0,v);continue}if(p.kind!=="plain"){o.push(`${a} sits under graphic "${p.id}" — the graphic keeps the window`);continue}const m=Math.min(c,p.endSec);m<c-1e-6&&o.push(`${a} crosses out of take "${p.id}" — carved up to its edge (${m.toFixed(3)}s)`);const y={...p,id:s,startSec:Math.max(p.startSec,l),endSec:m,...i.dismissed===!0?{}:{kept:{srcIn:i.srcIn,srcOut:i.srcOut}}},w=l-p.startSec,x=p.endSec-m,S=[...w>=cl?[{...p,endSec:l}]:[],w>=cl?y:{...y,startSec:p.startSec},...x>=cl?[{...p,startSec:m}]:[]];if(x<cl){const h=S[S.length-1];S[S.length-1]={...h,endSec:p.endSec}}r.splice(f,1,...S)}return{cues:r,reports:o}}function G4(e,t,n,r,o){const i=n.toSource(t),s=r.toOutput(i);if(s!==null)return s;const a=r.toOutputClamped(i);return o.push(`${e} at ${t.toFixed(3)}s fell inside the new cut — snapped to ${a.toFixed(3)}s`),a}function X4(e,t){const n=[...t].sort((o,i)=>o.start-i.start);if(n.length===0)return[...e];const r=[];for(const o of e){if(o.kind!=="keep"){r.push(o);continue}let i=o.srcIn;for(const s of n){const a=Math.max(i,s.start),l=Math.min(o.srcOut,s.end);a>=l||(a>i&&r.push({srcIn:i,srcOut:a,kind:"keep"}),r.push({srcIn:a,srcOut:l,kind:"remove",reason:"user",confidence:1}),i=l)}i<o.srcOut&&r.push({srcIn:i,srcOut:o.srcOut,kind:"keep"})}return r}const Hh=1e-6;function q4(e,t,n,r){var a,l;const o=Object.values((t==null?void 0:t.reasons)??{}).some(c=>c===!1)||(((a=t==null?void 0:t.kept)==null?void 0:a.length)??0)>0||(((l=t==null?void 0:t.dismissed)==null?void 0:l.length)??0)>0,i=n.flatMap(c=>c.src!==void 0&&c.src.endSec>c.src.startSec?[{start:c.src.startSec,end:c.src.endSec}]:[]);if(!(o||i.length>0)||r.length===0||e.length===0&&i.length===0)return null;try{const c=e.length>0?Z4(e,t):r.map(m=>({srcIn:m.srcIn,srcOut:m.srcOut,kind:"keep"})),f=new bc(X4(c,i)),p=Fo(r);return uS(p,f,Hh)?null:{oldMap:p,newMap:f}}catch{return null}}function J4(e,t={}){if(e===null){const o=i=>i;return{toLive:o,fromLive:o,hasOldClockPreimage:()=>!0,toSourceSec:t.identityToSource??null,oldToSourceSec:t.identityToSource??null}}const{oldMap:n,newMap:r}=e;return{toLive:o=>{const i=n.toSource(o);return r.toOutput(i)??r.toOutputClamped(i)},fromLive:o=>{const i=r.toSource(o);return n.toOutput(i)??n.toOutputClamped(i)},hasOldClockPreimage:o=>n.toOutput(r.toSource(o))!==null,toSourceSec:o=>r.toSource(o),oldToSourceSec:o=>n.toSource(o)}}function fS(e,t,n){const r=e.fromLive(t),o=e.fromLive(n);return o-r<Hh?{kind:"degenerate"}:e.hasOldClockPreimage(t)&&e.hasOldClockPreimage(n)?{kind:"exact",startSec:r,endSec:o}:{kind:"shrunk",startSec:r,endSec:o,report:`cut ${t.toFixed(3)}s–${n.toFixed(3)}s trimmed to the last render's ${r.toFixed(3)}s–${o.toFixed(3)}s — the revived material at its edge isn't in the last render yet`}}function Q4(e,t,n){const r=[],o=(s,a)=>G4(s,a,t,n,r),i={spans:n.spans.map(s=>({...s})),outputDurationSec:n.outputDuration,captionLines:e.captionLines.map((s,a)=>({...s,start:o(`caption line ${a+1} start`,s.start),end:o(`caption line ${a+1} end`,s.end),words:s.words.map(l=>({...l,start:o(`caption word "${l.text}" start`,l.start),end:o(`caption word "${l.text}" end`,l.end)}))})),sceneCues:e.sceneCues.flatMap(s=>{const a=o(`scene "${s.id}" start`,s.startSec),l=o(`scene "${s.id}" end`,s.endSec);return l-a<Hh?(r.push(`scene "${s.id}" removed from the live preview by a cut`),[]):[{...s,startSec:a,endSec:l}]}),punch:{scale:1,allowed:[]}};return e.zoomPlan&&(i.zoomPlan=e.zoomPlan.map((s,a)=>({...s,startSec:o(`zoom segment ${a+1} start`,s.startSec),endSec:o(`zoom segment ${a+1} end`,s.endSec)}))),e.ctaWindow&&(i.ctaWindow={startSec:o("CTA window start",e.ctaWindow.startSec),endSec:o("CTA window end",e.ctaWindow.endSec)}),e.sourceTextRegions&&(i.sourceTextRegions=e.sourceTextRegions.map((s,a)=>({...s,startSec:o(`source text region ${a+1} start`,s.startSec),endSec:o(`source text region ${a+1} end`,s.endSec)}))),{fields:i,reports:r}}function dl(e){const t=/^w(-?\d+)$/.exec(e);return t?Number(t[1]):null}function eA(e,t){const n=[];if(t.length===0)return{doc:e,reports:n};const r=new Map;for(const s of t)r.set(s.fromMs,s.toMs);const o=(s,a)=>{const l={},c=Object.entries(s).sort((f,p)=>(dl(f[0])??0)-(dl(p[0])??0));for(const[f,p]of c){const m=dl(f),y=m===null?void 0:r.get(m),w=y===void 0?f:`w${y}`;if(!(w in l)){l[w]=p;continue}f in l?n.push(`${a} entry ${f} collided on both ${w} and its own key — dropped`):(l[f]=p,n.push(`${a} entry ${f} could not move to ${w} — another entry is already there; left where it was`))}return l},i=s=>{const a=dl(s),l=a===null?void 0:r.get(a);return l===void 0?s:`w${l}`};return{doc:{...e,captions:o(e.captions,"caption retype"),captionWordsHidden:o(e.captionWordsHidden,"caption hide"),captionLineTiming:o(e.captionLineTiming,"caption timing"),captionLineWindows:o(e.captionLineWindows,"caption window"),captionRangeEdits:e.captionRangeEdits.map(s=>({...s,fromKey:i(s.fromKey),toKey:i(s.toKey)}))},reports:n}}const cn={width:1080,height:1920};cn.width;cn.height;const $a={centerYFrac:.38,sizeFrac:.22},tA=.35,nA=.45,pS=1-1/M4,rA=.4*pS,oA=.6*pS;function hS(e,t,n=cn){const r=e.w*n.width,o=e.h*n.height;return Math.max(o,r/(t.sourceAspect??n.width/n.height))}function iA(e,t,n=cn){if(t.subject==="screen")return .5;const r=e.h*n.height,o=hS(e,t,n),i=o-r;if(i<=1)return .5;const s=t.sizeFrac??$a.sizeFrac,a=(t.centerYFrac-s/2-tA*s)*o,l=(t.centerYFrac+s/2)*o,c=(a+l)/2-nA*r,f=a-rA*r,p=l+oA*r-r,m=p<=f?Math.min(Math.max(c,p),f):p;return Math.min(1,Math.max(0,m/i))}function sA(e,t,n,r,o=cn){if(r.length===0)return e;const i=t.h*o.height,s=hS(t,n,o);if(s-i<=1)return e;const l=i/s,c=1-l;if(c<=0)return e;let f=e*c;for(let p=0;p<r.length+1;p++){const m=r.find(v=>{const b=v.y,k=v.y+v.h,E=f+l,C=b<f&&f<k,I=b<E&&E<k;return C||I});if(!m)break;const y=[],w=m.y+m.h;w<=c&&y.push(w);const x=m.y-l;if(x>=0&&y.push(x),m.h<=l){const v=Math.max(0,m.y+m.h-l),b=Math.min(c,m.y);v<=b&&y.push(Math.min(Math.max(f,v),b))}const S=n.sizeFrac??$a.sizeFrac,h=n.centerYFrac+S/2,g=y.filter(v=>v+l>=h);if(g.length===0)return e;f=g.reduce((v,b)=>Math.abs(b-f)<Math.abs(v-f)?b:v)}return Math.min(1,Math.max(0,f/c))}function aA(e,t,n=cn){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 lA={top:.12,bottom:.22,right:.16,left:.04},uA={top:.06,bottom:.12,right:.05,left:.05};function or(e=cn){return e.width>e.height?uA:lA}function cA(e=cn){const t=or(e);return{x:t.left,y:t.top,w:1-t.left-t.right,h:1-t.top-t.bottom}}const dA=.08,fA=.05;function bu(e,t=cn){const n=cA(t),r=1e-9,o=(c,f,p)=>c<f-r?f:c>p+r?p:c,i=o(e.w,dA,n.w),s=o(e.h,fA,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 Wy=.045;function pA(e){return e.width>e.height?44:64}const gr={x:0,y:0,w:1,h:1},xd=.3,ni={x:.5-xd/2,y:.66,w:xd,h:xd*1080/1920};function Oo(e,t=$a,n=[],r=cn){const o=a=>sA(iA(a,t,r),a,t,n,r),i=a=>aA(a,t,r),s=r.width>r.height;switch(e){case"full-bleed":return{video:{rect:gr,cornerRadius:0,blurPx:0,dim:0,opacity:1,objectPosY:o(gr),objectPosX:i(gr)},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:gr,cornerRadius:0,blurPx:0,dim:0,opacity:1,objectPosY:o(gr),objectPosX:i(gr)},graphic:a,captionAnchor:s?.62:.49}}case"split-left":case"split-right":{if(s){const l=e==="split-left",c={x:l?0:.5,y:0,w:.5,h:1};return{video:{rect:c,cornerRadius:0,blurPx:0,dim:0,opacity:1,objectPosY:o(c),objectPosX:i(c)},graphic:l?{x:.55,y:.2,w:.4,h:.56}:{x:.05,y:.2,w:.4,h:.56},captionAnchor:.82}}const a={x:0,y:0,w:1,h:.5};return{video:{rect:a,cornerRadius:0,blurPx:0,dim:0,opacity:1,objectPosY:o(a),objectPosX:i(a)},graphic:{x:.04,y:.58,w:.8,h:.2},captionAnchor:.53}}case"video-top":{const a={x:0,y:0,w:1,h:.42};return{video:{rect:a,cornerRadius:0,blurPx:0,dim:0,opacity:1,objectPosY:o(a),objectPosX:i(a)},graphic:{x:.04,y:.54,w:.8,h:.24},captionAnchor:.48}}case"pip-bubble":return{video:{rect:ni,cornerRadius:1,blurPx:0,dim:0,opacity:1,objectPosY:o(ni),objectPosX:i(ni)},graphic:{x:.06,y:.14,w:.78,h:.42},captionAnchor:s?.78:.61};case"graphic-only":return{video:{rect:ni,cornerRadius:1,blurPx:0,dim:0,opacity:0,objectPosY:o(ni),objectPosX:i(ni)},graphic:{x:.04,y:.14,w:.8,h:.54},captionAnchor:s?.8:.73};case"blurred-behind":return{video:{rect:gr,cornerRadius:0,blurPx:22,dim:.55,opacity:1,objectPosY:o(gr),objectPosX:i(gr)},graphic:{x:.07,y:.24,w:.77,h:.36},captionAnchor:s?.8:.69}}}const hA={x:.07,y:.24,w:.77,h:.36};function mS(e,t=cn){return e.graphicRect?bu(e.graphicRect,t):Oo(e.layout,$a,[],t).graphic??hA}const gS=.35;function no(e,t){for(const n of e)if(t>=n.startSec&&t<n.endSec)return n;return null}function Mn(e,t,n){return e+(t-e)*n}function mA(e,t,n){return{x:Mn(e.x,t.x,n),y:Mn(e.y,t.y,n),w:Mn(e.w,t.w,n),h:Mn(e.h,t.h,n)}}function Vy(e,t,n){return{rect:mA(e.rect,t.rect,n),cornerRadius:Mn(e.cornerRadius,t.cornerRadius,n),blurPx:Mn(e.blurPx,t.blurPx,n),dim:Mn(e.dim,t.dim,n),opacity:Mn(e.opacity,t.opacity,n),objectPosY:Mn(e.objectPosY,t.objectPosY,n),objectPosX:Mn(e.objectPosX,t.objectPosX,n)}}function Su(e){return e*e*(3-2*e)}function yS(e){return e.filter(t=>!(t.kind==="plain"&&t.layout==="full-bleed"))}function bd(e,t,n,r){const o=Oo(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 gA(e,t,n=$a,r=[],o=cn){const i=yS(e),s=r.filter(h=>t>=h.startSec&&t<h.endSec),a=Oo("full-bleed",n,s,o).video,l=no(i,t);if(!l)return a;const c=bd(l,n,s,o),f=Math.min(gS,(l.endSec-l.startSec)/2),p=t-l.startSec,m=l.endSec-t,y=no(i,l.startSec-.001),w=no(i,l.endSec+.001),x=y?bd(y,n,s,o):a,S=w?bd(w,n,s,o):a;return p<f?Vy(x,c,Su(p/f)):m<f?Vy(c,S,Su(1-m/f)):c}function yA(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 Sd(e){return e==="pip-bubble"||e==="graphic-only"?1:0}function vA(e,t){const n=yS(e),r=no(n,t);if(!r)return 0;const o=Sd(r.layout),i=Math.min(gS,(r.endSec-r.startSec)/2),s=no(n,r.startSec-.001),a=no(n,r.endSec+.001),l=s?Sd(s.layout):0,c=a?Sd(a.layout):0,f=t-r.startSec,p=r.endSec-t;return f<i?Mn(l,o,Su(f/i)):p<i?Mn(o,c,Su(1-p/i)):o}function wA(e,t,n){return e.filter(r=>(r.startSec??Number.NEGATIVE_INFINITY)<n&&(r.endSec??Number.POSITIVE_INFINITY)>t)}function xA(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 bA(e,t,n,r=cn){const o=Oo(e,void 0,[],r),i=or(r),s=o.captionAnchor,a=l=>{const c={y:l-Wy,h:Wy*2};if(c.y<i.top||c.y+c.h>1-i.bottom||xA(c,t)>0)return!1;const f=n??o.graphic;return!(f&&Math.min(c.y+c.h,f.y+f.h)-Math.max(c.y,f.y)>0)};if(a(s))return s;for(let l=.02;l<=.6;l+=.02)for(const c of[s-l,s+l])if(a(c))return c;return s}const SA=.3,kA=.3,EA=.133,Uh=e=>e*(2-e);function vS(e,t=SA,n=kA){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 Hy=.4;function CA(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 IA(e,t){return t?e>=t.startSec-Hy&&e<=t.endSec+Hy:!1}function TA(e,t){return e??pA(t)}function jA(e){return e*10/64}function RA(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 PA(e,t){return e==="rtl"?`'${fa}', ${t}`:t}function FA(e){return e==="rtl"?1.9:1.15}const $A=()=>{const[e]=he.useState(()=>l2(`load ${fa}`));return he.useEffect(()=>{let t=!1;const n=()=>{t||(t=!0,u2(e))};return new FontFace(fa,`url("${dc(cS)}") format("truetype")`,{weight:"900"}).load().then(o=>{document.fonts.add(o),n()},n),n},[e]),null},_A=({line:e,wordOffset:t,verticalAnchor:n,fontSizePx:r,activeColor:o,fontFamily:i,textColor:s,ctaKeyword:a,ctaWindow:l})=>{const c=Pt(),{fps:f,width:p,height:m}=ht(),y=or({width:p,height:m}),w=e.start+c/f,x=Bh(e.words.map(S=>S.text).join(" "));return u.jsx(kn,{style:{pointerEvents:"none"},children:u.jsx("div",{style:{position:"absolute",top:`${n*100}%`,left:0,right:0,transform:"translateY(-50%)",direction:x,display:"flex",justifyContent:"center",gap:"0.28em",flexWrap:"wrap",paddingLeft:`${y.left*100}%`,paddingRight:`${y.right*100}%`,fontFamily:PA(x,i),fontWeight:900,fontSize:r,lineHeight:FA(x),textAlign:"center",color:s,WebkitTextStroke:`${jA(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((S,h)=>{const g=Math.max(S.end,S.start+.12),v=w>=S.start&&w<=g,b=v?Math.min(1,(w-S.start)/EA):0,k=Uh(b);return u.jsx("span",{"data-caption-word":t+h,"data-caption-text":S.text,"data-caption-src":He(S)===null?void 0:S.srcStart,style:{display:"inline-block",pointerEvents:"auto",transform:k>0?`scale(${1+.08*k})`:"scale(1)",color:v?o:s},children:CA(S.text,IA(S.start,l)?a:void 0)},h)})})})},MA=({lines:e,cues:t=[],verticalAnchor:n=.76,fontSizePx:r,activeColor:o="#FFE14D",theme:i,ctaKeyword:s,ctaWindow:a,sourceTextRegions:l=[]})=>{const{fps:c,width:f,height:p}=ht(),m={width:f,height:p},y=TA(r,m),{fontFamily:w,color:x}=RA(i),S=[];let h=0;for(const g of e)S.push(h),h+=g.words.length;return u.jsxs(kn,{children:[D4(e)?u.jsx($A,{}):null,e.map((g,v)=>{const b=t.length>0?no(t,g.start):null,k=(b==null?void 0:b.captionY)!==void 0?b.captionY:t.length>0||l.length>0?bA((b==null?void 0:b.layout)??"full-bleed",wA(l,g.start,g.end),b==null?void 0:b.graphicRect,m):n,{from:E,durationInFrames:C}=hc(g.start,g.end,c);return u.jsx(Ft,{from:E,durationInFrames:C,children:u.jsx(_A,{line:g,wordOffset:S[v],verticalAnchor:k,fontSizePx:y*((b==null?void 0:b.captionScale)??1),activeColor:o,fontFamily:w,textColor:x,ctaKeyword:s,ctaWindow:a})},v)})]})};function wS(e,t,n,r=.5,o=.5){const i=Math.max(1,e.width),s=Math.max(1,e.height),a=Math.max(1,t.w),l=Math.max(1,t.h),c=Math.max(n.width/a,n.height/l),f=-t.x*c+(n.width-a*c)*Uy(r),p=-t.y*c+(n.height-l*c)*Uy(o);return{width:i*c,height:s*c,left:f,top:p}}function Uy(e){return Number.isFinite(e)?Math.min(1,Math.max(0,e)):.5}function xS(e,t,n){const r=Math.max(1,e.width),o=Math.max(1,e.height),i=Math.max(1,t.w),s=Math.max(1,t.h),a=Math.min(n.width/i,n.height/s),l=-t.x*a+(n.width-i*a)/2,c=-t.y*a+(n.height-s*a)/2;return{width:r*a,height:o*a,left:l,top:c}}function AA(e,t){return xS(e,{x:0,y:0,w:e.width,h:e.height},t)}function bS(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 NA(e,t,n,r,o,i){return e==="fit"?xS(t,n,r):wS(t,n,r,o,i)}function LA(e,t,n,r){return e.length===0?{x:0,y:0,w:r.width,h:r.height,full:!0}:N4(e,bS(t,n),r)}function OA(e,t,n){if(e.length===0)return null;const r=bS(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 DA(e,t,n,r,o,i,s,a,l){if(!o)return null;if(e&&e.length>0){const f=OA(e,n,r);if(f)return wS(o,f.window,s,f.bias.x,f.bias.y)}if(!t||t.length<2)return null;const c=LA(t,n,r,o);return c.full?null:NA(i,o,c,s,a,l)}const zA=({cues:e,theme:t,face:n,zoomPlan:r,sourceTextRegions:o,contentTimeline:i,framingTimeline:s,spans:a,sourceSize:l,contentCropMode:c="cover",sourceFit:f="cover",children:p})=>{const m=Pt(),{fps:y,width:w,height:x}=ht(),S=m/y,g=gA(e,S,n??void 0,o??[],{width:w,height:x}),v=vA(e,S),b=g.rect.w*w,k=g.rect.h*x,E=g.cornerRadius*Math.min(b,k)/2,C=no(e,S),I=C==null?void 0:C.video,j=r&&r.length>0?A4(r,S):1,F=Math.max(0,g.opacity*(1-.6*g.cornerRadius)),L=(I==null?void 0:I.autoZoom)!==!1,V=f==="contain"&&l!==void 0,M=L&&!V?1+(j-1)*F:1,$=(I==null?void 0:I.scale)??1,D=(I==null?void 0:I.dx)??0,H=(I==null?void 0:I.dy)??0,P=yA(M,$,D,H);return u.jsxs(kn,{children:[u.jsx(kn,{style:{background:t.bg,opacity:v}}),u.jsxs("div",{"data-edit-video":C==null?void 0:C.id,style:{position:"absolute",left:`${g.rect.x*100}%`,top:`${g.rect.y*100}%`,width:b,height:k,borderRadius:E,overflow:"hidden",opacity:g.opacity,backgroundColor:V?t.bg:void 0,boxShadow:g.cornerRadius>.5?"0 18px 60px rgba(0,0,0,0.55)":void 0},children:[u.jsx("div",{style:{position:"absolute",inset:0,filter:g.blurPx>.5?`blur(${g.blurPx}px)`:void 0,transform:P,transformOrigin:"50% 40%","--ossclip-obj-y":`${g.objectPosY*100}%`,"--ossclip-obj-x":`${g.objectPosX*100}%`},children:V?u.jsx(BA,{source:l,slot:{width:b,height:k},children:p}):u.jsx(WA,{timeline:i,framing:s,spans:a,sourceSize:l,mode:c,tSec:S,slot:{width:b,height:k},posX:g.objectPosX,posY:g.objectPosY,children:p})}),u.jsx("div",{style:{position:"absolute",inset:0,background:"black",opacity:g.dim}})]})]})},BA=({source:e,slot:t,children:n})=>{const r=AA(e,t);return u.jsx("div",{style:{position:"absolute",width:r.width,height:r.height,left:r.left,top:r.top},children:n})},WA=({timeline:e,framing:t,spans:n,sourceSize:r,mode:o,tSec:i,slot:s,posX:a,posY:l,children:c})=>{const f=DA(t,e,n??[],i,r,o,s,a,l);return f?u.jsx("div",{style:{position:"absolute",width:f.width,height:f.height,left:f.left,top:f.top},children:c}):u.jsx("div",{style:{position:"absolute",inset:0},children:c})},Zh=.94,VA=new Set(["FlowDiagram","StrikethroughReveal","ChatMock","BulletList"]),Zy=2.4,fl=.45,kc=.58,Vt=.72,HA=.62;function li(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:"",Ur=e=>Array.isArray(e)?e:[];function UA(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 c=i?64:96;return a+=li(Ge(t.title).length,c,o,1.05,Vt),l++,Ge(t.sub)&&(a+=li(Ge(t.sub).length,40,o,1.2,kc),l++),a+s*Math.max(0,l-1)}case"StatCard":{const o=li(Ge(t.label).length,42,n*.55,1.15,Vt);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+=li(Ge(t.text).length,72,o,1.02,Vt),Ge(t.struck)&&(i+=26+li(Ge(t.struck).length,44,o,1.2,Vt)),i}case"StrikethroughReveal":{const o=Ur(t.lines).map(a=>Ge(a==null?void 0:a.text)),i=IS(o,n,r),s=o.reduce((a,l)=>a+CS(l,i,n).length,0);return s*i*1.08+i*.2*Math.max(0,s-1)}case"FlowDiagram":{const o=Ur(t.nodes).map(l=>Ge(l)),i=Math.max(1,o.length),{mode:s,fontSize:a}=_S(o,n,r);return s==="row"?a*Ws+4:a*(Ws*i+$S*(i-1))}case"TerminalMock":{const o=Ur(t.windows);let i=0;for(const s of o){const a=Ur(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=PS(t).map(s=>s.text),i=FS(o,{widthPx:n,heightPx:r});return RS(o,i,n)}case"ScreenshotFrame":{const o=n*.94;return(Ge(t.src)?o*9/16:480)+4}case"BulletList":{const o=Ur(t.items).map(s=>Ge(s)),i=ES(o,n,r,!!Ge(t.title),Ge(t.title));return XA(o.length,i,!!Ge(t.title))}}}const Lr=e=>Ge(e).split(/\s+/).reduce((t,n)=>Math.max(t,n.length),0);function ZA(e,t){switch(e){case"RuleCard":{const n=Lr(t.kicker)*30*(Vt+.28),r=Lr(t.text)*72*Vt,o=Lr(t.struck)*44*(Vt+.04),i=Math.max(n,r,o);return i>0?156+i:0}case"TitleCard":{const n=Ge(t.emphasis)?64:96,r=Lr(t.eyebrow)*34*(Vt+.35),o=Lr(t.emphasis)*210*Vt,i=Lr(t.title)*n*(Vt+.02),s=Lr(t.sub)*40*kc,a=Math.max(r,o,i,s);return a>0?80+a:0}case"TerminalMock":{let n=0;for(const r of Ur(t.windows))for(const o of Ur(r==null?void 0:r.lines))n=Math.max(n,Ge(o).length);return n>0?108+n*27*HA:0}case"StatCard":{const n=Ge(t.value).length*110*Vt;return n===0?0:164+Lr(t.label)*42*Vt+40+n}default:return 0}}const Ky=36,KA=120,SS=1.6,kS=.88,YA=(Vt+.28)*.36,GA=1.1;function XA(e,t,n){return(Math.max(1,e)*SS+(n?kS:0))*t}function ES(e,t=831,n=1/0,r=!1,o=""){const i=e.reduce((l,c)=>Math.max(l,c.length),0);if(i===0)return Ky;const s=Math.min(t/(i*Vt+GA),o?t/(o.length*YA):1/0),a=n*Zh/(Math.max(1,e.length)*SS+(r?kS:0));return Math.max(Ky,Math.min(KA,Math.floor(Math.min(s,a))))}const qA=92,JA=44,QA=150,e3=[" → "," -> "," → "," > "];function CS(e,t,n){const r=o=>o.length*t*Vt<=n;if(r(e))return[e];for(const o of e3){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 IS(e,t=831,n=1/0){const r=e.reduce((s,a)=>Math.max(s,a.length),0);if(r===0)return qA;const o=t/(r*Vt),i=n/(Math.max(1,e.length)*1.28);return Math.max(JA,Math.min(QA,Math.floor(Math.min(o,i))))}const Yy=22,Gy=44,t3=96,Xy=22,TS=.85,jS=.82;function RS(e,t,n){const o=(n-80)*jS-2*t*TS;let i=0;for(const s of e)i+=li(s.length,t,o,1.2,kc)+t*1.2+4;return i+t*.5*Math.max(0,e.length-1)}function PS(e){const t=Ge(e.keyword);return t?[{from:"user",text:`"${t.toUpperCase()}"`}]:Ur(e.messages).map(n=>{const r=n??{};return{from:r.from==="agent"?"agent":"user",text:Ge(r.text)}})}function FS(e,t={}){const n=t.widthPx??831,r=t.heightPx??1/0,o=n-80,i=e.reduce((p,m)=>Math.max(p,m.length),0);if(i===0)return Gy;const s=e.flatMap(p=>p.split(/\s+/)).reduce((p,m)=>Math.max(p,m.length),0),a=p=>o*jS/(p*kc+2*TS),l=Math.min(i,Xy),c=i>Xy?Gy:t3;let f=Math.floor(Math.min(a(l),a(s),c));for(;f>Yy&&RS(e,f,n)>r*Zh;)f-=1;return Math.max(Yy,f)}const qy=26,n3=22,r3=76,Ws=2.1,$S=2.05;function _S(e,t,n=1/0){const r=e.reduce((x,S)=>x+S.length,0),o=Math.max(1,e.length),i=.78,s=1.6,a=1.8,l=t-20,c=Math.floor(Math.min(l/(i*r+s*o+a*(o-1)),n/Ws)),f=Math.max(...e.map(x=>x.length),1),p=Ws*o+$S*(o-1),m=Math.floor(Math.min(l/(i*f+s),n/p,r3)),y=c>=qy;return m>=n3?y?c*Ws>=m*p?{mode:"row",fontSize:c}:{mode:"stack",fontSize:m}:{mode:"stack",fontSize:m}:{mode:"row",fontSize:Math.max(qy,c)}}function o3(e,t,n){if(VA.has(e))return 1;const r=n.heightPx*Zh,o=c=>UA(e,t,n.widthPx/c)*c<=r;if(!o(fl))return fl;const i=ZA(e,t),s=i>0?n.widthPx/i:Zy;let a=fl,l=Math.max(fl,Math.min(Zy,s));if(l<=a)return a;for(let c=0;c<24;c++){const f=(a+l)/2;o(f)?a=f:l=f}return a}function Rt(e=0){const t=Pt(),{fps:n}=ht();return Vf({frame:t-e,fps:n,config:{damping:200,stiffness:130},durationInFrames:Math.round(n*.5)})}function sr(e,t=26){return{opacity:e,transform:`translateY(${(1-e)*t}px)`}}function Do(e){return{opacity:e,transform:`scale(${.9+.1*e})`}}function i3(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 bt(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 s3=({props:e,theme:t,edits:n})=>{var l;const r=Rt(0),o=Rt(5),i=Rt(10),s=(l=e.emphasis)==null?void 0:l.trim(),a=!!s&&s.toLowerCase().includes(e.title.trim().toLowerCase());return u.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:28,textAlign:"center",fontFamily:t.fontDisplay,color:t.fg,padding:"0 40px"},children:[e.eyebrow?u.jsx("div",{"data-edit-id":"eyebrow",style:{...sr(r),fontSize:34,fontWeight:700,letterSpacing:"0.35em",color:t.muted,textTransform:"uppercase",...bt(n,"eyebrow")},children:e.eyebrow}):null,s?u.jsx("div",{"data-edit-id":"emphasis",style:{...sr(o,40),fontSize:210,fontWeight:900,lineHeight:.95,...bt(n,"emphasis")},children:s}):null,a?null:u.jsx("div",{"data-edit-id":"title",style:{...sr(s?i:o,34),fontSize:s?64:96,fontWeight:900,lineHeight:1.05,textTransform:"uppercase",letterSpacing:"0.02em",...bt(n,"title")},children:e.title}),e.sub?u.jsx("div",{"data-edit-id":"sub",style:{...sr(i),fontSize:40,fontWeight:600,color:t.muted,...bt(n,"sub")},children:e.sub}):null]})},a3=({props:e,theme:t,edits:n})=>{const r=Rt(0),o=Rt(6),i=e.inverted;return u.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:30,fontFamily:t.fontDisplay,width:"100%",padding:"0 30px"},children:[u.jsxs("div",{style:{...Do(r),display:"flex",alignItems:"center",justifyContent:"space-between",gap:40,width:"100%",background:i?t.fg:t.cardBg,color:i?t.bg:t.fg,border:`2px solid ${i?t.fg:t.cardBorder}`,borderRadius:t.radiusPx,padding:"44px 52px"},children:[u.jsx("div",{"data-edit-id":"label",style:{fontSize:42,fontWeight:800,textTransform:"uppercase",letterSpacing:"0.06em",lineHeight:1.15,maxWidth:"55%",...bt(n,"label")},children:e.label}),u.jsx("div",{"data-edit-id":"value",style:{fontSize:110,fontWeight:900,whiteSpace:"nowrap",...bt(n,"value")},children:e.value})]}),e.caption?u.jsx("div",{"data-edit-id":"caption",style:{...sr(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",...bt(n,"caption")},children:e.caption}):null]})},l3=({props:e,theme:t,edits:n})=>{const r=Rt(0),o=Rt(8);return u.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:26,fontFamily:t.fontDisplay,width:"100%",padding:"0 30px"},children:[u.jsxs("div",{style:{...Do(r),width:"100%",background:t.fg,color:t.bg,borderRadius:t.radiusPx,padding:"40px 48px",textAlign:"left"},children:[u.jsx("div",{"data-edit-id":"kicker",style:{fontSize:30,fontWeight:800,letterSpacing:"0.28em",textTransform:"uppercase",color:"#55555E",marginBottom:14,fontFamily:t.fontMono,...bt(n,"kicker")},children:e.kicker}),u.jsx("div",{"data-edit-id":"text",style:{fontSize:72,fontWeight:900,lineHeight:1.02,textTransform:"uppercase",...bt(n,"text")},children:e.text})]}),e.struck?u.jsx("div",{"data-edit-id":"struck",style:{...sr(o),fontSize:44,fontWeight:800,color:t.muted,textDecoration:"line-through",textDecorationThickness:6,textDecorationColor:t.danger,textTransform:"uppercase",letterSpacing:"0.04em",...bt(n,"struck")},children:e.struck}):null]})},u3=({text:e,struck:t,mark:n,delay:r,fontSize:o,theme:i,editId:s,edits:a})=>{const l=Rt(r),c=Rt(r+8);return u.jsxs("div",{"data-edit-id":s,style:{...sr(l,30),position:"relative",display:"inline-block",...bt(a,s)},children:[u.jsxs("span",{style:{fontSize:o,fontWeight:900,textTransform:"uppercase",lineHeight:1.08,whiteSpace:"nowrap",color:t?i.muted:i.fg},children:[n!=="none"?u.jsx("span",{style:{color:n==="cross"?i.danger:i.success,marginRight:"0.3em"},children:n==="cross"?"✗":"✓"}):null,e]}),t?u.jsx("div",{style:{position:"absolute",left:"-2%",top:"50%",height:o*.11,width:`${c*104}%`,background:i.danger,borderRadius:o*.055,transform:"translateY(-50%) rotate(-2deg)"}}):null]})},c3=({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=IS(i,n,r),a=e.lines.flatMap((l,c)=>CS(l.text,s,n??831).map((f,p)=>({text:f,struck:l.struck,mark:p===0?l.mark??"none":"none",lineIndex:c})));return u.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:s*.2,textAlign:"center",fontFamily:t.fontDisplay},children:a.map((l,c)=>u.jsx(u3,{text:l.text,struck:l.struck,mark:l.mark,delay:c*6,fontSize:s,theme:t,editId:`line-${l.lineIndex}`,edits:o},c))})},d3=({text:e,emphasized:t,delay:n,fontSize:r,theme:o,editId:i,edits:s})=>{const a=Rt(n);return u.jsx("div",{"data-edit-id":i,style:{...Do(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,...bt(s,i)},children:e})},f3=({delay:e,fontSize:t,theme:n,down:r=!1})=>{const o=Rt(e);return u.jsx("div",{style:{opacity:o,color:n.muted,fontSize:t*1.15,fontWeight:700,lineHeight:1,paddingLeft:r?0:t*.55},children:r?"↓":"→"})};function p3(e,t=h3,n){return _S(e,t,n)}const h3=864,m3=({props:e,theme:t,widthPx:n,heightPx:r,edits:o})=>{const{mode:i,fontSize:s}=p3(e.nodes,n,r),a=i==="row";return u.jsx("div",{style:{display:"flex",flexDirection:a?"row":"column",flexWrap:"nowrap",alignItems:"center",justifyContent:"center",gap:a?0:s*.45,padding:"0 10px"},children:e.nodes.map((l,c)=>u.jsxs("div",{style:{display:"flex",flexDirection:a?"row":"column",alignItems:"center",gap:a?s*.55:s*.45},children:[c>0?u.jsx(f3,{delay:c*6+3,fontSize:s,theme:t,down:!a}):null,u.jsx(d3,{text:l,emphasized:e.emphasizeLast&&c===e.nodes.length-1,delay:c*6,fontSize:s,theme:t,editId:`node-${c}`,edits:o})]},c))})},g3=({title:e,lines:t,delay:n,theme:r,editId:o,edits:i})=>{const s=Rt(n);return u.jsxs("div",{"data-edit-id":o,style:{...Do(s),background:r.cardBg,border:`2px solid ${r.cardBorder}`,borderRadius:r.radiusPx/2,overflow:"hidden",width:"100%",fontFamily:r.fontMono,...bt(i,o)},children:[u.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"14px 20px",borderBottom:`2px solid ${r.cardBorder}`},children:[["#FF5F57","#FEBC2E","#28C840"].map(a=>u.jsx("div",{style:{width:16,height:16,borderRadius:8,background:a}},a)),u.jsx("div",{style:{marginLeft:10,fontSize:24,color:r.muted},children:e})]}),u.jsx("div",{style:{padding:"18px 22px",display:"flex",flexDirection:"column",gap:8},children:t.map((a,l)=>u.jsx("div",{style:{fontSize:27,color:r.fg,whiteSpace:"pre"},children:a},l))})]})},y3=({props:e,theme:t,edits:n})=>{const r=Rt(e.windows.length*6+4);return u.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:22,width:"100%",padding:"0 30px"},children:[e.windows.map((o,i)=>u.jsx(g3,{title:o.title,lines:o.lines,delay:i*6,theme:t,editId:`window-${i}`,edits:n},i)),e.fanOut?u.jsxs("div",{"data-edit-id":"fanOut",style:{...sr(r),fontFamily:t.fontDisplay,fontSize:40,fontWeight:900,letterSpacing:"0.2em",color:t.fg,textTransform:"uppercase",...bt(n,"fanOut")},children:["⌄ ",e.fanOut]}):null]})},v3=({from:e,text:t,delay:n,fontSize:r,theme:o,editId:i,edits:s})=>{const a=Rt(n),l=e==="user";return u.jsx("div",{"data-edit-id":i,style:{...Do(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,...bt(s,i)},children:t})},w3=({props:e,theme:t,widthPx:n,heightPx:r,edits:o})=>{const i=PS(e),s=FS(i.map(a=>a.text),{widthPx:n,heightPx:r});return u.jsx("div",{style:{display:"flex",flexDirection:"column",gap:s*.5,width:"100%",padding:"0 40px"},children:i.map((a,l)=>u.jsx(v3,{from:a.from,text:a.text,delay:l*8,fontSize:s,theme:t,editId:`message-${l}`,edits:o},l))})},x3=({props:e,theme:t,edits:n})=>{const r=Rt(0),o=Rt(8),i=Pt(),{fps:s}=ht(),a=e.kenBurns?Qi(i,[0,s*8],[1,1.08],{extrapolateRight:"clamp"}):1,l=e.src?/^https?:\/\//.test(e.src)?e.src:dc(e.src):null;return u.jsxs("div",{"data-edit-id":"src",style:{...Do(r),position:"relative",width:"94%",...bt(n,"src")},children:[u.jsx("div",{style:{overflow:"hidden",borderRadius:t.radiusPx/2,border:`2px solid ${t.cardBorder}`,background:t.cardBg,boxShadow:"0 24px 80px rgba(0,0,0,0.5)"},children:l?u.jsx(cc,{src:l,style:{width:"100%",display:"block",transform:`scale(${a})`}}):u.jsx("div",{style:{height:420,display:"flex",flexDirection:"column",gap:14,padding:30,transform:`scale(${a})`},children:[.9,.75,.85,.6,.8,.5].map((c,f)=>u.jsx("div",{style:{height:22,width:`${c*100}%`,borderRadius:6,background:f%3===0?t.cardBorder:"#22222B"}},f))})}),e.label?u.jsx("div",{"data-edit-id":"label",style:{...Do(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",...bt(n,"label")},children:e.label}):null]})},b3=({text:e,index:t,fontSize:n,theme:r,edits:o})=>{const i=`item-${t}`,s=Rt(t*7);return u.jsxs("div",{"data-edit-id":i,style:{...sr(s,26),display:"flex",alignItems:"baseline",gap:n*.35,...bt(o,i)},children:[u.jsx("span",{style:{fontSize:n*.75,color:r.accent,fontWeight:900},children:"▸"}),u.jsx("span",{style:{fontSize:n,fontWeight:900,textTransform:"uppercase",lineHeight:1.15,whiteSpace:"nowrap",color:r.fg},children:e})]})},S3=({props:e,theme:t,widthPx:n,heightPx:r,edits:o})=>{const i=ES(e.items,n,r,!!e.title,e.title),s=Rt(0);return u.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:i*.45,fontFamily:t.fontDisplay},children:[e.title?u.jsx("div",{"data-edit-id":"title",style:{...sr(s,20),fontSize:i*.36,fontWeight:700,letterSpacing:"0.28em",textTransform:"uppercase",color:t.muted,...bt(o,"title")},children:e.title}):null,e.items.map((a,l)=>u.jsx(b3,{text:a,index:l,fontSize:i,theme:t,edits:o},l))]})},k3={TitleCard:s3,StatCard:a3,RuleCard:l3,StrikethroughReveal:c3,FlowDiagram:m3,TerminalMock:y3,ChatMock:w3,ScreenshotFrame:x3,BulletList:S3},E3=new Set(["lower-third","full-bleed"]),C3=.55,I3=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}, ${C3})`},T3=e=>({width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",opacity:e,transform:e<1?`translateY(${(1-e)*18}px)`:void 0}),j3=({durationInFrames:e,children:t})=>{const n=Pt(),{fps:r}=ht(),{exitSec:o}=vS(e/r),i=(e-n)/r,s=o<=0?1:Math.min(1,Math.max(0,i/o));return u.jsx("div",{style:T3(Uh(s)),children:t})},R3=({durationInFrames:e,themeBg:t,radiusPx:n})=>{const r=Pt(),{fps:o}=ht(),{enterSec:i}=vS(e/o),s=i<=0?1:Math.min(1,Math.max(0,r/o/i)),a=Uh(s);return u.jsx("div",{style:{position:"absolute",inset:0,background:I3(t),backdropFilter:"blur(14px)",WebkitBackdropFilter:"blur(14px)",borderRadius:n,opacity:a,transform:a<1?`translateY(${(1-a)*18}px)`:void 0}})},P3=({cues:e,theme:t})=>{const{fps:n,width:r,height:o}=ht();return u.jsx(kn,{style:{pointerEvents:"none"},children:e.map(i=>{if(i.kind==="plain"||!i.component||!i.props)return null;const s=mS(i,{width:r,height:o}),a=k3[i.component],{from:l,durationInFrames:c}=hc(i.startSec,i.endSec,n),f=s.w*r,p=s.h*o,m=E3.has(i.layout),y=m?Math.min(24,Math.round(p*.12)):0,w=f-y*2,x=p-y*2,S=o3(i.component,i.props,{widthPx:w,heightPx:x});return u.jsx(Ft,{from:l,durationInFrames:c,children:u.jsx("div",{"data-edit-scene":i.id,style:{position:"absolute",left:`${s.x*100}%`,top:`${s.y*100}%`,width:`${s.w*100}%`,height:`${s.h*100}%`,display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"auto",overflow:"hidden"},children:u.jsxs(j3,{durationInFrames:c,children:[m?u.jsx(R3,{durationInFrames:c,themeBg:t.bg,radiusPx:t.radiusPx}):null,u.jsx("div",{style:{width:w/S,transform:`scale(${S})`,position:"relative"},children:u.jsx(a,{props:i.props,theme:t,widthPx:w/S,heightPx:x/S,edits:i3(i.elements,S)})})]})})},i.id)})})},F3="made with ossclip",$3=.45,_3=.024;function M3(e=cn){const t=or(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)*_3),opacity:$3,text:F3}}function A3(e){return e===!0}const N3=({theme:e,frame:t})=>{const n=M3(t);return u.jsx("div",{style:{position:"absolute",left:n.xPx,top:n.yPx,fontFamily:e.fontDisplay,fontSize:n.fontPx,fontWeight:600,letterSpacing:"0.02em",color:e.fg,opacity:n.opacity,pointerEvents:"none",whiteSpace:"nowrap"},children:n.text})},L3=4;function O3(e){if(typeof e!="object"||e===null)return null;const t=e;return typeof t.fileName!="string"||t.fileName.length===0||typeof t.durationSec!="number"||!Number.isFinite(t.durationSec)||t.durationSec<=0?null:{fileName:t.fileName,durationSec:t.durationSec}}function D3(e,t){return hc(0,e,t)}function z3(e,t){const n=Math.min(L3,t),r=t-e;return r>=n?1:Math.min(1,Math.max(0,r/n))}const B3=({cover:e,durationInFrames:t})=>{const n=Pt();return u.jsx(kn,{style:{backgroundColor:"black",opacity:z3(n,t)},children:u.jsx(cc,{src:/^https?:\/\//.test(e.fileName)?e.fileName:dc(e.fileName),style:{width:"100%",height:"100%",objectFit:"cover"}})})},W3=({cover:e})=>{const{fps:t}=ht(),{from:n,durationInFrames:r}=D3(e.durationSec,t);return u.jsx(Ft,{from:n,durationInFrames:r,layout:"none",children:u.jsx(kn,{style:{pointerEvents:"none"},children:u.jsx(B3,{cover:e,durationInFrames:r})})})};function V3(e){return e!==!0}const H3=({videoFileName:e,spans:t,captionLines:n,sceneCues:r,theme:o,settings:i,face:s,zoomPlan:a,ctaKeyword:l,ctaWindow:c,sourceTextRegions:f,contentTimeline:p,framingTimeline:m,sourceSize:y,contentCropMode:w,sourceFit:x,watermark:S,captionsHidden:h,staticCamera:g,punch:v,coverInVideo:b})=>{if(!e)return u.jsx(kn,{style:{backgroundColor:"#111",color:"#888",alignItems:"center",justifyContent:"center",fontFamily:"monospace",fontSize:40},children:"no production loaded"});const k=/^https?:\/\//.test(e)?e:dc(e),E=x==="contain"||g===!0?null:ZP(v),C=O3(b);return u.jsxs(kn,{style:{backgroundColor:"black"},children:[u.jsx(zA,{cues:r,theme:o,face:s,zoomPlan:a,sourceTextRegions:f,contentTimeline:p,framingTimeline:m,spans:t,sourceSize:y,contentCropMode:w,sourceFit:x,children:u.jsx(YP,{src:k,spans:t,...E?{punch:E}:{},...x==="contain"?{punchInScale:1,background:"transparent"}:{},...g===!0?{punchInScale:1}:{}})}),u.jsx(P3,{cues:r,theme:o}),V3(h)?u.jsx(MA,{lines:n,cues:r,activeColor:o.accent,theme:o,ctaKeyword:l,ctaWindow:c,sourceTextRegions:f}):null,A3(S)?u.jsx(N3,{theme:o,frame:{width:i.width,height:i.height}}):null,C?u.jsx(W3,{cover:C}):null]})},U3=600,Z3=()=>({doc:m4(),past:[],future:[],dirty:!1,savedAt:0,lastCoalesce:null}),nr=(e,t)=>e.scenes[t]??{props:{},elements:{}};function K3(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<U3;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=nr(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(Dy(e.doc,t.sceneId,t.elementId,t.patch),t.coalesce);case"clearElement":return n(T4(e.doc,t.sceneId,t.elementId));case"hideElement":return n(Dy(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(j4(e.doc,t.sceneId,t.elementId)):e}case"patchTiming":{const o=nr(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...o,timing:t.timing}}})}case"clearTiming":return n(R4(e.doc,t.sceneId));case"patchVideo":{const o=nr(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=nr(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=nr(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...o,captionY:t.y}}},t.coalesce)}case"patchCaptionScale":{const o=nr(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 t.at===void 0&&t.src===void 0||e.doc.splits.some(i=>t.src!==void 0&&i.src!==void 0?Math.abs(i.src-t.src)<.001:t.at!==void 0&&i.at!==void 0?Math.abs(i.at-t.at)<.001:!1)?e:n({...e.doc,splits:[...e.doc.splits,{...t.at!==void 0?{at:t.at}:{},...t.src!==void 0?{src:t.src}:{},id:p4(t.src??t.at,e.doc.splits)}].sort((i,s)=>(i.at??i.src??0)-(s.at??s.src??0))});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=nr(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:t.src===void 0||i.src.startSec!==t.src.startSec||i.src.endSec!==t.src.endSec);return n({...e.doc,cuts:[...o,{startSec:t.startSec,endSec:t.endSec,...t.src?{src:t.src}:{}}]})}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=nr(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...o,component:t.component}}})}case"patchLayout":{const{graphicRect:o,...i}=nr(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...i,layout:t.layout}}})}case"patchGraphicRect":{const o=nr(e.doc,t.sceneId);return n({...e.doc,scenes:{...e.doc.scenes,[t.sceneId]:{...o,graphicRect:t.rect}}},t.coalesce)}case"clearGraphicRect":return n(P4(e.doc,t.sceneId));case"patchCaption":{const o=yn(t.srcStart),i=Ay(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=yn(t.fromSrcStart),i=yn(t.toSrcStart),s=t.text.trim();if(!s)return e;const a=Ny(e.doc.captionRangeEdits,o,i,t.was);if(s===a){const S=e.doc.captionRangeEdits.filter(h=>h.fromKey!==o||h.toKey!==i);return S.length===e.doc.captionRangeEdits.length?e:n({...e.doc,captionRangeEdits:S})}const l=Math.min(Math.round(t.fromSrcStart*1e3),Math.round(t.toSrcStart*1e3)),c=Math.max(Math.round(t.fromSrcStart*1e3),Math.round(t.toSrcStart*1e3)),f=S=>{if(da(S))return!1;const h=Number(S.slice(1));return h>=l&&h<=c},p=Object.fromEntries(Object.entries(e.doc.captions).filter(([S])=>!f(S))),m=Object.fromEntries(Object.entries(e.doc.captionWordsHidden).filter(([S])=>!f(S))),y=Object.fromEntries(Object.entries(e.doc.captionLineTiming).filter(([S])=>!f(S))),w=Object.fromEntries(Object.entries(e.doc.captionLineWindows).filter(([S])=>!f(S))),x=[...e.doc.captionRangeEdits.filter(S=>{const h=Math.min(Number(S.fromKey.slice(1)),Number(S.toKey.slice(1)));return Math.max(Number(S.fromKey.slice(1)),Number(S.toKey.slice(1)))<l||h>c}),{fromKey:o,toKey:i,text:s,was:a}];return n({...e.doc,captions:p,captionWordsHidden:m,captionLineTiming:y,captionLineWindows:w,captionRangeEdits:x})}case"patchCaptionAllOccurrences":{let o=e.doc.captions,i=!1;for(const s of t.entries){const a=yn(s.srcStart),l=Ay(o,a,s.was);if(t.text===l){if(!(a in o))continue;const{[a]:f,...p}=o;o=p,i=!0;continue}const c=o[a];c!==void 0&&c.text===t.text&&c.was===l||(o={...o,[a]:{text:t.text,was:l}},i=!0)}return i?n({...e.doc,captions:o}):e}case"patchCaptionRangeAllOccurrences":{const o=t.text.trim();if(!o)return e;let i=e.doc,s=!1;for(const a of t.entries){const l=yn(a.fromSrcStart),c=yn(a.toSrcStart),f=Ny(i.captionRangeEdits,l,c,a.was);if(o===f){const w=i.captionRangeEdits.filter(x=>x.fromKey!==l||x.toKey!==c);if(w.length===i.captionRangeEdits.length)continue;i={...i,captionRangeEdits:w},s=!0;continue}const p=Math.min(Math.round(a.fromSrcStart*1e3),Math.round(a.toSrcStart*1e3)),m=Math.max(Math.round(a.fromSrcStart*1e3),Math.round(a.toSrcStart*1e3)),y=w=>{if(da(w))return!1;const x=Number(w.slice(1));return x>=p&&x<=m};i={...i,captions:Object.fromEntries(Object.entries(i.captions).filter(([w])=>!y(w))),captionWordsHidden:Object.fromEntries(Object.entries(i.captionWordsHidden).filter(([w])=>!y(w))),captionLineTiming:Object.fromEntries(Object.entries(i.captionLineTiming).filter(([w])=>!y(w))),captionLineWindows:Object.fromEntries(Object.entries(i.captionLineWindows).filter(([w])=>!y(w))),captionRangeEdits:[...i.captionRangeEdits.filter(w=>{const x=Math.min(Number(w.fromKey.slice(1)),Number(w.toKey.slice(1)));return Math.max(Number(w.fromKey.slice(1)),Number(w.toKey.slice(1)))<p||x>m}),{fromKey:l,toKey:c,text:o,was:f}]},s=!0}return s?n(i):e}case"patchCaptionLineTiming":{let o=e.doc.captionLineTiming,i=!1;for(const s of t.entries){const a=yn(s.srcStart);if(Math.abs(s.lead)<.001&&Math.abs(s.tail)<.001){if(!(a in o))continue;const{[a]:c,...f}=o;o=f,i=!0;continue}const l=o[a];l!==void 0&&l.lead===s.lead&&l.tail===s.tail||(o={...o,[a]:{lead:s.lead,tail:s.tail}},i=!0)}return i?n({...e.doc,captionLineTiming:o}):e}case"patchCaptionLineWindows":{let o=e.doc.captionLineWindows,i=!1;for(const s of t.entries){const a=yn(s.srcStart);if(s.window===null){if(!(a in o))continue;const{[a]:c,...f}=o;o=f,i=!0;continue}const l=o[a];l!==void 0&&l.srcStart===s.window.srcStart&&l.srcEnd===s.window.srcEnd||(o={...o,[a]:{...s.window}},i=!0)}return i?n({...e.doc,captionLineWindows:o}):e}case"hideCaptionWords":{const o={...e.doc.captionWordsHidden};let i=!1;for(const s of t.words){const a=yn(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=yn(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=yn(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:t.src===void 0||s.src.startSec!==t.src.startSec||s.src.endSec!==t.src.endSec);return n({...e.doc,captionWordsHidden:o,cuts:[...i,{startSec:t.startSec,endSec:t.endSec,...t.src?{src:t.src}:{}}]})}case"setReasonEnabled":{const{reasons:o}=e.doc.cleanup;if(t.enabled){if(!(t.reason in o))return e;const{[t.reason]:i,...s}=o;return n({...e.doc,cleanup:{...e.doc.cleanup,reasons:s}})}return o[t.reason]===!1?e:n({...e.doc,cleanup:{...e.doc.cleanup,reasons:{...o,[t.reason]:!1}}})}case"toggleKept":{if(!(t.srcOut>t.srcIn))return e;const{kept:o}=e.doc.cleanup,i=o.filter(a=>!(a.srcIn<t.srcOut&&a.srcOut>t.srcIn)),s=i.length<o.length?{...e.doc.cleanup,kept:i}:{...e.doc.cleanup,kept:[...o,{srcIn:t.srcIn,srcOut:t.srcOut}]};return n({...e.doc,cleanup:s})}case"dismissRemoval":{if(!(t.srcOut>t.srcIn))return e;const{kept:o,dismissed:i}=e.doc.cleanup;return i.some(s=>s.srcIn<t.srcOut&&s.srcOut>t.srcIn)?e:n({...e.doc,cleanup:{...e.doc.cleanup,kept:o.filter(s=>!(s.srcIn<t.srcOut&&s.srcOut>t.srcIn)),dismissed:[...i,{srcIn:t.srcIn,srcOut:t.srcOut}]}})}case"restoreDismissed":{const{dismissed:o}=e.doc.cleanup,i=o.filter(s=>!(s.srcIn<t.srcOut&&s.srcOut>t.srcIn));return i.length===o.length?e:n({...e.doc,cleanup:{...e.doc.cleanup,dismissed:i}})}case"rekeyCaptionKeys":{if(t.mapping.length===0)return e;const{doc:o,reports:i}=eA(e.doc,t.mapping);for(const s of i)console.warn(`caption re-key: ${s}`);return n(o)}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 Y3(){const[e,t]=d.useReducer(K3,void 0,Z3),n=d.useRef([]),r=async()=>{const o=x4(e.doc,n.current),i=await fetch("/api/overrides",{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify(o)});if(!i.ok){const s=await i.json().catch(()=>({}));throw new Error(s.error??"save failed")}t({type:"saved"})};return{doc:e.doc,dirty:e.dirty,canUndo:e.past.length>0,canRedo:e.future.length>0,load:o=>t({type:"load",doc:o}),undo:()=>t({type:"undo"}),redo:()=>t({type:"redo"}),save:r,syncCues:o=>{n.current=o},patchProps:(o,i,s)=>t({type:"patchProps",sceneId:o,patch:i,coalesce:s}),patchElement:(o,i,s,a)=>t({type:"patchElement",sceneId:o,elementId:i,patch:s,coalesce:a}),clearElement:(o,i)=>t({type:"clearElement",sceneId:o,elementId:i}),hideElement:(o,i)=>t({type:"hideElement",sceneId:o,elementId:i}),restoreElement:(o,i)=>t({type:"restoreElement",sceneId:o,elementId:i}),patchTiming:(o,i)=>t({type:"patchTiming",sceneId:o,timing:i}),clearTiming:o=>t({type:"clearTiming",sceneId:o}),patchVideo:(o,i,s)=>t({type:"patchVideo",sceneId:o,patch:i,coalesce:s}),clearVideo:o=>t({type:"clearVideo",sceneId:o}),patchPip:(o,i,s)=>t({type:"patchPip",sceneId:o,patch:i,coalesce:s}),clearPip:o=>t({type:"clearPip",sceneId:o}),patchCaptionY:(o,i,s)=>t({type:"patchCaptionY",sceneId:o,y:i,coalesce:s}),patchCaptionScale:(o,i,s)=>t({type:"patchCaptionScale",sceneId:o,scale:i,coalesce:s}),clearCaptionStyle:o=>t({type:"clearCaptionStyle",sceneId:o}),patchCaptionStyleAll:(o,i)=>t({type:"patchCaptionStyleAll",sceneIds:o,...i}),addSplit:o=>t({type:"addSplit",at:o.at,src:o.src}),setCaptionsHidden:o=>t({type:"setCaptionsHidden",hidden:o}),hideScene:o=>t({type:"hideScene",sceneId:o}),restoreScene:o=>t({type:"restoreScene",sceneId:o}),cutChunk:(o,i,s)=>t({type:"cutChunk",startSec:o,endSec:i,src:s}),restoreChunk:o=>t({type:"restoreChunk",index:o}),patchGraphicRect:(o,i,s)=>t({type:"patchGraphicRect",sceneId:o,rect:i,coalesce:s}),clearGraphicRect:o=>t({type:"clearGraphicRect",sceneId:o}),patchComponent:(o,i)=>t({type:"patchComponent",sceneId:o,component:i}),patchLayout:(o,i)=>t({type:"patchLayout",sceneId:o,layout:i}),patchCaption:(o,i,s)=>t({type:"patchCaption",srcStart:o,text:i,was:s}),patchCaptionRange:(o,i,s,a)=>t({type:"patchCaptionRange",fromSrcStart:o,toSrcStart:i,text:s,was:a}),patchCaptionAllOccurrences:(o,i)=>t({type:"patchCaptionAllOccurrences",entries:o,text:i}),patchCaptionRangeAllOccurrences:(o,i)=>t({type:"patchCaptionRangeAllOccurrences",entries:o,text:i}),patchCaptionLineTiming:o=>t({type:"patchCaptionLineTiming",entries:o}),patchCaptionLineWindows:o=>t({type:"patchCaptionLineWindows",entries:o}),hideCaptionWords:o=>t({type:"hideCaptionWords",words:o}),restoreCaptionWords:o=>t({type:"restoreCaptionWords",srcStarts:o}),cutWords:(o,i,s,a)=>t({type:"cutWords",words:o,startSec:i,endSec:s,src:a}),setReasonEnabled:(o,i)=>t({type:"setReasonEnabled",reason:o,enabled:i}),toggleKept:(o,i)=>t({type:"toggleKept",srcIn:o,srcOut:i}),dismissRemoval:(o,i)=>t({type:"dismissRemoval",srcIn:o,srcOut:i}),restoreDismissed:(o,i)=>t({type:"restoreDismissed",srcIn:o,srcOut:i}),rekeyCaptionKeys:o=>t({type:"rekeyCaptionKeys",mapping:o}),patchTheme:o=>t({type:"patchTheme",patch:o})}}function G3(e){const t=e.spans;if(t===void 0)return{};let n;try{n=Fo(t).spans.length}catch{return{}}if(n===0)return{};const r={};return e.captionLines&&(r.captionLines=zy(e.captionLines,t)),e.baseCaptionLines&&(r.baseCaptionLines=zy(e.baseCaptionLines,t)),r}function Jy(e,t){const n=t.baseCaptionLines??t.captionLines??[],r=k4(e.captions,n);return{doc:{...e,captions:E4(e.captions,r)},unresolved:r.unresolved}}function MS(e){const t={};for(const[n,r]of Object.entries(e))da(n)||(t[n]=r);return t}function X3(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 q3(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 AS(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 J3(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 Q3(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 eN(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 kd(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 tN(e){if(e===void 0||e.trim()==="")return null;const t=Number(e);return He({srcStart:t})===null?null:t}function nN(e,t,n){if(Object.keys(t).length===0)return{lines:[...e],dropped:[]};let r=null;try{r=n.length>0?Fo(n):null}catch{r=null}return r===null?{lines:[...e],dropped:Object.keys(t).map(o=>({key:o,expected:"",found:null}))}:aS(e,t,r)}function rN(e,t,n,r){const o=V4(e,t,{breakpoints:r.breakpoints,...W4(r.landscape)}),i=nS(o,MS(n.captions)).lines,s=rS(i,n.captionRangeEdits).lines,a=oS(s,n.captionWordsHidden).lines,l=sS(a,n.captionLineTiming),c=aS(l.lines,n.captionLineWindows,t);return{baseLines:o,liveLines:s,timingLines:a,lines:c.lines,dropped:[...l.dropped,...c.dropped]}}function Qy(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 ev(e){const t=e==null?void 0:e.closest("[data-edit-video]");return(t==null?void 0:t.dataset.editVideo)||null}function tv(e,t,n){const r=e.querySelectorAll(`[data-edit-scene="${t}"] [data-edit-id="${n}"]`);if(r.length===0)return null;let o=1/0,i=1/0,s=-1/0,a=-1/0;return r.forEach(l=>{const c=l.getBoundingClientRect();o=Math.min(o,c.left),i=Math.min(i,c.top),s=Math.max(s,c.right),a=Math.max(a,c.bottom)}),new DOMRect(o,i,s-o,a-i)}const nv=.015,oN=1e-9;function ri(e,t){let n=null,r=1/0;for(const o of e){const i=Math.abs(o.feature-o.target);i<=t+oN&&i<r&&(n=o,r=i)}return n}function rv(e,t,n,r){const o={...e},i=[];if(t==="move"){const s=e.x+e.w/2,a=e.x+e.w,l=.5-e.w/2,c=l>=n.left&&l+e.w<=1-n.right,f=ri([...c?[{target:.5,feature:s}]:[],{target:n.left,feature:e.x},{target:1-n.right,feature:a}],r);f&&(o.x=e.x+(f.target-f.feature),i.push({axis:"x",at:f.target}));const p=e.y+e.h/2,m=e.y+e.h,y=.5-e.h/2,w=y>=n.top&&y+e.h<=1-n.bottom,x=ri([...w?[{target:.5,feature:p}]:[],{target:n.top,feature:e.y},{target:1-n.bottom,feature:m}],r);return x&&(o.y=e.y+(x.target-x.feature),i.push({axis:"y",at:x.target})),{rect:o,guides:i}}if(t.includes("w")){const s=ri([{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=ri([{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=ri([{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=ri([{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 iN(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=lS(e.id);return{sceneId:e.id,rootId:o,isSplitHalf:o!==e.id,startSec:e.startSec,endSec:e.endSec,targets:n}}function ov(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 iv=64,pl=9,hl=e=>Math.round(e*10)/10,oi=e=>Math.round(e*1e4)/1e4,NS={position:"absolute",width:10,height:10,background:"#5b8cff",border:"1px solid #0B0B0E",borderRadius:2,pointerEvents:"auto",zIndex:6},sv={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"}},sN={...NS,background:"#ffe14d"},aN={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}},lN={position:"absolute",cursor:"move",pointerEvents:"auto",zIndex:5},LS=/^(line|node|message|window|item)-(\d+)$/;function uN(e,t,n){const r=LS.exec(e);if(!r)return null;const o=r[1],i=Number(r[2]);if(o==="message"&&i===0&&typeof t.keyword=="string"&&t.keyword){const f=n.trim().replace(/^"(.*)"$/,"$1").toLowerCase();return f?{keyword:f}:null}const s=o==="line"?"lines":o==="node"?"nodes":o==="item"?"items":o==="window"?"windows":"messages",a=t[s];if(!Array.isArray(a)||i<0||i>=a.length)return null;const l=a.slice(),c=l[i];if(o==="node"||o==="item")l[i]=n;else if(o==="window"){if(typeof c!="object"||c===null)return null;const f=n.split(`
162
+ `).slice(0,6).map(p=>p.slice(0,40));l[i]={...c,lines:f}}else{if(typeof c!="object"||c===null)return null;l[i]={...c,text:n}}return{[s]:l}}function cN(e,t){const n=LS.exec(e);if(!n){const c=t[e];return typeof c=="string"?c:null}const r=n[1],o=Number(n[2]);if(r==="message"&&o===0&&typeof t.keyword=="string"&&t.keyword)return t.keyword;const s=t[r==="line"?"lines":r==="node"?"nodes":r==="item"?"items":r==="window"?"windows":"messages"];if(!Array.isArray(s)||o<0||o>=s.length)return null;const a=s[o];if(r==="node"||r==="item")return typeof a=="string"?a:null;if(r==="window"){const c=a==null?void 0:a.lines;return Array.isArray(c)&&c.every(f=>typeof f=="string")?c.join(`
163
+ `):null}const l=a==null?void 0:a.text;return typeof l=="string"?l:null}function OS(){const e=document.activeElement;(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&e.blur()}const dN=({stageRef:e,selection:t,onSelect:n,edits:r,onSave:o,settings:i,playerRef:s,onTransport:a,onVideoPreview:l,onGraphicPreview:c,cue:f,cues:p,onToggleHelp:m,onRequestDelete:y,fromLive:w=g=>g,hasOldClockPreimage:x=()=>!0,toSourceSec:S=null,onClockRefused:h=()=>{}})=>{const[g,v]=d.useState(null),b=d.useRef(null),k=d.useRef(0),E=d.useRef(null),C=d.useRef(0),I=d.useRef(null),j=d.useRef(0),F=d.useRef(null),[L,V]=d.useState(!1),[M,$]=d.useState([]),D=d.useRef(null),[H,P]=d.useState(null),[T,W]=d.useState(null),R=d.useRef(null),[Z,Q]=d.useState({dx:0,dy:0}),_=d.useRef(null),N=d.useRef(t),z=d.useCallback(U=>{N.current=U,n(U)},[n]);d.useEffect(()=>{N.current=t},[t]);const ne=(U,G)=>{const K=[];let le=null;for(let Y=0;Y<25;Y++){const ie=document.elementFromPoint(U,G);if(!ie||ie===document.documentElement||ie===document.body){le=ie;break}if(le=ie,ie.hasAttribute("data-edit-id")||ie.hasAttribute("data-edit-scene")||ie.hasAttribute("data-caption-word")||ie.closest("[data-edit-video]")!==null||["BUTTON","INPUT","SELECT","TEXTAREA"].includes(ie.tagName)||!(ie instanceof HTMLElement))break;K.push({el:ie,prev:ie.style.pointerEvents}),ie.style.pointerEvents="none"}return K.forEach(({el:Y,prev:ie})=>{Y.style.pointerEvents=ie}),le},J=d.useCallback(()=>{var ie,ke;const U=e.current,G=(ie=s.current)==null?void 0:ie.getScale(),K=((ke=U==null?void 0:U.querySelector(".__remotion-player"))==null?void 0:ke.getBoundingClientRect())??(U==null?void 0:U.getBoundingClientRect());if(!K||!G||G<=0)return null;const le=i.width*G,Y=i.height*G;return{left:K.left+(K.width-le)/2,top:K.top+(K.height-Y)/2,w:le,h:Y}},[e,s,i]);return d.useEffect(()=>{if(!t){v(null);return}let U;const G=()=>{var le;const K=e.current;if(K){const Y=t.elementId?tv(K,t.sceneId,t.elementId):((le=K.querySelector(`[data-edit-scene="${t.sceneId}"]`))==null?void 0:le.getBoundingClientRect())??null;v(Y)}U=requestAnimationFrame(G)};return U=requestAnimationFrame(G),()=>cancelAnimationFrame(U)},[e,t]),d.useEffect(()=>{const U=G=>{var Y,ie;const K=e.current;if(!K||!K.contains(G.target)||G.altKey||G.button!==0)return;(((Y=N.current)==null?void 0:Y.elementId)&&((ie=_.current)==null?void 0:ie.contains(G.target))||Qy(ne(G.clientX,G.clientY))!==null)&&G.stopPropagation()};return window.addEventListener("pointerdown",U,!0),()=>window.removeEventListener("pointerdown",U,!0)},[e]),d.useEffect(()=>{const U=G=>{var oe,de,fe,Ce,Te,Re,xe;const K=e.current;if(!K||!K.contains(G.target))return;const le=document.activeElement;if((le instanceof HTMLInputElement||le instanceof HTMLTextAreaElement)&&le.contains(G.target)||(OS(),G.altKey||G.button!==0))return;const Y=G.target instanceof Element?G.target.closest("[data-el-handle]"):null,ie=N.current;if(Y&&(ie!=null&&ie.elementId)){const be=tv(K,ie.sceneId,ie.elementId);if(be){const pe=be.left+be.width/2,Le=be.top+be.height/2,Ie=Math.hypot(G.clientX-pe,G.clientY-Le);if(Ie>2){const Ye=((de=(oe=r.doc.scenes[ie.sceneId])==null?void 0:oe.elements[ie.elementId])==null?void 0:de.scale)??1;D.current={sceneId:ie.sceneId,elementId:ie.elementId,cx:pe,cy:Le,startDist:Ie,prior:Ye,factor:1},P(1)}}return}if((fe=N.current)!=null&&fe.elementId&&((Ce=_.current)!=null&&Ce.contains(G.target))){R.current={x:G.clientX,y:G.clientY,dx:0,dy:0},Q({dx:0,dy:0});return}const ke=G.target instanceof Element?G.target.closest("[data-box-handle]"):null,O=N.current;if(ke&&O&&!O.elementId){const be=K.querySelector(`[data-edit-scene="${O.sceneId}"]`),pe=J();if(be&&pe){const Le=be.getBoundingClientRect();F.current=null,I.current={sceneId:O.sceneId,handle:ke.dataset.boxHandle,x:G.clientX,y:G.clientY,dx:0,dy:0,start:{x:(Le.left-pe.left)/pe.w,y:(Le.top-pe.top)/pe.h,w:Le.width/pe.w,h:Le.height/pe.h}},V(!0)}return}const X=ne(G.clientX,G.clientY),se=Qy(X);if(!se){const be=X==null?void 0:X.closest("[data-edit-scene]");if(be){z({sceneId:be.dataset.editScene,elementId:null});return}const pe=ev(X),Le=K.getBoundingClientRect().bottom;if(pe&&G.clientY<Le-iv){z({sceneId:pe,elementId:null});const Ie=p.find(ze=>ze.id===pe);if((Ie==null?void 0:Ie.layout)==="pip-bubble"&&!G.altKey){const ze=Oo("pip-bubble",void 0,[],i).video.rect;E.current={sceneId:pe,x:G.clientX,y:G.clientY,base:{x:((Te=Ie.pip)==null?void 0:Te.x)??ze.x,y:((Re=Ie.pip)==null?void 0:Re.y)??ze.y},slot:{w:ze.w,h:ze.h}};return}const Ye=(xe=r.doc.scenes[pe])==null?void 0:xe.video;b.current={sceneId:pe,x:G.clientX,y:G.clientY,dx:0,dy:0,baseDx:(Ye==null?void 0:Ye.dx)??0,baseDy:(Ye==null?void 0:Ye.dy)??0};return}z(null);return}z({sceneId:se.sceneId,elementId:se.elementId}),R.current={x:G.clientX,y:G.clientY,dx:0,dy:0},Q({dx:0,dy:0})};return window.addEventListener("mousedown",U),()=>window.removeEventListener("mousedown",U)},[e,z,r,J,p,i]),d.useEffect(()=>{const U=()=>{var ie,ke;const le=(ie=s.current)==null?void 0:ie.getScale(),Y=(ke=e.current)==null?void 0:ke.getBoundingClientRect();return le&&le>0?1/le:Y&&Y.width>0?i.width/Y.width:1},G=le=>{const Y=e.current;if(Y&&!(I.current||D.current))if(E.current)Y.style.cursor="move";else if(b.current)Y.style.cursor="grabbing";else{const oe=le.target instanceof Element?le.target:null,de=oe!==null&&Y.contains(oe)&&!oe.closest("button, input, select, textarea, [data-edit-id], [data-edit-scene], [data-caption-word]")&&le.clientY<Y.getBoundingClientRect().bottom-iv,fe=de&&(()=>{var Te;const Ce=ev(oe);return Ce!==null&&((Te=p.find(Re=>Re.id===Ce))==null?void 0:Te.layout)==="pip-bubble"})();Y.style.cursor=de?fe?"move":"grab":""}const ie=D.current;if(ie){const de=Math.hypot(le.clientX-ie.cx,le.clientY-ie.cy)/ie.startDist;ie.factor=Math.min(4/ie.prior,Math.max(.05/ie.prior,de)),P(ie.factor);return}const ke=I.current;if(ke){ke.dx=le.clientX-ke.x,ke.dy=le.clientY-ke.y,F.current=le.altKey,j.current||(j.current=requestAnimationFrame(()=>{j.current=0;const oe=I.current,de=J();if(!oe||!de)return;const fe=bu(ov(oe.start,oe.handle,oe.dx/de.w,oe.dy/de.h),i);if(le.altKey)$([]),c({sceneId:oe.sceneId,rect:fe});else{const Ce=rv(fe,oe.handle,or(i),nv);$(Ce.guides),c({sceneId:oe.sceneId,rect:Ce.rect})}}));return}if(E.current){C.current||(C.current=requestAnimationFrame(()=>{C.current=0;const oe=E.current,de=J();if(!oe||!de)return;const fe=(le.clientX-oe.x)/de.w,Ce=(le.clientY-oe.y)/de.h;r.patchPip(oe.sceneId,{x:oi(Math.min(Math.max(oe.base.x+fe,0),1-oe.slot.w)),y:oi(Math.min(Math.max(oe.base.y+Ce,0),1-oe.slot.h))},`pip:${oe.sceneId}:drag`)}));return}const X=b.current;if(X){X.dx=le.clientX-X.x,X.dy=le.clientY-X.y,k.current||(k.current=requestAnimationFrame(()=>{k.current=0;const oe=b.current;if(!oe)return;const de=U();l({sceneId:oe.sceneId,patch:{dx:oe.baseDx+oe.dx*de,dy:oe.baseDy+oe.dy*de}})}));return}const se=R.current;se&&(se.dx=le.clientX-se.x,se.dy=le.clientY-se.y,Q({dx:se.dx,dy:se.dy}))},K=le=>{const Y=D.current;if(Y){D.current=null,P(null),Math.abs(Y.factor-1)>.001&&r.patchElement(Y.sceneId,Y.elementId,{scale:Math.round(Y.prior*Y.factor*1e3)/1e3});return}const ie=I.current;if(ie){if(I.current=null,V(!1),$([]),j.current&&(cancelAnimationFrame(j.current),j.current=0),ie.dx!==0||ie.dy!==0){const oe=J();if(oe){let de=bu(ov(ie.start,ie.handle,ie.dx/oe.w,ie.dy/oe.h),i);(F.current??le.altKey)||(de=rv(de,ie.handle,or(i),nv).rect),r.patchGraphicRect(ie.sceneId,{x:oi(de.x),y:oi(de.y),w:oi(de.w),h:oi(de.h)})}}F.current=null,c(null);return}if(E.current){E.current=null,C.current&&(cancelAnimationFrame(C.current),C.current=0);return}const O=b.current;if(O){if(b.current=null,k.current&&(cancelAnimationFrame(k.current),k.current=0),O.dx!==0||O.dy!==0){const oe=U();r.patchVideo(O.sceneId,{dx:hl(O.baseDx+O.dx*oe),dy:hl(O.baseDy+O.dy*oe)})}l(null);return}const X=R.current,se=N.current;if(!X||!(se!=null&&se.elementId)){R.current=null;return}if(X.dx!==0||X.dy!==0){const oe=U(),de=r.doc.scenes[se.sceneId],fe=de==null?void 0:de.elements[se.elementId];r.patchElement(se.sceneId,se.elementId,{dx:hl(((fe==null?void 0:fe.dx)??0)+X.dx*oe),dy:hl(((fe==null?void 0:fe.dy)??0)+X.dy*oe)})}R.current=null,Q({dx:0,dy:0})};return window.addEventListener("mousemove",G),window.addEventListener("mouseup",K),()=>{window.removeEventListener("mousemove",G),window.removeEventListener("mouseup",K)}},[r,e,i,s,l,c,J,p]),d.useEffect(()=>{const U=G=>{var ke;const K=e.current;if(!K||!K.contains(G.target))return;const le=(ke=ne(G.clientX,G.clientY))==null?void 0:ke.closest("[data-caption-word]");if(!le)return;G.preventDefault();const Y=tN(le.dataset.captionSrc),ie=le.dataset.captionText??"";Y===null||!ie||W({srcStart:Y,was:ie,draft:ie,rect:le.getBoundingClientRect()})};return window.addEventListener("dblclick",U),()=>window.removeEventListener("dblclick",U)},[e]),d.useEffect(()=>{const U=()=>{const Y=document.activeElement;return Y instanceof HTMLInputElement||Y instanceof HTMLTextAreaElement||Y instanceof HTMLSelectElement||Y instanceof HTMLElement&&Y.isContentEditable},G=()=>{const Y=document.activeElement;return Y instanceof HTMLTextAreaElement||Y instanceof HTMLElement&&Y.isContentEditable?!0:Y instanceof HTMLInputElement&&!["range","checkbox","radio","button"].includes(Y.type)},K=()=>{const Y=document.activeElement;Y instanceof HTMLElement&&!G()&&Y.blur()},le=Y=>{var ke,O,X;if(T!==null)return;const ie=Y.metaKey||Y.ctrlKey;if(Y.key==="Escape"){if(U()){(ke=document.activeElement)==null||ke.blur();return}z(null)}else if(ie&&Y.key.toLowerCase()==="z")Y.preventDefault(),Y.shiftKey?r.redo():r.undo();else if(ie&&Y.key.toLowerCase()==="y")Y.preventDefault(),r.redo();else if(ie&&Y.key.toLowerCase()==="s")Y.preventDefault(),o();else if(Y.key===" "&&!ie){if(G())return;const se=document.activeElement;if(se instanceof HTMLElement&&se.tagName==="BUTTON"&&((O=e.current)!=null&&O.contains(se)))return;K(),Y.preventDefault(),(X=s.current)==null||X.toggle()}else if(!ie&&["j","k","l"].includes(Y.key.toLowerCase())){if(G())return;K(),Y.preventDefault(),a(Y.key.toUpperCase())}else if(!ie&&!Y.altKey&&(Y.key==="ArrowLeft"||Y.key==="ArrowRight")){if(U())return;Y.preventDefault();const se=s.current;if(!se)return;se.seekTo(Math.max(0,se.getCurrentFrame()+(Y.key==="ArrowRight"?1:-1)))}else if(ie&&Y.key.toLowerCase()==="b"){{const Te=document.activeElement;if(Te instanceof HTMLTextAreaElement||Te instanceof HTMLElement&&Te.isContentEditable)return;Te instanceof HTMLElement&&Te.blur()}Y.preventDefault();const se=s.current;if(!se)return;const oe=se.getCurrentFrame()/i.fps;if(!p.find(Te=>oe>=Te.startSec+Vi&&oe<=Te.endSec-Vi))return;const fe=S===null?void 0:Math.round(S(oe)*1e3)/1e3,Ce=x(oe)?Math.round(w(oe)*1e3)/1e3:void 0;if(Ce===void 0&&fe===void 0){h("Can't split here: this moment isn't anchorable yet — render once and try again.");return}r.addSplit({at:Ce,src:fe})}else if(!ie&&Y.altKey&&(Y.key==="ArrowLeft"||Y.key==="ArrowRight")){if(G())return;const se=N.current,oe=se?(()=>{const de=p.findIndex(fe=>fe.id===se.sceneId);return de===-1?void 0:p[de+(Y.key==="ArrowRight"?1:-1)]})():p[Y.key==="ArrowRight"?0:p.length-1];if(!oe)return;Y.preventDefault(),z({sceneId:oe.id,elementId:null})}else if(ie&&(Y.key==="ArrowLeft"||Y.key==="ArrowRight")){if(G())return;Y.preventDefault();const se=s.current;if(!se)return;const oe=se.getCurrentFrame()/i.fps,de=p.findIndex(Ce=>oe>=Ce.startSec&&oe<Ce.endSec),fe=p[(de===-1?0:de)+(Y.key==="ArrowRight"?1:-1)];if(!fe)return;se.seekTo(Math.round(fe.startSec*i.fps)),z({sceneId:fe.id,elementId:null})}else if(!ie&&!Y.altKey&&Y.key==="?"){if(U())return;Y.preventDefault(),m()}else if(!ie&&(Y.key==="Delete"||Y.key==="Backspace")){if(U())return;const se=N.current;if(!se||se.elementId!==null||!f||f.id!==se.sceneId)return;const oe=iN(f,r.doc);if(!oe)return;Y.preventDefault(),y(oe)}};return window.addEventListener("keydown",le),()=>window.removeEventListener("keydown",le)},[z,r,T,o,s,e,a,f,p,i,m,y,w,x,S,h]),u.jsxs("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},children:[Z.dx!==0||Z.dy!==0||L?u.jsx("div",{"data-testid":"safe-area-guide",style:{position:"absolute",left:`${or(i).left*100}%`,top:`${or(i).top*100}%`,right:`${or(i).right*100}%`,bottom:`${or(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,M.map(U=>u.jsx("div",{"data-testid":`guide-${U.axis}`,style:{position:"absolute",pointerEvents:"none",background:"#FFE14D",...U.axis==="x"?{left:`${U.at*100}%`,top:0,bottom:0,width:1}:{top:`${U.at*100}%`,left:0,right:0,height:1}}},U.axis)),g&&t?u.jsxs("div",{ref:_,"data-testid":"overlay-box",style:{position:"fixed",pointerEvents:"auto",left:g.left+Z.dx-pl/2+g.width*(1-(H??1))/2,top:g.top+Z.dy-pl/2+g.height*(1-(H??1))/2,width:g.width*(H??1)+pl,height:g.height*(H??1)+pl,border:t.elementId?"2px dashed #ffe14d":"2px dashed #5b8cff",borderRadius:4,boxShadow:"0 0 0 1px rgba(0,0,0,0.35)",cursor:t.elementId?"grab":"default"},children:[t.elementId?u.jsx("div",{style:{position:"absolute",bottom:"100%",left:0,marginBottom:4,fontSize:10,fontFamily:"ui-monospace, 'SF Mono', monospace",letterSpacing:"0.04em",textTransform:"uppercase",color:"#0B0B0E",background:"#ffe14d",padding:"2px 6px",borderRadius:3,whiteSpace:"nowrap"},children:t.elementId}):null,t.elementId?["nw","ne","se","sw"].map(U=>u.jsx("div",{"data-el-handle":U,"data-testid":`el-handle-${U}`,style:{...sN,...sv[U]}},U)):null,!t.elementId&&f&&f.kind!=="plain"?u.jsxs(u.Fragment,{children:[["top","bottom","left","right"].map(U=>u.jsx("div",{"data-box-handle":"move","data-testid":U==="top"?"box-handle-move":`box-handle-move-${U}`,style:{...lN,...aN[U]}},U)),["nw","n","ne","e","se","s","sw","w"].map(U=>u.jsx("div",{"data-box-handle":U,"data-testid":`box-handle-${U}`,style:{...NS,...sv[U]}},U))]}):null]}):null,T?u.jsx("input",{autoFocus:!0,"data-testid":"caption-edit",value:T.draft,onChange:U=>W({...T,draft:U.target.value}),onBlur:()=>{const U=T.draft.trim();U&&r.patchCaption(T.srcStart,U,T.was),W(null)},onKeyDown:U=>{U.key==="Enter"&&U.target.blur(),U.key==="Escape"&&W(null)},style:{position:"fixed",pointerEvents:"auto",left:T.rect.left-4,top:T.rect.top-4,width:Math.max(T.rect.width+40,90),height:T.rect.height+8,fontSize:Math.max(13,Math.min(T.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]})},vn={display:"flex",flexDirection:"column",gap:6},Es={display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},Ve={fontSize:11,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"#9A9AA3"},Ei={fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",fontSize:13,background:"#0F0F14",border:"1px solid #2A2A33",borderRadius:6,color:"#fff",padding:"6px 8px",width:"100%"},op={...Ei,fontFamily:"'Inter', system-ui, sans-serif"},lt={display:"flex",flexDirection:"column",gap:14,padding:"16px 18px",borderBottom:"1px solid #22222a"},mn={fontSize:12,fontWeight:600,color:"#FF5C5C",background:"transparent",border:"1px solid #452626",borderRadius:6,padding:"7px 10px",cursor:"pointer"},gn=()=>{var e,t;(t=(e=document.activeElement)==null?void 0:e.blur)==null||t.call(e)},fN=e=>String(Math.round(e*1e3)/1e3),av=e=>Math.round(e*1e3)/1e3,nn=({id:e,value:t,onCommit:n,min:r,max:o,dragStep:i})=>{const[s,a]=he.useState(null),[l,c]=he.useState(!1),f=he.useRef(null),p=he.useRef(null),m=r??-1/0,y=o??1/0,w=i??(r!==void 0&&o!==void 0?(o-r)/240:.5),x=s!==null;return u.jsxs("div",{style:vn,children:[u.jsx("span",{style:Ve,children:e}),u.jsx("input",{type:"text",inputMode:"decimal",ref:f,"data-testid":`field-${e}`,style:{...Ei,...x?{}:{cursor:"ew-resize",touchAction:"none"},...l?{borderColor:"#FFE14D",color:"#FFE14D"}:{}},value:s??(Number.isFinite(t)?fN(t):"0"),onFocus:S=>a(S.target.value),onBlur:()=>a(null),onPointerDown:S=>{x||(S.preventDefault(),p.current={x:S.clientX,v:Number.isFinite(t)?t:0,moved:!1},S.currentTarget.setPointerCapture(S.pointerId),c(!0))},onPointerMove:S=>{const h=p.current;if(!h)return;const g=S.clientX-h.x;if(!h.moved&&Math.abs(g)<=2)return;h.moved=!0;const v=Math.round(Math.min(y,Math.max(m,h.v+g*w))*1e3)/1e3;n(v)},onPointerUp:()=>{var h,g,v;const S=((h=p.current)==null?void 0:h.moved)===!0;p.current=null,c(!1),S||((g=f.current)==null||g.focus(),(v=f.current)==null||v.select())},onPointerCancel:()=>{p.current=null,c(!1)},onChange:S=>{a(S.target.value);const h=S.target.value.trim();if(h==="")return;const g=Number(h.replace(",","."));Number.isFinite(g)&&n(Math.min(y,Math.max(m,g)))}})]})},ml=({id:e,value:t,isColor:n,onCommit:r})=>u.jsxs("div",{style:vn,children:[u.jsx("span",{style:Ve,children:e}),u.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[n?u.jsx("input",{type:"color",value:t,onChange:o=>r(o.target.value),style:{width:28,height:28,border:"1px solid #2A2A33",borderRadius:6,padding:0,background:"none"}}):null,u.jsx("input",{"data-testid":`theme-${e}`,style:{...op,flex:1},value:t,onChange:o=>r(o.target.value)})]})]}),pN=({selection:e,cue:t,frame:n,allSceneIds:r,edits:o,onSelect:i,resolvedTheme:s,anchorText:a,onVideoPreview:l,runInfo:c,captionsHiddenByFlag:f,fromLive:p=x=>x,hasOldClockPreimage:m=()=>!0,toSourceSec:y=null,onClockRefused:w=()=>{}})=>{var k,E,C,I,j,F,L,V,M,$,D,H;if(e!=null&&e.elementId&&t){const P=e.elementId,T=((k=t.elements)==null?void 0:k[P])??{},W=t.props?cN(P,t.props):null,R=/^window-\d+$/.test(P);return u.jsxs("div",{children:[u.jsxs("div",{style:lt,children:[u.jsx("span",{style:Ve,children:"Selected"}),u.jsx("div",{style:{fontSize:15,fontWeight:700,fontFamily:"ui-monospace, monospace"},children:P})]}),(()=>{var ne;const Z=/^line-(\d+)$/.exec(P),Q=(ne=t.props)==null?void 0:ne.lines;if(t.component!=="StrikethroughReveal"||!Z||!Array.isArray(Q))return null;const _=Number(Z[1]),N=Q[_];if(!N)return null;const z=N.struck?"struck":(N.mark??"none")!=="none"?N.mark:"plain";return u.jsx("div",{style:lt,children:u.jsxs("div",{style:vn,children:[u.jsx("span",{style:Ve,children:"Line style"}),u.jsxs("select",{"data-testid":"line-style",style:Ei,value:z,onChange:J=>{const U=J.target.value,G=Q.slice();G[_]={...G[_],struck:U==="struck",mark:U==="cross"||U==="check"?U:"none"},o.patchProps(e.sceneId,{lines:G})},children:[u.jsx("option",{value:"plain",children:"plain"}),u.jsx("option",{value:"struck",children:"struck through"}),u.jsx("option",{value:"cross",children:"✗ wrong"}),u.jsx("option",{value:"check",children:"✓ right"})]})]})})})(),W!==null?u.jsx("div",{style:lt,children:u.jsxs("div",{style:vn,children:[u.jsx("span",{style:Ve,children:"Text"}),(()=>{const Z=Q=>{const _=t.props??{},N=/^(line|node|message|window|item)-\d+$/.test(P)?uN(P,_,Q):{[P]:Q};N&&o.patchProps(e.sceneId,N,`text:${e.sceneId}:${P}`)};return R?u.jsx("textarea",{style:{...op,resize:"vertical",fontFamily:"inherit"},"data-testid":"element-text",rows:Math.min(6,Math.max(2,W.split(`
164
+ `).length)),value:W,onChange:Q=>Z(Q.target.value)}):u.jsx("input",{style:op,"data-testid":"element-text",value:W,onChange:Q=>Z(Q.target.value)})})()]})}):null,u.jsxs("div",{style:lt,children:[u.jsxs("div",{style:vn,children:[u.jsxs("span",{style:Ve,children:["scale"," ",u.jsxs("span",{style:{color:"#EDEDF2"},children:[(T.scale??1).toFixed(2),"×"]})]}),u.jsx("input",{type:"range","data-testid":"el-scale-slider",min:.1,max:3,step:.01,value:T.scale??1,onChange:Z=>o.patchElement(e.sceneId,P,{scale:Number(Z.target.value)},`element:${e.sceneId}:${P}:scale`)})]}),u.jsxs("div",{style:Es,children:[u.jsx(nn,{id:"x",value:T.dx??0,dragStep:1,onCommit:Z=>o.patchElement(e.sceneId,P,{dx:Z},`element:${e.sceneId}:${P}:dx`)}),u.jsx(nn,{id:"y",value:T.dy??0,dragStep:1,onCommit:Z=>o.patchElement(e.sceneId,P,{dy:Z},`element:${e.sceneId}:${P}:dy`)})]}),u.jsx(nn,{id:"scale",value:T.scale??1,min:.05,max:4,dragStep:.01,onCommit:Z=>o.patchElement(e.sceneId,P,{scale:Z},`element:${e.sceneId}:${P}:scale`)})]}),u.jsxs("div",{style:lt,children:[u.jsx("button",{style:mn,onClick:()=>{gn(),o.clearElement(e.sceneId,P)},children:"Reset element"}),u.jsx("button",{"data-testid":"delete-element",style:{...mn,marginTop:8},onClick:()=>{gn(),o.hideElement(e.sceneId,P),i({sceneId:e.sceneId,elementId:null})},children:"Delete element"})]})]})}if(e&&t){const P=t.kind==="plain";if(((E=o.doc.scenes[e.sceneId])==null?void 0:E.hidden)===!0)return u.jsx("div",{children:u.jsxs("div",{style:lt,children:[u.jsx("span",{style:Ve,children:"Scene"}),u.jsxs("div",{style:{fontSize:15,fontWeight:700,fontFamily:"ui-monospace, monospace"},children:[e.sceneId," ",u.jsx("span",{style:{color:"#9A9AA3",fontWeight:400},children:"(deleted)"})]}),u.jsx("div",{style:{fontSize:12,color:"#9A9AA3"},children:"Its window plays as a plain take. Restore brings the graphic back."}),u.jsx("button",{"data-testid":"restore-scene",style:{...mn,color:"#5FBF77",border:"1px solid #24402c"},onClick:()=>{gn(),o.restoreScene(e.sceneId)},children:"Restore scene"})]})});const T=o.doc.cuts.findIndex(R=>R.src===void 0&&R.startSec===t.startSec&&R.endSec===t.endSec);if(T!==-1)return u.jsx("div",{children:u.jsxs("div",{style:lt,children:[u.jsx("span",{style:Ve,children:P?"Take":"Scene"}),u.jsxs("div",{style:{fontSize:15,fontWeight:700,fontFamily:"ui-monospace, monospace"},children:[e.sceneId," ",u.jsx("span",{style:{color:"#9A9AA3",fontWeight:400},children:"(marked for removal)"})]}),u.jsx("div",{style:{fontSize:12,color:"#9A9AA3"},children:"Struck through on the timeline. It disappears from the output on the next produce/Render — this preview still plays it (the editor doesn't re-derive a second cut timeline just to show one early)."}),u.jsx("button",{"data-testid":"restore-chunk",style:{...mn,color:"#5FBF77",border:"1px solid #24402c"},onClick:()=>{gn(),o.restoreChunk(T)},children:"Restore"})]})});const W=Object.entries(t.elements??{}).filter(([,R])=>R.hidden===!0).map(([R])=>{var _,N;const Q=((N=(_=o.doc.scenes[e.sceneId])==null?void 0:_.elements[R])==null?void 0:N.hidden)===!0?e.sceneId:lS(e.sceneId);return{id:R,owningSceneId:Q}});return u.jsxs("div",{children:[u.jsxs("div",{style:lt,children:[u.jsx("span",{style:Ve,children:P?"Take":"Scene"}),u.jsx("div",{style:{fontSize:15,fontWeight:700,fontFamily:"ui-monospace, monospace"},children:e.sceneId}),P?u.jsx("div",{style:{fontSize:12,color:"#9A9AA3"},children:"A continuous stretch of the talking head — no graphic. Frame it below; its window follows the cut."}):null]}),u.jsxs("div",{style:lt,children:[!P&&t.component?u.jsxs("div",{style:vn,children:[u.jsx("span",{style:Ve,children:"Component"}),u.jsx("select",{style:Ei,value:t.component,onChange:R=>o.patchComponent(e.sceneId,R.target.value),children:wc.options.map(R=>u.jsx("option",{value:R,children:R},R))})]}):null,!P&&t.component?e4(t.component).map(R=>{var Z,Q,_;return R.kind==="boolean"?u.jsxs("div",{style:vn,children:[u.jsx("span",{style:Ve,children:R.key}),u.jsx("input",{type:"checkbox","data-testid":`prop-${R.key}`,checked:typeof((Z=t.props)==null?void 0:Z[R.key])=="boolean"?t.props[R.key]:R.fallback===!0,onChange:N=>o.patchProps(e.sceneId,{[R.key]:N.target.checked})})]},R.key):u.jsxs("div",{style:vn,children:[u.jsx("span",{style:Ve,children:R.key}),u.jsx("select",{style:Ei,"data-testid":`prop-${R.key}`,value:String(((Q=t.props)==null?void 0:Q[R.key])??((_=R.options)==null?void 0:_[0])??""),onChange:N=>o.patchProps(e.sceneId,{[R.key]:N.target.value}),children:(R.options??[]).map(N=>u.jsx("option",{value:N,children:N},N))})]},R.key)}):null,u.jsxs("div",{style:vn,children:[u.jsx("span",{style:Ve,children:"Layout"}),u.jsx("select",{style:Ei,"data-testid":"layout-select",value:t.layout,onChange:R=>o.patchLayout(e.sceneId,R.target.value),children:vc.options.map(R=>u.jsx("option",{value:R,children:R},R))})]})]}),u.jsxs("div",{style:lt,children:[u.jsx("span",{style:Ve,children:"Video framing"}),u.jsxs("div",{style:vn,children:[u.jsxs("span",{style:Ve,children:["zoom"," ",u.jsxs("span",{style:{color:"#EDEDF2"},children:[(((C=t.video)==null?void 0:C.scale)??1).toFixed(2),"×"]})]}),u.jsx("input",{type:"range","data-testid":"zoom-slider",min:.5,max:3,step:.01,value:((I=t.video)==null?void 0:I.scale)??1,onChange:R=>l({sceneId:e.sceneId,patch:{scale:Number(R.target.value)}}),onPointerUp:R=>{const Z=Number(R.target.value);o.patchVideo(e.sceneId,{scale:Z},`video:${e.sceneId}:scale`),l(null)},onKeyUp:R=>{if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(R.key))return;const Q=Number(R.target.value);o.patchVideo(e.sceneId,{scale:Q},`video:${e.sceneId}:scale`),l(null)}})]}),u.jsxs("label",{style:{display:"flex",gap:8,alignItems:"center",fontSize:12,color:"#9A9AA3",cursor:"pointer"},children:[u.jsx("input",{type:"checkbox","data-testid":"auto-zoom",checked:((j=t.video)==null?void 0:j.autoZoom)!==!1,onChange:R=>o.patchVideo(e.sceneId,{autoZoom:R.target.checked})}),"auto zoom (the slow push composes on top of your zoom)"]}),u.jsx("div",{style:{fontSize:12,color:"#9A9AA3"},children:"Pan: drag the picture on the stage."}),u.jsx(nn,{id:"scale",value:((F=t.video)==null?void 0:F.scale)??1,min:.05,max:4,dragStep:.01,onCommit:R=>o.patchVideo(e.sceneId,{scale:R},`video:${e.sceneId}:scale`)}),u.jsxs("div",{style:Es,children:[u.jsx(nn,{id:"dx",value:((L=t.video)==null?void 0:L.dx)??0,dragStep:1,onCommit:R=>o.patchVideo(e.sceneId,{dx:R},`video:${e.sceneId}:dx`)}),u.jsx(nn,{id:"dy",value:((V=t.video)==null?void 0:V.dy)??0,dragStep:1,onCommit:R=>o.patchVideo(e.sceneId,{dy:R},`video:${e.sceneId}:dy`)})]}),t.video?u.jsx("button",{style:mn,onClick:()=>{gn(),o.clearVideo(e.sceneId)},children:"Reset framing"}):null]}),t.layout==="pip-bubble"?(()=>{const R=Oo("pip-bubble",void 0,[],n).video,Z=t.pip??{},Q=Z.cornerRadius??R.cornerRadius;return u.jsxs("div",{style:lt,children:[u.jsx("span",{style:Ve,children:"PiP bubble"}),u.jsxs("div",{style:vn,children:[u.jsxs("span",{style:Ve,children:["roundness"," ",u.jsx("span",{style:{color:"#EDEDF2"},children:Q.toFixed(2)})]}),u.jsx("input",{type:"range","data-testid":"pip-roundness",min:0,max:1,step:.01,value:Q,onChange:_=>o.patchPip(e.sceneId,{cornerRadius:Number(_.target.value)},`pip:${e.sceneId}:cornerRadius`)})]}),u.jsxs("div",{style:Es,children:[u.jsx(nn,{id:"pip-x",value:Z.x??R.rect.x,min:0,max:1-R.rect.w,dragStep:.002,onCommit:_=>o.patchPip(e.sceneId,{x:_},`pip:${e.sceneId}:x`)}),u.jsx(nn,{id:"pip-y",value:Z.y??R.rect.y,min:0,max:1-R.rect.h,dragStep:.002,onCommit:_=>o.patchPip(e.sceneId,{y:_},`pip:${e.sceneId}:y`)})]}),t.pip?u.jsx("button",{"data-testid":"reset-pip",style:mn,onClick:()=>{gn(),o.clearPip(e.sceneId)},children:"Reset bubble"}):null]})})():null,(()=>{var Q;if(P)return null;const R=mS(t,n),Z=_=>N=>o.patchGraphicRect(e.sceneId,bu({...R,[_]:N},n),`box:${e.sceneId}:${_}`);return u.jsxs("div",{style:lt,children:[u.jsx("span",{style:Ve,children:"Graphic box"}),u.jsx("div",{style:{fontSize:12,color:"#9A9AA3"},children:"Frame fractions — or drag the handles on the stage."}),u.jsxs("div",{style:Es,children:[u.jsx(nn,{id:"box-x",value:R.x,min:0,max:1,dragStep:.002,onCommit:Z("x")}),u.jsx(nn,{id:"box-y",value:R.y,min:0,max:1,dragStep:.002,onCommit:Z("y")})]}),u.jsxs("div",{style:Es,children:[u.jsx(nn,{id:"box-w",value:R.w,min:.08,max:1,dragStep:.002,onCommit:Z("w")}),u.jsx(nn,{id:"box-h",value:R.h,min:.05,max:1,dragStep:.002,onCommit:Z("h")})]}),(Q=o.doc.scenes[e.sceneId])!=null&&Q.graphicRect?u.jsx("button",{"data-testid":"reset-box",style:mn,onClick:()=>{gn(),o.clearGraphicRect(e.sceneId)},children:"Reset box"}):null]})})(),(()=>{const R=Oo(t.layout,void 0,[],n).captionAnchor,Z=t.captionY??R,Q=t.captionScale??1,_=o.doc.scenes[e.sceneId];return u.jsxs("div",{style:lt,children:[u.jsx("span",{style:Ve,children:"Captions"}),o.doc.captionsHidden===!0||f===!0?u.jsxs("div",{"data-testid":"captions-hidden-hint",style:{fontSize:12,color:"#FFE14D"},children:["Captions are hidden globally",f===!0?" (--no-captions)":" (Theme panel)"," — these settings are kept and apply when captions are shown again."]}):null,u.jsxs("div",{style:vn,children:[u.jsxs("span",{style:Ve,children:["position"," ",u.jsx("span",{style:{color:"#EDEDF2"},children:Z.toFixed(2)})]}),u.jsx("input",{type:"range","data-testid":"caption-y-slider",min:.05,max:.95,step:.01,value:Z,onChange:N=>o.patchCaptionY(e.sceneId,Number(N.target.value),`captionY:${e.sceneId}`)})]}),u.jsxs("div",{style:vn,children:[u.jsxs("span",{style:Ve,children:["scale"," ",u.jsxs("span",{style:{color:"#EDEDF2"},children:[Q.toFixed(2),"×"]})]}),u.jsx("input",{type:"range","data-testid":"caption-scale-slider",min:.2,max:3,step:.01,value:Q,onChange:N=>o.patchCaptionScale(e.sceneId,Number(N.target.value),`captionScale:${e.sceneId}`)})]}),u.jsx(nn,{id:"caption-scale",value:Q,min:.2,max:3,dragStep:.01,onCommit:N=>o.patchCaptionScale(e.sceneId,N,`captionScale:${e.sceneId}`)}),u.jsx("button",{"data-testid":"caption-y-all",style:{...mn,color:"#EDEDF2",border:"1px solid #2A2A33"},title:"Write this scene's caption position and scale to every scene — one undo step",onClick:()=>{gn(),o.patchCaptionStyleAll(r,{y:Z,scale:Q})},children:"Apply to all scenes"}),(_==null?void 0:_.captionY)!==void 0||(_==null?void 0:_.captionScale)!==void 0?u.jsx("button",{"data-testid":"reset-caption-y",style:mn,onClick:()=>{gn(),o.clearCaptionStyle(e.sceneId)},children:"Reset captions"}):null]})})(),u.jsxs("div",{style:lt,children:[u.jsx("span",{style:Ve,children:"Timing"}),u.jsxs("div",{"data-testid":"timing-range",style:{fontSize:13,fontFamily:"ui-monospace, 'SF Mono', monospace"},children:[t.startSec.toFixed(2),"s – ",t.endSec.toFixed(2),"s",u.jsxs("span",{style:{color:"#9A9AA3"},children:[" ","(",(t.endSec-t.startSec).toFixed(2),"s)"]})]}),u.jsx("div",{style:{fontSize:12,color:t.pinned?"#FFE14D":"#9A9AA3"},children:P?"Derived from the cut — not movable":t.pinned?"Pinned to these times":"Tracking transcript"}),!t.pinned&&a?u.jsxs("div",{style:{fontSize:12,color:"#9A9AA3",fontStyle:"italic"},children:["“",a,"”"]}):null,t.pinned?u.jsx("button",{style:mn,onClick:()=>{gn(),o.clearTiming(e.sceneId)},children:"Un-pin (re-anchor to words)"}):null]}),P?null:u.jsx("div",{style:lt,children:u.jsx("button",{"data-testid":"delete-scene",style:mn,onClick:()=>{gn(),o.hideScene(e.sceneId)},children:"Delete scene"})}),W.length>0?u.jsxs("div",{style:lt,children:[u.jsx("span",{style:Ve,children:"Hidden elements"}),W.map(({id:R,owningSceneId:Z})=>u.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[u.jsx("span",{style:{fontSize:13,fontFamily:"ui-monospace, monospace",color:"#C9C9D4"},children:R}),u.jsx("button",{"data-testid":`restore-element-${R}`,style:{...mn,color:"#5FBF77",border:"1px solid #24402c",padding:"4px 8px"},onClick:()=>{gn(),o.restoreElement(Z,R)},children:"Restore"})]},R))]}):null,u.jsxs("div",{style:lt,children:[u.jsx("div",{style:{fontSize:12,color:"#9A9AA3"},children:"Removes this window from the output. The preview stops playing it immediately — Restore lives on the seam it leaves on the timeline."}),u.jsx("button",{"data-testid":"cut-chunk",style:mn,onClick:()=>{gn();const R=fS({fromLive:p,hasOldClockPreimage:m},t.startSec,t.endSec);if(y!==null){const Z={startSec:av(y(t.startSec)),endSec:av(y(t.endSec))},Q=R.kind==="degenerate"?{startSec:p(t.startSec),endSec:p(t.endSec)}:{startSec:R.startSec,endSec:R.endSec};o.cutChunk(Q.startSec,Q.endSec,Z);return}if(R.kind==="degenerate"){w("Can't cut this window: it isn't in the last render yet — render once (or re-remove the pause) to cut it.");return}R.kind==="shrunk"&&console.warn(`ossclip cut preview: ${R.report}`),o.cutChunk(R.startSec,R.endSec)},children:"Delete this chunk"})]})]})}const x=o.doc.theme,S=(P,T)=>o.patchTheme({[P]:T}),h=P=>`${Math.floor(P/60)}:${String(Math.floor(P%60)).padStart(2,"0")}`,g=((M=c==null?void 0:c.usage)==null?void 0:M.totals)??null,v=(($=c==null?void 0:c.production)==null?void 0:$.producer)??null,b=((D=c==null?void 0:c.production)==null?void 0:D.clip)??null;return u.jsxs("div",{children:[u.jsxs("div",{style:lt,children:[u.jsx("span",{style:Ve,children:"Theme"}),u.jsx("div",{style:{fontSize:12,color:"#9A9AA3"},children:"Nothing selected — global tokens."})]}),u.jsxs("div",{style:lt,children:[u.jsx(ml,{id:"accent",value:x.accent??s.accent,isColor:!0,onCommit:P=>S("accent",P)}),u.jsx(ml,{id:"bg",value:x.bg??s.bg,isColor:!0,onCommit:P=>S("bg",P)}),u.jsx(ml,{id:"fg",value:x.fg??s.fg,isColor:!0,onCommit:P=>S("fg",P)}),u.jsx(nn,{id:"radiusPx",value:x.radiusPx??s.radiusPx,min:0,dragStep:.5,onCommit:P=>S("radiusPx",P)}),u.jsx(ml,{id:"fontDisplay",value:x.fontDisplay??s.fontDisplay,isColor:!1,onCommit:P=>S("fontDisplay",P)})]}),u.jsxs("div",{style:lt,children:[u.jsx("span",{style:Ve,children:"Captions"}),u.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,color:"#EDEDF2",cursor:"pointer"},children:[u.jsx("input",{type:"checkbox","data-testid":"captions-visible-toggle",checked:o.doc.captionsHidden!==!0&&f!==!0,disabled:f===!0&&o.doc.captionsHidden!==!0,onChange:P=>o.setCaptionsHidden(!P.target.checked)}),"Show captions"]}),o.doc.captionsHidden===!0?u.jsx("div",{style:{fontSize:12,color:"#9A9AA3"},children:"Hidden everywhere — the CTA keyword styling rides the caption track, so it is hidden too. Per-scene caption position/scale edits are kept."}):null,f===!0?u.jsx("div",{"data-testid":"captions-flag-note",style:{fontSize:12,color:"#FFE14D"},children:"This project was produced with --no-captions, which Render replays — the toggle can't bring captions back here; re-run produce without the flag."}):null]}),v||g?u.jsxs("div",{style:lt,"data-testid":"run-info",children:[u.jsx("span",{style:Ve,children:"This video"}),v?u.jsxs("div",{style:{fontSize:12,color:"#C9C9D4"},children:["planned by ",u.jsx("span",{style:{color:"#EDEDF2"},children:v.provider}),v.models.length>0?` (${v.models.join(", ")})`:"",v.cached?" · reused from cache":"",v.at?` · ${new Date(v.at).toLocaleString()}`:""]}):null,g?u.jsxs("div",{style:{fontSize:12,color:"#C9C9D4"},children:[g.calls," LLM call",g.calls===1?"":"s"," ·"," ",g.inputTokens.toLocaleString()," in / ",g.outputTokens.toLocaleString()," out tokens",g.anyEstimated?" (partly estimated)":""]}):null,g&&g.equivalentUsd!==null?u.jsx("div",{style:{fontSize:12,color:"#C9C9D4"},children:g.allUnbilled?`~$${g.equivalentUsd.toFixed(2)} of API-rate work, covered by the subscription`:g.billedUsd!==null?`~$${g.billedUsd.toFixed(2)} charged at API rates`:`~$${g.equivalentUsd.toFixed(2)} at API rates`}):null,b?u.jsxs("div",{style:{fontSize:12,color:"#C9C9D4"},children:["clip: ",h(b.startSec),"–",h(b.endSec),(H=c==null?void 0:c.production)!=null&&H.sourceDuration?` of ${h(c.production.sourceDuration)}`:""," ","(--clip ",b.targetSec,")"]}):null]}):null,u.jsx("div",{style:lt,children:u.jsx("div",{"data-testid":"ai-disclaimer",style:{fontSize:12,color:"#9A9AA3"},children:"AI can make mistakes. The cut, captions and graphics are generated — review them before publishing."})})]})},Ed=1.2,ku=.05;function hN(e,t,n,r){return n<=0||r<=0?0:Math.min(1,Math.max(0,(e-t)/n))*r}const mN=16,gN=e=>Math.min(mN,Math.max(1,e));function yN(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 Kh=e=>e.filter(t=>t.kind!=="plain");function vN(e,t,n,r){const o=Kh(e),i=o.findIndex(y=>y.id===t),s=o[i];if(!s)return null;const a=s.endSec-s.startSec,l=i>0?o[i-1]:void 0,c=i<o.length-1?o[i+1]:void 0,f=l?l.endSec+ku:0,p=c?c.startSec-ku:r,m=Math.min(Math.max(s.startSec+n,f),Math.max(f,p-a));return{startSec:m,endSec:m+a}}const lv=e=>Math.round(e*1e3)/1e3;function uv(e,t,n){if(!n)return{startSec:e,endSec:t};const r=lv(n(e)),o=lv(n(t));return o>r?{srcStart:r,srcEnd:o}:{startSec:e,endSec:t}}function wN(e,t,n,r,o){const i=Kh(e),s=i.findIndex(y=>y.id===t),a=s>0?i[s-1]:void 0,l=s>=0&&s<i.length-1?i[s+1]:void 0,c=a?a.endSec+ku:0,f=l?l.startSec-ku:o;let p=Math.min(Math.max(n,c),Math.max(c,f-Ed)),m=Math.max(Math.min(r,f),p+Ed);return m>f&&(m=f,p=Math.max(c,m-Ed)),{startSec:p,endSec:m}}function cv(e,t,n,r){const o=[0,r,n];for(const a of Kh(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 gl(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 DS(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 Cd(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 Yh={silence:"#4DA3FF",pause:"#B78CFF",filler:"#FFB84D",retake:"#FF7AB8",user:"#6BDD8B",clip:"#4DDCD4"},xN="#8a8a95";function bN(e){const t=`${(e.srcOut-e.srcIn).toFixed(1)}s removed`;return e.reason?`${e.reason} · ${t}`:t}const SN=1e-6;function kN(e,t,n){if(t.length===0)return[];const r=new Set(Wh(e,n)),o=new Set(Vh(e,n)),i=[];for(const s of e){if(o.has(s)||s.kind!=="remove"||s.srcOut<=s.srcIn)continue;const a=DS(t,s.srcIn),l=i.filter(c=>Math.abs(c.outSec-a)<SN).length;i.push({srcIn:s.srcIn,srcOut:s.srcOut,reason:s.reason,outSec:a,label:bN(s),color:s.reason?Yh[s.reason]:xN,stackIndex:l,vetoable:Sc(s.reason),vetoed:r.has(s)})}return i}const EN={silence:"Silences",pause:"Pauses",filler:"Fillers",retake:"Retakes",user:"Your cuts",clip:"Clip window"};function CN(e){const t=new Map;for(const n of e){if(n.kind!=="remove"||n.reason===void 0||!Sc(n.reason)||n.srcOut<=n.srcIn)continue;const r=t.get(n.reason)??{reason:n.reason,count:0,seconds:0};r.count+=1,r.seconds+=n.srcOut-n.srcIn,t.set(n.reason,r)}return Object.keys(Yh).map(n=>t.get(n)).filter(n=>n!==void 0)}function IN(e){return{keep:e.vetoed?"Re-remove":"Keep this (preview plays it)",dismiss:e.reason!==void 0?`Not a ${e.reason} — remove marker`:"Remove marker — keep as footage"}}const TN=({x:e,y:t,items:n,onClose:r})=>{d.useEffect(()=>{const i=a=>{a.key==="Escape"&&(a.stopPropagation(),r())},s=()=>r();return window.addEventListener("keydown",i,!0),window.addEventListener("mousedown",s),window.addEventListener("scroll",s,!0),window.addEventListener("contextmenu",s),()=>{window.removeEventListener("keydown",i,!0),window.removeEventListener("mousedown",s),window.removeEventListener("scroll",s,!0),window.removeEventListener("contextmenu",s)}},[r]);const o=Math.min(e,(typeof window<"u"?window.innerWidth:1280)-200);return u.jsx("div",{"data-testid":"context-menu",role:"menu",style:{...jN,left:o,top:t},onMouseDown:i=>i.stopPropagation(),onContextMenu:i=>i.preventDefault(),children:n.map(i=>u.jsx("button",{role:"menuitem","data-testid":`context-menu-item-${i.label}`,style:RN,onMouseDown:s=>s.stopPropagation(),onClick:()=>{i.onPick(),r()},onMouseEnter:s=>{s.currentTarget.style.background="#22222c"},onMouseLeave:s=>{s.currentTarget.style.background="transparent"},children:i.label},i.label))})},jN={position:"fixed",zIndex:80,minWidth:180,background:"#16161d",border:"1px solid #2C2C38",borderRadius:6,padding:4,boxShadow:"0 10px 32px rgba(0,0,0,0.55)"},RN={display:"block",width:"100%",textAlign:"left",background:"transparent",border:"none",borderRadius:4,padding:"7px 10px",color:"#EDEDF2",fontSize:12,fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",cursor:"pointer",whiteSpace:"nowrap"},PN=10,FN=4,dv=8,fv=8,$N=300,_N=e=>{const t=Math.max(0,Math.round(e));return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`},MN=(e,t)=>{const[n,r]=he.useState({}),o=he.useRef({}),i=t.map(s=>s.toFixed(1)).join(",");return he.useEffect(()=>{if(!e||t.length===0)return;const s=[...new Set(t.map(p=>p.toFixed(1)))].filter(p=>o.current[p]===void 0);if(s.length===0)return;let a=!1;const l=document.createElement("video");l.src=e,l.muted=!0,l.preload="auto";const c=document.createElement("canvas");return(async()=>{await new Promise((m,y)=>{l.onloadedmetadata=()=>m(),l.onerror=()=>y(new Error("no video for thumbnails"))}),c.width=168,c.height=Math.max(1,Math.round(168*l.videoHeight/Math.max(1,l.videoWidth)));const p=c.getContext("2d");if(p){for(const m of s){if(a)return;await new Promise(y=>{l.onseeked=()=>y(),l.currentTime=Math.max(0,Number(m))}),p.drawImage(l,0,0,c.width,c.height),o.current[m]=c.toDataURL("image/jpeg",.6)}a||r({...o.current})}})().catch(()=>{}),()=>{a=!0,l.removeAttribute("src"),l.load()}},[e,i]),n},AN=({cues:e,ghosts:t,cuts:n=[],spans:r=[],cleanup:o=[],durationSec:i,fps:s,playerRef:a,selection:l,onSelect:c,edits:f,videoSrc:p,toSourceSec:m,pinSourceSec:y=null,toLive:w=S=>S,onRevived:x})=>{const S=d.useRef(null),h=d.useRef(null),g=d.useRef(!1),v=d.useRef(null),[b,k]=d.useState(0),E=d.useRef(b);E.current=b;const[C,I]=d.useState(null),[j,F]=d.useState(null),[L,V]=d.useState(1),M=he.useMemo(()=>m?e.filter(_=>_.kind==="plain").map(_=>m((_.startSec+_.endSec)/2)):[],[e,m]),$=MN(p,M),D=d.useRef(null),H=d.useRef(null),P=d.useCallback((_,N)=>{const z=D.current;V(ne=>{const J=gN(_);if(J===ne||!z)return J;const U=z.getBoundingClientRect();return H.current={prevZoom:ne,anchorX:N!==void 0?N-U.left:U.width/2},J})},[]);d.useLayoutEffect(()=>{const _=D.current,N=H.current;!_||!N||(H.current=null,_.scrollLeft=yN(N.prevZoom,L,_.clientWidth,_.scrollLeft,N.anchorX))},[L]);const T=d.useRef(L);T.current=L,d.useEffect(()=>{const _=D.current;if(!_)return;const N=z=>{z.ctrlKey||z.metaKey?(z.preventDefault(),P(T.current*Math.exp(-z.deltaY*.01),z.clientX)):_.scrollWidth>_.clientWidth&&(z.preventDefault(),_.scrollLeft+=z.deltaY+z.deltaX)};return _.addEventListener("wheel",N,{passive:!1}),()=>_.removeEventListener("wheel",N)},[P]),d.useEffect(()=>{const _=a.current;if(!_)return;k(_.getCurrentFrame());const N=z=>k(z.detail.frame);return _.addEventListener("frameupdate",N),()=>_.removeEventListener("frameupdate",N)},[a]),d.useEffect(()=>{const _=D.current;if(!_||i<=0||_.scrollWidth<=_.clientWidth||g.current||v.current!==null||h.current!==null)return;const N=b/s/i*_.scrollWidth,{scrollLeft:z,clientWidth:ne}=_;(N<z||N>z+ne)&&(_.scrollLeft=Math.max(0,Math.min(_.scrollWidth-ne,N-ne*.1)))},[b,s,i]),d.useEffect(()=>{var N,z;if(!l||g.current||v.current!==null||h.current!==null)return;const _=(N=D.current)==null?void 0:N.querySelector(`[data-testid="timeline-block-${l.sceneId}"]`);(z=_==null?void 0:_.scrollIntoView)==null||z.call(_,{inline:"nearest",block:"nearest"})},[l]);const W=d.useCallback(_=>{var ne;const N=S.current;if(!N||i<=0)return;const z=N.getBoundingClientRect();(ne=a.current)==null||ne.seekTo(Math.round(hN(_,z.left,z.width,i)*s))},[a,i,s]),R=d.useCallback((_,N)=>z=>{z.stopPropagation(),z.preventDefault();const ne=S.current;ne&&(h.current={sceneId:_.id,edge:N,startContentX:z.clientX-ne.getBoundingClientRect().left,origStart:_.startSec,origEnd:_.endSec},F({sceneId:_.id,startSec:_.startSec,endSec:_.endSec,snapped:null}))},[]),Z=d.useRef(0);d.useEffect(()=>{const _=ne=>{const J=D.current;if(!J||J.scrollWidth<=J.clientWidth)return;const U=Date.now();if(U-Z.current<$N)return;const G=J.getBoundingClientRect(),K=J.scrollWidth-J.clientWidth;ne>=G.right-fv&&J.scrollLeft<K?(J.scrollLeft=Math.min(K,J.scrollLeft+J.clientWidth),Z.current=U):ne<=G.left+fv&&J.scrollLeft>0&&(J.scrollLeft=Math.max(0,J.scrollLeft-J.clientWidth),Z.current=U)},N=ne=>{var oe;if((g.current||((oe=v.current)==null?void 0:oe.moved)===!0||h.current!==null)&&_(ne.clientX),g.current){W(ne.clientX);return}const U=v.current;if(U&&i>0){if(!U.moved&&Math.abs(ne.clientX-U.startX)<FN)return;if(U.moved=!0,U.scrub){W(ne.clientX);return}const de=S.current,fe=de==null?void 0:de.getBoundingClientRect(),Ce=fe?(ne.clientX-fe.left-U.startContentX)/fe.width*i:0;let Te=Ce,Re=null;const xe=fe&&fe.width>0&&!ne.altKey?e.find(pe=>pe.id===U.sceneId):void 0;if(xe&&fe){const pe=dv/(fe.width/i),Le=cv(e,U.sceneId,E.current/s,i),Ie=xe.startSec+Ce,Ye=xe.endSec+Ce,ze=gl(Ie,Le,pe),dt=gl(Ye,Le,pe),Nt=ze.snapped===null?1/0:Math.abs(ze.sec-Ie),kt=dt.snapped===null?1/0:Math.abs(dt.sec-Ye);Nt<=kt&&ze.snapped!==null?(Te=Ce+(ze.sec-Ie),Re=ze.snapped):dt.snapped!==null&&(Te=Ce+(dt.sec-Ye),Re=dt.snapped)}const be=vN(e,U.sceneId,Te,i);if(be){const pe=Re!==null&&(Math.abs(be.startSec-Re)<1e-6||Math.abs(be.endSec-Re)<1e-6)?Re:null;F({sceneId:U.sceneId,...be,snapped:pe})}return}const G=h.current;if(!G||i<=0)return;const K=S.current;if(!K)return;const le=K.getBoundingClientRect(),Y=(ne.clientX-le.left-G.startContentX)/le.width*i;let ie=G.edge==="start"?G.origStart+Y:G.origStart,ke=G.edge==="end"?G.origEnd+Y:G.origEnd,O=null;if(!ne.altKey&&le.width>0){const de=dv/(le.width/i),fe=cv(e,G.sceneId,E.current/s,i);if(G.edge==="start"){const Ce=gl(ie,fe,de);ie=Ce.sec,O=Ce.snapped}else{const Ce=gl(ke,fe,de);ke=Ce.sec,O=Ce.snapped}}const X=wN(e,G.sceneId,ie,ke,i),se=O!==null&&(Math.abs(X.startSec-O)<1e-6||Math.abs(X.endSec-O)<1e-6)?O:null;F({sceneId:G.sceneId,...X,snapped:se})},z=ne=>{g.current=!1;const J=v.current;if(J){v.current=null,J.moved&&!J.scrub&&F(G=>(G&&G.sceneId===J.sceneId&&f.patchTiming(J.sceneId,uv(G.startSec,G.endSec,y)),null));return}const U=h.current;U&&(F(G=>(G&&G.sceneId===U.sceneId&&(G.startSec!==U.origStart||G.endSec!==U.origEnd)&&f.patchTiming(U.sceneId,uv(G.startSec,G.endSec,y)),null)),h.current=null)};return window.addEventListener("mousemove",N),window.addEventListener("mouseup",z),()=>{window.removeEventListener("mousemove",N),window.removeEventListener("mouseup",z)}},[e,i,f,W,s,y]);const Q=i>0?Math.min(1,b/s/i)*100:0;return u.jsxs("div",{style:NN,onMouseDownCapture:OS,children:[C!==null?(()=>{const _=IN(C.seam),{srcIn:N,srcOut:z}=C.seam;return u.jsx(TN,{x:C.x,y:C.y,onClose:()=>I(null),items:[{label:_.keep,onPick:()=>{f.toggleKept(N,z),C.seam.vetoed||x==null||x(N,z)}},{label:_.dismiss,onPick:()=>{f.dismissRemoval(N,z),x==null||x(N,z)}}]})})():null,u.jsxs("div",{style:LN,children:[u.jsx("span",{style:DN,children:"ctrl+scroll to zoom"}),u.jsx("button",{"data-testid":"zoom-out",style:Id,onClick:()=>P(L/2),disabled:L<=1,title:"Zoom out (ctrl/cmd + scroll on the timeline)",children:"−"}),u.jsxs("span",{"data-testid":"zoom-level",style:ON,children:[Math.round(L*10)/10,"×"]}),u.jsx("button",{"data-testid":"zoom-in",style:Id,onClick:()=>P(L*2),disabled:L>=16,title:"Zoom in (ctrl/cmd + scroll on the timeline)",children:"+"}),u.jsx("button",{"data-testid":"zoom-fit",style:{...Id,width:"auto",padding:"0 8px"},onClick:()=>P(1),disabled:L<=1,title:"Fit the whole clip in view",children:"fit"})]}),u.jsx("div",{ref:D,"data-testid":"timeline-scroller",style:zN,children:u.jsxs("div",{style:{width:`${L*100}%`,minWidth:"100%",paddingBottom:6},children:[(()=>{const _=kN(o,r,f.doc.cleanup);return _.length===0?null:u.jsxs("div",{"data-testid":"marker-lane",style:YN,children:[_.map(N=>{const z=i>0?Math.min(100,Math.max(0,N.outSec/i*100)):0,ne=N.vetoed?`${N.label} — kept: playing in the preview (click to re-remove)`:N.vetoable?`${N.label} — click to keep this; the preview updates immediately`:N.label;return u.jsx("div",{"data-testid":`timeline-removal-${N.srcIn}-${N.srcOut}`,...N.vetoed?{"data-vetoed":"true"}:{},title:ne,...N.vetoable?{onMouseDown:J=>{J.button!==2&&(J.stopPropagation(),J.preventDefault(),f.toggleKept(N.srcIn,N.srcOut),N.vetoed||x==null||x(N.srcIn,N.srcOut))},onContextMenu:J=>{J.preventDefault(),J.stopPropagation(),I({x:J.clientX,y:J.clientY,seam:N})}}:{},style:{...GN,...N.vetoable?{cursor:"pointer"}:{},left:`${z}%`,...z>90?{transform:"translateX(-100%)"}:{},marginLeft:N.stackIndex*10,zIndex:2+N.stackIndex,...N.vetoed?{background:"transparent",border:`1px dashed ${N.color}`,color:N.color,opacity:.7}:{background:`${N.color}30`,border:`1px solid ${N.color}`,color:"#EDEDF2"}},children:N.vetoed?`kept · ${N.label}`:N.label},`removal-${N.srcIn}-${N.srcOut}`)}),_.filter(N=>N.vetoed&&i>0).map(N=>{const z=Math.min(100,Math.max(0,N.outSec/i*100)),ne=Math.min(100-z,(N.srcOut-N.srcIn)/i*100);return u.jsx("div",{"data-testid":`timeline-kept-band-${N.srcIn}-${N.srcOut}`,style:{...XN,left:`${z}%`,width:`${ne}%`,borderColor:N.color}},`kept-band-${N.srcIn}-${N.srcOut}`)})]})})(),u.jsx("div",{"data-testid":"ruler",style:BN,onMouseDown:_=>{_.preventDefault(),W(_.clientX),g.current=!0},children:(()=>{var G;if(i<=0)return u.jsx("span",{style:Td,children:"0:00"});const N=(((G=D.current)==null?void 0:G.clientWidth)??1200)*L/i;let ne=[.5,1,2,5,10,15,30,60,120,300,600].find(K=>K*N>=70)??600;for(;i/(ne/5)>600;)ne*=2;const J=ne/5,U=[];for(let K=0;K<=i+1e-6;K+=J){const le=Math.round(K/J)%5===0,Y=`${K/i*100}%`;U.push(u.jsx("div",{style:{position:"absolute",left:Y,bottom:0,width:1,height:le?8:4,background:le?"#3A3A44":"#26262e",pointerEvents:"none"}},K.toFixed(3))),le&&K+J<=i&&U.push(u.jsx("span",{style:{...Td,position:"absolute",left:Y,top:0,transform:K===0?void 0:"translateX(-50%)",pointerEvents:"none"},children:_N(K)},`l${K.toFixed(3)}`))}return u.jsxs(u.Fragment,{children:[U,u.jsx("span",{style:{...Td,position:"absolute",right:2,top:0,pointerEvents:"none"},children:Cd(i,s)})]})})()}),u.jsxs("div",{ref:S,style:WN,onMouseDown:_=>{_.preventDefault(),W(_.clientX),g.current=!0},children:[e.map(_=>{const N=_.kind==="plain",z=(j==null?void 0:j.sceneId)===_.id,ne=z?j.startSec:_.startSec,J=z?j.endSec:_.endSec,U=i>0?ne/i*100:0,G=i>0?Math.max(0,(J-ne)/i*100):0,K=(l==null?void 0:l.sceneId)===_.id,le=N&&m?$[m((_.startSec+_.endSec)/2).toFixed(1)]:void 0;return u.jsxs("div",{"data-testid":`timeline-block-${_.id}`,onMouseDown:Y=>{var ie;Y.stopPropagation(),Y.preventDefault(),c({sceneId:_.id,elementId:null}),v.current={sceneId:_.id,startX:Y.clientX,startContentX:Y.clientX-(((ie=S.current)==null?void 0:ie.getBoundingClientRect().left)??0),moved:!1,scrub:N}},style:{...pv,left:`${U}%`,width:`${G}%`,zIndex:z?4:K?3:1,border:K?"2px solid #5b8cff":_.kept!==void 0?"1px dashed #B78CFF":N?"1px solid #22222a":"1px solid #2A2A33",backgroundColor:K?"#1c2333":_.kept!==void 0?"#1a1524":N?"#131318":"#1A1A21",...le?{backgroundImage:`linear-gradient(rgba(10,10,14,0.35), rgba(10,10,14,0.6)), url(${le})`,backgroundSize:"auto 100%, auto 100%",backgroundRepeat:"repeat-x"}:{}},children:[u.jsx("span",{style:N?le?{...yl,color:"#D8D8DE",textShadow:"0 1px 2px rgba(0,0,0,0.9)"}:{...yl,color:"#55555f"}:yl,children:_.kept!==void 0?"KEPT":_.id}),!N&&_.pinned?u.jsx("span",{style:VN,children:"PIN"}):null,N?null:u.jsxs(u.Fragment,{children:[u.jsx("div",{onMouseDown:R(_,"start"),style:{...hv,left:0,cursor:"ew-resize"}}),u.jsx("div",{onMouseDown:R(_,"end"),style:{...hv,right:0,cursor:"ew-resize"}})]})]},_.id)}),t.map(_=>{const N=i>0?_.startSec/i*100:0,z=i>0?Math.max(0,(_.endSec-_.startSec)/i*100):0,ne=(l==null?void 0:l.sceneId)===_.id;return u.jsx("div",{"data-testid":`timeline-block-${_.id}`,onMouseDown:J=>{J.stopPropagation(),J.preventDefault(),c({sceneId:_.id,elementId:null})},style:{...pv,left:`${N}%`,width:`${z}%`,zIndex:ne?3:2,border:ne?"2px dashed #5b8cff":"1px dashed #6a6a75",background:"transparent"},children:u.jsx("span",{style:{...yl,color:"#6a6a75",textDecoration:"line-through"},children:_.id})},`ghost-${_.id}`)}),n.map((_,N)=>{const z=J=>i>0?Math.min(100,Math.max(0,J/i*100)):0;if(!_.src){const J=Math.min(Math.max(w(_.startSec),0),i),U=Math.min(Math.max(w(_.endSec),0),i),G=z(J),K=i>0?Math.max(0,(U-J)/i*100):0;return u.jsx("div",{"data-testid":`timeline-cut-${_.startSec}-${_.endSec}`,style:{...HN,left:`${G}%`,width:`${K}%`},children:u.jsx("div",{style:UN})},`cut-${N}-${_.startSec}-${_.endSec}`)}if(r.length===0)return null;const ne=z(DS(r,_.src.startSec));return u.jsx("div",{"data-testid":`timeline-cut-seam-${_.startSec}-${_.endSec}`,title:"Restore cut — the material returns on the next produce/Render",onMouseDown:J=>{J.stopPropagation(),J.preventDefault(),f.restoreChunk(N)},style:{...ZN,left:`${ne}%`},children:u.jsx("div",{style:KN})},`cut-${N}-${_.startSec}-${_.endSec}`)}),j?u.jsxs("div",{"data-testid":"drag-readout",style:{...mv,left:`${i>0?j.startSec/i*100:0}%`,transform:i>0&&j.startSec/i>.85?"translateX(-100%)":mv.transform},children:[Cd(j.startSec,s)," – ",Cd(j.endSec,s)]}):null,(j==null?void 0:j.snapped)!==null&&(j==null?void 0:j.snapped)!==void 0?u.jsx("div",{"data-testid":"snap-tick",style:{...qN,left:`${i>0?j.snapped/i*100:0}%`}}):null,u.jsx("div",{"data-testid":"playhead",style:{...JN,left:`${Q}%`},children:u.jsx("div",{"data-testid":"playhead-grab",onMouseDown:_=>{_.stopPropagation(),_.preventDefault(),g.current=!0},style:QN})})]})]})})]})},NN={flexShrink:0,borderTop:"1px solid #1E1E24",background:"#111116",padding:"6px 20px 8px"},LN={display:"flex",justifyContent:"flex-end",alignItems:"center",gap:6,marginBottom:4},Id={width:22,height:18,fontSize:12,lineHeight:1,color:"#EDEDF2",background:"#1A1A21",border:"1px solid #2A2A33",borderRadius:4,cursor:"pointer",padding:0},ON={fontSize:10,fontFamily:"ui-monospace, 'SF Mono', monospace",color:"#9A9AA3",minWidth:26,textAlign:"center"},DN={fontSize:10,color:"#55555f",marginRight:4,userSelect:"none"},zN={overflowX:"auto",overflowY:"hidden"},BN={position:"relative",height:18,padding:"0 2px",marginBottom:4,borderBottom:"1px solid #1E1E24",cursor:"ew-resize",userSelect:"none"},Td={fontSize:10,fontFamily:"ui-monospace, 'SF Mono', monospace",color:"#9A9AA3"},WN={position:"relative",height:44,background:"#0F0F14",border:"1px solid #2A2A33",borderRadius:6,overflow:"visible",userSelect:"none"},pv={position:"absolute",top:3,bottom:3,borderRadius:4,boxSizing:"border-box",cursor:"pointer",display:"flex",alignItems:"center",overflow:"hidden"},yl={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"},VN={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"},HN={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)"},UN={position:"absolute",left:0,right:0,top:"50%",height:2,background:"rgba(255,92,92,0.8)"},ZN={position:"absolute",top:-4,bottom:-4,width:12,marginLeft:-6,zIndex:4,cursor:"pointer",pointerEvents:"auto"},KN={position:"absolute",left:"50%",top:0,bottom:0,width:2,background:"#FF5C5C",pointerEvents:"none"},YN={position:"relative",height:22,marginBottom:2},GN={position:"absolute",top:2,height:16,display:"flex",alignItems:"center",padding:"0 6px",borderRadius:4,fontSize:10,lineHeight:"16px",fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",whiteSpace:"nowrap",maxWidth:140,overflow:"hidden",textOverflow:"ellipsis",userSelect:"none"},XN={position:"absolute",bottom:0,height:0,borderBottom:"2px dotted",opacity:.6,pointerEvents:"none"},hv={position:"absolute",top:0,bottom:0,width:PN},qN={position:"absolute",top:-4,bottom:-4,width:1,zIndex:6,background:"#FFE14D",pointerEvents:"none"},mv={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"},JN={position:"absolute",top:-26,bottom:-4,width:2,zIndex:5,background:"#FFE14D",pointerEvents:"none"},QN={position:"absolute",top:0,bottom:0,left:-4,width:10,pointerEvents:"auto",cursor:"ew-resize"};function e5(e,t,n){const r=e.filter(m=>He(m.word)!==null);if(r.length===0)return null;const o=e[0].word,i=e[e.length-1].word,s=Math.max(o.start,t??0),a=i.end;if(a<=s)return null;const l=[];e.every(m=>{const y=He(m.word);return y!==null&&y in n.captionWordsHidden})||l.push("caption");const f=n.cuts.some(m=>m.src===void 0&&m.startSec===s&&m.endSec===a),p=e.some(m=>m.synthetic);return!f&&!p&&l.push("caption-video"),l.length===0?null:{startSec:s,endSec:a,words:r.map(m=>({srcStart:m.word.srcStart,was:m.live})),targets:l}}function t5(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,c=[];for(let f=0;f+o<=e.length;){if(f>t-o&&f<=n){f=n+1;continue}const p=e.slice(f,f+o),m=p.every(w=>He(w.word)!==null&&r(w.word)===void 0),y=l!==null&&He(p[0].word)===l;if(m&&!y&&i(p)===a){c.push({fromSrcStart:p[0].word.srcStart,toSrcStart:p[o-1].word.srcStart,was:p.map(w=>w.base).join(" ").normalize("NFC"),rawWas:p.map(w=>w.base).join(" ")}),f+=o;continue}f++}return c}function n5(e,t,n,r,o){const i=Math.max(0,Math.floor(o)),s=new Float32Array(i);if(i===0||!(r>n)||!(t>0)||e.length===0)return{buckets:s,fromSec:n,toSec:r};const a=r-n;for(let l=0;l<i;l++){const c=Math.max(0,Math.ceil((n+a*l/i)*t)),f=Math.min(e.length,Math.ceil((n+a*(l+1)/i)*t));let p=0;for(let m=c;m<f;m++){const y=Math.abs(e[m]);y>p&&(p=y)}s[l]=p}return{buckets:s,fromSec:n,toSec:r}}const wo=560,Fn=48,gv=10;let vl=null;const r5=e=>((vl===null||vl.key!==e)&&(vl={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)}),vl.promise),yv=6,vv=8,o5=e=>{const t=e.anchorTop+e.anchorHeight+yv,n=e.anchorTop-e.menuH-yv,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(vv,Math.min(i,e.clientWidth-e.menuW-vv));return{top:o,left:s}},wv="transcript-word-",xv=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^="${wv}"]`))??null;if(n===null)return null;const r=Number(n.getAttribute("data-testid").slice(wv.length));return Number.isInteger(r)?r:null},bv=(e,t)=>{const n=Math.max(0,e.start-gv),r=e.end+gv;return{start:n,end:Number.isFinite(t)&&t>0?Math.min(r,Math.max(t,n)):r}},Sv=.001,i5=e=>{const t=e.span.end-e.span.start,n=t>0?(e.newSpan.end-e.newSpan.start)/t:1,r=o=>e.newSpan.start+(o-e.span.start)*n;return e.lines.map(o=>{const i=r(o.srcStart),s=r(o.srcEnd),a=Math.abs(i-o.srcStart)<Sv&&Math.abs(s-o.srcEnd)<Sv;return{srcStart:o.srcStart,window:a?null:{srcStart:i,srcEnd:s}}})},s5=e=>{const t=new Set;for(let n=0;n<e.length;n++)for(let r=n+1;r<e.length;r++){const o=e[n],i=e[r];o.srcStart<i.srcEnd&&i.srcStart<o.srcEnd&&(t.add(o.key),t.add(i.key))}return t},a5=(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)}},l5=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))}},jd=(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)}},u5=(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 c=He(l);return c!==null&&i.has(c)};s!==void 0&&s.words.some(a)?(n.push(r),r++):n.push(null)}return n},c5=({baseLines:e,liveLines:t,timingLines:n,fps:r,playerRef:o,edits:i,onDeleteWords:s,width:a,workdir:l,toPlayerSec:c=p=>p,fromPlayerSec:f=p=>p})=>{const[p,m]=d.useState(""),[y,w]=d.useState(null),[x,S]=d.useState(null),[h,g]=d.useState(null),[v,b]=d.useState(null),[k,E]=d.useState(!1),[C,I]=d.useState(!1),[j,F]=d.useState(null),[L,V]=d.useState(0),M=d.useRef(null),$=d.useRef(null),[D,H]=d.useState(null),[P,T]=d.useState(null),[W,R]=d.useState(null),[Z,Q]=d.useState(!1),[_,N]=d.useState(null),[z,ne]=d.useState(!1),J=d.useRef(null),U=d.useRef(null),G=d.useMemo(()=>{const A=new Map;for(const B of e)for(const te of B.words){const me=He(te);if(me===null)continue;const ve=A.get(me);ve?ve.push(te.text):A.set(me,[te.text])}return A},[e]),K=d.useMemo(()=>{var me;const A=[];let B=0;const te=new Map;for(let ve=0;ve<t.length;ve++){const $e=t[ve];for(let Pe=0;Pe<$e.words.length;Pe++){const _e=$e.words[Pe],Ne=He(_e);let Et;if(Ne!==null){const Dt=te.get(Ne)??0;te.set(Ne,Dt+1),Et=(me=G.get(Ne))==null?void 0:me[Dt]}A.push({index:B,base:Et??_e.text,live:_e.text,synthetic:Ne!==null&&Et===void 0,start:_e.start,end:_e.end,lineIndex:ve,word:_e}),B++}}return A},[G,t]);d.useEffect(()=>{S(null),g(null)},[K.length]);const le=d.useMemo(()=>new Set(Object.keys(i.doc.captionWordsHidden)),[i.doc.captionWordsHidden]),Y=A=>{const B=He(A.word);return B!==null&&le.has(B)},ie=d.useMemo(()=>Bh(K.map(A=>A.live).join(" ")),[K]);d.useEffect(()=>{if(ie!=="rtl"||typeof FontFace>"u"||!document.fonts)return;let A=!1;for(const B of document.fonts)B.family===fa&&(A=!0);if(!A)try{new FontFace(fa,`url("/media/${cS}") format("truetype")`).load().then(te=>document.fonts.add(te),()=>{})}catch{}},[ie]),d.useEffect(()=>{const A=o.current;if(!A)return;const B=te=>{const me=f(te.detail.frame/r),ve=K.find($e=>me>=$e.start&&me<$e.end);R($e=>ve?ve.index===$e?$e:ve.index:$e)};return A.addEventListener("frameupdate",B),()=>A.removeEventListener("frameupdate",B)},[o,r,K,f]),d.useEffect(()=>{var A,B,te;W!==null&&((te=(B=(A=J.current)==null?void 0:A.querySelector(`[data-testid="transcript-word-${W}"]`))==null?void 0:B.scrollIntoView)==null||te.call(B,{block:"nearest"}))},[W]);const ke=p.trim().normalize("NFC").toLowerCase(),O=d.useMemo(()=>ke?K.filter(A=>A.live.normalize("NFC").toLowerCase().includes(ke)).map(A=>A.index):[],[ke,K]),X=d.useMemo(()=>ke?new Set(O):null,[ke,O]),[se,oe]=d.useState(0),de=A=>{var B,te,me;(me=(te=(B=J.current)==null?void 0:B.querySelector(`[data-testid="transcript-word-${A}"]`))==null?void 0:te.scrollIntoView)==null||me.call(te,{block:"center"})};d.useEffect(()=>{oe(0),O.length>0&&de(O[0])},[O]);const fe=A=>{if(O.length===0)return;const B=(se+A+O.length)%O.length;oe(B),de(O[B])},Ce=A=>{const B=A.draft.trim();B&&i.patchCaption(A.srcStart,B,A.base),w(null)},Te=A=>{He(A.word)!==null&&Re(A.word)===void 0&&w({index:A.index,draft:A.live,srcStart:A.word.srcStart,base:A.base})},Re=A=>{const B=He(A);if(B===null)return;const te=Number(B.slice(1));return i.doc.captionRangeEdits.find(me=>{const ve=Number(me.fromKey.slice(1)),$e=Number(me.toKey.slice(1));return te>=Math.min(ve,$e)&&te<=Math.max(ve,$e)})},xe=x===null?null:Math.min(x.anchor,x.focus),be=x===null?null:Math.max(x.anchor,x.focus),pe=xe===null||be===null?[]:K.slice(xe,be+1),Le=pe.length>0&&pe.every(Y),Ie=pe.some(A=>He(A.word)===null),Ye=pe.map(A=>Re(A.word)).find(A=>A!==void 0),ze=A=>{var Ne,Et,Dt;if(y!==null||h!==null||v!==null)return;const B=J.current;if(!B)return;const te=(Ne=document.getSelection)==null?void 0:Ne.call(document);if(!te||te.isCollapsed)return;const{anchorNode:me,focusNode:ve}=te;if(!me||!ve||!B.contains(me)||!B.contains(ve))return;const $e=ve.nodeType===3?ve.parentElement:ve;if((Et=$e==null?void 0:$e.closest)!=null&&Et.call($e,"input, textarea"))return;const Pe=xv(me),_e=xv(ve);Pe===null||_e===null||A.detail>=2&&Pe===_e||(S({anchor:Math.min(Pe,_e),focus:Math.max(Pe,_e)}),(Dt=te.removeAllRanges)==null||Dt.call(te))};d.useLayoutEffect(()=>{if(xe===null||be===null){N(null);return}const A=J.current,B=(A==null?void 0:A.querySelector(`[data-testid="transcript-word-${xe}"]`))??null,te=(A==null?void 0:A.querySelector(`[data-testid="transcript-word-${be}"]`))??null;if(!A||te===null){N(null);return}const me=B!==null&&B.offsetTop===te.offsetTop,ve=me?Math.min(B.offsetLeft,te.offsetLeft):te.offsetLeft,$e=me?Math.max(B.offsetLeft+B.offsetWidth,te.offsetLeft+te.offsetWidth):te.offsetLeft+te.offsetWidth,Pe=U.current,_e=o5({anchorTop:te.offsetTop,anchorHeight:te.offsetHeight,anchorLeft:ve,anchorWidth:$e-ve,menuW:(Pe==null?void 0:Pe.offsetWidth)??0,menuH:(Pe==null?void 0:Pe.offsetHeight)??0,scrollTop:A.scrollTop,clientWidth:A.clientWidth,clientHeight:A.clientHeight});N(Ne=>Ne!==null&&Ne.top===_e.top&&Ne.left===_e.left?Ne:_e)},[xe,be,a,y,h,v,_]),d.useEffect(()=>{ne(!1),b(null)},[xe,be]),d.useEffect(()=>{h!==null&&(xe!==h.selLo||be!==h.selHi)&&g(null)},[h,xe,be]);const dt=d.useMemo(()=>h!==null&&xe!==null&&be!==null?t5(K,xe,be,Re):[],[h,xe,be,K,i.doc.captionRangeEdits]),Nt=()=>{if(pe.length===0||Ie)return;const A=e5(pe.map(B=>({word:B.word,live:B.live,synthetic:B.synthetic})),xe!==null&&xe>0?K[xe-1].end:null,i.doc);A!==null&&(s(A),S(null))},kt=()=>{if(pe.length===0||Ie)return;const A=Ye;if(A!==void 0){const B=Math.min(Number(A.fromKey.slice(1)),Number(A.toKey.slice(1))),te=Math.max(Number(A.fromKey.slice(1)),Number(A.toKey.slice(1))),me=K.filter(ve=>{const $e=He(ve.word);if($e===null)return!1;const Pe=Number($e.slice(1));return Pe>=B&&Pe<=te});if(me.length===0)return;S({anchor:me[0].index,focus:me[me.length-1].index}),g({draft:me.map(ve=>ve.live).join(" ").normalize("NFC"),fromSrcStart:Number(A.fromKey.slice(1))/1e3,toSrcStart:Number(A.toKey.slice(1))/1e3,was:me.map(ve=>ve.base).join(" ").normalize("NFC"),rawWas:me.map(ve=>ve.base).join(" "),covered:!0,selLo:me[0].index,selHi:me[me.length-1].index});return}g({draft:pe.map(B=>B.live).join(" ").normalize("NFC"),fromSrcStart:pe[0].word.srcStart,toSrcStart:pe[pe.length-1].word.srcStart,was:pe.map(B=>B.base).join(" ").normalize("NFC"),rawWas:pe.map(B=>B.base).join(" "),covered:!1,selLo:xe,selHi:be})},pr=A=>{const B=A.draft.trim();if(B){const te=B.split(/\s+/).filter(Boolean);!A.covered&&A.fromSrcStart===A.toSrcStart&&te.length===1?i.patchCaption(A.fromSrcStart,B,A.rawWas):i.patchCaptionRange(A.fromSrcStart,A.toSrcStart,B,A.was),S(null)}g(null)},os=A=>{const B=A.draft.trim();if(B){const te=B.split(/\s+/).filter(Boolean);!A.covered&&A.fromSrcStart===A.toSrcStart&&te.length===1?i.patchCaptionAllOccurrences([{srcStart:A.fromSrcStart,was:A.rawWas},...dt.map(me=>({srcStart:me.fromSrcStart,was:me.rawWas}))],B):i.patchCaptionRangeAllOccurrences([{fromSrcStart:A.fromSrcStart,toSrcStart:A.toSrcStart,was:A.was},...dt],B),S(null)}g(null)},mo=()=>{pe.length===0||Ie||(i.hideCaptionWords(pe.filter(A=>!Y(A)).map(A=>({srcStart:A.word.srcStart,was:A.live}))),S(null))},Fr=()=>{pe.length!==0&&(i.restoreCaptionWords(pe.filter(Y).map(A=>A.word.srcStart)),S(null))},qn=d.useMemo(()=>u5(t,n),[t,n]),Go=A=>{var te;const B=qn[A]??null;return B===null?null:He((te=n[B])==null?void 0:te.words[0])},go=A=>{const B=Go(A);if(B===null)return;const te=i.doc.captionLineWindows[B];if(te!==void 0)return`caption placed at ${te.srcStart.toFixed(2)}s–${te.srcEnd.toFixed(2)}s of the source — Timing to change`;const me=i.doc.captionLineTiming[B];return me===void 0?void 0:`caption timing adjusted (${Math.round(me.lead*1e3)}ms in / ${Math.round(me.tail*1e3)}ms out) — Timing to change`},yo=pe.length===0?0:pe[pe.length-1].lineIndex-pe[0].lineIndex+1,Xo=()=>{if(pe.length===0||Ie)return;const A=n,B=qn[pe[0].lineIndex]??null,te=qn[pe[pe.length-1].lineIndex]??null;if(B===null||te===null)return;const me=[];for(let _e=B;_e<=te;_e++){const Ne=jd(A,_e);if(Ne===null)return;me.push(Ne)}const ve=me[0],$e=me[me.length-1],Pe={start:ve.srcStart,end:$e.srcEnd};b({track:A,from:B,to:te,span:Pe,newSpan:(()=>{var Et,Dt;const _e=bv(Pe,L),Ne=i.doc.captionLineWindows;return a5({start:((Et=Ne[ve.key])==null?void 0:Et.srcStart)??Pe.start,end:((Dt=Ne[$e.key])==null?void 0:Dt.srcEnd)??Pe.end},_e.start,_e.end)})()})},Lt=d.useMemo(()=>{if(v===null)return null;const A=[];for(let B=v.from;B<=v.to;B++){const te=jd(v.track,B);if(te===null)return null;A.push(te)}return A},[v]),hr=d.useMemo(()=>v===null||Lt===null?null:i5({lines:Lt,span:v.span,newSpan:v.newSpan}),[v,Lt]),Kt=d.useMemo(()=>{const A=new Map;for(const te of hr??[])te.window!==null&&A.set(yn(te.srcStart),te.window);const B=[];for(let te=0;te<n.length;te++){const me=jd(n,te);if(me===null)continue;const ve=A.get(me.key)??i.doc.captionLineWindows[me.key];B.push({key:me.key,srcStart:(ve==null?void 0:ve.srcStart)??me.srcStart,srcEnd:(ve==null?void 0:ve.srcEnd)??me.srcEnd})}return B},[n,i.doc.captionLineWindows,hr]),Ot=d.useMemo(()=>s5(Kt),[Kt]),In=v===null?0:v.to-v.from+1,at=d.useMemo(()=>v===null?null:bv(v.span,L),[v,L]);d.useEffect(()=>{T(null),V(0)},[l]),d.useEffect(()=>{if(v===null||P!==null)return;let A=!1;return r5(l).then(B=>{!A&&B!==null&&(T(B),B.sampleRate>0&&V(B.channel.length/B.sampleRate))}),()=>{A=!0}},[v,P,l]);const Tn=A=>at===null?0:(A-at.start)/(at.end-at.start)*wo;d.useEffect(()=>{var Dt;if(v===null||at===null)return;const A=M.current,B=((Dt=A==null?void 0:A.getContext)==null?void 0:Dt.call(A,"2d"))??null;if(!A||!B)return;const te=Tn;B.fillStyle="#0F0F14",B.fillRect(0,0,wo,Fn);const me=Math.floor(wo/2),ve=P===null?new Float32Array(me):n5(P.channel,P.sampleRate,at.start,at.end,me).buckets;B.fillStyle="#4a4a58";const $e=wo/me;for(let Ct=0;Ct<me;Ct++){const _r=Math.max(1,ve[Ct]*(Fn-4));B.fillRect(Ct*$e,(Fn-_r)/2,Math.max(1,$e-1),_r)}const Pe=new Set((Lt==null?void 0:Lt.map(Ct=>Ct.key))??[]);for(const Ct of Kt){if(Pe.has(Ct.key))continue;const _r=te(Ct.srcStart),dn=Math.max(1,te(Ct.srcEnd)-_r);B.fillStyle=Ot.has(Ct.key)?"rgba(240, 165, 60, 0.28)":"rgba(255, 255, 255, 0.05)",B.fillRect(_r,0,dn,Fn)}const _e=te(v.newSpan.start),Ne=te(v.newSpan.end),Et=(Lt==null?void 0:Lt.some(Ct=>Ot.has(Ct.key)))??!1;B.fillStyle=Et?"rgba(240, 165, 60, 0.22)":"rgba(255, 225, 77, 0.18)",B.fillRect(_e,0,Math.max(1,Ne-_e),Fn),B.fillStyle=Et?"#F0A53C":"#FFE14D",B.fillRect(_e-1,0,2,Fn),B.fillRect(Ne-1,0,2,Fn)},[v,at,Lt,Kt,Ot,P]);const $r=at===null?0:(at.end-at.start)/wo,Jn=v===null||at===null?null:{lead:Tn(v.newSpan.start),tail:Tn(v.newSpan.end)},vo=A=>B=>{v!==null&&(B.preventDefault(),H({edge:A,startX:B.clientX,span:v.newSpan}))};d.useEffect(()=>{if(D===null||v===null||at===null)return;const A=te=>{b({...v,newSpan:l5({edge:D.edge,span:D.span,dSec:(te.clientX-D.startX)*$r,lo:at.start,hi:at.end})})},B=()=>H(null);return window.addEventListener("pointermove",A),window.addEventListener("pointerup",B),window.addEventListener("pointercancel",B),window.addEventListener("blur",B),()=>{window.removeEventListener("pointermove",A),window.removeEventListener("pointerup",B),window.removeEventListener("pointercancel",B),window.removeEventListener("blur",B)}},[D,v,at,$r]),d.useEffect(()=>{v===null&&D!==null&&H(null)},[v,D]);const jn=()=>{var B;const A=$.current;if(!(A===null||v===null)){if(k){A.pause(),E(!1),F(null);return}A.currentTime=v.newSpan.start;try{const te=(B=A.play)==null?void 0:B.call(A);te&&typeof te.catch=="function"&&te.catch(()=>{})}catch{}E(!0),F(v.newSpan.start)}},qo=()=>{const A=$.current;if(!(A===null||v===null||!k)){if(A.currentTime<v.newSpan.end){F(A.currentTime);return}if(C){A.currentTime=v.newSpan.start,F(v.newSpan.start);return}A.pause(),E(!1),F(null)}};d.useEffect(()=>{var A;v!==null||!k||((A=$.current)==null||A.pause(),E(!1),F(null))},[v,k]);const tn=A=>{i.patchCaptionLineWindows(A),b(null)};return u.jsxs("div",{"data-testid":"transcript-panel",style:{...d5,width:a},children:[u.jsxs("div",{style:f5,children:[u.jsx("span",{style:p5,children:"Transcript"}),u.jsxs("div",{style:R5,children:[u.jsx("span",{style:Ev,children:"Click to jump · double-click to retype · drag to select"}),u.jsx("button",{"data-testid":"transcript-help-toggle",style:P5,onClick:()=>Q(A=>!A),title:"What each gesture does","aria-label":"Transcript help","aria-expanded":Z,children:"?"})]}),Z?u.jsx("div",{"data-testid":"transcript-help",style:Ev,children:"Drag across words — or shift-click — to mark a run. Its toolbar offers Edit (rewrite freely — word count may change, captions only; works on a single word too, the way to split a merged one), Timing (whole CAPTIONS — drag the waveform handles to move when they come in and go out, or drag between them to shift them all, taking the time from the captions either side) and Delete — from the captions only (restorable — the word stays here and in the audio) or from the video too, on the next Render. Double-click retype stays 1:1 — word count and timing fixed, so scene anchors and the caption highlight keep working."}):null,u.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[u.jsx("input",{"data-testid":"transcript-search",style:{...h5,flex:1},placeholder:"Find a word…",value:p,onChange:A=>m(A.target.value),onKeyDown:A=>{A.key==="Enter"&&(A.preventDefault(),fe(A.shiftKey?-1:1))}}),u.jsx("button",{"data-testid":"transcript-prev",style:Cv,onClick:()=>fe(-1),disabled:O.length===0,title:"Previous match (⇧Enter)","aria-label":"Previous match",children:"‹"}),u.jsx("button",{"data-testid":"transcript-next",style:Cv,onClick:()=>fe(1),disabled:O.length===0,title:"Next match (Enter)","aria-label":"Next match",children:"›"})]}),X?u.jsx("div",{"data-testid":"transcript-match-count",style:{fontSize:11,color:"#9A9AA3"},children:O.length===0?"0 matches":`${se+1}/${O.length} match${O.length===1?"":"es"}`}):null]}),u.jsxs("div",{style:m5,"data-testid":"transcript-body",dir:ie,ref:J,onMouseUp:ze,tabIndex:0,onKeyDown:A=>{if(!(y!==null||h!==null)){if(v!==null){A.key==="Escape"&&(A.stopPropagation(),b(null));return}if(A.key==="Escape"){if(x===null)return;A.stopPropagation(),S(null),g(null);return}(A.key==="Delete"||A.key==="Backspace")&&x!==null&&(A.preventDefault(),A.stopPropagation(),Le?Fr():Nt())}},children:[K.map((A,B)=>{const te=Re(A.word),me=go(A.lineIndex),ve=(()=>{const Pe=Go(A.lineIndex);return Pe!==null&&Ot.has(Pe)})(),$e=Y(A)?"hidden from captions — select and Restore":te!==void 0?`part of a rewritten range (was “${te.was}”) — select it and use Edit`:A.synthetic?`rewritten (was “${A.base}”) — select and Edit to change`:A.live!==A.base?`edited (was “${A.base}”) — double-click to retype`:"click to jump · double-click to retype";return u.jsxs(he.Fragment,{children:[B>0?" ":null,(y==null?void 0:y.index)===A.index?u.jsx("input",{autoFocus:!0,"data-testid":"transcript-edit",style:A5,value:y.draft,onChange:Pe=>w({...y,draft:Pe.target.value}),onBlur:()=>Ce(y),onKeyDown:Pe=>{Pe.key==="Enter"&&Pe.target.blur(),Pe.key==="Escape"&&w(null)}}):u.jsx("span",{"data-testid":`transcript-word-${A.index}`,onClick:Pe=>{var _e;if(h!==null&&g(null),v!==null&&b(null),Pe.shiftKey){S(Ne=>Ne===null?{anchor:A.index,focus:A.index}:{...Ne,focus:A.index});return}(_e=o.current)==null||_e.seekTo(Math.ceil(c(A.start)*r)),S({anchor:A.index,focus:A.index})},onDoubleClick:()=>Te(A),title:`${$e}${me===void 0?"":` · ${me}`}${ve?" · overlaps another caption":""}`,style:{...g5,...me!==void 0?E5:{},...Y(A)?k5:{},...A.live!==A.base||A.synthetic?w5:{},...ve?b5:{},...W===A.index?x5:{},...xe!==null&&A.index>=xe&&A.index<=be?S5:{},...X!=null&&X.has(A.index)?y5:{},...O[se]===A.index?v5:{}},children:A.live})]},A.index)}),x!==null&&_!==null&&y===null&&h===null&&v===null?u.jsxs("div",{"data-testid":"transcript-selection-menu",role:"menu",ref:U,dir:"ltr",style:{...Dl,top:_.top,left:_.left},children:[u.jsx(ii,{"data-testid":"transcript-edit-range",onClick:kt,disabled:Ie,title:Ie?"A selected word has no source anchor (this project predates them) — re-run produce first":Ye!==void 0?"Re-edit the rewritten range this selection touches":pe.length===1?"Retype this word (1:1 — same as double-click)":"Rewrite these words as free text — word count may change",children:"Edit"}),u.jsx(ii,{"data-testid":"transcript-timing",onClick:Xo,disabled:pe.length===0||Ie,title:Ie?"A selected word has no source anchor (this project predates them) — re-run produce first":yo===1?"Adjust when this caption appears and leaves":`Adjust when these ${yo} captions appear and leave`,children:"Timing"}),Le?u.jsx(ii,{"data-testid":"transcript-restore",onClick:Fr,title:"Show these words in the captions again",children:"Restore"}):u.jsxs("span",{style:{position:"relative"},children:[u.jsx(ii,{"data-testid":"transcript-delete-menu",onClick:()=>ne(A=>!A),title:"Delete these words — from the captions only, or from the video too",children:"Delete ▾"}),z?u.jsxs("div",{"data-testid":"transcript-delete-flyout",dir:"ltr",style:F5,children:[u.jsx(ii,{"data-testid":"transcript-hide",onClick:()=>{ne(!1),mo()},disabled:Ie,title:Ie?"A selected word has no source anchor (this project predates them) — re-run produce first":"Hide these words from the captions — restorable, the words stay here and in the audio",children:"Delete captions"}),u.jsx(ii,{"data-testid":"transcript-delete",onClick:()=>{ne(!1),Nt()},disabled:Ie,title:Ie?"A selected word has no source anchor (this project predates them) — re-run produce first":"Delete these words — from the captions only, or from the video too",children:"Delete + video…"})]}):null]}),u.jsxs("span",{style:Iv,children:[pe.length," word",pe.length===1?"":"s"]})]}):null,h!==null&&_!==null?u.jsxs("div",{"data-testid":"transcript-range-popover",ref:U,dir:"ltr",style:{...Dl,top:_.top,left:_.left,flexDirection:"column",alignItems:"stretch",gap:6},children:[u.jsx("textarea",{autoFocus:!0,"data-testid":"transcript-range-edit",rows:3,dir:"auto",style:_5,value:h.draft,onChange:A=>g({...h,draft:A.target.value}),onKeyDown:A=>{A.key==="Enter"&&!A.shiftKey&&(A.preventDefault(),pr(h)),A.key==="Escape"&&g(null)}}),u.jsxs("div",{style:{display:"flex",gap:6},children:[u.jsx("button",{"data-testid":"transcript-apply",style:Or,onClick:()=>pr(h),title:"Rewrite this selection (Enter)",children:"Apply"}),dt.length>0?u.jsxs("button",{"data-testid":"transcript-apply-all",style:Or,onClick:()=>os(h),title:"Rewrite this selection AND every other place the same words occur — one undo step",children:["Apply to all (",dt.length,")"]}):null,u.jsx("button",{style:Or,onClick:()=>g(null),title:"Discard the rewrite (Esc)",children:"Cancel"})]})]}):null,u.jsx("audio",{"data-testid":"transcript-timing-audio",ref:$,src:"/media/audio.wav",preload:"none",onTimeUpdate:qo,onLoadedMetadata:A=>{const B=A.currentTarget.duration;Number.isFinite(B)&&B>0&&V(B)}}),v!==null&&at!==null&&_!==null?u.jsxs("div",{"data-testid":"transcript-timing-popover",ref:U,dir:"ltr",style:{...Dl,top:_.top,left:_.left,flexDirection:"column",alignItems:"stretch",gap:6},children:[u.jsxs("div",{style:{position:"relative",width:wo,height:Fn},children:[u.jsx("canvas",{"data-testid":"transcript-timing-canvas",ref:M,width:wo,height:Fn,style:{display:"block",borderRadius:4}}),Jn!==null?u.jsxs(u.Fragment,{children:[u.jsx("div",{"data-testid":"transcript-timing-band",title:In===1?"Drag to move this caption onto the audio it belongs to, its duration intact":"Drag to move these captions onto the audio they belong to, every duration intact",onPointerDown:vo("band"),style:{...I5,left:Jn.lead,width:Math.max(0,Jn.tail-Jn.lead),cursor:(D==null?void 0:D.edge)==="band"?"grabbing":"grab"}}),u.jsx(kv,{"data-testid":"transcript-timing-handle-lead",title:In===1?"Drag to move when this caption comes in":"Drag to move when the first caption comes in",x:Jn.lead,active:(D==null?void 0:D.edge)==="lead",onPointerDown:vo("lead")}),u.jsx(kv,{"data-testid":"transcript-timing-handle-tail",title:In===1?"Drag to move when this caption goes out":"Drag to move when the last caption goes out",x:Jn.tail,active:(D==null?void 0:D.edge)==="tail",onPointerDown:vo("tail")}),j!==null?u.jsx("div",{"data-testid":"transcript-timing-playhead",style:{...T5,left:Tn(j)}}):null]}):null]}),u.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[u.jsx("button",{"data-testid":"transcript-timing-play",style:Or,onClick:jn,title:k?"Pause":In===1?"Play the audio under this caption's window":"Play the audio under these captions' window",children:k?"Pause":"Play"}),u.jsx("button",{"data-testid":"transcript-timing-loop",style:C?{...Or,...M5}:Or,"aria-pressed":C,onClick:()=>I(A=>!A),title:C?"Stop at the end of the selection instead of repeating it":"Repeat the selection so the same seconds can be checked against the words",children:"Loop"}),u.jsxs("span",{"data-testid":"transcript-timing-span",style:Iv,children:[v.newSpan.start.toFixed(2),"s – ",v.newSpan.end.toFixed(2),"s",` · ${In} caption${In===1?"":"s"}`,(Lt??[]).some(A=>Ot.has(A.key))?" · overlaps":""]}),u.jsx("button",{"data-testid":"transcript-timing-apply",style:Or,onClick:()=>{hr!==null&&tn(hr)},title:In===1?"Store where this caption sits in the source audio":"Store where these captions sit in the source audio — one undo step for the whole gesture",children:"Apply"}),u.jsx("button",{"data-testid":"transcript-timing-cancel",style:Or,onClick:()=>b(null),title:"Discard the placement (Esc)",children:"Cancel"})]})]}):null]})]})},ii=({children:e,...t})=>{const[n,r]=d.useState(!1);return u.jsx("button",{role:"menuitem",...t,style:{...$5,...n&&!t.disabled?{background:"#34343F"}:{},...t.disabled?{opacity:.5,cursor:"default"}:{}},onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:e})},kv=({x:e,active:t,...n})=>{const[r,o]=d.useState(!1);return u.jsx("div",{...n,style:{...C5,left:e-zS/2},onPointerEnter:()=>o(!0),onPointerLeave:()=>o(!1),children:u.jsx("div",{style:{...j5,background:t?"#fff":r?"#FFF0A0":"#FFE14D",width:t?4:2}})})},d5={flexShrink:0,display:"flex",flexDirection:"column",background:"#111116",minHeight:0},f5={display:"flex",flexDirection:"column",gap:8,padding:"14px 14px 10px",borderBottom:"1px solid #1E1E24"},p5={fontSize:11,fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"#9A9AA3"},Ev={fontSize:11,lineHeight:1.45,color:"#6a6a75"},h5={fontFamily:"'Inter', system-ui, sans-serif",fontSize:13,background:"#0F0F14",border:"1px solid #2A2A33",borderRadius:6,color:"#fff",padding:"6px 8px"},m5={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"},g5={cursor:"pointer",borderRadius:3,padding:"2px 4px",unicodeBidi:"isolate"},y5={background:"#2b2b1a",outline:"1px solid #6b6432"},v5={background:"#3d3a17",outline:"2px solid #FFE14D",color:"#fff"},Cv={width:26,height:30,fontSize:16,lineHeight:1,color:"#EDEDF2",background:"#1A1A21",border:"1px solid #2A2A33",borderRadius:6,cursor:"pointer",padding:0},w5={color:"#FFE14D"},x5={background:"#2E5CFF30",color:"#F2F4FF",borderRadius:4},b5={color:"#F0A53C"},S5={background:"#FFE14D",color:"#111",borderRadius:0,boxShadow:"-4px 0 0 0 #FFE14D, 4px 0 0 0 #FFE14D"},k5={textDecoration:"line-through",color:"#6a6a75"},E5={borderBottom:"1px dotted #9A9AA3"},zS=12,C5={position:"absolute",top:0,width:zS,height:Fn,cursor:"ew-resize",touchAction:"none",display:"flex",justifyContent:"center"},I5={position:"absolute",top:0,height:Fn,touchAction:"none"},T5={position:"absolute",top:0,width:1,height:Fn,background:"#FFFFFF",pointerEvents:"none"},j5={height:"100%",borderRadius:1,pointerEvents:"none"},R5={display:"flex",gap:6,alignItems:"center",justifyContent:"space-between"},P5={width:20,height:20,fontSize:11,lineHeight:1,color:"#9A9AA3",background:"#1A1A21",border:"1px solid #2A2A33",borderRadius:6,cursor:"pointer",padding:0,flexShrink:0},Dl={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},F5={...Dl,top:"100%",left:0,marginTop:4,zIndex:32,minWidth:170,flexDirection:"column",alignItems:"stretch"},Iv={fontSize:11,color:"#9A9AA3",paddingInline:"6px 8px",whiteSpace:"nowrap"},$5={fontSize:12,fontWeight:600,color:"#EDEDF2",background:"transparent",border:"none",borderRadius:6,padding:"6px 10px",cursor:"pointer",textAlign:"left",whiteSpace:"nowrap"},_5={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"},Or={fontSize:11,color:"#EDEDF2",background:"#34343F",border:"1px solid #45454F",borderRadius:6,cursor:"pointer",padding:"4px 8px"},M5={color:"#111",background:"#FFE14D",borderColor:"#FFE14D"},A5={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"},N5=[{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"]]}],L5=({onClose:e})=>(d.useEffect(()=>{const t=n=>{n.key==="Escape"&&(n.stopPropagation(),e())};return window.addEventListener("keydown",t,!0),()=>window.removeEventListener("keydown",t,!0)},[e]),u.jsx("div",{style:O5,onMouseDown:e,children:u.jsxs("div",{"data-testid":"shortcuts-modal",style:D5,onMouseDown:t=>t.stopPropagation(),children:[u.jsxs("div",{style:z5,children:[u.jsx("span",{style:B5,children:"keybinds"}),u.jsx("span",{style:W5,children:"esc close"})]}),u.jsx("div",{style:V5,children:"available commands and configured shortcuts"}),N5.map(t=>u.jsxs("div",{style:{marginTop:18},children:[u.jsx("div",{style:H5,children:t.title}),t.rows.map(([n,r])=>u.jsxs("div",{style:U5,children:[u.jsx("span",{style:Z5,children:n}),u.jsx("span",{style:K5,children:r})]},n))]},t.title))]})})),O5={position:"fixed",inset:0,zIndex:30,background:"rgba(5,5,8,0.6)",display:"flex",alignItems:"center",justifyContent:"center"},D5={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"},z5={display:"flex",justifyContent:"space-between",alignItems:"center"},B5={fontSize:18,fontWeight:700,color:"#EDEDF2"},W5={fontSize:13,fontWeight:700,color:"#0B0B0E",background:"#a8c7fa",borderRadius:4,padding:"3px 10px"},V5={fontSize:13,color:"#6a6a75",marginTop:4},H5={fontSize:14,fontWeight:700,color:"#8ab4f8",marginBottom:6},U5={display:"flex",gap:16,padding:"3px 0"},Z5={width:290,flexShrink:0,color:"#c5a3ff",fontWeight:600,fontSize:13},K5={color:"#C9C9D4",fontSize:13},Tv={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`}},Y5=({plan:e,onConfirm:t,onCancel:n})=>{const[r,o]=d.useState(e.targets[0]),i=d.useRef(null),s=d.useRef(null);return d.useEffect(()=>{const a=l=>{if(l.key==="Escape"){l.stopPropagation(),n();return}if(l.key!=="Tab")return;const c=i.current;if(!c)return;const f=c.querySelectorAll("input, button"),p=f[0],m=f[f.length-1];!p||!m||(l.shiftKey&&document.activeElement===p?(l.preventDefault(),m.focus()):!l.shiftKey&&document.activeElement===m&&(l.preventDefault(),p.focus()))};return window.addEventListener("keydown",a,!0),()=>window.removeEventListener("keydown",a,!0)},[n]),d.useEffect(()=>{var l;const a=document.activeElement;return(l=s.current)==null||l.focus(),()=>{var c;return(c=a==null?void 0:a.focus)==null?void 0:c.call(a)}},[]),u.jsx("div",{style:G5,onMouseDown:n,children:u.jsxs("form",{ref:i,"data-testid":"delete-scene-modal",role:"dialog","aria-modal":"true","aria-label":`Delete ${e.rootId}`,style:X5,onMouseDown:a=>a.stopPropagation(),onSubmit:a=>{a.preventDefault(),t(r)},children:[u.jsxs("div",{style:q5,children:[u.jsxs("span",{style:J5,children:["delete ",e.rootId,e.isSplitHalf?u.jsx("span",{style:Q5,children:"half"}):null,"?"]}),u.jsx("span",{style:eL,children:"esc cancel"})]}),u.jsx("div",{style:tL,children:"undoable with ⌘Z, like every other edit"}),u.jsx("div",{style:{marginTop:16},children:e.targets.map(a=>u.jsxs("label",{style:nL,"data-testid":`delete-option-${a}`,children:[u.jsx("input",{type:"radio",name:"delete-target",value:a,checked:r===a,onChange:()=>o(a),style:rL}),u.jsxs("span",{children:[u.jsx("span",{style:oL,children:Tv[a].label}),u.jsx("span",{style:iL,children:Tv[a].detail(e)})]})]},a))}),u.jsxs("div",{style:sL,children:[u.jsx("button",{type:"button","data-testid":"delete-cancel",style:BS,onClick:n,children:"Cancel"}),u.jsx("button",{ref:s,type:"submit","data-testid":"delete-confirm",style:aL,children:"Delete"})]})]})})},G5={position:"fixed",inset:0,zIndex:30,background:"rgba(5,5,8,0.6)",display:"flex",alignItems:"center",justifyContent:"center"},X5={width:420,maxWidth:"90vw",background:"#12121A",border:"1px solid #3A3A48",borderRadius:8,padding:"18px 22px 20px",fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace"},q5={display:"flex",justifyContent:"space-between",alignItems:"center",gap:12},J5={fontSize:16,fontWeight:700,color:"#EDEDF2"},Q5={fontSize:11,fontWeight:700,color:"#0B0B0E",background:"#c5a3ff",borderRadius:4,padding:"2px 6px",marginLeft:6},eL={fontSize:12,fontWeight:700,color:"#0B0B0E",background:"#a8c7fa",borderRadius:4,padding:"3px 10px",whiteSpace:"nowrap"},tL={fontSize:12,color:"#6a6a75",marginTop:4},nL={display:"flex",alignItems:"flex-start",gap:10,padding:"8px 0",cursor:"pointer"},rL={accentColor:"#8ab4f8",marginTop:2,cursor:"pointer"},oL={display:"block",fontSize:13,fontWeight:600,color:"#EDEDF2"},iL={display:"block",fontSize:12,color:"#9A9AA3",marginTop:2},sL={display:"flex",justifyContent:"flex-end",gap:8,marginTop:14},BS={fontSize:12,fontWeight:600,color:"#C9C9D4",background:"transparent",border:"1px solid #2A2A33",borderRadius:6,padding:"7px 12px",cursor:"pointer",fontFamily:"inherit"},aL={...BS,color:"#FF5C5C",border:"1px solid #452626"},jv={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`}},lL=({plan:e,onConfirm:t,onCancel:n})=>{const[r,o]=d.useState(e.targets[0]),i=d.useRef(null),s=d.useRef(null);d.useEffect(()=>{const l=c=>{if(c.key==="Escape"){c.stopPropagation(),n();return}if(c.key!=="Tab")return;const f=i.current;if(!f)return;const p=f.querySelectorAll("input, button"),m=p[0],y=p[p.length-1];!m||!y||(c.shiftKey&&document.activeElement===m?(c.preventDefault(),y.focus()):!c.shiftKey&&document.activeElement===y&&(c.preventDefault(),m.focus()))};return window.addEventListener("keydown",l,!0),()=>window.removeEventListener("keydown",l,!0)},[n]),d.useEffect(()=>{var c;const l=document.activeElement;return(c=s.current)==null||c.focus(),()=>{var f;return(f=l==null?void 0:l.focus)==null?void 0:f.call(l)}},[]);const a=e.words.length;return u.jsx("div",{style:uL,onMouseDown:n,children:u.jsxs("form",{ref:i,"data-testid":"delete-words-modal",role:"dialog","aria-modal":"true","aria-label":`Delete ${a} word${a===1?"":"s"}`,style:cL,onMouseDown:l=>l.stopPropagation(),onSubmit:l=>{l.preventDefault(),t(r)},children:[u.jsxs("div",{style:dL,children:[u.jsxs("span",{style:fL,children:["delete ",a," word",a===1?"":"s","?"]}),u.jsx("span",{style:pL,children:"esc cancel"})]}),u.jsx("div",{style:hL,children:"undoable with ⌘Z, like every other edit"}),u.jsx("div",{style:{marginTop:16},children:e.targets.map(l=>u.jsxs("label",{style:mL,"data-testid":`delete-words-option-${l}`,children:[u.jsx("input",{type:"radio",name:"delete-words-target",value:l,checked:r===l,onChange:()=>o(l),style:gL}),u.jsxs("span",{children:[u.jsx("span",{style:yL,children:jv[l].label}),u.jsx("span",{style:vL,children:jv[l].detail(e)})]})]},l))}),u.jsxs("div",{style:wL,children:[u.jsx("button",{type:"button","data-testid":"delete-words-cancel",style:WS,onClick:n,children:"Cancel"}),u.jsx("button",{ref:s,type:"submit","data-testid":"delete-words-confirm",style:xL,children:"Delete"})]})]})})},uL={position:"fixed",inset:0,zIndex:30,background:"rgba(5,5,8,0.6)",display:"flex",alignItems:"center",justifyContent:"center"},cL={width:420,maxWidth:"90vw",background:"#12121A",border:"1px solid #3A3A48",borderRadius:8,padding:"18px 22px 20px",fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace"},dL={display:"flex",justifyContent:"space-between",alignItems:"center",gap:12},fL={fontSize:16,fontWeight:700,color:"#EDEDF2"},pL={fontSize:12,fontWeight:700,color:"#0B0B0E",background:"#a8c7fa",borderRadius:4,padding:"3px 10px",whiteSpace:"nowrap"},hL={fontSize:12,color:"#6a6a75",marginTop:4},mL={display:"flex",alignItems:"flex-start",gap:10,padding:"8px 0",cursor:"pointer"},gL={accentColor:"#8ab4f8",marginTop:2,cursor:"pointer"},yL={display:"block",fontSize:13,fontWeight:600,color:"#EDEDF2"},vL={display:"block",fontSize:12,color:"#9A9AA3",marginTop:2},wL={display:"flex",justifyContent:"flex-end",gap:8,marginTop:14},WS={fontSize:12,fontWeight:600,color:"#C9C9D4",background:"transparent",border:"1px solid #2A2A33",borderRadius:6,padding:"7px 12px",cursor:"pointer",fontFamily:"inherit"},xL={...WS,color:"#FF5C5C",border:"1px solid #452626"},bL=(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("/")}},Rv=e=>e.scrollTop+e.clientHeight<e.scrollHeight-1,SL=(e,t,n)=>n<=0?-1:Math.max(0,Math.min(n-1,e+t)),Pv=({recent:e,required:t,onOpen:n,onClose:r})=>{const[o,i]=d.useState(null),[s,a]=d.useState(null),[l,c]=d.useState(!1),f=d.useRef(null),p=d.useRef(null),[m,y]=d.useState(!1),[w,x]=d.useState(!1),S=()=>{y(f.current?Rv(f.current):!1)},h=()=>{x(p.current?Rv(p.current):!1)},g=async k=>{try{const E=await fetch(`/api/fs${k?`?dir=${encodeURIComponent(k)}`:""}`),C=await E.json();if(!E.ok)throw new Error(C.error??`listing failed: ${E.status}`);i(C)}catch(E){a(E instanceof Error?E.message:String(E))}};d.useEffect(()=>{g()},[]),d.useEffect(()=>{const k=()=>{S(),h()};return k(),window.addEventListener("resize",k),()=>window.removeEventListener("resize",k)},[o,e]),d.useEffect(()=>{if(t)return;const k=E=>{E.key==="Escape"&&(E.stopPropagation(),r())};return window.addEventListener("keydown",k,!0),()=>window.removeEventListener("keydown",k,!0)},[t,r]);const v=k=>{var F;const E=k.key==="ArrowDown"?1:k.key==="ArrowUp"?-1:0;if(E===0&&k.key!=="Home"&&k.key!=="End")return;const C=Array.from(k.currentTarget.querySelectorAll("button"));if(C.length===0)return;const I=C.indexOf(document.activeElement),j=k.key==="Home"?0:k.key==="End"?C.length-1:SL(I,E,C.length);k.preventDefault(),(F=C[j])==null||F.focus()},b=k=>{c(!0),a(null),n(k).then(E=>{c(!1),E&&a(E)})};return u.jsx("div",{style:kL,onMouseDown:t?void 0:r,children:u.jsxs("div",{"data-testid":"project-picker",style:EL,onMouseDown:k=>k.stopPropagation(),children:[u.jsxs("div",{style:CL,children:[u.jsx("span",{style:IL,children:t?"open a project":"switch project"}),t?null:u.jsx("button",{"data-testid":"project-picker-close",style:TL,onClick:r,children:"esc close"})]}),u.jsx("div",{style:jL,children:"A project is a work directory a `ossclip produce` run wrote — the folder holding render-props.json."}),s?u.jsx("div",{"data-testid":"project-picker-error",style:RL,children:s}):null,e.length>0?u.jsxs("div",{style:{marginTop:16,flexShrink:0},children:[u.jsx("div",{style:Fv,children:"recent"}),u.jsx("div",{ref:p,className:"ossclip-scroll-list",style:w?{...$v,...Mv}:$v,onScroll:h,onKeyDown:v,"data-testid":"project-recent-list",children:e.map(k=>{const{head:E,tail:C}=bL(k);return u.jsxs("button",{"data-testid":"project-recent",className:"ossclip-picker-row",style:{...Rd,...ML},disabled:l,onClick:()=>b(k),title:k,children:[u.jsx("span",{style:{color:"#FFE14D",flexShrink:0},children:"▸"}),u.jsxs("span",{style:AL,children:[u.jsx("span",{style:NL,children:C}),E?u.jsx("span",{style:LL,children:E}):null]})]},k)})})]}):null,u.jsxs("div",{style:_L,children:[u.jsx("div",{style:Fv,children:"browse"}),u.jsxs("div",{style:{color:"#6a6a75",fontSize:12,marginBottom:6},children:["Folders only — hidden ones are omitted, and any projects produced inside a folder show up directly as ",u.jsx("span",{style:{color:"#FFE14D"},children:"▸ .ossclip/…"})," entries."]}),o?u.jsxs(u.Fragment,{children:[u.jsxs("div",{style:PL,children:[u.jsx("span",{style:FL,title:o.dir,children:o.dir}),o.isWorkdir?u.jsx("button",{"data-testid":"project-open-current",style:$L,disabled:l,onClick:()=>b(o.dir),children:"open this project"}):null]}),u.jsxs("div",{ref:f,className:"ossclip-scroll-list",style:m?{..._v,...Mv}:_v,onScroll:S,onKeyDown:v,"data-testid":"project-fs-list",children:[o.parent?u.jsxs("button",{"data-testid":"project-fs-up",className:"ossclip-picker-row",style:Rd,disabled:l,onClick:()=>void g(o.parent),children:[u.jsx("span",{style:{color:"#6a6a75",flexShrink:0},children:"↑"}),u.jsx("span",{style:Av,children:".."})]}):null,o.entries.map(k=>u.jsxs("button",{"data-testid":k.isWorkdir?"project-fs-workdir":"project-fs-dir",className:`ossclip-picker-row${k.isWorkdir?" is-workdir":""}`,style:Rd,disabled:l,onClick:()=>k.isWorkdir?b(k.path):void g(k.path),title:k.path,children:[u.jsx("span",{style:{flexShrink:0,color:k.isWorkdir?"#FFE14D":"#6a6a75"},children:k.isWorkdir?"▸":"▪"}),u.jsxs("span",{style:Av,children:[k.name,k.isWorkdir?null:u.jsx("span",{style:{color:"#55555f"},children:"/"})]}),k.isWorkdir?u.jsx("span",{style:OL,children:"project"}):null]},k.path)),o.entries.length===0?u.jsx("div",{style:{color:"#6a6a75",fontSize:12,padding:"6px 8px"},children:"no folders here"}):null]})]}):u.jsx("div",{style:{color:"#6a6a75",fontSize:13},children:"loading…"})]})]})})},kL={position:"fixed",inset:0,zIndex:30,background:"rgba(5,5,8,0.6)",display:"flex",alignItems:"center",justifyContent:"center"},EL={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"},CL={display:"flex",justifyContent:"space-between",alignItems:"center"},IL={fontSize:18,fontWeight:700,color:"#EDEDF2"},TL={fontSize:13,fontWeight:700,color:"#0B0B0E",background:"#a8c7fa",border:"none",borderRadius:4,padding:"3px 10px",cursor:"pointer"},jL={fontSize:13,color:"#6a6a75",marginTop:4},RL={marginTop:12,fontSize:13,color:"#FF5C5C"},Fv={fontSize:14,fontWeight:700,color:"#8ab4f8",marginBottom:6},PL={display:"flex",alignItems:"center",gap:10,marginBottom:6},FL={fontSize:12,color:"#9A9AA3",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},$L={flexShrink:0,fontSize:12,fontWeight:700,color:"#0B0B0E",background:"#FFE14D",border:"1px solid #FFE14D",borderRadius:6,padding:"4px 10px",cursor:"pointer"},_L={marginTop:16,display:"flex",flexDirection:"column",flex:1,minHeight:0},$v={maxHeight:218,overflowY:"auto",overscrollBehavior:"contain",flexShrink:0,display:"flex",flexDirection:"column",gap:2},_v={flex:1,minHeight:0,overflowY:"auto",overscrollBehavior:"contain",display:"flex",flexDirection:"column",gap:2},Mv={maskImage:"linear-gradient(to bottom, black calc(100% - 24px), transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black calc(100% - 24px), transparent 100%)"},Rd={flexShrink:0,minHeight:34,display:"flex",alignItems:"center",gap:8,width:"100%",boxSizing:"border-box",textAlign:"left",fontFamily:"inherit",fontSize:13,lineHeight:1.4,borderRadius:6,padding:"6px 10px",cursor:"pointer",overflow:"hidden"},Av={overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},ML={minHeight:46,alignItems:"center"},AL={display:"flex",flexDirection:"column",minWidth:0},NL={color:"#EDEDF2",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},LL={fontSize:11,color:"#6a6a75",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},OL={marginLeft:10,fontSize:11,fontWeight:700,color:"#FFE14D"},DL=({defaultOutPath:e,onCancel:t,onConfirm:n})=>{const[r,o]=d.useState(e??""),[i,s]=he.useState(!1),[a,l]=d.useState(!1);d.useEffect(()=>{const f=p=>{p.key==="Escape"?(p.stopPropagation(),t()):p.key==="Enter"&&!a&&(p.preventDefault(),n(r.trim()?r.trim():void 0,i))};return window.addEventListener("keydown",f,!0),()=>window.removeEventListener("keydown",f,!0)},[t,n,r,a,i]);const c=async()=>{l(!0);try{const f=await fetch("/api/pick-save-path",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({defaultPath:r||e})});if(f.ok){const p=await f.json();p.path&&o(p.path)}}catch{}finally{l(!1)}};return u.jsx("div",{style:zL,onMouseDown:t,children:u.jsxs("div",{"data-testid":"render-modal",style:BL,onMouseDown:f=>f.stopPropagation(),children:[u.jsxs("div",{style:WL,children:[u.jsx("div",{style:VL,children:"🎬 Render Master Video"}),u.jsx("button",{style:HL,onClick:t,children:"✕"})]}),u.jsx("div",{style:UL,children:"Choose where to export your rendered master cut, or keep the default location."}),u.jsxs("div",{style:{marginTop:20},children:[u.jsx("label",{style:ZL,children:"Export File Destination"}),u.jsxs("div",{style:KL,children:[u.jsx("input",{"data-testid":"render-outpath-input",type:"text",value:r,onChange:f=>o(f.target.value),placeholder:"e.g. /Users/name/Movies/final-cut.mp4",style:YL,autoFocus:!0}),u.jsx("button",{"data-testid":"render-browse-btn",style:GL,onClick:c,disabled:a,title:"Open native file picker to choose destination",children:a?"Browsing…":"📁 Browse…"})]})]}),u.jsxs("div",{style:XL,children:[u.jsx("button",{style:qL,onClick:t,children:"Cancel"}),u.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,margin:"12px 0",fontSize:13,opacity:.85},children:[u.jsx("input",{type:"checkbox","data-testid":"render-replan",checked:i,onChange:f=>s(f.target.checked)}),"Re-plan graphics with the LLM (discards the reviewed plan)"]}),u.jsx("button",{"data-testid":"render-confirm-btn",style:JL,onClick:()=>n(r.trim()?r.trim():void 0,i),children:"Start Render ⚡"})]})]})})},zL={position:"fixed",inset:0,zIndex:40,background:"rgba(5,5,8,0.75)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center"},BL={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"},WL={display:"flex",justifyContent:"space-between",alignItems:"center"},VL={fontSize:18,fontWeight:700,color:"#EDEDF2",letterSpacing:"-0.01em"},HL={background:"transparent",border:"none",color:"#8B8B9E",fontSize:16,cursor:"pointer",padding:"4px 8px",borderRadius:4},UL={fontSize:13,color:"#8B8B9E",marginTop:6,lineHeight:1.4},ZL={display:"block",fontSize:12,fontWeight:600,color:"#C9C9D4",marginBottom:8,textTransform:"uppercase",letterSpacing:"0.04em"},KL={display:"flex",gap:8},YL={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"},GL={background:"#1E1E2A",border:"1px solid #3A3A48",borderRadius:6,color:"#EDEDF2",padding:"0 16px",fontSize:13,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap"},XL={display:"flex",justifyContent:"flex-end",gap:12,marginTop:24},qL={background:"transparent",border:"1px solid #2C2C38",borderRadius:6,color:"#C9C9D4",padding:"9px 18px",fontSize:13,fontWeight:600,cursor:"pointer"},JL={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 QL(e){switch(e){case"override":return"Project override";case"flag":case"config":return"Your default portrait"}}function eO(e){const t=/^data:([^;,]+);base64,(.+)$/s.exec(e);return t?{mimeType:t[1],data:t[2]}:null}function tO(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 Nv=60,nO=({onClose:e})=>{const[t,n]=d.useState(null),[r,o]=d.useState(null),[i,s]=d.useState(""),[a,l]=d.useState(""),[c,f]=d.useState(""),[p,m]=d.useState(null),[y,w]=d.useState(!1),[x,S]=d.useState(null),[h,g]=d.useState(null),v=d.useRef(null);d.useEffect(()=>{const j=F=>{F.key==="Escape"&&(F.stopPropagation(),e())};return window.addEventListener("keydown",j,!0),()=>window.removeEventListener("keydown",j,!0)},[e]),d.useEffect(()=>{(async()=>{try{const j=await fetch("/api/thumbnail"),F=await j.json();if(!j.ok)throw new Error(F.error??`GET /api/thumbnail failed: ${j.status}`);n(F),m(F.imageUrl),F.concept&&(s(F.concept.overlayText),l(F.concept.scene),f(F.concept.styleNotes))}catch(j){o(j instanceof Error?j.message:String(j))}})()},[]);const b=async()=>{w(!0),S(null);try{const j=await fetch("/api/thumbnail/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({concept:{scene:a,overlayText:i,styleNotes:c}})}),F=await j.json();if(!j.ok||F.ok!==!0){S(F.error??`regenerate failed: ${j.status}`);return}m(F.imageUrl??null)}catch(j){S(j instanceof Error?j.message:String(j))}finally{w(!1)}},k=j=>{n(F=>F&&{...F,portrait:j})},E=async j=>{g(null);try{const F=await new Promise(($,D)=>{const H=new FileReader;H.onload=()=>$(String(H.result)),H.onerror=()=>D(new Error("could not read the image file")),H.readAsDataURL(j)}),L=eO(F);if(L===null){g("could not read the image file");return}const V=await fetch("/api/thumbnail/portrait",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(L)}),M=await V.json();if(!V.ok||M.ok!==!0){g(M.error??`swap failed: ${V.status}`);return}k(M.portrait??null)}catch(F){g(F instanceof Error?F.message:String(F))}},C=async()=>{g(null);try{const j=await fetch("/api/thumbnail/portrait",{method:"DELETE"}),F=await j.json();if(!j.ok||F.ok!==!0){g(F.error??`reset failed: ${j.status}`);return}k(F.portrait??null)}catch(j){g(j instanceof Error?j.message:String(j))}},I=(t==null?void 0:t.status)==="unavailable";return u.jsx("div",{style:rO,onMouseDown:e,children:u.jsxs("div",{"data-testid":"thumbnail-modal",style:oO,onMouseDown:j=>j.stopPropagation(),children:[u.jsxs("div",{style:iO,children:[u.jsx("div",{style:sO,children:"AI Thumbnail"}),u.jsx("button",{style:aO,onClick:e,"aria-label":"Close",children:"✕"})]}),r?u.jsxs("div",{"data-testid":"thumbnail-load-error",style:_d,children:["Couldn't load the thumbnail state: ",r]}):t===null?u.jsx("div",{style:Pd,children:"Loading…"}):I?u.jsx("div",{"data-testid":"thumbnail-unavailable",style:{...Pd,marginTop:12},children:tO(t.reason)}):u.jsxs(u.Fragment,{children:[t.status==="skipped"?u.jsx("div",{"data-testid":"thumbnail-skipped-note",style:{...Pd,marginTop:8},children:"Thumbnail was skipped at the concept approval prompt — regenerating replaces that decision."}):null,u.jsx("div",{style:lO,children:p?u.jsx("img",{"data-testid":"thumbnail-image",src:p,alt:"Current AI thumbnail",style:uO}):u.jsx("div",{"data-testid":"thumbnail-placeholder",style:cO,children:"No thumbnail generated yet — edit the concept and hit Regenerate."})}),t.portrait?u.jsxs("div",{"data-testid":"portrait-strip",style:dO,children:[u.jsx("img",{"data-testid":"portrait-preview",src:t.portrait.url,alt:"Portrait reference",style:fO}),u.jsxs("div",{style:{flex:1,minWidth:0},children:[u.jsx("div",{"data-testid":"portrait-source",style:pO,children:QL(t.portrait.source)}),u.jsx("div",{style:Ov,children:"The swap applies to this project only and is used by future renders too."})]}),u.jsx("button",{"data-testid":"portrait-swap-btn",style:Lv,onClick:()=>{var j;return(j=v.current)==null?void 0:j.click()},disabled:y,children:"Swap face…"}),t.portrait.source==="override"?u.jsx("button",{"data-testid":"portrait-reset-btn",style:Lv,onClick:()=>void C(),disabled:y,children:"Use default"}):null,u.jsx("input",{ref:v,"data-testid":"portrait-file-input",type:"file",accept:"image/png,image/jpeg,image/webp",style:{display:"none"},onChange:j=>{var L;const F=(L=j.target.files)==null?void 0:L[0];j.target.value="",F&&E(F)}})]}):null,h?u.jsx("div",{"data-testid":"portrait-error",style:_d,children:h}):null,u.jsxs("div",{style:{marginTop:16},children:[u.jsxs("label",{style:Fd,children:["Overlay text — the words ON the image (",Nv," chars, 4–9 words)"]}),u.jsx("input",{"data-testid":"thumbnail-overlay-input",type:"text",maxLength:Nv,value:i,onChange:j=>s(j.target.value),style:$d})]}),u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:Fd,children:"Scene — what the image shows"}),u.jsx("textarea",{"data-testid":"thumbnail-scene-input",value:a,onChange:j=>l(j.target.value),rows:3,style:{...$d,resize:"vertical"}})]}),u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:Fd,children:"Style notes — palette, lighting, mood"}),u.jsx("textarea",{"data-testid":"thumbnail-style-input",value:c,onChange:j=>f(j.target.value),rows:3,style:{...$d,resize:"vertical"}})]}),x?u.jsx("div",{"data-testid":"thumbnail-error",style:_d,children:x}):null,u.jsxs("div",{style:hO,children:[u.jsx("div",{style:Ov,children:"Regenerating replaces the video's .thumbnail.png and saves this concept for future renders."}),u.jsx("button",{"data-testid":"thumbnail-regenerate-btn",style:{...mO,...y?{opacity:.6,cursor:"default"}:{}},onClick:()=>void b(),disabled:y,children:y?"Generating…":"Regenerate"})]})]})]})})},rO={position:"fixed",inset:0,zIndex:40,background:"rgba(5,5,8,0.75)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center"},oO={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"},iO={display:"flex",justifyContent:"space-between",alignItems:"center"},sO={fontSize:18,fontWeight:700,color:"#EDEDF2",letterSpacing:"-0.01em"},aO={background:"transparent",border:"none",color:"#8B8B9E",fontSize:16,cursor:"pointer",padding:"4px 8px",borderRadius:4},Pd={fontSize:13,color:"#8B8B9E",marginTop:6,lineHeight:1.4},lO={marginTop:16,border:"1px solid #2C2C38",borderRadius:6,background:"#09090D",aspectRatio:"16 / 9",display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden"},uO={width:"100%",height:"100%",objectFit:"contain"},cO={color:"#8B8B9E",fontSize:13,padding:16,textAlign:"center"},dO={display:"flex",alignItems:"center",gap:12,marginTop:12,padding:"10px 12px",border:"1px solid #2C2C38",borderRadius:6,background:"#09090D"},fO={width:44,height:44,borderRadius:6,objectFit:"cover",flexShrink:0,border:"1px solid #2C2C38"},pO={fontSize:12,fontWeight:600,color:"#C9C9D4",marginBottom:2},Lv={background:"transparent",border:"1px solid #3A3A48",borderRadius:6,color:"#C9C9D4",padding:"7px 12px",fontSize:12,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap"},Fd={display:"block",fontSize:12,fontWeight:600,color:"#C9C9D4",marginBottom:8,textTransform:"uppercase",letterSpacing:"0.04em"},$d={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"},_d={marginTop:12,color:"#FF5C5C",fontSize:13,fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",whiteSpace:"pre-wrap"},hO={display:"flex",justifyContent:"space-between",alignItems:"center",gap:12,marginTop:20},Ov={fontSize:12,color:"#8B8B9E",lineHeight:1.4},mO={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)"},gO=({cutlist:e,edits:t,onClose:n})=>{d.useEffect(()=>{const i=s=>{s.key==="Escape"&&(s.stopPropagation(),n())};return window.addEventListener("keydown",i,!0),()=>window.removeEventListener("keydown",i,!0)},[n]);const r=CN(e),o=t.doc.cleanup.kept.length;return u.jsx("div",{style:vO,onMouseDown:n,children:u.jsxs("div",{"data-testid":"cleanup-modal",style:wO,onMouseDown:i=>i.stopPropagation(),children:[u.jsxs("div",{style:xO,children:[u.jsx("div",{style:bO,children:"Cleanup"}),u.jsx("button",{style:SO,onClick:n,"aria-label":"Close",children:"✕"})]}),u.jsx("div",{style:Md,children:'What produce removed, by reason. Untick a category to keep it — the preview plays your choice immediately and the next render applies it. Individual removals can be kept by clicking their marker above the timeline; right-click a marker to say the classification was wrong ("not a retake").'}),r.length===0?u.jsx("div",{"data-testid":"cleanup-empty",style:{...Md,marginTop:16},children:"This run proposed no removals to review."}):u.jsx("div",{style:{marginTop:16},children:r.map(i=>{const s=t.doc.cleanup.reasons[i.reason]!==!1;return u.jsxs("label",{"data-testid":`cleanup-reason-${i.reason}`,style:Dv,children:[u.jsx("input",{type:"checkbox","data-testid":`cleanup-checkbox-${i.reason}`,checked:s,onChange:a=>t.setReasonEnabled(i.reason,a.target.checked)}),u.jsx("span",{style:{...kO,background:Yh[i.reason]}}),u.jsxs("span",{style:{...zv,...s?{}:{color:"#8B8B9E"}},children:[EN[i.reason]," — ",i.count," removal",i.count===1?"":"s"," ","· ",i.seconds.toFixed(1),"s"]}),s?null:u.jsx("span",{"data-testid":`cleanup-declined-${i.reason}`,style:EO,children:"kept — live in the preview"})]},i.reason)})}),o>0?u.jsxs("div",{"data-testid":"cleanup-kept-note",style:{...CO,marginTop:12},children:[o," individual removal",o===1?"":"s"," kept via timeline markers."]}):null,t.doc.cleanup.dismissed.length>0?u.jsxs("div",{style:{marginTop:16},children:[u.jsx("div",{style:{...Md,marginBottom:6},children:"Dismissed markers — the material is ordinary footage now. Restore one to bring the proposal (and its marker) back."}),t.doc.cleanup.dismissed.map(i=>u.jsxs("div",{"data-testid":`cleanup-dismissed-${i.srcIn}-${i.srcOut}`,style:Dv,children:[u.jsxs("span",{style:zv,children:[i.srcIn.toFixed(1),"s – ",i.srcOut.toFixed(1),"s (",(i.srcOut-i.srcIn).toFixed(1),"s)"]}),u.jsx("button",{"data-testid":`cleanup-restore-dismissed-${i.srcIn}-${i.srcOut}`,style:yO,onClick:()=>t.restoreDismissed(i.srcIn,i.srcOut),children:"Restore proposal"})]},`${i.srcIn}-${i.srcOut}`))]}):null]})})},yO={fontSize:12,fontWeight:600,color:"#C9C9D4",background:"#1A1A21",border:"1px solid #2A2A33",borderRadius:6,padding:"5px 10px",cursor:"pointer",whiteSpace:"nowrap"},vO={position:"fixed",inset:0,zIndex:40,background:"rgba(5,5,8,0.75)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center"},wO={width:460,maxWidth:"92vw",maxHeight:"90vh",overflowY:"auto",background:"#12121A",border:"1px solid #3A3A48",borderRadius:10,padding:"24px 28px",boxShadow:"0 20px 40px rgba(0,0,0,0.6)",fontFamily:"ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"},xO={display:"flex",justifyContent:"space-between",alignItems:"center"},bO={fontSize:18,fontWeight:700,color:"#EDEDF2",letterSpacing:"-0.01em"},SO={background:"transparent",border:"none",color:"#8B8B9E",fontSize:16,cursor:"pointer",padding:"4px 8px",borderRadius:4},Md={fontSize:13,color:"#8B8B9E",marginTop:6,lineHeight:1.4},Dv={display:"flex",alignItems:"center",gap:10,padding:"8px 10px",border:"1px solid #2C2C38",borderRadius:6,background:"#09090D",marginBottom:8,cursor:"pointer"},kO={width:10,height:10,borderRadius:2,flexShrink:0},zv={fontSize:13,color:"#EDEDF2",flex:1,minWidth:0},EO={fontSize:11,color:"#FFE14D",whiteSpace:"nowrap"},CO={fontSize:12,color:"#8B8B9E",lineHeight:1.4},Bv=3,Wv=5,Ad=500;function IO(e){return e.split(/\s+/).filter(t=>t.replace(/^#+/,"").length>0).map(t=>t.startsWith("#")?t:`#${t}`)}function TO(e){return e.map(t=>t.startsWith("#")?t:`#${t}`).join(" ")}function VS(e){return e.split(",").map(t=>t.trim()).filter(t=>t.length>0)}function HS(e){return e.join(", ")}function jO(e){return HS(VS(e)).length}function RO(e){const t=Math.max(0,Math.floor(e));return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`}function PO(e){return`[${{browse:"Browse",search:"Search",benefit:"Benefit",alt:"Alt"}[e]}]`}const FO="This run never generated YouTube metadata. Run produce with --youtube (and an LLM provider) once — the pack lands here afterwards.",$O=({onClose:e})=>{var V;const[t,n]=d.useState(null),[r,o]=d.useState(null),[i,s]=d.useState([]),[a,l]=d.useState(null),[c,f]=d.useState(""),[p,m]=d.useState(""),[y,w]=d.useState(""),[x,S]=d.useState(null),[h,g]=d.useState(null),[v,b]=d.useState(null),[k,E]=d.useState(!1),[C,I]=d.useState(null);d.useEffect(()=>{const M=$=>{$.key==="Escape"&&($.stopPropagation(),e())};return window.addEventListener("keydown",M,!0),()=>window.removeEventListener("keydown",M,!0)},[e]);const j=d.useCallback(async()=>{try{const M=await fetch("/api/youtube"),$=await M.json();if(!M.ok)throw new Error($.error??`GET /api/youtube failed: ${M.status}`);n($),$.pack&&(s($.pack.titles),l($.pack.titleAngles??null),f($.pack.description),m(TO($.pack.hashtags)),w(HS($.pack.tags)),S($.pack.hook60??null),g($.pack.linkedinPost??null),b($.pack.communityPost??null))}catch(M){o(M instanceof Error?M.message:String(M))}},[]);d.useEffect(()=>{j()},[j]);const F=async()=>{var M;E(!0),I(null);try{const $=await fetch("/api/youtube",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({pack:{titles:i,...a!==null?{titleAngles:a}:{},description:c,hashtags:IO(p),tags:VS(y),...(M=t==null?void 0:t.pack)!=null&&M.chapters?{chapters:t.pack.chapters}:{},...x!==null?{hook60:x}:{},...h!==null?{linkedinPost:h}:{},...v!==null?{communityPost:v}:{}}})}),D=await $.json();if(!$.ok||D.ok!==!0){I(D.error??`save failed: ${$.status}`);return}await j()}catch($){I($ instanceof Error?$.message:String($))}finally{E(!1)}},L=jO(y);return u.jsx("div",{style:_O,onMouseDown:e,children:u.jsxs("div",{"data-testid":"youtube-modal",style:MO,onMouseDown:M=>M.stopPropagation(),children:[u.jsxs("div",{style:AO,children:[u.jsx("div",{style:NO,children:"YouTube SEO metadata"}),u.jsx("button",{style:LO,onClick:e,"aria-label":"Close",children:"✕"})]}),r?u.jsxs("div",{"data-testid":"youtube-load-error",style:Uv,children:["Couldn't load the YouTube pack: ",r]}):t===null?u.jsx("div",{style:Vv,children:"Loading…"}):t.available?u.jsxs(u.Fragment,{children:[u.jsxs("div",{style:{marginTop:16},children:[u.jsxs("label",{style:Dr,children:["Title options (",Bv,"–",Wv,", up to 100 chars each)"]}),i.map((M,$)=>u.jsxs("div",{style:OO,children:[(a==null?void 0:a[$])!==void 0?u.jsx("span",{"data-testid":`youtube-title-angle-${$}`,style:DO,children:PO(a[$])}):null,u.jsx("input",{"data-testid":`youtube-title-input-${$}`,type:"text",maxLength:100,value:M,onChange:D=>s(H=>H.map((P,T)=>T===$?D.target.value:P)),style:xo}),u.jsx("button",{"data-testid":`youtube-title-remove-${$}`,style:Hv,disabled:i.length<=Bv,onClick:()=>{s(D=>D.filter((H,P)=>P!==$)),l(D=>D&&D.filter((H,P)=>P!==$))},"aria-label":`Remove title ${$+1}`,children:"✕"})]},$)),u.jsx("button",{"data-testid":"youtube-title-add",style:Hv,disabled:i.length>=Wv,onClick:()=>{s(M=>[...M,""]),l(M=>M&&[...M,"alt"])},children:"+ Add title"})]}),u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:Dr,children:"Description"}),u.jsx("textarea",{"data-testid":"youtube-description-input",value:c,onChange:M=>f(M.target.value),rows:6,style:{...xo,resize:"vertical"}})]}),u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:Dr,children:"Hashtags — space-separated, # added if missing"}),u.jsx("input",{"data-testid":"youtube-hashtags-input",type:"text",value:p,onChange:M=>m(M.target.value),style:xo})]}),u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:Dr,children:"Tags — comma-separated"}),u.jsx("input",{"data-testid":"youtube-tags-input",type:"text",value:y,onChange:M=>w(M.target.value),style:xo}),u.jsxs("div",{"data-testid":"youtube-tags-counter",style:{...zO,...L>Ad?{color:"#FFB84D"}:{}},children:[L," / ",Ad,L>Ad?" — tags past the budget are dropped on save":""]})]}),(V=t.pack)!=null&&V.chapters&&t.pack.chapters.length>0?u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:Dr,children:"Chapters (read-only — embedded in the description on save/render)"}),u.jsx("div",{"data-testid":"youtube-chapters",style:BO,children:t.pack.chapters.map((M,$)=>u.jsxs("div",{children:[RO(M.atSec)," ",M.title]},$))}),u.jsx("div",{style:Zv,children:"Timestamps are measured from the actual edit, so they are not hand-editable here; the .youtube.md splices them into the description's Timestamps block for you."})]}):null,x!==null?u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:Dr,children:"First-60s hook strategy (for you — never uploaded)"}),u.jsx("textarea",{"data-testid":"youtube-hook60-input",value:x,onChange:M=>S(M.target.value),rows:3,style:{...xo,resize:"vertical"}})]}):null,h!==null?u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:Dr,children:"LinkedIn post"}),u.jsx("textarea",{"data-testid":"youtube-linkedin-input",value:h,onChange:M=>g(M.target.value),rows:6,style:{...xo,resize:"vertical"}})]}):null,v!==null?u.jsxs("div",{style:{marginTop:12},children:[u.jsx("label",{style:Dr,children:"Community post"}),u.jsx("textarea",{"data-testid":"youtube-community-input",value:v,onChange:M=>b(M.target.value),rows:3,style:{...xo,resize:"vertical"}})]}):null,C?u.jsx("div",{"data-testid":"youtube-error",style:Uv,children:C}):null,u.jsxs("div",{style:WO,children:[u.jsx("div",{style:Zv,children:"Saves for future renders and rewrites the .youtube.md file now. Delete youtube-pack-approved.json in the workdir to let the AI regenerate."}),u.jsx("button",{"data-testid":"youtube-save-btn",style:{...VO,...k?{opacity:.6,cursor:"default"}:{}},onClick:()=>void F(),disabled:k,children:k?"Saving…":"Save"})]})]}):u.jsx("div",{"data-testid":"youtube-unavailable",style:{...Vv,marginTop:12},children:FO})]})})},_O={position:"fixed",inset:0,zIndex:40,background:"rgba(5,5,8,0.75)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center"},MO={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"},AO={display:"flex",justifyContent:"space-between",alignItems:"center"},NO={fontSize:18,fontWeight:700,color:"#EDEDF2",letterSpacing:"-0.01em"},LO={background:"transparent",border:"none",color:"#8B8B9E",fontSize:16,cursor:"pointer",padding:"4px 8px",borderRadius:4},Vv={fontSize:13,color:"#8B8B9E",marginTop:6,lineHeight:1.4},Dr={display:"block",fontSize:12,fontWeight:600,color:"#C9C9D4",marginBottom:8,textTransform:"uppercase",letterSpacing:"0.04em"},xo={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"},OO={display:"flex",gap:8,alignItems:"center",marginBottom:8},DO={fontSize:11,fontWeight:700,color:"#8B8B9E",fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",whiteSpace:"nowrap",minWidth:62},Hv={fontSize:12,fontWeight:600,color:"#C9C9D4",background:"#1A1A21",border:"1px solid #2A2A33",borderRadius:6,padding:"6px 10px",cursor:"pointer",whiteSpace:"nowrap"},zO={marginTop:6,fontSize:12,color:"#8B8B9E",fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace"},BO={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},Uv={marginTop:12,color:"#FF5C5C",fontSize:13,fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",whiteSpace:"pre-wrap"},WO={display:"flex",justifyContent:"space-between",alignItems:"center",gap:12,marginTop:20},Zv={fontSize:12,color:"#8B8B9E",lineHeight:1.4,marginTop:6},VO={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 HO(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 UO(e){const t=e.trim().replace(/\s+/g," "),n=U4(t);return{preview:n,trimmed:n!==t}}function US(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 Kv(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 ZO(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 Yv(e){return{...e.typed===(e.persistedText??"")?{}:{text:e.typed},...e.atSec===void 0?{}:{atSec:e.atSec},from:e.from}}function KO(e){if(e.from==="final")return{atSec:e.playheadOutSec,note:null};const t=new bc(e.cutlist);if(t.spans.length===0)return{atSec:e.playheadOutSec,note:`Couldn't convert to the original take's clock — this render recorded no cutlist, so ${e.playheadOutSec.toFixed(1)}s of the finished video is being used as-is.`};const n=t.toSource(e.playheadOutSec);return{atSec:n,note:`${e.playheadOutSec.toFixed(1)}s of the finished video is ${n.toFixed(1)}s of the original take.`}}function YO(e){return`That moment isn't in the rendered video yet — snapped to the nearest rendered moment, ${e.toFixed(2)}s. The mp4 genuinely lacks the frame until the next render; render once to take a cover from it, or read it off the original take by typing that take's own seconds.`}function GO(e){if(e.prevFrom===e.nextFrom)return null;const t=US(e.atRaw);if(!t.ok||t.atSec===void 0)return null;const n=new bc(e.cutlist);if(n.spans.length===0)return{atRaw:e.atRaw,note:"Couldn't convert between clocks — this render recorded no cutlist; the seconds are unchanged."};if(e.nextFrom==="source"){const i=n.toSource(t.atSec);return{atRaw:i.toFixed(2),note:`${t.atSec.toFixed(1)}s of the finished video is ${i.toFixed(1)}s of the original take.`}}const r=n.toOutput(t.atSec);if(r!==null)return{atRaw:r.toFixed(2),note:`${t.atSec.toFixed(1)}s of the original take is ${r.toFixed(1)}s of the finished video.`};const o=n.toOutputClamped(t.atSec);return{atRaw:o.toFixed(2),note:`${t.atSec.toFixed(1)}s of the original take was cut from the finished video — snapped to the nearest kept moment, ${o.toFixed(1)}s.`}}const XO=({onClose:e,playheadSec:t})=>{const[n,r]=d.useState(null),[o,i]=d.useState(null),[s,a]=d.useState(""),[l,c]=d.useState(""),[f,p]=d.useState("final"),[m,y]=d.useState(null),[w,x]=d.useState(!1),[S,h]=d.useState(null),[g,v]=d.useState([]),[b,k]=d.useState([]),[E,C]=d.useState(null),[I,j]=d.useState(null);d.useEffect(()=>{const H=P=>{P.key==="Escape"&&(P.stopPropagation(),e())};return window.addEventListener("keydown",H,!0),()=>window.removeEventListener("keydown",H,!0)},[e]),d.useEffect(()=>{(async()=>{try{const H=await fetch("/api/cover"),P=await H.json();if(!H.ok)throw new Error(P.error??`GET /api/cover failed: ${H.status}`);r(P),y(P.imageUrl),k(P.cutlist??[]),P.provenance&&(a(P.provenance.text),Kv(P.provenance).enabled&&p(P.provenance.frame.source))}catch(H){i(H instanceof Error?H.message:String(H))}})()},[]);const F=US(l),L=UO(s),V=Kv((n==null?void 0:n.provenance)??null),M=async()=>{var H;if(F.ok){x(!0),h(null),v([]);try{const P=await fetch("/api/cover/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Yv({typed:s,persistedText:((H=n==null?void 0:n.provenance)==null?void 0:H.text)??null,atSec:F.atSec,from:f}))}),T=await P.json();if(!P.ok||T.ok!==!0){h(T.error??`regenerate failed: ${P.status}`);return}if(y(T.imageUrl??null),j(null),v(T.notes??[]),T.provenance){const W=T.provenance;r(R=>R&&{...R,provenance:W,status:"ready"}),a(W.text)}}catch(P){h(P instanceof Error?P.message:String(P))}finally{x(!1)}}},$=async()=>{var H;if(F.ok){x(!0),h(null),v([]);try{const P=await fetch("/api/cover/preview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Yv({typed:s,persistedText:((H=n==null?void 0:n.provenance)==null?void 0:H.text)??null,atSec:F.atSec,from:f}))}),T=await P.json();if(!P.ok||T.ok!==!0){h(T.error??`preview failed: ${P.status}`);return}j(T.previewImageUrl??null),v(T.notes??[])}catch(P){h(P instanceof Error?P.message:String(P))}finally{x(!1)}}},D=(n==null?void 0:n.status)==="unavailable";return u.jsx("div",{style:qO,onMouseDown:e,children:u.jsxs("div",{"data-testid":"cover-modal",style:JO,onMouseDown:H=>H.stopPropagation(),children:[u.jsxs("div",{style:QO,children:[u.jsx("div",{style:eD,children:"Cover image"}),u.jsx("button",{style:tD,onClick:e,"aria-label":"Close",children:"✕"})]}),o?u.jsxs("div",{"data-testid":"cover-load-error",style:Nd,children:["Couldn't load the cover state: ",o]}):n===null?u.jsx("div",{style:Gv,children:"Loading…"}):D?u.jsx("div",{"data-testid":"cover-unavailable",style:{...Gv,marginTop:12},children:HO(n.reason)}):u.jsxs(u.Fragment,{children:[u.jsx("div",{style:nD,children:I?u.jsx("img",{"data-testid":"cover-image",src:I,alt:"Cover preview",style:Xv}):m?u.jsx("img",{"data-testid":"cover-image",src:m,alt:"Current cover",style:Xv}):u.jsx("div",{"data-testid":"cover-placeholder",style:oD,children:"No cover on disk yet — set a headline and hit Apply."})}),I?u.jsx("div",{"data-testid":"cover-preview-badge",style:rD,children:"Preview — not saved. The cover on disk is unchanged; Apply writes it for real."}):null,u.jsxs("div",{style:{marginTop:16},children:[u.jsxs("label",{style:qv,children:["Headline — at most ",dS," words (§35)"]}),u.jsx("input",{"data-testid":"cover-text-input",type:"text",value:s,onChange:H=>a(H.target.value),style:Jv}),L.trimmed?u.jsxs("div",{"data-testid":"cover-headline-preview",style:{...bo,marginTop:6},children:["Will render as: “",L.preview,"”"]}):null]}),u.jsxs("div",{style:{marginTop:16},children:[u.jsx("label",{style:qv,children:"Frame"}),u.jsxs("div",{style:Qv,children:[u.jsx("button",{"data-testid":"cover-playhead-btn",style:wl,onClick:()=>{const H=t(),P=KO({playheadOutSec:H.sec,from:f,cutlist:b});c(P.atSec.toFixed(2)),C(H.snapped?[YO(H.sec),P.note].filter(T=>T!==null).join(" "):P.note)},disabled:w,children:"Use current playhead"}),u.jsx("input",{"data-testid":"cover-at-input",type:"text",inputMode:"decimal",placeholder:"seconds — blank keeps the current still",value:l,onChange:H=>{c(H.target.value),C(null)},style:{...Jv,flex:1}})]}),F.ok?null:u.jsx("div",{"data-testid":"cover-at-error",style:Nd,children:F.message}),E?u.jsx("div",{"data-testid":"cover-clock-note",style:{...bo,marginTop:6},children:E}):null,u.jsx("div",{style:{...Qv,marginTop:10},children:["final","source"].map(H=>{const P=H==="source"&&!V.enabled;return u.jsx("button",{"data-testid":`cover-from-${H}`,style:{...wl,...f===H?iD:{},...P?{opacity:.5,cursor:"default"}:{}},onClick:()=>{const T=GO({atRaw:l,prevFrom:f,nextFrom:H,cutlist:b});T!==null&&(c(T.atRaw),C(T.note)),p(H)},disabled:w||P,"aria-pressed":f===H,children:H==="final"?"Finished video":"Original take"},H)})}),u.jsx("div",{"data-testid":"cover-from-note",style:{...bo,marginTop:6},children:ZO(f)}),V.note?u.jsx("div",{"data-testid":"cover-from-disabled-note",style:{...bo,marginTop:4},children:V.note}):null,u.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."})]}),g.length>0?u.jsx("div",{"data-testid":"cover-notes",style:{...bo,marginTop:12},children:g.map(H=>u.jsx("div",{children:H},H))}):null,S?u.jsx("div",{"data-testid":"cover-error",style:Nd,children:S}):null,u.jsxs("div",{style:sD,children:[u.jsx("div",{style:bo,children:n.outPath?`Writes ${n.outPath} — the video itself is untouched.`:"The video itself is untouched."}),u.jsxs("div",{style:{display:"flex",gap:8},children:[u.jsx("button",{"data-testid":"cover-cancel-btn",style:wl,onClick:e,children:"Cancel"}),u.jsx("button",{"data-testid":"cover-preview-btn",style:{...wl,...w||!F.ok?{opacity:.6,cursor:"default"}:{}},onClick:()=>void $(),disabled:w||!F.ok,children:"Preview"}),u.jsx("button",{"data-testid":"cover-apply-btn",style:{...aD,...w||!F.ok?{opacity:.6,cursor:"default"}:{}},onClick:()=>void M(),disabled:w||!F.ok,children:w?"Rebuilding…":"Apply"})]})]})]})]})})},qO={position:"fixed",inset:0,zIndex:40,background:"rgba(5,5,8,0.75)",backdropFilter:"blur(4px)",display:"flex",alignItems:"center",justifyContent:"center"},JO={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"},QO={display:"flex",justifyContent:"space-between",alignItems:"center"},eD={fontSize:18,fontWeight:700,color:"#EDEDF2",letterSpacing:"-0.01em"},tD={background:"transparent",border:"none",color:"#8B8B9E",fontSize:16,cursor:"pointer",padding:"4px 8px",borderRadius:4},Gv={fontSize:13,color:"#8B8B9E",marginTop:6,lineHeight:1.4},nD={marginTop:16,border:"1px solid #2C2C38",borderRadius:6,background:"#09090D",maxHeight:320,minHeight:180,display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden"},Xv={maxWidth:"100%",maxHeight:320,objectFit:"contain"},rD={marginTop:8,padding:"6px 10px",borderRadius:6,border:"1px solid #8a6d1a",background:"rgba(255,196,0,0.08)",color:"#FFC400",fontSize:12,fontWeight:600,lineHeight:1.4},oD={color:"#8B8B9E",fontSize:13,padding:16,textAlign:"center"},qv={display:"block",fontSize:12,fontWeight:600,color:"#C9C9D4",marginBottom:8,textTransform:"uppercase",letterSpacing:"0.04em"},Jv={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"},Qv={display:"flex",alignItems:"center",gap:8},wl={background:"transparent",border:"1px solid #3A3A48",borderRadius:6,color:"#C9C9D4",padding:"9px 12px",fontSize:12,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap"},iD={borderColor:"#5b8cff",color:"#EDEDF2"},Nd={marginTop:12,color:"#FF5C5C",fontSize:13,fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",whiteSpace:"pre-wrap"},sD={display:"flex",justifyContent:"space-between",alignItems:"center",gap:12,marginTop:20},bo={fontSize:12,color:"#8B8B9E",lineHeight:1.4,wordBreak:"break-all"},aD={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 lD(e){return e==="linkedin-page"?"linkedin":e}function uD(e){const t=[],n=new Map;for(const r of e){const o=lD(r.provider),i=n.get(o);i===void 0?(t.push(o),n.set(o,[r])):i.push(r)}return t.map(r=>{const o=n.get(r),i=o[0].caption;return{network:r,channels:o,caption:i,mixed:o.some(s=>s.caption!==i)}})}const cD={x:280,linkedin:1500,instagram:2200,tiktok:2200,facebook:2200,youtube:5e3};function dD(e){return cD[e]??1500}const fD='Publishing goes through your own self-hosted Postiz instance (postiz.com): set "postizUrl" in ~/.ossclip/config.json and OSSCLIP_POSTIZ_API_KEY in ~/.ossclip/.env, then restart the editor.',pD="No captions to post yet — run produce with --youtube (or approve a pack in the SEO panel) so publish has copy to send.",hD="No finished render to publish — render first.";function ip(e){const t=Math.round(e);return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`}function e0(e){if(e===null)return"Encoding & publishing…";if(e.phase==="uploading")return"Uploading…";const t=e.pct!==null?`${e.pct}%`:"…",n=e.etaSec!==null?` · ~${ip(e.etaSec)} left`:"";return`Encoding${e.file!=null?` ${e.file}`:""} ${t}${n}`}function mD(e,t){return typeof e!="number"||typeof t!="number"||e<=t?null:`video ${ip(e)} > ${ip(t)} cap`}function gD(e){return`⚠ ${e} word${e===1?"":"s"} not in the take`}function yD(e){if(e.trim().length===0)return null;const t=Date.parse(e);return Number.isNaN(t)?null:new Date(t).toISOString()}function t0(e){const t=n=>String(n).padStart(2,"0");return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}T${t(e.getHours())}:${t(e.getMinutes())}`}const vD=[{label:"In an hour",at:e=>t0(new Date(e.getTime()+36e5))},{label:"Tomorrow 9am",at:e=>{const t=new Date(e);return t.setDate(t.getDate()+1),t.setHours(9,0,0,0),t0(t)}}],wD=({onClose:e})=>{const[t,n]=d.useState(null),[r,o]=d.useState(null),[i,s]=d.useState({}),[a,l]=d.useState({}),[c,f]=d.useState(""),p=he.useRef(null),[m,y]=d.useState(!1),[w,x]=d.useState(null),[S,h]=d.useState(null),[g,v]=d.useState(null),[b,k]=d.useState({}),[E,C]=d.useState(null),[I,j]=d.useState({}),[F,L]=d.useState({}),[V,M]=d.useState(""),[$,D]=d.useState(null),[H,P]=d.useState(!1),[T,W]=d.useState(null),[R,Z]=d.useState(null);d.useEffect(()=>{const O=X=>{X.key==="Escape"&&(X.stopPropagation(),e())};return window.addEventListener("keydown",O,!0),()=>window.removeEventListener("keydown",O,!0)},[e]);const Q=d.useCallback(async()=>{try{const O=await fetch("/api/publish"),X=await O.json();if(!O.ok)throw new Error(X.error??`GET /api/publish failed: ${O.status}`);n(X),X.integrations&&l(Object.fromEntries(X.integrations.map(se=>[se.id,se.caption])))}catch(O){o(O instanceof Error?O.message:String(O))}},[]);d.useEffect(()=>{Q()},[Q]);const _=Object.entries(i).filter(([,O])=>O).map(([O])=>O),N=Object.fromEntries(((t==null?void 0:t.integrations)??[]).map(O=>[O.id,O.durationCapSec??null])),z=uD(((t==null?void 0:t.integrations)??[]).map(O=>({...O,caption:a[O.id]??O.caption}))),ne=yD(c),J=c.trim().length>0&&ne===null,U=((t==null?void 0:t.receipt)??null)!==null||g!==null,G=async()=>{y(!0),h(null);const O=()=>{fetch("/api/publish/progress").then(se=>se.json()).then(se=>x(se.progress??null)).catch(()=>{})};O();const X=window.setInterval(O,1e3);try{const se=await fetch("/api/publish",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({integrationIds:_,...ne!==null?{at:ne}:{},captions:Object.fromEntries(_.map(de=>[de,a[de]??""])),...U?{force:!0}:{}})}),oe=await se.json();if(!se.ok||oe.ok!==!0||!oe.receipt){h(oe.error??`publish failed: ${se.status}`);return}v(oe.receipt)}catch(se){h(se instanceof Error?se.message:String(se))}finally{window.clearInterval(X),x(null),y(!1)}},K=async(O,X,se,oe)=>{j(de=>({...de,[O]:{}})),L(de=>({...de,[O]:!1}));try{const de=await fetch("/api/publish/regenerate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({network:O,instruction:oe,currentCaption:se})}),fe=await de.json();if(!de.ok||fe.ok!==!0||typeof fe.caption!="string"){j(Te=>({...Te,[O]:{error:fe.error??`regenerate failed: ${de.status}`}}));return}const Ce=fe.caption;l(Te=>({...Te,...Object.fromEntries(X.map(Re=>[Re,Ce]))})),j(Te=>({...Te,[O]:{usage:fe.usage,notes:fe.notes??[]}}))}catch(de){j(fe=>({...fe,[O]:{error:de instanceof Error?de.message:String(de)}}))}},le=async(O,X,se)=>{const oe=(b[O]??"").trim();if(oe.length!==0){C(O);try{await K(O,X,se,oe)}finally{C(null)}}},Y=async()=>{const O=V.trim();if(O.length===0)return;const X=z.filter(se=>se.channels.some(oe=>i[oe.id]===!0));if(X.length!==0)try{for(let se=0;se<X.length;se++){const oe=X[se],de=oe.channels.map(Te=>Te.id),fe=(b[oe.network]??"").trim(),Ce=fe.length>0?fe:O;D({network:oe.network,index:se+1,total:X.length}),C(oe.network),await K(oe.network,de,a[de[0]]??oe.caption,Ce)}}finally{C(null),D(null)}},ie=async()=>{P(!0),W(null);try{const O=await fetch("/api/youtube/generate",{method:"POST"}),X=await O.json();if(!O.ok||X.ok!==!0){W(X.error??`generate failed: ${O.status}`);return}Z(X.usage??null),await Q()}catch(O){W(O instanceof Error?O.message:String(O))}finally{P(!1)}},ke=g??(t==null?void 0:t.receipt)??null;return u.jsx("div",{style:xD,onMouseDown:e,children:u.jsxs("div",{"data-testid":"publish-modal",style:bD,onMouseDown:O=>O.stopPropagation(),children:[u.jsxs("div",{style:SD,children:[u.jsx("div",{style:kD,children:"Publish to social"}),u.jsx("button",{style:ED,onClick:e,"aria-label":"Close",children:"✕"})]}),r?u.jsxs("div",{"data-testid":"publish-load-error",style:xl,children:["Couldn't load publish state: ",r]}):t===null?u.jsx("div",{style:Wt,children:"Loading…"}):t.configured?t.reachable===!1?u.jsxs("div",{"data-testid":"publish-unreachable",style:{...Wt,marginTop:12},children:["Postiz didn't answer: ",t.reason]}):t.packAvailable?t.outPathExists?g!==null?u.jsxs("div",{"data-testid":"publish-done",style:{...Wt,marginTop:12},children:[g.when.kind==="now"?`Published to ${g.targets.length} account(s).`:`Scheduled for ${g.when.iso} on ${g.targets.length} account(s).`,g.postIds.length>0?` Posts: ${g.postIds.join(", ")}.`:""," Track it in your Postiz launches view."]}):u.jsxs(u.Fragment,{children:[R!==null?u.jsx("div",{"data-testid":"publish-generate-usage",style:{...Wt,marginTop:8},children:R}):null,ke!==null?u.jsxs("div",{"data-testid":"publish-receipt-note",style:{...Wt,marginTop:8},children:["This project already published on ",ke.publishedAt," to"," ",ke.targets.map(O=>O.provider).join(", ")," — publishing again will post it again."]}):null,u.jsxs("div",{style:{marginTop:16},children:[u.jsx("label",{style:n0,children:"Accounts"}),(t.integrations??[]).length===0?u.jsx("div",{style:Wt,children:"No accounts connected in Postiz yet — connect them there first."}):null,u.jsxs("div",{style:{display:"flex",gap:6,marginBottom:8},children:[u.jsx("input",{"data-testid":"publish-regen-all-instruction",placeholder:'One instruction for every selected network, e.g. "shorter, no hashtags"',value:V,onChange:O=>M(O.target.value),style:{...Ld,flex:1,padding:"6px 10px",fontSize:12}}),u.jsx("button",{type:"button","data-testid":"publish-regen-all",disabled:E!==null||$!==null||V.trim().length===0||_.length===0,onClick:()=>void Y(),style:si,children:"Regenerate selected captions"})]}),$!==null?u.jsxs("div",{"data-testid":"publish-regen-all-progress",style:{...Wt,marginBottom:8},children:["Regenerating ",$.network,"… ",$.index,"/",$.total]}):null,z.map(O=>{var Ce,Te,Re;const X=O.channels.map(xe=>xe.id),se=X.filter(xe=>i[xe]===!0),oe=se.length>0,de=dD(O.channels[0].provider),fe=a[X[0]]??O.caption;return u.jsxs("div",{style:TD,children:[u.jsxs("div",{style:jD,children:[u.jsx("span",{style:RD,children:O.network}),u.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:O.channels.map(xe=>{const be=i[xe.id]===!0,pe=mD(t.durationSec,N[xe.id]);return u.jsxs("button",{type:"button","data-testid":`publish-chip-${xe.id}`,"aria-pressed":be,disabled:pe!==null,title:pe??void 0,onClick:()=>s(Le=>({...Le,[xe.id]:!be})),style:{...si,...be?ID:{},...pe!==null?CD:{}},children:[xe.name,pe!==null?` — ${pe}`:""]},xe.id)})})]}),oe?u.jsxs(u.Fragment,{children:[O.mixed?u.jsx("div",{"data-testid":`publish-mixed-${O.network}`,style:{...Wt,marginBottom:6},children:"These channels had different captions — editing here sets one for every channel you pick in this group."}):null,u.jsx("textarea",{"data-testid":`publish-caption-${O.network}`,value:fe,rows:4,onChange:xe=>l(be=>({...be,...Object.fromEntries(X.map(pe=>[pe,xe.target.value]))})),style:PD}),u.jsxs("div",{"data-testid":`publish-count-${O.network}`,style:{...$D,...fe.length>de?{color:"#FF5C5C"}:{}},children:[fe.length," / ",de,se.length>1?` · posts to ${se.length} channels`:""]}),u.jsxs("div",{style:{display:"flex",gap:6,marginTop:6},children:[u.jsx("input",{"data-testid":`publish-regen-instruction-${O.network}`,placeholder:'Fix the caption, e.g. "the 50 teams figure was an example, not a fact"',value:b[O.network]??"",onChange:xe=>k(be=>({...be,[O.network]:xe.target.value})),style:{...Ld,flex:1,padding:"6px 10px",fontSize:12}}),u.jsx("button",{type:"button","data-testid":`publish-regen-${O.network}`,disabled:E!==null||$!==null||(b[O.network]??"").trim().length===0,onClick:()=>void le(O.network,X,fe),style:si,children:E===O.network?"Regenerating…":"Regenerate"})]}),((Ce=I[O.network])==null?void 0:Ce.error)!==void 0?u.jsx("div",{"data-testid":`publish-regen-error-${O.network}`,style:xl,children:I[O.network].error}):null,((Te=I[O.network])==null?void 0:Te.usage)!==void 0?u.jsx("div",{"data-testid":`publish-regen-usage-${O.network}`,style:{...Wt,marginTop:4},children:I[O.network].usage}):null,(((Re=I[O.network])==null?void 0:Re.notes)??[]).length>0?u.jsxs(u.Fragment,{children:[u.jsxs("button",{type:"button","data-testid":`publish-regen-notes-toggle-${O.network}`,"aria-expanded":F[O.network]===!0,onClick:()=>L(xe=>({...xe,[O.network]:xe[O.network]!==!0})),style:FD,children:[gD(I[O.network].notes.length)," ",F[O.network]===!0?"▾":"▸"]}),F[O.network]===!0?I[O.network].notes.map(xe=>u.jsx("div",{"data-testid":`publish-regen-note-${O.network}`,style:{...Wt,marginTop:2,color:"#E5B300"},children:xe},xe)):null]}):null]}):null]},O.network)})]}),u.jsxs("div",{style:{marginTop:16},children:[u.jsx("label",{style:n0,children:"When"}),u.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[u.jsx("input",{ref:p,"data-testid":"publish-schedule",type:"datetime-local",value:c,onChange:O=>f(O.target.value),onClick:()=>{var O,X;try{(X=(O=p.current)==null?void 0:O.showPicker)==null||X.call(O)}catch{}},style:{...Ld,width:"auto",cursor:"pointer"}}),vD.map(O=>u.jsx("button",{type:"button","data-testid":`publish-when-${O.label.replace(/\s+/g,"-").toLowerCase()}`,onClick:()=>f(O.at(new Date)),style:si,children:O.label},O.label)),c.trim().length>0?u.jsx("button",{type:"button","data-testid":"publish-when-clear",onClick:()=>f(""),style:si,children:"Clear"}):null,u.jsx("span",{style:Wt,children:ne===null?"empty = publish now":`scheduled: ${ne}`})]})]}),S?u.jsx("div",{"data-testid":"publish-error",style:xl,children:S}):null,m?u.jsx("div",{"data-testid":"publish-busy-note",style:{...Wt,marginTop:12},children:"Encoding the delivery file and uploading through Postiz — this can take a few minutes for a long video."}):null,m?u.jsx("div",{"data-testid":"publish-progress",style:{...Wt,marginTop:4},children:e0(w)}):null,u.jsxs("div",{style:_D,children:[u.jsx("div",{style:MD,children:"Sends through your Postiz instance, on your accounts — nothing goes anywhere until you press the button."}),u.jsx("button",{"data-testid":"publish-send",style:AD,disabled:m||_.length===0||J,onClick:()=>void G(),children:m?e0(w):U?"Publish again":ne!==null?"Schedule":"Publish now"})]})]}):u.jsx("div",{"data-testid":"publish-no-render",style:{...Wt,marginTop:12},children:hD}):u.jsxs("div",{"data-testid":"publish-no-pack",style:{...Wt,marginTop:12},children:[pD,u.jsx("div",{style:{marginTop:10},children:u.jsx("button",{type:"button","data-testid":"publish-generate-pack",disabled:H,onClick:()=>void ie(),style:si,children:H?"Generating captions… (one LLM call)":"Generate captions"})}),T!==null?u.jsx("div",{"data-testid":"publish-generate-error",style:xl,children:T}):null]}):u.jsx("div",{"data-testid":"publish-unconfigured",style:{...Wt,marginTop:12},children:fD})]})})},xD={position:"fixed",inset:0,background:"rgba(0,0,0,0.6)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:60},bD={width:640,maxWidth:"calc(100vw - 48px)",maxHeight:"calc(100vh - 96px)",overflowY:"auto",background:"#121218",border:"1px solid #2C2C38",borderRadius:10,padding:24,boxShadow:"0 24px 80px rgba(0,0,0,0.55)"},SD={display:"flex",justifyContent:"space-between",alignItems:"center"},kD={fontSize:18,fontWeight:700,color:"#EDEDF2",letterSpacing:"-0.01em"},ED={background:"transparent",border:"none",color:"#8B8B9E",fontSize:16,cursor:"pointer",padding:"4px 8px",borderRadius:4},Wt={fontSize:13,color:"#8B8B9E",marginTop:6,lineHeight:1.4},si={background:"transparent",border:"1px solid #3a3a44",borderRadius:999,color:"#c9c9d4",cursor:"pointer",fontSize:12,padding:"4px 10px"},CD={opacity:.45,cursor:"not-allowed"},ID={background:"#5b8cff",borderColor:"#5b8cff",color:"#0b0b0f",fontWeight:700},n0={display:"block",fontSize:12,fontWeight:600,color:"#C9C9D4",marginBottom:8,textTransform:"uppercase",letterSpacing:"0.04em"},Ld={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"},TD={border:"1px solid #2C2C38",borderRadius:6,background:"#09090D",padding:"10px 14px",marginBottom:8},jD={display:"flex",gap:10,alignItems:"center",cursor:"pointer"},RD={fontSize:11,fontWeight:700,color:"#8B8B9E",fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",textTransform:"uppercase",letterSpacing:"0.04em",minWidth:72},PD={width:"100%",boxSizing:"border-box",marginTop:8,background:"#121218",border:"1px solid #2C2C38",borderRadius:6,padding:"8px 12px",color:"#EDEDF2",fontSize:13,fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",outline:"none",resize:"vertical"},FD={background:"transparent",border:"none",padding:0,marginTop:4,cursor:"pointer",textAlign:"left",fontSize:12,color:"#E5B300",fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace"},$D={marginTop:4,fontSize:12,color:"#8B8B9E",fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace"},xl={marginTop:12,color:"#FF5C5C",fontSize:13,fontFamily:"ui-monospace, 'SF Mono', Consolas, monospace",whiteSpace:"pre-wrap"},_D={display:"flex",justifyContent:"space-between",alignItems:"center",gap:12,marginTop:20},MD={fontSize:12,color:"#8B8B9E",lineHeight:1.4},AD={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 bl(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 ND(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 r0(e,t){const n=Math.max(0,Math.floor((t-e)/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,"0")}`}function LD(e,t){return e?{load:e,notifyDiscard:t}:{load:null,notifyDiscard:!1}}function OD(e,t){return e===null||e===t}function DD(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 zD(e){if(e.dirty){if(e.renderRunning){e.onBlocked();return}e.save().catch(t=>e.onSaveError(t instanceof Error?t.message:String(t)))}}function BD(e,t,n=r=>r){const{cues:r}=Ol(e,t);return wu(r,zh(t.splits)).filter(i=>{var s;return((s=t.scenes[i.id])==null?void 0:s.hidden)===!0}).map(i=>({...i,startSec:n(i.startSec),endSec:n(i.endSec)}))}const o0=e=>e,i0=e=>({...e,...G3(e)}),s0=e=>{const t=AS(e);e.forEach((n,r)=>{console.warn(`ossclip §137: dropped caption edit ${JSON.stringify(n)} — ${t[r]}`)})},WD=()=>{const e=Y3(),t=d.useRef(e.dirty);t.current=e.dirty;const[n,r]=d.useState(!1),[o,i]=d.useState(!1),[s,a]=d.useState(null),[l,c]=d.useState(null),[f,p]=d.useState([]),[m,y]=d.useState([]),w=d.useRef(e.doc.captions);w.current=e.doc.captions;const[x,S]=d.useState(null),[h,g]=d.useState(null),[v,b]=d.useState(null),[k,E]=d.useState([]),[C,I]=d.useState(null),j=d.useRef(!1),F=d.useCallback((q,re)=>{j.current||(j.current=!0,(async()=>{try{const ae=await fetch("/api/retranscribe-range",{method:"POST",body:JSON.stringify({srcIn:q,srcOut:re})}),je=await ae.json();if(!je.ok){console.warn(`re-transcribe failed: ${je.error??ae.status}`);return}for(const zn of je.reports??[])console.warn(`re-transcribe: ${zn}`);e.rekeyCaptionKeys(je.mapping??[]);const Rn=(await(await fetch("/api/transcript")).json()).transcript;Rn&&Array.isArray(Rn.words)&&I({language:typeof Rn.language=="string"?Rn.language:"en",words:Rn.words})}catch(ae){console.warn(`re-transcribe failed: ${ae instanceof Error?ae.message:String(ae)}`)}finally{j.current=!1}})())},[e]),[L,V]=d.useState(null),[M,$]=d.useState(null),[D,H]=d.useState(!1),[P,T]=d.useState(1),[W,R]=d.useState(null),[Z,Q]=d.useState(!1),[_,N]=d.useState([]),[z,ne]=d.useState(null),J=d.useRef(null),[U,G]=d.useState(!1),[K,le]=d.useState(null),[Y,ie]=d.useState(!1),[ke,O]=d.useState(),X=d.useRef(null);d.useEffect(()=>()=>{X.current!==null&&window.clearInterval(X.current)},[]);const[se,oe]=d.useState(null),de=d.useRef(null),fe=d.useRef(null),Ce=d.useRef(null),Te=d.useRef(null),[Re,xe]=d.useState(null),[be,pe]=d.useState(null),Le=d.useCallback(q=>{var je;if(Ce.current=q,pe(q),(je=Te.current)==null||je.disconnect(),Te.current=null,!q)return;const re=()=>xe({w:Math.max(0,q.clientWidth-Dd*2),h:Math.max(0,q.clientHeight-Dd*2)});re();const ae=new ResizeObserver(re);ae.observe(q),Te.current=ae},[]),[Ie,Ye]=d.useState(1),ze=d.useRef(Ie);ze.current=Ie;const dt=d.useRef(null),Nt=d.useCallback((q,re)=>{const ae=Ce.current,je=Math.min(8,Math.max(.25,q)),Be=ze.current;if(ae&&je!==Be){const mt=ae.getBoundingClientRect();dt.current={prev:Be,ax:((re==null?void 0:re.x)??mt.left+mt.width/2)-mt.left,ay:((re==null?void 0:re.y)??mt.top+mt.height/2)-mt.top,sl:ae.scrollLeft,st:ae.scrollTop}}Ye(je)},[]);d.useLayoutEffect(()=>{const q=Ce.current,re=dt.current;if(!q||!re)return;dt.current=null;const ae=Ie/re.prev;q.scrollLeft=(re.sl+re.ax)*ae-re.ax,q.scrollTop=(re.st+re.ay)*ae-re.ay},[Ie]),d.useEffect(()=>{const q=be;if(!q)return;const re=ae=>{(ae.ctrlKey||ae.metaKey)&&(ae.preventDefault(),Nt(ze.current*Math.exp(-ae.deltaY*.01),{x:ae.clientX,y:ae.clientY}))};return q.addEventListener("wheel",re,{passive:!1}),()=>q.removeEventListener("wheel",re)},[be,Nt]);const kt=d.useRef(null);d.useEffect(()=>{const q=ae=>{const je=kt.current,Be=Ce.current;!je||!Be||(Be.scrollLeft=je.sl-(ae.clientX-je.x),Be.scrollTop=je.st-(ae.clientY-je.y))},re=()=>{kt.current=null};return window.addEventListener("mousemove",q),window.addEventListener("mouseup",re),()=>{window.removeEventListener("mousemove",q),window.removeEventListener("mouseup",re)}},[]);const[pr,os]=d.useState(!1),[mo,Fr]=d.useState(()=>{const q=Number(window.localStorage.getItem(l0));return Number.isFinite(q)&&q>0?u0(q):300}),qn=d.useRef(null);d.useEffect(()=>{const q=ae=>{const je=qn.current;je&&Fr(u0(je.startW+(ae.clientX-je.startX)))},re=()=>{qn.current&&(qn.current=null,Fr(ae=>(window.localStorage.setItem(l0,String(ae)),ae)))};return window.addEventListener("mousemove",q),window.addEventListener("mouseup",re),()=>{window.removeEventListener("mousemove",q),window.removeEventListener("mouseup",re)}},[]);const[Go,go]=d.useState(!1),[yo,Xo]=d.useState(!1),[Lt,hr]=d.useState(!1),[Kt,Ot]=d.useState(!1),[In,at]=d.useState(!1),[Tn,$r]=d.useState(!1),[Jn,vo]=d.useState(!1);d.useEffect(()=>{if(!Kt)return;const q=re=>{re.key==="Escape"&&(re.stopPropagation(),Ot(!1))};return window.addEventListener("keydown",q,!0),()=>window.removeEventListener("keydown",q,!0)},[Kt]);const[jn,qo]=d.useState(null),[tn,A]=d.useState(null),[B,te]=d.useState(!0),me=d.useCallback(q=>{const re=UP({rate:P,playing:D},q);T(re.rate);const ae=fe.current;ae&&(re.playing&&!D&&ae.play(),!re.playing&&D&&ae.pause())},[P,D]);d.useEffect(()=>{const q=fe.current;if(!q)return;const re=()=>H(!0),ae=()=>H(!1);return q.addEventListener("play",re),q.addEventListener("pause",ae),()=>{q.removeEventListener("play",re),q.removeEventListener("pause",ae)}});const ve=d.useCallback(()=>{if(X.current!==null)return;const q=window.setInterval(()=>{(async()=>{try{const ae=await(await fetch("/api/render/status")).json();if(ae.running||ae.exitCode===null){le(je=>({running:ae.running,lines:ae.lines??[],startedAt:ae.startedAt??(je==null?void 0:je.startedAt)}));return}if(X.current!==null&&(window.clearInterval(X.current),X.current=null),ae.exitCode===0){const Be=await(await fetch("/api/production")).json(),mt=i0(Be.renderProps);g(mt),G(!!Be.canRender);const Rn=LD(Be.overrides,t.current);if(Rn.load){const zn=w.current,er=Jy(Rn.load,mt);e.load(er.doc),s0(er.unresolved),p(er.unresolved);const fn=q3(X3(zn,er.doc.captions));for(const ss of fn)console.warn(`ossclip §137: ${ss}`);y(fn)}else p([]),y([]);Rn.notifyDiscard&&r(!0),le(zn=>({running:!1,lines:ae.lines??[],succeeded:!0,startedAt:ae.startedAt??(zn==null?void 0:zn.startedAt),finishedAt:Date.now()})),fetch("/api/reveal-output",{method:"POST"}).catch(()=>{})}else le({running:!1,lines:ae.lines??[],failed:ae.exitCode,cancelled:ae.cancelled})}catch{X.current===null&&ve()}})()},1e3);X.current=q},[]),$e=d.useCallback(async()=>{const q=await fetch("/api/production");if(!q.ok)throw new Error(`GET /api/production failed: ${q.status}`);const re=await q.json();if(re.defaultOutPath&&O(re.defaultOutPath),N(re.recent??[]),re.noWorkdir){p([]),y([]),Q(!0);return}const ae=i0(re.renderProps);g(ae);const je=J.current,Be=re.workdir??null;J.current=Be,ne(Be),G(!!re.canRender);const mt=Jy(re.overrides,ae);e.load(mt.doc),s0(mt.unresolved),p(mt.unresolved),y([]),fetch("/api/usage").then(async fn=>b(fn.ok?await fn.json():null)).catch(()=>b(null)),fetch("/api/cleanup").then(async fn=>E(fn.ok?(await fn.json()).cutlist??[]:[])).catch(()=>E([])),fetch("/api/transcript").then(async fn=>{const mr=(fn.ok?await fn.json():{transcript:null}).transcript;I(mr&&Array.isArray(mr.words)?{language:typeof mr.language=="string"?mr.language:"en",words:mr.words}:null)}).catch(()=>I(null));const zn=await(await fetch("/api/render/status")).json(),er=OD(je,Be)?DD(zn):null;er&&(le(er),er.running?ve():te(!1))},[ve]);d.useEffect(()=>{$e().catch(q=>V(q instanceof Error?q.message:String(q)))},[]);const Pe=d.useCallback(async q=>{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:q})}),ae=await re.json().catch(()=>({}));return re.ok?($(null),R(null),oe(null),le(null),Ye(1),g(null),Q(!1),await $e(),null):ae.error??`open failed: ${re.status}`}catch(re){return re instanceof Error?re.message:String(re)}},[e.dirty,$e]),_e=d.useMemo(()=>{if(!h)return{lines:[],dropped:[]};const q=h.baseCaptionLines??h.captionLines??[];return nS(q,MS(e.doc.captions))},[h,e.doc.captions]),Ne=d.useMemo(()=>h?rS(_e.lines,e.doc.captionRangeEdits):{lines:[],dropped:[]},[h,_e,e.doc.captionRangeEdits]),Et=d.useMemo(()=>h?oS(Ne.lines,e.doc.captionWordsHidden):{lines:[],dropped:[]},[h,Ne,e.doc.captionWordsHidden]),Dt=d.useMemo(()=>h?sS(Et.lines,e.doc.captionLineTiming):{lines:[],dropped:[]},[h,Et,e.doc.captionLineTiming]),Ct=d.useMemo(()=>h?nN(Dt.lines,e.doc.captionLineWindows,h.spans??[]):{lines:[],dropped:[]},[h,Dt,e.doc.captionLineWindows]),_r=d.useMemo(()=>AS(f),[f]),dn=d.useMemo(()=>h?q4(k,e.doc.cleanup,e.doc.cuts,h.spans??[]):null,[h,k,e.doc.cleanup,e.doc.cuts]),et=d.useMemo(()=>{let q;try{const re=(h==null?void 0:h.spans)??[];if(re.length>0){const ae=Fo(re);q=je=>ae.toSource(je)}}catch{q=void 0}return J4(dn,{identityToSource:q})},[dn,h]),Yt=d.useMemo(()=>{if(!h)return null;const q=()=>{try{const gt=h.spans??[];return gt.length>0?Fo(gt):null}catch{return null}},re=(h.baseSceneCues??h.sceneCues??[]).filter(gt=>gt.kind!=="plain"),ae=h.baseTheme??h.theme??HM,je=q(),Be=je?Ly(e.doc,je).doc:e.doc,{cues:mt}=Ol(re,Be),{cues:Rn}=w4(mt,e.doc),zn=_4(Rn,{outputDurationSec:h.outputDurationSec,clipStarts:(h.spans??[]).map(gt=>gt.outIn)}),er=wu(zn,zh(e.doc.splits)),{cues:fn}=Ol(er,Be),{cues:ss}=tS(fn,e.doc);let mr=W?ss.map(gt=>gt.id===W.sceneId?{...gt,video:{...gt.video,...W.patch}}:gt):ss;se&&(mr=mr.map(gt=>gt.id===se.sceneId?{...gt,graphicRect:se.rect}:gt));const Rc={...h,sceneCues:mr,captionLines:Ct.lines,theme:I4(ae,e.doc),captionsHidden:h.captionsHiddenByFlag===!0||e.doc.captionsHidden===!0,videoFileName:`/media/${h.videoFileName}`,...h.coverInVideo?{coverInVideo:{...h.coverInVideo,fileName:`/media/${h.coverInVideo.fileName}`}}:{}},qh=(gt,Jh,as)=>{var sm,am;const ek=Wh(k,e.doc.cleanup).map(pn=>({srcIn:pn.srcIn,srcOut:pn.srcOut})),tk=Vh(k,e.doc.cleanup).map(pn=>({srcIn:pn.srcIn,srcOut:pn.srcOut,dismissed:!0})),Qh=e.doc.splits.filter(pn=>pn.at===void 0&&pn.src!==void 0),Pc=[...ek,...tk],em=C!==null&&(Pc.length>0||dn!==null);if(as===null||Pc.length===0&&Qh.length===0&&!em)return{props:gt,reports:Jh};const tm=Y4(gt.sceneCues??[],Pc,as),nm=f4(Qh,as),nk=wu(tm.cues,nm.points),rm=Ly(e.doc,as),{cues:om}=Ol(nk,rm.doc);let im=gt.captionLines,Fc;return em&&C!==null&&(Fc=rN(C,as,e.doc,{breakpoints:om.filter(pn=>pn.kind!=="plain").flatMap(pn=>[pn.startSec,pn.endSec]),landscape:(((sm=h.settings)==null?void 0:sm.width)??1080)>(((am=h.settings)==null?void 0:am.height)??1920)}),im=Fc.lines),{props:{...gt,sceneCues:om,captionLines:im},reports:[...Jh,...tm.reports,...nm.reports,...rm.reports],transcript:Fc}};if(!dn)return qh(Rc,[],je);const{fields:JS,reports:QS}=Q4(Rc,dn.oldMap,dn.newMap);return qh({...Rc,...JS},QS,dn.newMap)},[h,e.doc,W,se,Ct,dn,k,C]),Me=Yt===null?null:Yt.props,Qn=Yt==null?void 0:Yt.transcript,is=d.useMemo(()=>{var re;const q=[...J3(_e.dropped),...eN(Ne.dropped),...Q3(Et.dropped),...kd(Dt.dropped),...kd(Ct.dropped)];for(const ae of kd(((re=Yt==null?void 0:Yt.transcript)==null?void 0:re.dropped)??[]))q.includes(ae)||q.push(ae);return q},[_e,Ne,Et,Dt,Ct,Yt]),Ec=is.join(`
165
+ `),ZS=is.length>0&&Ec!==x;d.useEffect(()=>{if(is.length!==0)for(const q of is)console.warn(`ossclip §137: ${q}`)},[Ec]);const Cc=Me==null?void 0:Me.sceneCues;d.useEffect(()=>{Cc&&e.syncCues(Cc)},[Cc]);const KS=((Yt==null?void 0:Yt.reports)??[]).join(`
166
+ `);d.useEffect(()=>{if(!(!Yt||Yt.reports.length===0))for(const q of Yt.reports)console.warn(`ossclip cut preview: ${q}`)},[KS]);const Ic=d.useRef(null);d.useEffect(()=>{if(!h){Ic.current=null;return}const q=dn?dn.newMap:Fo(h.spans??[]),re=Ic.current;if(Ic.current={props:h,map:q},!re||re.props!==h||uS(re.map,q,1e-6))return;const ae=fe.current;if(!ae)return;const je=h.settings.fps,Be=re.map.toSource(ae.getCurrentFrame()/je),mt=q.toOutput(Be)??q.toOutputClamped(Be);ae.seekTo(Math.round(mt*je))},[dn,h]);const Gh=()=>{zD({dirty:e.dirty,renderRunning:(K==null?void 0:K.running)===!0,save:e.save,onBlocked:()=>i(!0),onSaveError:q=>V(q)})},Xh=d.useCallback(async(q,re)=>{try{e.dirty&&await e.save();const ae=await fetch("/api/render",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...q?{out:q}:{},...re===!0?{replan:!0}:{}})});if(!ae.ok){const je=await ae.json().catch(()=>({}));throw new Error(je.error??`render failed to start: ${ae.status}`)}le({running:!0,lines:[],startedAt:Date.now()}),te(!0),a(null),ve()}catch(ae){a(ae instanceof Error?ae.message:String(ae))}},[e,ve]),Tc=d.useMemo(()=>{if(!h)return[];const q=(h.baseSceneCues??h.sceneCues??[]).filter(re=>re.kind!=="plain");return BD(q,e.doc,et.toLive)},[h,e.doc,et]),Mr=d.useMemo(()=>M?(Me==null?void 0:Me.sceneCues.find(q=>q.id===M.sceneId))??Tc.find(q=>q.id===M.sceneId)??null:null,[Me,M,Tc]),YS=d.useMemo(()=>{if(!Mr||!Me)return;const q=Me.captionLines.filter(ae=>ae.start<Mr.endSec&&ae.end>Mr.startSec).flatMap(ae=>ae.words).filter(ae=>ae.start<Mr.endSec&&ae.end>Mr.startSec).map(ae=>ae.text);if(q.length===0)return;const re=q.join(" ");return re.length>90?`${re.slice(0,90)}…`:re},[Mr,Me]);if(L)return u.jsx("div",{style:Od,children:u.jsxs("div",{style:{padding:24,color:"#FF5C5C",fontFamily:"ui-monospace, monospace"},children:["Couldn't load the production: ",L]})});if(!Me)return u.jsx("div",{style:Od,children:Z?u.jsx(Pv,{recent:_,required:!0,onOpen:Pe,onClose:()=>{}}):u.jsx("div",{style:{padding:24,color:"#9A9AA3"},children:"Loading production…"})});const GS=Me.settings.width/Me.settings.height,XS=Re?Math.max(220,Math.min(Re.w,Re.h*GS)):380,qS=Math.round(XS*Ie),jc=u.jsx("button",{"data-testid":"render-logs-toggle",style:{...tt,padding:"2px 8px"},onClick:()=>te(q=>!q),title:B?"Collapse the log":"Expand the log",children:B?"▾ logs":"▸ logs"});return u.jsxs("div",{style:Od,children:[u.jsxs("div",{style:ZD,children:[u.jsx("span",{style:KD,children:"ossclip"}),z?u.jsx("span",{"data-testid":"workdir-label",style:YD,title:z,children:z.split("/").filter(Boolean).slice(-2).join("/")}):null,u.jsxs("div",{style:{display:"flex",gap:8},children:[u.jsx("button",{"data-testid":"open-button",style:tt,onClick:()=>Q(!0),title:z?`Open another project — currently ${z}`:"Open another project",children:"Open"}),u.jsx("button",{"data-testid":"undo-button",style:tt,onClick:()=>e.undo(),disabled:!e.canUndo,title:"Undo (⌘Z)","aria-label":"Undo",children:u.jsx(HD,{})}),u.jsx("button",{"data-testid":"redo-button",style:tt,onClick:()=>e.redo(),disabled:!e.canRedo,title:"Redo (⌘⇧Z)","aria-label":"Redo",children:u.jsx(UD,{})}),u.jsx("button",{"data-testid":"transcript-toggle",style:{...tt,...pr?{borderColor:"#5b8cff"}:{}},onClick:()=>os(q=>!q),title:"Find and retype caption words across the whole transcript",children:"Transcript"}),u.jsx("button",{"data-testid":"cover-button",style:{...tt,...In?{borderColor:"#5b8cff"}:{}},onClick:()=>at(!0),title:"Retype the cover headline or re-cut its frame — seconds, no re-render",children:"Cover"}),u.jsx("button",{"data-testid":"cleanup-button",style:{...tt,...Jn?{borderColor:"#5b8cff"}:{}},onClick:()=>vo(!0),title:"Review what produce removed — keep whole categories; the preview plays your choices immediately",children:"Cleanup"}),u.jsxs("div",{style:{position:"relative"},children:[u.jsx("button",{"data-testid":"youtube-menu",style:{...tt,...Kt||yo||Lt?{borderColor:"#5b8cff"}:{}},onClick:()=>Ot(q=>!q),title:"AI thumbnail and SEO metadata for the YouTube upload","aria-haspopup":"menu","aria-expanded":Kt,children:"YouTube ▾"}),Kt?u.jsxs(u.Fragment,{children:[u.jsx("div",{style:qD,onMouseDown:()=>Ot(!1)}),u.jsxs("div",{style:JD,role:"menu",children:[u.jsx("button",{"data-testid":"youtube-menu-thumbnail",style:a0,role:"menuitem",onClick:()=>{Ot(!1),Xo(!0)},children:"Thumbnail"}),u.jsx("button",{"data-testid":"youtube-menu-seo",style:a0,role:"menuitem",onClick:()=>{Ot(!1),hr(!0)},children:"SEO metadata"})]})]}):null]}),u.jsx("button",{"data-testid":"publish-button",style:{...tt,...Tn?{borderColor:"#5b8cff"}:{}},onClick:()=>$r(!0),title:"Push the finished render to your social accounts via your Postiz instance",children:"Publish"}),u.jsx("button",{style:{...tt,...e.dirty?XD:{}},onClick:Gh,disabled:!e.dirty||(K==null?void 0:K.running)===!0,title:(K==null?void 0:K.running)===!0?"Can't save while a render is running":void 0,children:"Save"}),u.jsxs("div",{style:{display:"inline-flex",alignItems:"center"},children:[u.jsx("button",{"data-testid":"render-button",style:{...tt,borderTopRightRadius:0,borderBottomRightRadius:0,borderRight:"none"},onClick:()=>void Xh(),disabled:!U||(K==null?void 0:K.running)===!0,title:U?"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:K!=null&&K.running?"Rendering…":"Render"}),u.jsx("button",{"data-testid":"render-destination-button",style:{...tt,borderTopLeftRadius:0,borderBottomLeftRadius:0,padding:"7px 8px"},onClick:()=>ie(!0),disabled:!U||(K==null?void 0:K.running)===!0,title:"Choose export file destination (Browse…)",children:"▾"})]})]}),u.jsx("span",{style:{...GD,color:e.dirty?"#FFE14D":"#5FBF77"},...e.dirty?{"data-testid":"dirty"}:{},children:e.dirty?"● Unsaved changes":"✓ Saved"}),u.jsx("button",{"data-testid":"shortcuts-button",style:{...tt,padding:"7px 10px"},onClick:()=>go(q=>!q),title:"Keyboard shortcuts (?)",children:"?"})]}),Go?u.jsx(L5,{onClose:()=>go(!1)}):null,yo?u.jsx(nO,{onClose:()=>Xo(!1)}):null,Jn?u.jsx(gO,{cutlist:k,edits:e,onClose:()=>vo(!1)}):null,Lt?u.jsx($O,{onClose:()=>hr(!1)}):null,Tn?u.jsx(wD,{onClose:()=>$r(!1)}):null,In?u.jsx(XO,{onClose:()=>at(!1),playheadSec:()=>{var re;const q=(((re=fe.current)==null?void 0:re.getCurrentFrame())??0)/Me.settings.fps;return{sec:et.fromLive(q),snapped:!et.hasOldClockPreimage(q)}}}):null,Y?u.jsx(DL,{defaultOutPath:ke,onCancel:()=>ie(!1),onConfirm:(q,re)=>{ie(!1),Xh(q,re)}}):null,jn?u.jsx(Y5,{plan:jn,onCancel:()=>qo(null),onConfirm:q=>{if(q==="graphic")e.hideScene(jn.sceneId);else{const re=fS(et,jn.startSec,jn.endSec);if(et.toSourceSec!==null){const ae=et.toSourceSec,je={startSec:Math.round(ae(jn.startSec)*1e3)/1e3,endSec:Math.round(ae(jn.endSec)*1e3)/1e3},Be=re.kind==="degenerate"?{startSec:et.fromLive(jn.startSec),endSec:et.fromLive(jn.endSec)}:{startSec:re.startSec,endSec:re.endSec};e.cutChunk(Be.startSec,Be.endSec,je)}else re.kind==="degenerate"?c("Can't cut this window: it isn't in the last render yet — render once (or re-remove the pause) to cut it."):(re.kind==="shrunk"&&console.warn(`ossclip cut preview: ${re.report}`),e.cutChunk(re.startSec,re.endSec))}qo(null)}}):null,tn?u.jsx(lL,{plan:tn,onCancel:()=>A(null),onConfirm:q=>{if(q==="caption")e.hideCaptionWords(tn.words);else{const re=Qn?et.toSourceSec:et.oldToSourceSec,ae=mt=>Math.round(mt*1e3)/1e3,je=re===null?void 0:{startSec:ae(re(tn.startSec)),endSec:ae(re(tn.endSec))},Be=Qn?{startSec:ae(et.fromLive(tn.startSec)),endSec:ae(et.fromLive(tn.endSec))}:{startSec:tn.startSec,endSec:tn.endSec};e.cutWords(tn.words,Be.startSec,Be.endSec,je)}A(null)}}):null,Z?u.jsx(Pv,{recent:_,required:!1,onOpen:Pe,onClose:()=>Q(!1)}):null,K?u.jsxs("div",{"data-testid":"render-log",style:{...a6,borderColor:K.failed!==void 0?"#FF5C5C":"#2A2A33"},children:[K.failed!==void 0?u.jsxs("div",{style:{color:K.cancelled?"#9A9AA3":"#FF5C5C",marginBottom:4},"data-testid":K.cancelled?"render-cancelled":"render-failed",children:[K.cancelled?"render cancelled":`render failed (exit ${K.failed})`,u.jsx("button",{style:{...tt,marginLeft:10,padding:"2px 8px"},onClick:()=>le(null),children:"Dismiss"}),u.jsx("span",{style:{marginLeft:6},children:jc})]}):null,K.succeeded?u.jsxs("div",{"data-testid":"render-succeeded",style:c0,children:[u.jsxs("span",{style:{color:"#5FBF77"},children:["✓ done",K.startedAt!=null&&K.finishedAt!==void 0?` · ${r0(K.startedAt,K.finishedAt)}`:""]}),u.jsx("button",{"data-testid":"render-open-folder",style:{...tt,padding:"2px 8px"},onClick:()=>void fetch("/api/reveal-output",{method:"POST"}).catch(()=>{}),title:"Reveal the rendered file in your file manager",children:"Open folder"}),u.jsx("button",{style:{...tt,padding:"2px 8px"},onClick:()=>le(null),children:"Dismiss"}),jc]}):null,K.running?u.jsxs("div",{"data-testid":"render-status",style:c0,children:[u.jsx("style",{children:"@keyframes ossclip-spin { to { transform: rotate(360deg) } }"}),u.jsx("span",{style:l6,"aria-hidden":!0}),u.jsxs("span",{style:{color:"#EDEDF2"},children:["rendering",K.startedAt!=null?` · ${r0(K.startedAt,Date.now())}`:"",bl(K.lines)!==null?` · ${bl(K.lines)}%`:""]}),bl(K.lines)!==null?u.jsx("div",{style:u6,children:u.jsx("div",{"data-testid":"render-progress-bar",style:{...c6,width:`${bl(K.lines)}%`}})}):null,u.jsx("button",{"data-testid":"render-cancel",style:{...tt,padding:"2px 8px"},onClick:()=>void fetch("/api/render/cancel",{method:"POST"}),children:"Cancel"}),jc]}):null,B?u.jsxs(u.Fragment,{children:[ND(K.lines).map(q=>u.jsx("div",{"data-testid":"render-pinned",style:{color:"#C9C9D4"},children:q},q)),u.jsx(VD,{lines:K.lines})]}):null]}):null,n?u.jsxs("div",{"data-testid":"reanchor-notice",style:ai,children:["Render re-anchored your saved cuts and splits — edits made while it ran were dropped, not merged, to avoid overwriting that anchor.",u.jsx("button",{style:{...tt,marginLeft:10,padding:"2px 8px"},onClick:()=>r(!1),children:"Dismiss"})]}):null,_r.length>0||m.length>0?u.jsxs("div",{"data-testid":"caption-migration-notice",style:ai,children:[[..._r,...m].map((q,re)=>u.jsx("div",{children:q},re)),u.jsx("button",{style:{...tt,marginLeft:10,padding:"2px 8px"},onClick:()=>{p([]),y([])},children:"Dismiss"})]}):null,ZS?u.jsxs("div",{"data-testid":"caption-dropped-notice",style:ai,children:[is.map((q,re)=>u.jsx("div",{children:q},re)),u.jsx("button",{style:{...tt,marginLeft:10,padding:"2px 8px"},onClick:()=>S(Ec),children:"Dismiss"})]}):null,o?u.jsxs("div",{"data-testid":"save-blocked-notice",style:ai,children:["Can't save while a render is running — it's writing its own overrides.json right now. Wait for it to finish (or cancel it) before saving.",u.jsx("button",{style:{...tt,marginLeft:10,padding:"2px 8px"},onClick:()=>i(!1),children:"Dismiss"})]}):null,s!==null?u.jsxs("div",{"data-testid":"render-refused-notice",style:ai,children:["Render didn't start: ",s,u.jsx("button",{style:{...tt,marginLeft:10,padding:"2px 8px"},onClick:()=>a(null),children:"Dismiss"})]}):null,l!==null?u.jsxs("div",{"data-testid":"clock-refused-notice",style:ai,children:[l,u.jsx("button",{style:{...tt,marginLeft:10,padding:"2px 8px"},onClick:()=>c(null),children:"Dismiss"})]}):null,u.jsxs("div",{style:QD,children:[pr?u.jsxs(u.Fragment,{children:[u.jsx(c5,{baseLines:Qn?Qn.baseLines:(h==null?void 0:h.baseCaptionLines)??(h==null?void 0:h.captionLines)??[],liveLines:Qn?Qn.liveLines:Ne.lines,timingLines:Qn?Qn.timingLines:Et.lines,fps:Me.settings.fps,playerRef:fe,edits:e,onDeleteWords:A,width:mo,workdir:z,toPlayerSec:Qn?o0:et.toLive,fromPlayerSec:Qn?o0:et.fromLive}),u.jsx("div",{"data-testid":"transcript-divider",style:e6,title:"Drag to resize the transcript pane",onMouseDown:q=>{q.preventDefault(),qn.current={startX:q.clientX,startW:mo}}})]}):null,u.jsxs("div",{style:t6,children:[u.jsx("div",{ref:Le,style:n6,onMouseDown:q=>{if(q.altKey||q.button===1){q.preventDefault();const re=Ce.current;re&&(kt.current={x:q.clientX,y:q.clientY,sl:re.scrollLeft,st:re.scrollTop})}},children:u.jsx("div",{style:{margin:"auto",padding:Dd},children:u.jsxs("div",{ref:de,"data-testid":"stage","data-playing":D?"true":"false","data-rate":P,style:{position:"relative",display:"inline-block"},children:[u.jsx(OP,{ref:fe,component:H3,inputProps:Me,durationInFrames:Math.max(1,Math.round(Me.outputDurationSec*Me.settings.fps)),fps:Me.settings.fps,compositionWidth:Me.settings.width,compositionHeight:Me.settings.height,style:{width:qS},controls:!0,clickToPlay:!1,playbackRate:P}),u.jsx(dN,{stageRef:de,selection:M,onSelect:$,edits:e,onSave:Gh,settings:Me.settings,cues:Me.sceneCues,playerRef:fe,cue:Mr,onTransport:me,onVideoPreview:R,onGraphicPreview:oe,onToggleHelp:()=>go(q=>!q),onRequestDelete:qo,fromLive:et.fromLive,hasOldClockPreimage:et.hasOldClockPreimage,toSourceSec:et.toSourceSec,onClockRefused:c}),u.jsx("button",{"data-testid":"rate-chip",onClick:()=>me("L"),title:"Playback rate — click to speed up (J/K/L on the keyboard)",style:d6,children:P<0?`◂◂ ${Math.abs(P)}×`:`${P}×`})]})})}),u.jsxs("div",{style:r6,children:[u.jsx("button",{"data-testid":"view-zoom-out",style:zd,onClick:()=>Nt(Ie/2),disabled:Ie<=.25,title:"Zoom the preview out — below 100% shrinks under the fitted size",children:"−"}),u.jsxs("span",{"data-testid":"view-zoom-level",style:o6,children:[Math.round(Ie*100),"%"]}),u.jsx("button",{"data-testid":"view-zoom-in",style:zd,onClick:()=>Nt(Ie*2),disabled:Ie>=8,title:"Zoom the preview in — a viewing magnifier, it never edits the video",children:"+"}),u.jsx("button",{"data-testid":"view-zoom-fit",style:{...zd,width:"auto",padding:"0 8px"},onClick:()=>Nt(1),disabled:Math.abs(Ie-1)<.001,title:"Fit the preview to the window",children:"fit"}),u.jsx("span",{style:i6,children:"⌥-drag pans"})]})]}),u.jsx("div",{style:s6,children:u.jsx(pN,{selection:M,cue:Mr,frame:{width:Me.settings.width,height:Me.settings.height},allSceneIds:Me.sceneCues.map(q=>q.id),edits:e,onSelect:$,resolvedTheme:Me.theme,anchorText:YS,onVideoPreview:R,runInfo:v,captionsHiddenByFlag:(h==null?void 0:h.captionsHiddenByFlag)===!0,fromLive:et.fromLive,hasOldClockPreimage:et.hasOldClockPreimage,toSourceSec:et.toSourceSec,onClockRefused:c})})]}),u.jsx(AN,{cues:Me.sceneCues,ghosts:Tc,cuts:e.doc.cuts,spans:Me.spans??[],cleanup:k,durationSec:Me.outputDurationSec,fps:Me.settings.fps,playerRef:fe,selection:M,onSelect:$,edits:e,onRevived:F,videoSrc:Me.videoFileName,toLive:et.toLive,pinSourceSec:et.toSourceSec,toSourceSec:q=>{var re;for(const ae of Me.spans??[])if(q>=ae.outIn&&q<ae.outOut)return ae.srcIn+(q-ae.outIn);return((re=(Me.spans??[])[0])==null?void 0:re.srcIn)??q}})]})},VD=({lines:e})=>{const t=d.useRef(null),n=d.useRef(!0);return d.useEffect(()=>{const r=t.current;r&&n.current&&(r.scrollTop=r.scrollHeight)},[e]),u.jsx("div",{ref:t,"data-testid":"render-tail",onScroll:r=>{const o=r.currentTarget;n.current=o.scrollTop+o.clientHeight>=o.scrollHeight-8},style:{maxHeight:220,overflowY:"auto"},children:e.map((r,o)=>u.jsx("div",{children:r},o))})},HD=()=>u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",style:{display:"block"},children:[u.jsx("path",{d:"M9 14 4 9l5-5"}),u.jsx("path",{d:"M4 9h10.5a5.5 5.5 0 0 1 0 11H11"})]}),UD=()=>u.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",style:{display:"block"},children:[u.jsx("path",{d:"m15 14 5-5-5-5"}),u.jsx("path",{d:"M20 9H9.5a5.5 5.5 0 0 0 0 11H13"})]}),Od={fontFamily:"'Inter', system-ui, sans-serif",background:"#0B0B0E",color:"#EDEDF2",height:"100vh",overflow:"hidden",display:"flex",flexDirection:"column"},ZD={display:"flex",alignItems:"center",gap:14,padding:"10px 20px",borderBottom:"1px solid #1E1E24",background:"#111116"},KD={fontWeight:800,fontSize:14,letterSpacing:"0.02em",color:"#FFE14D",marginRight:8},YD={fontSize:12,fontFamily:"ui-monospace, 'SF Mono', monospace",color:"#6a6a75",maxWidth:260,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},GD={fontSize:12,fontFamily:"ui-monospace, 'SF Mono', monospace",marginLeft:"auto"},tt={fontSize:12,fontWeight:600,color:"#EDEDF2",background:"#1A1A21",border:"1px solid #2A2A33",borderRadius:6,padding:"7px 12px",cursor:"pointer"},XD={background:"#FFE14D",color:"#0B0B0E",border:"1px solid #FFE14D"},qD={position:"fixed",inset:0,zIndex:30},JD={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"},a0={fontSize:12,fontWeight:600,color:"#EDEDF2",background:"transparent",border:"none",borderRadius:4,padding:"8px 10px",cursor:"pointer",textAlign:"left"},QD={display:"flex",flex:1,minHeight:0},Dd=32,l0="ossclip.transcriptWidth",u0=e=>Math.min(640,Math.max(220,e)),e6={width:5,flexShrink:0,cursor:"col-resize",background:"#1E1E24",borderLeft:"1px solid #2A2A33"},t6={position:"relative",flex:1,minWidth:0},n6={position:"absolute",inset:0,display:"flex",overflow:"auto"},r6={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},zd={width:22,height:18,fontSize:12,lineHeight:1,color:"#EDEDF2",background:"#1A1A21",border:"1px solid #2A2A33",borderRadius:4,cursor:"pointer",padding:0},o6={fontSize:10,fontFamily:"ui-monospace, 'SF Mono', monospace",color:"#9A9AA3",minWidth:34,textAlign:"center"},i6={fontSize:10,color:"#55555f",userSelect:"none"},s6={width:260,flexShrink:0,borderLeft:"1px solid #1E1E24",background:"#111116",overflowY:"auto"},a6={fontSize:11,fontFamily:"ui-monospace, 'SF Mono', monospace",color:"#9A9AA3",background:"#0F0F14",borderBottom:"1px solid #2A2A33",padding:"6px 20px",whiteSpace:"pre-wrap",flexShrink:0},ai={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},c0={display:"flex",alignItems:"center",gap:10,marginBottom:4},l6={width:12,height:12,flexShrink:0,border:"2px solid #2A2A33",borderTopColor:"#FFE14D",borderRadius:"50%",animation:"ossclip-spin 0.8s linear infinite"},u6={flex:1,maxWidth:260,height:4,background:"#1E1E24",borderRadius:2,overflow:"hidden"},c6={height:"100%",background:"#FFE14D",borderRadius:2,transition:"width 0.6s ease"},d6={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"};Bd.createRoot(document.getElementById("root")).render(u.jsx(he.StrictMode,{children:u.jsx(WD,{})}));