function mf(e,t){for(var n=0;nr[l]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))r(l);new MutationObserver(l=>{for(const i of l)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(l){const i={};return l.integrity&&(i.integrity=l.integrity),l.referrerPolicy&&(i.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?i.credentials="include":l.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(l){if(l.ep)return;l.ep=!0;const i=n(l);fetch(l.href,i)}})();function vf(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Du={exports:{}},ni={},Fu={exports:{}},W={};/** * @license React * react.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Wr=Symbol.for("react.element"),gf=Symbol.for("react.portal"),yf=Symbol.for("react.fragment"),xf=Symbol.for("react.strict_mode"),Sf=Symbol.for("react.profiler"),wf=Symbol.for("react.provider"),_f=Symbol.for("react.context"),kf=Symbol.for("react.forward_ref"),jf=Symbol.for("react.suspense"),Nf=Symbol.for("react.memo"),Cf=Symbol.for("react.lazy"),sa=Symbol.iterator;function Ef(e){return e===null||typeof e!="object"?null:(e=sa&&e[sa]||e["@@iterator"],typeof e=="function"?e:null)}var $u={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Uu=Object.assign,Au={};function Qn(e,t,n){this.props=e,this.context=t,this.refs=Au,this.updater=n||$u}Qn.prototype.isReactComponent={};Qn.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")};Qn.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function bu(){}bu.prototype=Qn.prototype;function ns(e,t,n){this.props=e,this.context=t,this.refs=Au,this.updater=n||$u}var rs=ns.prototype=new bu;rs.constructor=ns;Uu(rs,Qn.prototype);rs.isPureReactComponent=!0;var aa=Array.isArray,Bu=Object.prototype.hasOwnProperty,ls={current:null},Wu={key:!0,ref:!0,__self:!0,__source:!0};function Vu(e,t,n){var r,l={},i=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(i=""+t.key),t)Bu.call(t,r)&&!Wu.hasOwnProperty(r)&&(l[r]=t[r]);var u=arguments.length-2;if(u===1)l.children=n;else if(1>>1,J=w[Y];if(0>>1;Yl(Z,U))Bl(de,Z)?(w[Y]=de,w[B]=U,Y=B):(w[Y]=Z,w[D]=U,Y=D);else if(Bl(de,U))w[Y]=de,w[B]=U,Y=B;else break e}}return R}function l(w,R){var U=w.sortIndex-R.sortIndex;return U!==0?U:w.id-R.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var o=Date,u=o.now();e.unstable_now=function(){return o.now()-u}}var a=[],c=[],m=1,d=null,p=3,y=!1,x=!1,S=!1,N=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,f=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function g(w){for(var R=n(c);R!==null;){if(R.callback===null)r(c);else if(R.startTime<=w)r(c),R.sortIndex=R.expirationTime,t(a,R);else break;R=n(c)}}function _(w){if(S=!1,g(w),!x)if(n(a)!==null)x=!0,V(P);else{var R=n(c);R!==null&&ee(_,R.startTime-w)}}function P(w,R){x=!1,S&&(S=!1,v(z),z=-1),y=!0;var U=p;try{for(g(R),d=n(a);d!==null&&(!(d.expirationTime>R)||w&&!Q());){var Y=d.callback;if(typeof Y=="function"){d.callback=null,p=d.priorityLevel;var J=Y(d.expirationTime<=R);R=e.unstable_now(),typeof J=="function"?d.callback=J:d===n(a)&&r(a),g(R)}else r(a);d=n(a)}if(d!==null)var Ae=!0;else{var D=n(c);D!==null&&ee(_,D.startTime-R),Ae=!1}return Ae}finally{d=null,p=U,y=!1}}var I=!1,E=null,z=-1,G=5,F=-1;function Q(){return!(e.unstable_now()-Fw||125Y?(w.sortIndex=U,t(c,w),n(a)===null&&w===n(c)&&(S?(v(z),z=-1):S=!0,ee(_,U-Y))):(w.sortIndex=J,t(a,w),x||y||(x=!0,V(P))),w},e.unstable_shouldYield=Q,e.unstable_wrapCallback=function(w){var R=p;return function(){var U=p;p=R;try{return w.apply(this,arguments)}finally{p=U}}}})(Qu);Ku.exports=Qu;var Af=Ku.exports;/** * @license React * react-dom.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var bf=h,qe=Af;function C(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),eo=Object.prototype.hasOwnProperty,Bf=/^[: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]*$/,ca={},da={};function Wf(e){return eo.call(da,e)?!0:eo.call(ca,e)?!1:Bf.test(e)?da[e]=!0:(ca[e]=!0,!1)}function Vf(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 Hf(e,t,n,r){if(t===null||typeof t>"u"||Vf(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 Oe(e,t,n,r,l,i,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=o}var Ne={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Ne[e]=new Oe(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Ne[t]=new Oe(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Ne[e]=new Oe(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Ne[e]=new Oe(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){Ne[e]=new Oe(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Ne[e]=new Oe(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Ne[e]=new Oe(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Ne[e]=new Oe(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Ne[e]=new Oe(e,5,!1,e.toLowerCase(),null,!1,!1)});var os=/[\-:]([a-z])/g;function ss(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(os,ss);Ne[t]=new Oe(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(os,ss);Ne[t]=new Oe(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(os,ss);Ne[t]=new Oe(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Ne[e]=new Oe(e,1,!1,e.toLowerCase(),null,!1,!1)});Ne.xlinkHref=new Oe("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Ne[e]=new Oe(e,1,!1,e.toLowerCase(),null,!0,!0)});function as(e,t,n,r){var l=Ne.hasOwnProperty(t)?Ne[t]:null;(l!==null?l.type!==0:r||!(2u||l[o]!==i[u]){var a=` `+l[o].replace(" at new "," at ");return e.displayName&&a.includes("")&&(a=a.replace("",e.displayName)),a}while(1<=o&&0<=u);break}}}finally{Ci=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?dr(e):""}function qf(e){switch(e.tag){case 5:return dr(e.type);case 16:return dr("Lazy");case 13:return dr("Suspense");case 19:return dr("SuspenseList");case 0:case 2:case 15:return e=Ei(e.type,!1),e;case 11:return e=Ei(e.type.render,!1),e;case 1:return e=Ei(e.type,!0),e;default:return""}}function lo(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 jn:return"Fragment";case kn:return"Portal";case to:return"Profiler";case us:return"StrictMode";case no:return"Suspense";case ro:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Xu:return(e.displayName||"Context")+".Consumer";case Ju:return(e._context.displayName||"Context")+".Provider";case cs:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ds:return t=e.displayName||null,t!==null?t:lo(e.type)||"Memo";case Rt:t=e._payload,e=e._init;try{return lo(e(t))}catch{}}return null}function Gf(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 lo(t);case 8:return t===us?"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 Kt(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function ec(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Kf(e){var t=ec(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 l=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(o){r=""+o,i.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function rl(e){e._valueTracker||(e._valueTracker=Kf(e))}function tc(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=ec(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Ll(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 io(e,t){var n=t.checked;return ae({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function pa(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Kt(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 nc(e,t){t=t.checked,t!=null&&as(e,"checked",t,!1)}function oo(e,t){nc(e,t);var n=Kt(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")?so(e,t.type,n):t.hasOwnProperty("defaultValue")&&so(e,t.type,Kt(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function ha(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 so(e,t,n){(t!=="number"||Ll(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var fr=Array.isArray;function zn(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=ll.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Nr(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var mr={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},Qf=["Webkit","ms","Moz","O"];Object.keys(mr).forEach(function(e){Qf.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),mr[t]=mr[e]})});function oc(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||mr.hasOwnProperty(e)&&mr[e]?(""+t).trim():t+"px"}function sc(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=oc(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var Yf=ae({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 co(e,t){if(t){if(Yf[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(C(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(C(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(C(61))}if(t.style!=null&&typeof t.style!="object")throw Error(C(62))}}function fo(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 po=null;function fs(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ho=null,Dn=null,Fn=null;function ga(e){if(e=qr(e)){if(typeof ho!="function")throw Error(C(280));var t=e.stateNode;t&&(t=si(t),ho(e.stateNode,e.type,t))}}function ac(e){Dn?Fn?Fn.push(e):Fn=[e]:Dn=e}function uc(){if(Dn){var e=Dn,t=Fn;if(Fn=Dn=null,ga(e),t)for(e=0;e>>=0,e===0?32:31-(sp(e)/ap|0)|0}var il=64,ol=4194304;function pr(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 zl(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,i=e.pingedLanes,o=n&268435455;if(o!==0){var u=o&~l;u!==0?r=pr(u):(i&=o,i!==0&&(r=pr(i)))}else o=n&~l,o!==0?r=pr(o):i!==0&&(r=pr(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&l)&&(l=r&-r,i=t&-t,l>=i||l===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Vr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-st(t),e[t]=n}function fp(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=gr),Ca=" ",Ea=!1;function Tc(e,t){switch(e){case"keyup":return Ap.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ic(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Nn=!1;function Bp(e,t){switch(e){case"compositionend":return Ic(t);case"keypress":return t.which!==32?null:(Ea=!0,Ca);case"textInput":return e=t.data,e===Ca&&Ea?null:e;default:return null}}function Wp(e,t){if(Nn)return e==="compositionend"||!Ss&&Tc(e,t)?(e=Ec(),wl=gs=Dt=null,Nn=!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)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=La(n)}}function Oc(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Oc(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function zc(){for(var e=window,t=Ll();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ll(e.document)}return t}function ws(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 Xp(e){var t=zc(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Oc(n.ownerDocument.documentElement,n)){if(r!==null&&ws(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 l=n.textContent.length,i=Math.min(r.start,l);r=r.end===void 0?i:Math.min(r.end,l),!e.extend&&i>r&&(l=r,r=i,i=l),l=Ra(n,i);var o=Ra(n,r);l&&o&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.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=document.documentMode,Cn=null,So=null,xr=null,wo=!1;function Ma(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;wo||Cn==null||Cn!==Ll(r)||(r=Cn,"selectionStart"in r&&ws(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}),xr&&Lr(xr,r)||(xr=r,r=$l(So,"onSelect"),0Tn||(e.current=Eo[Tn],Eo[Tn]=null,Tn--)}function ne(e,t){Tn++,Eo[Tn]=e.current,e.current=t}var Qt={},Ie=Jt(Qt),Fe=Jt(!1),an=Qt;function Wn(e,t){var n=e.type.contextTypes;if(!n)return Qt;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},i;for(i in n)l[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function $e(e){return e=e.childContextTypes,e!=null}function Al(){le(Fe),le(Ie)}function Aa(e,t,n){if(Ie.current!==Qt)throw Error(C(168));ne(Ie,t),ne(Fe,n)}function Vc(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var l in r)if(!(l in t))throw Error(C(108,Gf(e)||"Unknown",l));return ae({},n,r)}function bl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Qt,an=Ie.current,ne(Ie,e),ne(Fe,Fe.current),!0}function ba(e,t,n){var r=e.stateNode;if(!r)throw Error(C(169));n?(e=Vc(e,t,an),r.__reactInternalMemoizedMergedChildContext=e,le(Fe),le(Ie),ne(Ie,e)):le(Fe),ne(Fe,n)}var yt=null,ai=!1,bi=!1;function Hc(e){yt===null?yt=[e]:yt.push(e)}function ch(e){ai=!0,Hc(e)}function Xt(){if(!bi&&yt!==null){bi=!0;var e=0,t=X;try{var n=yt;for(X=1;e>=o,l-=o,xt=1<<32-st(t)+l|n<z?(G=E,E=null):G=E.sibling;var F=p(v,E,g[z],_);if(F===null){E===null&&(E=G);break}e&&E&&F.alternate===null&&t(v,E),f=i(F,f,z),I===null?P=F:I.sibling=F,I=F,E=G}if(z===g.length)return n(v,E),ie&&en(v,z),P;if(E===null){for(;zz?(G=E,E=null):G=E.sibling;var Q=p(v,E,F.value,_);if(Q===null){E===null&&(E=G);break}e&&E&&Q.alternate===null&&t(v,E),f=i(Q,f,z),I===null?P=Q:I.sibling=Q,I=Q,E=G}if(F.done)return n(v,E),ie&&en(v,z),P;if(E===null){for(;!F.done;z++,F=g.next())F=d(v,F.value,_),F!==null&&(f=i(F,f,z),I===null?P=F:I.sibling=F,I=F);return ie&&en(v,z),P}for(E=r(v,E);!F.done;z++,F=g.next())F=y(E,v,z,F.value,_),F!==null&&(e&&F.alternate!==null&&E.delete(F.key===null?z:F.key),f=i(F,f,z),I===null?P=F:I.sibling=F,I=F);return e&&E.forEach(function(xe){return t(v,xe)}),ie&&en(v,z),P}function N(v,f,g,_){if(typeof g=="object"&&g!==null&&g.type===jn&&g.key===null&&(g=g.props.children),typeof g=="object"&&g!==null){switch(g.$$typeof){case nl:e:{for(var P=g.key,I=f;I!==null;){if(I.key===P){if(P=g.type,P===jn){if(I.tag===7){n(v,I.sibling),f=l(I,g.props.children),f.return=v,v=f;break e}}else if(I.elementType===P||typeof P=="object"&&P!==null&&P.$$typeof===Rt&&Va(P)===I.type){n(v,I.sibling),f=l(I,g.props),f.ref=ar(v,I,g),f.return=v,v=f;break e}n(v,I);break}else t(v,I);I=I.sibling}g.type===jn?(f=sn(g.props.children,v.mode,_,g.key),f.return=v,v=f):(_=Tl(g.type,g.key,g.props,null,v.mode,_),_.ref=ar(v,f,g),_.return=v,v=_)}return o(v);case kn:e:{for(I=g.key;f!==null;){if(f.key===I)if(f.tag===4&&f.stateNode.containerInfo===g.containerInfo&&f.stateNode.implementation===g.implementation){n(v,f.sibling),f=l(f,g.children||[]),f.return=v,v=f;break e}else{n(v,f);break}else t(v,f);f=f.sibling}f=Qi(g,v.mode,_),f.return=v,v=f}return o(v);case Rt:return I=g._init,N(v,f,I(g._payload),_)}if(fr(g))return x(v,f,g,_);if(rr(g))return S(v,f,g,_);pl(v,g)}return typeof g=="string"&&g!==""||typeof g=="number"?(g=""+g,f!==null&&f.tag===6?(n(v,f.sibling),f=l(f,g),f.return=v,v=f):(n(v,f),f=Ki(g,v.mode,_),f.return=v,v=f),o(v)):n(v,f)}return N}var Hn=Qc(!0),Yc=Qc(!1),Vl=Jt(null),Hl=null,Rn=null,Ns=null;function Cs(){Ns=Rn=Hl=null}function Es(e){var t=Vl.current;le(Vl),e._currentValue=t}function Io(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 Un(e,t){Hl=e,Ns=Rn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(De=!0),e.firstContext=null)}function et(e){var t=e._currentValue;if(Ns!==e)if(e={context:e,memoizedValue:t,next:null},Rn===null){if(Hl===null)throw Error(C(308));Rn=e,Hl.dependencies={lanes:0,firstContext:e}}else Rn=Rn.next=e;return t}var rn=null;function Ps(e){rn===null?rn=[e]:rn.push(e)}function Jc(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,Ps(t)):(n.next=l.next,l.next=n),t.interleaved=n,jt(e,r)}function jt(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 Mt=!1;function Ts(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Xc(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 wt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Wt(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,q&2){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,jt(e,n)}return l=r.interleaved,l===null?(t.next=t,Ps(r)):(t.next=l.next,l.next=t),r.interleaved=t,jt(e,n)}function kl(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,hs(e,n)}}function Ha(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var l=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?l=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?l=i=t:i=i.next=t}else l=i=t;n={baseState:r.baseState,firstBaseUpdate:l,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 ql(e,t,n,r){var l=e.updateQueue;Mt=!1;var i=l.firstBaseUpdate,o=l.lastBaseUpdate,u=l.shared.pending;if(u!==null){l.shared.pending=null;var a=u,c=a.next;a.next=null,o===null?i=c:o.next=c,o=a;var m=e.alternate;m!==null&&(m=m.updateQueue,u=m.lastBaseUpdate,u!==o&&(u===null?m.firstBaseUpdate=c:u.next=c,m.lastBaseUpdate=a))}if(i!==null){var d=l.baseState;o=0,m=c=a=null,u=i;do{var p=u.lane,y=u.eventTime;if((r&p)===p){m!==null&&(m=m.next={eventTime:y,lane:0,tag:u.tag,payload:u.payload,callback:u.callback,next:null});e:{var x=e,S=u;switch(p=t,y=n,S.tag){case 1:if(x=S.payload,typeof x=="function"){d=x.call(y,d,p);break e}d=x;break e;case 3:x.flags=x.flags&-65537|128;case 0:if(x=S.payload,p=typeof x=="function"?x.call(y,d,p):x,p==null)break e;d=ae({},d,p);break e;case 2:Mt=!0}}u.callback!==null&&u.lane!==0&&(e.flags|=64,p=l.effects,p===null?l.effects=[u]:p.push(u))}else y={eventTime:y,lane:p,tag:u.tag,payload:u.payload,callback:u.callback,next:null},m===null?(c=m=y,a=d):m=m.next=y,o|=p;if(u=u.next,u===null){if(u=l.shared.pending,u===null)break;p=u,u=p.next,p.next=null,l.lastBaseUpdate=p,l.shared.pending=null}}while(!0);if(m===null&&(a=d),l.baseState=a,l.firstBaseUpdate=c,l.lastBaseUpdate=m,t=l.shared.interleaved,t!==null){l=t;do o|=l.lane,l=l.next;while(l!==t)}else i===null&&(l.shared.lanes=0);dn|=o,e.lanes=o,e.memoizedState=d}}function qa(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Wi.transition;Wi.transition={};try{e(!1),t()}finally{X=n,Wi.transition=r}}function md(){return tt().memoizedState}function hh(e,t,n){var r=Ht(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},vd(e))gd(t,n);else if(n=Jc(e,t,n,r),n!==null){var l=Re();at(n,e,r,l),yd(n,t,r)}}function mh(e,t,n){var r=Ht(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(vd(e))gd(t,l);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,u=i(o,n);if(l.hasEagerState=!0,l.eagerState=u,ut(u,o)){var a=t.interleaved;a===null?(l.next=l,Ps(t)):(l.next=a.next,a.next=l),t.interleaved=l;return}}catch{}finally{}n=Jc(e,t,l,r),n!==null&&(l=Re(),at(n,e,r,l),yd(n,t,r))}}function vd(e){var t=e.alternate;return e===se||t!==null&&t===se}function gd(e,t){Sr=Kl=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function yd(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,hs(e,n)}}var Ql={readContext:et,useCallback:Ee,useContext:Ee,useEffect:Ee,useImperativeHandle:Ee,useInsertionEffect:Ee,useLayoutEffect:Ee,useMemo:Ee,useReducer:Ee,useRef:Ee,useState:Ee,useDebugValue:Ee,useDeferredValue:Ee,useTransition:Ee,useMutableSource:Ee,useSyncExternalStore:Ee,useId:Ee,unstable_isNewReconciler:!1},vh={readContext:et,useCallback:function(e,t){return ft().memoizedState=[e,t===void 0?null:t],e},useContext:et,useEffect:Ka,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Nl(4194308,4,cd.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Nl(4194308,4,e,t)},useInsertionEffect:function(e,t){return Nl(4,2,e,t)},useMemo:function(e,t){var n=ft();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=ft();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=hh.bind(null,se,e),[r.memoizedState,e]},useRef:function(e){var t=ft();return e={current:e},t.memoizedState=e},useState:Ga,useDebugValue:Fs,useDeferredValue:function(e){return ft().memoizedState=e},useTransition:function(){var e=Ga(!1),t=e[0];return e=ph.bind(null,e[1]),ft().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=se,l=ft();if(ie){if(n===void 0)throw Error(C(407));n=n()}else{if(n=t(),we===null)throw Error(C(349));cn&30||nd(r,t,n)}l.memoizedState=n;var i={value:n,getSnapshot:t};return l.queue=i,Ka(ld.bind(null,r,i,e),[e]),r.flags|=2048,Ur(9,rd.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=ft(),t=we.identifierPrefix;if(ie){var n=St,r=xt;n=(r&~(1<<32-st(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Fr++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[pt]=t,e[Or]=r,Pd(e,t,!1,!1),t.stateNode=e;e:{switch(o=fo(n,r),n){case"dialog":re("cancel",e),re("close",e),l=r;break;case"iframe":case"object":case"embed":re("load",e),l=r;break;case"video":case"audio":for(l=0;lKn&&(t.flags|=128,r=!0,ur(i,!1),t.lanes=4194304)}else{if(!r)if(e=Gl(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),ur(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!ie)return Pe(t),null}else 2*fe()-i.renderingStartTime>Kn&&n!==1073741824&&(t.flags|=128,r=!0,ur(i,!1),t.lanes=4194304);i.isBackwards?(o.sibling=t.child,t.child=o):(n=i.last,n!==null?n.sibling=o:t.child=o,i.last=o)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=fe(),t.sibling=null,n=oe.current,ne(oe,r?n&1|2:n&1),t):(Pe(t),null);case 22:case 23:return Ws(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?We&1073741824&&(Pe(t),t.subtreeFlags&6&&(t.flags|=8192)):Pe(t),null;case 24:return null;case 25:return null}throw Error(C(156,t.tag))}function jh(e,t){switch(ks(t),t.tag){case 1:return $e(t.type)&&Al(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return qn(),le(Fe),le(Ie),Rs(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Ls(t),null;case 13:if(le(oe),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(C(340));Vn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return le(oe),null;case 4:return qn(),null;case 10:return Es(t.type._context),null;case 22:case 23:return Ws(),null;case 24:return null;default:return null}}var ml=!1,Te=!1,Nh=typeof WeakSet=="function"?WeakSet:Set,O=null;function Mn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){ce(e,t,r)}else n.current=null}function Uo(e,t,n){try{n()}catch(r){ce(e,t,r)}}var iu=!1;function Ch(e,t){if(_o=Dl,e=zc(),ws(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 l=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,u=-1,a=-1,c=0,m=0,d=e,p=null;t:for(;;){for(var y;d!==n||l!==0&&d.nodeType!==3||(u=o+l),d!==i||r!==0&&d.nodeType!==3||(a=o+r),d.nodeType===3&&(o+=d.nodeValue.length),(y=d.firstChild)!==null;)p=d,d=y;for(;;){if(d===e)break t;if(p===n&&++c===l&&(u=o),p===i&&++m===r&&(a=o),(y=d.nextSibling)!==null)break;d=p,p=d.parentNode}d=y}n=u===-1||a===-1?null:{start:u,end:a}}else n=null}n=n||{start:0,end:0}}else n=null;for(ko={focusedElem:e,selectionRange:n},Dl=!1,O=t;O!==null;)if(t=O,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,O=e;else for(;O!==null;){t=O;try{var x=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var S=x.memoizedProps,N=x.memoizedState,v=t.stateNode,f=v.getSnapshotBeforeUpdate(t.elementType===t.type?S:lt(t.type,S),N);v.__reactInternalSnapshotBeforeUpdate=f}break;case 3:var g=t.stateNode.containerInfo;g.nodeType===1?g.textContent="":g.nodeType===9&&g.documentElement&&g.removeChild(g.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(C(163))}}catch(_){ce(t,t.return,_)}if(e=t.sibling,e!==null){e.return=t.return,O=e;break}O=t.return}return x=iu,iu=!1,x}function wr(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var i=l.destroy;l.destroy=void 0,i!==void 0&&Uo(t,n,i)}l=l.next}while(l!==r)}}function di(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 Ao(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 Ld(e){var t=e.alternate;t!==null&&(e.alternate=null,Ld(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[pt],delete t[Or],delete t[Co],delete t[ah],delete t[uh])),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 Rd(e){return e.tag===5||e.tag===3||e.tag===4}function ou(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Rd(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 bo(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=Ul));else if(r!==4&&(e=e.child,e!==null))for(bo(e,t,n),e=e.sibling;e!==null;)bo(e,t,n),e=e.sibling}function Bo(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(Bo(e,t,n),e=e.sibling;e!==null;)Bo(e,t,n),e=e.sibling}var ke=null,it=!1;function Lt(e,t,n){for(n=n.child;n!==null;)Md(e,t,n),n=n.sibling}function Md(e,t,n){if(ht&&typeof ht.onCommitFiberUnmount=="function")try{ht.onCommitFiberUnmount(ri,n)}catch{}switch(n.tag){case 5:Te||Mn(n,t);case 6:var r=ke,l=it;ke=null,Lt(e,t,n),ke=r,it=l,ke!==null&&(it?(e=ke,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):ke.removeChild(n.stateNode));break;case 18:ke!==null&&(it?(e=ke,n=n.stateNode,e.nodeType===8?Ai(e.parentNode,n):e.nodeType===1&&Ai(e,n),Tr(e)):Ai(ke,n.stateNode));break;case 4:r=ke,l=it,ke=n.stateNode.containerInfo,it=!0,Lt(e,t,n),ke=r,it=l;break;case 0:case 11:case 14:case 15:if(!Te&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var i=l,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&Uo(n,t,o),l=l.next}while(l!==r)}Lt(e,t,n);break;case 1:if(!Te&&(Mn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(u){ce(n,t,u)}Lt(e,t,n);break;case 21:Lt(e,t,n);break;case 22:n.mode&1?(Te=(r=Te)||n.memoizedState!==null,Lt(e,t,n),Te=r):Lt(e,t,n);break;default:Lt(e,t,n)}}function su(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Nh),t.forEach(function(r){var l=zh.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function rt(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=o),r&=~i}if(r=l,r=fe()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Ph(r/1960))-r,10e?16:e,Ft===null)var r=!1;else{if(e=Ft,Ft=null,Xl=0,q&6)throw Error(C(331));var l=q;for(q|=4,O=e.current;O!==null;){var i=O,o=i.child;if(O.flags&16){var u=i.deletions;if(u!==null){for(var a=0;afe()-bs?on(e,0):As|=n),Ue(e,t)}function bd(e,t){t===0&&(e.mode&1?(t=ol,ol<<=1,!(ol&130023424)&&(ol=4194304)):t=1);var n=Re();e=jt(e,t),e!==null&&(Vr(e,t,n),Ue(e,n))}function Oh(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),bd(e,n)}function zh(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(C(314))}r!==null&&r.delete(t),bd(e,n)}var Bd;Bd=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Fe.current)De=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return De=!1,_h(e,t,n);De=!!(e.flags&131072)}else De=!1,ie&&t.flags&1048576&&qc(t,Wl,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Cl(e,t),e=t.pendingProps;var l=Wn(t,Ie.current);Un(t,n),l=Os(null,t,r,e,l,n);var i=zs();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,$e(r)?(i=!0,bl(t)):i=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,Ts(t),l.updater=ci,t.stateNode=l,l._reactInternals=t,Ro(t,r,e,n),t=zo(null,t,r,!0,i,n)):(t.tag=0,ie&&i&&_s(t),Le(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Cl(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=Fh(r),e=lt(r,e),l){case 0:t=Oo(null,t,r,e,n);break e;case 1:t=nu(null,t,r,e,n);break e;case 11:t=eu(null,t,r,e,n);break e;case 14:t=tu(null,t,r,lt(r.type,e),n);break e}throw Error(C(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:lt(r,l),Oo(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:lt(r,l),nu(e,t,r,l,n);case 3:e:{if(Nd(t),e===null)throw Error(C(387));r=t.pendingProps,i=t.memoizedState,l=i.element,Xc(e,t),ql(t,r,null,n);var o=t.memoizedState;if(r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){l=Gn(Error(C(423)),t),t=ru(e,t,r,n,l);break e}else if(r!==l){l=Gn(Error(C(424)),t),t=ru(e,t,r,n,l);break e}else for(Ve=Bt(t.stateNode.containerInfo.firstChild),He=t,ie=!0,ot=null,n=Yc(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Vn(),r===l){t=Nt(e,t,n);break e}Le(e,t,r,n)}t=t.child}return t;case 5:return Zc(t),e===null&&To(t),r=t.type,l=t.pendingProps,i=e!==null?e.memoizedProps:null,o=l.children,jo(r,l)?o=null:i!==null&&jo(r,i)&&(t.flags|=32),jd(e,t),Le(e,t,o,n),t.child;case 6:return e===null&&To(t),null;case 13:return Cd(e,t,n);case 4:return Is(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Hn(t,null,r,n):Le(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:lt(r,l),eu(e,t,r,l,n);case 7:return Le(e,t,t.pendingProps,n),t.child;case 8:return Le(e,t,t.pendingProps.children,n),t.child;case 12:return Le(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,i=t.memoizedProps,o=l.value,ne(Vl,r._currentValue),r._currentValue=o,i!==null)if(ut(i.value,o)){if(i.children===l.children&&!Fe.current){t=Nt(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var u=i.dependencies;if(u!==null){o=i.child;for(var a=u.firstContext;a!==null;){if(a.context===r){if(i.tag===1){a=wt(-1,n&-n),a.tag=2;var c=i.updateQueue;if(c!==null){c=c.shared;var m=c.pending;m===null?a.next=a:(a.next=m.next,m.next=a),c.pending=a}}i.lanes|=n,a=i.alternate,a!==null&&(a.lanes|=n),Io(i.return,n,t),u.lanes|=n;break}a=a.next}}else if(i.tag===10)o=i.type===t.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(C(341));o.lanes|=n,u=o.alternate,u!==null&&(u.lanes|=n),Io(o,n,t),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===t){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}Le(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,Un(t,n),l=et(l),r=r(l),t.flags|=1,Le(e,t,r,n),t.child;case 14:return r=t.type,l=lt(r,t.pendingProps),l=lt(r.type,l),tu(e,t,r,l,n);case 15:return _d(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:lt(r,l),Cl(e,t),t.tag=1,$e(r)?(e=!0,bl(t)):e=!1,Un(t,n),xd(t,r,l),Ro(t,r,l,n),zo(null,t,r,!0,e,n);case 19:return Ed(e,t,n);case 22:return kd(e,t,n)}throw Error(C(156,t.tag))};function Wd(e,t){return vc(e,t)}function Dh(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 Xe(e,t,n,r){return new Dh(e,t,n,r)}function Hs(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Fh(e){if(typeof e=="function")return Hs(e)?1:0;if(e!=null){if(e=e.$$typeof,e===cs)return 11;if(e===ds)return 14}return 2}function qt(e,t){var n=e.alternate;return n===null?(n=Xe(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 Tl(e,t,n,r,l,i){var o=2;if(r=e,typeof e=="function")Hs(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case jn:return sn(n.children,l,i,t);case us:o=8,l|=8;break;case to:return e=Xe(12,n,t,l|2),e.elementType=to,e.lanes=i,e;case no:return e=Xe(13,n,t,l),e.elementType=no,e.lanes=i,e;case ro:return e=Xe(19,n,t,l),e.elementType=ro,e.lanes=i,e;case Zu:return pi(n,l,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Ju:o=10;break e;case Xu:o=9;break e;case cs:o=11;break e;case ds:o=14;break e;case Rt:o=16,r=null;break e}throw Error(C(130,e==null?e:typeof e,""))}return t=Xe(o,n,t,l),t.elementType=e,t.type=r,t.lanes=i,t}function sn(e,t,n,r){return e=Xe(7,e,r,t),e.lanes=n,e}function pi(e,t,n,r){return e=Xe(22,e,r,t),e.elementType=Zu,e.lanes=n,e.stateNode={isHidden:!1},e}function Ki(e,t,n){return e=Xe(6,e,null,t),e.lanes=n,e}function Qi(e,t,n){return t=Xe(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function $h(e,t,n,r,l){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=Ti(0),this.expirationTimes=Ti(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ti(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function qs(e,t,n,r,l,i,o,u,a){return e=new $h(e,t,n,u,a),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Xe(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ts(i),e}function Uh(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Gd)}catch(e){console.error(e)}}Gd(),Gu.exports=Ge;var Vh=Gu.exports,Kd,mu=Vh;Kd=mu.createRoot,mu.hydrateRoot;/** * @remix-run/router v1.23.2 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function br(){return br=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function Ys(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function qh(){return Math.random().toString(36).substr(2,8)}function gu(e,t){return{usr:e.state,key:e.key,idx:t}}function Go(e,t,n,r){return n===void 0&&(n=null),br({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Xn(t):t,{state:n,key:t&&t.key||r||qh()})}function ti(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function Xn(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function Gh(e,t,n,r){r===void 0&&(r={});let{window:l=document.defaultView,v5Compat:i=!1}=r,o=l.history,u=$t.Pop,a=null,c=m();c==null&&(c=0,o.replaceState(br({},o.state,{idx:c}),""));function m(){return(o.state||{idx:null}).idx}function d(){u=$t.Pop;let N=m(),v=N==null?null:N-c;c=N,a&&a({action:u,location:S.location,delta:v})}function p(N,v){u=$t.Push;let f=Go(S.location,N,v);c=m()+1;let g=gu(f,c),_=S.createHref(f);try{o.pushState(g,"",_)}catch(P){if(P instanceof DOMException&&P.name==="DataCloneError")throw P;l.location.assign(_)}i&&a&&a({action:u,location:S.location,delta:1})}function y(N,v){u=$t.Replace;let f=Go(S.location,N,v);c=m();let g=gu(f,c),_=S.createHref(f);o.replaceState(g,"",_),i&&a&&a({action:u,location:S.location,delta:0})}function x(N){let v=l.location.origin!=="null"?l.location.origin:l.location.href,f=typeof N=="string"?N:ti(N);return f=f.replace(/ $/,"%20"),pe(v,"No window.location.(origin|href) available to create URL for href: "+f),new URL(f,v)}let S={get action(){return u},get location(){return e(l,o)},listen(N){if(a)throw new Error("A history only accepts one active listener");return l.addEventListener(vu,d),a=N,()=>{l.removeEventListener(vu,d),a=null}},createHref(N){return t(l,N)},createURL:x,encodeLocation(N){let v=x(N);return{pathname:v.pathname,search:v.search,hash:v.hash}},push:p,replace:y,go(N){return o.go(N)}};return S}var yu;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(yu||(yu={}));function Kh(e,t,n){return n===void 0&&(n="/"),Qh(e,t,n)}function Qh(e,t,n,r){let l=typeof t=="string"?Xn(t):t,i=Js(l.pathname||"/",n);if(i==null)return null;let o=Qd(e);Yh(o);let u=null;for(let a=0;u==null&&a{let a={relativePath:u===void 0?i.path||"":u,caseSensitive:i.caseSensitive===!0,childrenIndex:o,route:i};a.relativePath.startsWith("/")&&(pe(a.relativePath.startsWith(r),'Absolute route path "'+a.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),a.relativePath=a.relativePath.slice(r.length));let c=Gt([r,a.relativePath]),m=n.concat(a);i.children&&i.children.length>0&&(pe(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+c+'".')),Qd(i.children,t,m,c)),!(i.path==null&&!i.index)&&t.push({path:c,score:rm(c,i.index),routesMeta:m})};return e.forEach((i,o)=>{var u;if(i.path===""||!((u=i.path)!=null&&u.includes("?")))l(i,o);else for(let a of Yd(i.path))l(i,o,a)}),t}function Yd(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,l=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return l?[i,""]:[i];let o=Yd(r.join("/")),u=[];return u.push(...o.map(a=>a===""?i:[i,a].join("/"))),l&&u.push(...o),u.map(a=>e.startsWith("/")&&a===""?"/":a)}function Yh(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:lm(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const Jh=/^:[\w-]+$/,Xh=3,Zh=2,em=1,tm=10,nm=-2,xu=e=>e==="*";function rm(e,t){let n=e.split("/"),r=n.length;return n.some(xu)&&(r+=nm),t&&(r+=Zh),n.filter(l=>!xu(l)).reduce((l,i)=>l+(Jh.test(i)?Xh:i===""?em:tm),r)}function lm(e,t){return e.length===t.length&&e.slice(0,-1).every((r,l)=>r===t[l])?e[e.length-1]-t[t.length-1]:0}function im(e,t,n){let{routesMeta:r}=e,l={},i="/",o=[];for(let u=0;u{let{paramName:p,isOptional:y}=m;if(p==="*"){let S=u[d]||"";o=i.slice(0,i.length-S.length).replace(/(.)\/+$/,"$1")}const x=u[d];return y&&!x?c[p]=void 0:c[p]=(x||"").replace(/%2F/g,"/"),c},{}),pathname:i,pathnameBase:o,pattern:e}}function sm(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),Ys(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],l="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,u,a)=>(r.push({paramName:u,isOptional:a!=null}),a?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),l+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?l+="\\/*$":e!==""&&e!=="/"&&(l+="(?:(?=\\/|$))"),[new RegExp(l,t?void 0:"i"),r]}function am(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Ys(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function Js(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}const um=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,cm=e=>um.test(e);function dm(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:l=""}=typeof e=="string"?Xn(e):e,i;if(n)if(cm(n))i=n;else{if(n.includes("//")){let o=n;n=n.replace(/\/\/+/g,"/"),Ys(!1,"Pathnames cannot have embedded double slashes - normalizing "+(o+" -> "+n))}n.startsWith("/")?i=Su(n.substring(1),"/"):i=Su(n,t)}else i=t;return{pathname:i,search:hm(r),hash:mm(l)}}function Su(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(l=>{l===".."?n.length>1&&n.pop():l!=="."&&n.push(l)}),n.length>1?n.join("/"):"/"}function Yi(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function fm(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Xs(e,t){let n=fm(e);return t?n.map((r,l)=>l===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function Zs(e,t,n,r){r===void 0&&(r=!1);let l;typeof e=="string"?l=Xn(e):(l=br({},e),pe(!l.pathname||!l.pathname.includes("?"),Yi("?","pathname","search",l)),pe(!l.pathname||!l.pathname.includes("#"),Yi("#","pathname","hash",l)),pe(!l.search||!l.search.includes("#"),Yi("#","search","hash",l)));let i=e===""||l.pathname==="",o=i?"/":l.pathname,u;if(o==null)u=n;else{let d=t.length-1;if(!r&&o.startsWith("..")){let p=o.split("/");for(;p[0]==="..";)p.shift(),d-=1;l.pathname=p.join("/")}u=d>=0?t[d]:"/"}let a=dm(l,u),c=o&&o!=="/"&&o.endsWith("/"),m=(i||o===".")&&n.endsWith("/");return!a.pathname.endsWith("/")&&(c||m)&&(a.pathname+="/"),a}const Gt=e=>e.join("/").replace(/\/\/+/g,"/"),pm=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),hm=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,mm=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function vm(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const Jd=["post","put","patch","delete"];new Set(Jd);const gm=["get",...Jd];new Set(gm);/** * React Router v6.30.3 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function Br(){return Br=Object.assign?Object.assign.bind():function(e){for(var t=1;t{u.current=!0}),h.useCallback(function(c,m){if(m===void 0&&(m={}),!u.current)return;if(typeof c=="number"){r.go(c);return}let d=Zs(c,JSON.parse(o),i,m.relative==="path");e==null&&t!=="/"&&(d.pathname=d.pathname==="/"?t:Gt([t,d.pathname])),(m.replace?r.replace:r.push)(d,m.state,m)},[t,r,o,i,e])}function ef(){let{matches:e}=h.useContext(Et),t=e[e.length-1];return t?t.params:{}}function tf(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=h.useContext(Zt),{matches:l}=h.useContext(Et),{pathname:i}=mn(),o=JSON.stringify(Xs(l,r.v7_relativeSplatPath));return h.useMemo(()=>Zs(e,JSON.parse(o),i,n==="path"),[e,o,i,n])}function wm(e,t){return _m(e,t)}function _m(e,t,n,r){Zn()||pe(!1);let{navigator:l}=h.useContext(Zt),{matches:i}=h.useContext(Et),o=i[i.length-1],u=o?o.params:{};o&&o.pathname;let a=o?o.pathnameBase:"/";o&&o.route;let c=mn(),m;if(t){var d;let N=typeof t=="string"?Xn(t):t;a==="/"||(d=N.pathname)!=null&&d.startsWith(a)||pe(!1),m=N}else m=c;let p=m.pathname||"/",y=p;if(a!=="/"){let N=a.replace(/^\//,"").split("/");y="/"+p.replace(/^\//,"").split("/").slice(N.length).join("/")}let x=Kh(e,{pathname:y}),S=Em(x&&x.map(N=>Object.assign({},N,{params:Object.assign({},u,N.params),pathname:Gt([a,l.encodeLocation?l.encodeLocation(N.pathname).pathname:N.pathname]),pathnameBase:N.pathnameBase==="/"?a:Gt([a,l.encodeLocation?l.encodeLocation(N.pathnameBase).pathname:N.pathnameBase])})),i,n,r);return t&&S?h.createElement(yi.Provider,{value:{location:Br({pathname:"/",search:"",hash:"",state:null,key:"default"},m),navigationType:$t.Pop}},S):S}function km(){let e=Lm(),t=vm(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,l={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return h.createElement(h.Fragment,null,h.createElement("h2",null,"Unexpected Application Error!"),h.createElement("h3",{style:{fontStyle:"italic"}},t),n?h.createElement("pre",{style:l},n):null,null)}const jm=h.createElement(km,null);class Nm extends h.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?h.createElement(Et.Provider,{value:this.props.routeContext},h.createElement(Xd.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Cm(e){let{routeContext:t,match:n,children:r}=e,l=h.useContext(ea);return l&&l.static&&l.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(l.staticContext._deepestRenderedBoundaryId=n.route.id),h.createElement(Et.Provider,{value:t},r)}function Em(e,t,n,r){var l;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var i;if(!n)return null;if(n.errors)e=n.matches;else if((i=r)!=null&&i.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,u=(l=n)==null?void 0:l.errors;if(u!=null){let m=o.findIndex(d=>d.route.id&&(u==null?void 0:u[d.route.id])!==void 0);m>=0||pe(!1),o=o.slice(0,Math.min(o.length,m+1))}let a=!1,c=-1;if(n&&r&&r.v7_partialHydration)for(let m=0;m=0?o=o.slice(0,c+1):o=[o[0]];break}}}return o.reduceRight((m,d,p)=>{let y,x=!1,S=null,N=null;n&&(y=u&&d.route.id?u[d.route.id]:void 0,S=d.route.errorElement||jm,a&&(c<0&&p===0?(Mm("route-fallback"),x=!0,N=null):c===p&&(x=!0,N=d.route.hydrateFallbackElement||null)));let v=t.concat(o.slice(0,p+1)),f=()=>{let g;return y?g=S:x?g=N:d.route.Component?g=h.createElement(d.route.Component,null):d.route.element?g=d.route.element:g=m,h.createElement(Cm,{match:d,routeContext:{outlet:m,matches:v,isDataRoute:n!=null},children:g})};return n&&(d.route.ErrorBoundary||d.route.errorElement||p===0)?h.createElement(Nm,{location:n.location,revalidation:n.revalidation,component:S,error:y,children:f(),routeContext:{outlet:null,matches:v,isDataRoute:!0}}):f()},null)}var nf=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(nf||{}),rf=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(rf||{});function Pm(e){let t=h.useContext(ea);return t||pe(!1),t}function Tm(e){let t=h.useContext(ym);return t||pe(!1),t}function Im(e){let t=h.useContext(Et);return t||pe(!1),t}function lf(e){let t=Im(),n=t.matches[t.matches.length-1];return n.route.id||pe(!1),n.route.id}function Lm(){var e;let t=h.useContext(Xd),n=Tm(),r=lf();return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function Rm(){let{router:e}=Pm(nf.UseNavigateStable),t=lf(rf.UseNavigateStable),n=h.useRef(!1);return Zd(()=>{n.current=!0}),h.useCallback(function(l,i){i===void 0&&(i={}),n.current&&(typeof l=="number"?e.navigate(l):e.navigate(l,Br({fromRouteId:t},i)))},[e,t])}const wu={};function Mm(e,t,n){wu[e]||(wu[e]=!0)}function Om(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function of(e){let{to:t,replace:n,state:r,relative:l}=e;Zn()||pe(!1);let{future:i,static:o}=h.useContext(Zt),{matches:u}=h.useContext(Et),{pathname:a}=mn(),c=ta(),m=Zs(t,Xs(u,i.v7_relativeSplatPath),a,l==="path"),d=JSON.stringify(m);return h.useEffect(()=>c(JSON.parse(d),{replace:n,state:r,relative:l}),[c,d,l,n,r]),null}function _n(e){pe(!1)}function zm(e){let{basename:t="/",children:n=null,location:r,navigationType:l=$t.Pop,navigator:i,static:o=!1,future:u}=e;Zn()&&pe(!1);let a=t.replace(/^\/*/,"/"),c=h.useMemo(()=>({basename:a,navigator:i,static:o,future:Br({v7_relativeSplatPath:!1},u)}),[a,u,i,o]);typeof r=="string"&&(r=Xn(r));let{pathname:m="/",search:d="",hash:p="",state:y=null,key:x="default"}=r,S=h.useMemo(()=>{let N=Js(m,a);return N==null?null:{location:{pathname:N,search:d,hash:p,state:y,key:x},navigationType:l}},[a,m,d,p,y,x,l]);return S==null?null:h.createElement(Zt.Provider,{value:c},h.createElement(yi.Provider,{children:n,value:S}))}function Dm(e){let{children:t,location:n}=e;return wm(Ko(t),n)}new Promise(()=>{});function Ko(e,t){t===void 0&&(t=[]);let n=[];return h.Children.forEach(e,(r,l)=>{if(!h.isValidElement(r))return;let i=[...t,l];if(r.type===h.Fragment){n.push.apply(n,Ko(r.props.children,i));return}r.type!==_n&&pe(!1),!r.props.index||!r.props.children||pe(!1);let o={id:r.props.id||i.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=Ko(r.props.children,i)),n.push(o)}),n}/** * React Router DOM v6.30.3 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function Qo(){return Qo=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(n[l]=e[l]);return n}function $m(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Um(e,t){return e.button===0&&(!t||t==="_self")&&!$m(e)}const Am=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],bm="6";try{window.__reactRouterVersion=bm}catch{}const Bm="startTransition",_u=Mf[Bm];function Wm(e){let{basename:t,children:n,future:r,window:l}=e,i=h.useRef();i.current==null&&(i.current=Hh({window:l,v5Compat:!0}));let o=i.current,[u,a]=h.useState({action:o.action,location:o.location}),{v7_startTransition:c}=r||{},m=h.useCallback(d=>{c&&_u?_u(()=>a(d)):a(d)},[a,c]);return h.useLayoutEffect(()=>o.listen(m),[o,m]),h.useEffect(()=>Om(r),[r]),h.createElement(zm,{basename:t,children:n,location:u.location,navigationType:u.action,navigator:o,future:r})}const Vm=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Hm=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,bn=h.forwardRef(function(t,n){let{onClick:r,relative:l,reloadDocument:i,replace:o,state:u,target:a,to:c,preventScrollReset:m,viewTransition:d}=t,p=Fm(t,Am),{basename:y}=h.useContext(Zt),x,S=!1;if(typeof c=="string"&&Hm.test(c)&&(x=c,Vm))try{let g=new URL(window.location.href),_=c.startsWith("//")?new URL(g.protocol+c):new URL(c),P=Js(_.pathname,y);_.origin===g.origin&&P!=null?c=P+_.search+_.hash:S=!0}catch{}let N=xm(c,{relative:l}),v=qm(c,{replace:o,state:u,target:a,preventScrollReset:m,relative:l,viewTransition:d});function f(g){r&&r(g),g.defaultPrevented||v(g)}return h.createElement("a",Qo({},p,{href:x||N,onClick:S||i?r:f,ref:n,target:a}))});var ku;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(ku||(ku={}));var ju;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(ju||(ju={}));function qm(e,t){let{target:n,replace:r,state:l,preventScrollReset:i,relative:o,viewTransition:u}=t===void 0?{}:t,a=ta(),c=mn(),m=tf(e,{relative:o});return h.useCallback(d=>{if(Um(d,n)){d.preventDefault();let p=r!==void 0?r:ti(c)===ti(m);a(e,{replace:p,state:l,preventScrollReset:i,relative:o,viewTransition:u})}},[c,a,m,r,l,n,e,i,o,u])}function Gm(e){switch(e){case"complete":return"status-badge status-complete";case"scripted":return"status-badge status-scripted";default:return"status-badge status-draft"}}function Km(){const e=ta(),[t,n]=h.useState([]),[r,l]=h.useState(!0),[i,o]=h.useState(null),[u,a]=h.useState(!1),[c,m]=h.useState(""),[d,p]=h.useState(!1);h.useEffect(()=>{fetch("/api/videos").then(x=>x.json()).then(x=>n(x.videos||[])).catch(x=>o(x.message)).finally(()=>l(!1))},[]);async function y(x){if(x.preventDefault(),!!c.trim()){p(!0);try{const S=await fetch("/api/videos",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:c.trim()})});if(!S.ok)throw new Error("Failed");const N=await S.json();e(`/videos/${N.video.id}/edit`)}catch(S){alert(S.message)}finally{p(!1)}}}return s.jsxs("div",{className:"page",children:[s.jsxs("div",{className:"page-header",children:[s.jsx("span",{className:"page-title",children:"VIDEO LIBRARY"}),s.jsx("button",{onClick:()=>{a(!0),m("")},className:"btn-red",children:"+ NEW"})]}),r&&s.jsx("p",{className:"muted",children:"LOADING..."}),i&&s.jsxs("p",{className:"error-text",children:["ERROR: ",i]}),!r&&!i&&s.jsxs("table",{className:"data-table",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{className:"th",children:"ID"}),s.jsx("th",{className:"th",children:"TITLE"}),s.jsx("th",{className:"th",children:"STATUS"}),s.jsx("th",{className:"th",children:"SLIDES"}),s.jsx("th",{className:"th",children:"ACTIONS"})]})}),s.jsxs("tbody",{children:[t.map((x,S)=>s.jsxs("tr",{className:S%2===0?"tr-even":"tr-odd",children:[s.jsx("td",{className:"td td-id",children:x.id.slice(0,8)}),s.jsxs("td",{className:"td",children:[s.jsx(bn,{to:`/videos/${x.id}/edit`,children:x.title||"???"}),x.course_code&&s.jsxs("span",{className:"td-course",children:["[",x.course_code,"]"]})]}),s.jsx("td",{className:"td",children:s.jsx("span",{className:Gm(x.status),children:(x.status||"DRAFT").toUpperCase()})}),s.jsx("td",{className:"td td-count",children:x.slide_count??0}),s.jsxs("td",{className:"td",children:[s.jsx(bn,{to:`/videos/${x.id}/edit`,className:"action",children:"EDIT"})," ",s.jsx("a",{href:`/api/videos/${x.id}/export`,target:"_blank",rel:"noreferrer",className:"action-muted",children:"JSON"})]})]},x.id)),t.length===0&&s.jsx("tr",{children:s.jsx("td",{colSpan:5,className:"td td-id",style:{padding:"2rem 0.75rem"},children:"NO VIDEOS FOUND."})})]})]}),u&&s.jsx("div",{className:"overlay",onClick:()=>a(!1),children:s.jsxs("div",{className:"modal-sm",onClick:x=>x.stopPropagation(),children:[s.jsx("div",{className:"modal-title",children:"NEW PRESENTATION"}),s.jsxs("form",{onSubmit:y,children:[s.jsx("input",{value:c,onChange:x=>m(x.target.value),placeholder:"TITLE...",className:"modal-input",autoFocus:!0,required:!0}),s.jsxs("div",{style:{display:"flex",gap:10,marginTop:16,justifyContent:"flex-end"},children:[s.jsx("button",{type:"button",onClick:()=>a(!1),className:"btn-ghost",children:"CANCEL"}),s.jsx("button",{type:"submit",disabled:d||!c.trim(),className:"btn-red",style:{opacity:d||!c.trim()?.4:1},children:d?"WAIT...":"CREATE >"})]})]})]})})]})}var Qm=Object.defineProperty,Ym=(e,t,n)=>t in e?Qm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Jm=(e,t,n)=>Ym(e,t+"",n);function Yo(e){return e==="mobile-portrait"?"horizontal":"vertical"}function Xm({baselineIndex:e,dragDistance:t,totalCandidates:n,dragSpan:r}){if(n<=1)return 0;const l=Math.max(r,120),i=l*.25,o=Math.abs(t),u=Math.sign(t),a=ou.id===n.id);return s.jsxs("div",{className:`carousel-hud ${r?"carousel-hud--inspect":""}`,"aria-live":"polite",children:[s.jsx("div",{className:"carousel-hud__track","aria-label":"Glitch slide candidates",children:e.map((u,a)=>s.jsx("span",{className:`carousel-hud__dot ${u.id===n.id?"carousel-hud__dot--active":""}`,title:`${u.id} (${Math.round(u.score*100)} score)`,children:a+1},u.id))}),r?s.jsxs("div",{className:"carousel-hud__detail",children:[s.jsxs("div",{className:"carousel-hud__header",children:[s.jsx("span",{children:t==="fullscreen"?"Fullscreen":"Square"}),s.jsx("span",{children:l?"Browsing alternates":"Inspecting"})]}),n.authorName?s.jsxs("p",{className:"carousel-hud__author",children:["By ",n.authorName]}):null,s.jsxs("div",{className:"carousel-hud__footer",children:[s.jsx("strong",{children:n.id}),s.jsxs("span",{children:[o+1,"/",e.length]})]})]}):null]})}function tv({pauseMode:e,pendingVote:t,onResume:n,onPause:r}){const l=e==="playing",i=l?"Pause playback":t?"Resume playback and record vote":"Resume playback";return s.jsx("div",{className:"resume-control",children:s.jsx("button",{type:"button",className:"resume-control__button","aria-label":i,title:i,onClick:l?r:n,children:s.jsx("span",{className:`resume-control__icon ${l?"resume-control__icon--pause":"resume-control__icon--play"}`,"aria-hidden":"true"})})})}const Nu=new Map,sf={ChartSingle:()=>Promise.resolve().then(()=>Rv),DefinitionCard:()=>Promise.resolve().then(()=>Ov),EquationFocus:()=>Promise.resolve().then(()=>$v),FullscreenSplit:()=>Promise.resolve().then(()=>Av),FullscreenVideo:()=>Promise.resolve().then(()=>Bv),FullscreenVideoCenterCaption:()=>Promise.resolve().then(()=>Vv),FullscreenVideoTitle:()=>Promise.resolve().then(()=>Gv),GlitchComponentFrame:()=>Promise.resolve().then(()=>Zv),ProcessFlow:()=>Promise.resolve().then(()=>ng),QuoteImage:()=>Promise.resolve().then(()=>lg),SquareVideo:()=>Promise.resolve().then(()=>og),SquareYellow:()=>Promise.resolve().then(()=>ag)};function af(e,t){const n=Nu.get(t);if(n)return n;const r=e[t];if(!r)return Promise.reject(new Error(`Unknown slide component: ${t}`));const l=r();return Nu.set(t,l),l}async function Cu(e,t){const n=new Set;t.forEach(r=>{r.glitchSlides.forEach(l=>{n.add(l.componentKey)})}),await Promise.allSettled([...n].map(r=>af(e,r)))}class nv extends h.Component{constructor(){super(...arguments),Jm(this,"state",{hasError:!1})}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,n){console.error("Slide runtime crashed",t,n)}componentDidUpdate(t){t.children!==this.props.children&&this.state.hasError&&this.setState({hasError:!1})}render(){return this.state.hasError?this.props.fallback:this.props.children}}function Il({reason:e}){return s.jsxs("article",{className:"fallback-slide",children:[s.jsx("p",{className:"eyebrow",children:"Fallback slide"}),s.jsx("h3",{children:"Component unavailable"}),s.jsx("p",{children:"The player kept running even though this candidate could not render."}),e?s.jsx("code",{children:e}):null]})}function Jo({lectureId:e,slide:t,glitchSlide:n,slideRegistry:r,paused:l,onMediaLoadingChange:i}){const[o,u]=h.useState(null),[a,c]=h.useState(null);h.useEffect(()=>{let d=!1;return c(null),u(null),af(r,n.componentKey).then(p=>{d||(c(null),u(()=>p.default))}).catch(p=>{d||(u(null),c(p instanceof Error?p.message:"Failed to load slide component."))}),()=>{d=!0}},[n.componentKey,r]);const m={lectureId:e,slideId:t.id,glitchSlideId:n.id,displayMode:t.displayMode,props:n.props,latexString:n.latexString,paused:l,onMediaLoadingChange:i};return s.jsx(nv,{fallback:s.jsx(Il,{reason:a}),children:o?s.jsx(o,{...m}):a?s.jsx(Il,{reason:a}):s.jsx(Il,{reason:"Loading candidate module..."})})}function rv({lectureId:e,slide:t,glitchSlide:n,candidates:r,slideRegistry:l,paused:i,isInspecting:o,isSettling:u,viewportMode:a,dragBaselineGlitchSlideId:c,dragOffsetPx:m,onMediaLoadingChange:d}){const p=Yo(a),y=r.findIndex(g=>g.id===n.id),x=r.findIndex(g=>g.id===c),S=r.length>1,N=o&&x!==-1?x:Math.max(y,0),v=o?m:0,f=p==="horizontal"?`translate3d(calc(${-N*100}% + ${v}px), 0, 0)`:`translate3d(0, calc(${-N*100}% + ${v}px), 0)`;return s.jsx("div",{className:`slide-host slide-host--${t.displayMode} ${o?"slide-host--inspect":""}`,"data-testid":`slide-host-${t.displayMode}`,children:S?s.jsx("div",{className:"slide-host__viewport",children:s.jsx("div",{className:`slide-host__track slide-host__track--${p} ${u?"slide-host__track--settling":""}`,style:{transform:f},children:r.map(g=>s.jsx("div",{className:`slide-host__item ${g.id===n.id?"slide-host__item--active":""}`,children:s.jsx(Jo,{lectureId:e,slide:t,glitchSlide:g,slideRegistry:l,paused:i||g.id!==n.id,onMediaLoadingChange:g.id===n.id?d:void 0})},g.id))})}):s.jsx(Jo,{lectureId:e,slide:t,glitchSlide:n,slideRegistry:l,paused:i,onMediaLoadingChange:d})})}function Eu(e,t){return Math.min(t,Math.max(0,e))}function lv(e,t){for(const n of e)if(t>=n.startTimeSec&&tr.id===t);return n===-1?null:e[n+1]??null}function ov(e,t){return Math.min(e.durationSec,Math.max(0,t-e.startTimeSec))}function sv(e,t,n){var r;const l=e.findIndex(o=>o.id===t);if(l===-1)return n;const i=e[l];return i.endTimeSec!=null?i.endTimeSec:((r=e[l+1])==null?void 0:r.startTimeSec)??n}function Xo(e,t,n){for(const r of e){if(r.startTimeSec==null)continue;const l=sv(e,r.id,n);if(t>=r.startTimeSec&&tl.orientation===t);if(n.length>0)return n;const r=e.glitchSlides.filter(l=>!l.orientation||l.orientation==="any");return r.length>0?r:e.glitchSlides}function ra(e,t,n){const r=na(e,t);if(n){const l=r.find(i=>i.id===n);if(l)return l}return[...r].sort((l,i)=>i.score-l.score)[0]}function av(e,t,n,r){const l=Xo(e,t,n),i=l?e.findIndex(o=>o.id===l.id):-1;return e.slice(i+1,i+1+r)}function Pu(e,t){try{const n=e.play();n&&typeof n.catch=="function"&&n.catch(()=>{t()})}catch{t()}}function uv({segment:e,nextSegment:t,globalTimeSec:n,lectureDurationSec:r,pauseMode:l,viewportMode:i,onGlobalTimeChange:o,onSegmentError:u,onAutoplayBlocked:a,onTogglePlayback:c}){const m=h.useRef(null),d=h.useRef(0),p=e?ov(e,n):0;return h.useEffect(()=>{const y=m.current;!y||!e||Math.abs(y.currentTime-p)>.45&&(y.currentTime=p,d.current=p)},[p,e==null?void 0:e.id]),h.useEffect(()=>{const y=m.current;if(y){if(l==="playing"){Pu(y,a);return}y.pause()}},[a,l,e==null?void 0:e.id]),e?s.jsxs("div",{className:`video-stage video-stage--${i}`,children:[s.jsxs("div",{className:"video-stage__window",role:"button",tabIndex:0,"aria-label":l==="playing"?"Pause video":"Resume video",onClick:c,onKeyDown:y=>{(y.key===" "||y.key==="Enter")&&(y.preventDefault(),c())},children:[s.jsx("video",{ref:m,className:"video-stage__video",preload:"auto",autoPlay:!0,muted:!0,playsInline:!0,controls:!1,poster:e.poster,src:e.src,onLoadedMetadata:y=>{const x=y.currentTarget;x.currentTime=p,d.current=p,l==="playing"&&Pu(x,a)},onTimeUpdate:y=>{const x=y.currentTarget,S=Math.min(x.currentTime,e.durationSec);d.current=S,o(e.startTimeSec+S),S>=e.durationSec-.08&&e.startTimeSec+e.durationSec{o(e.startTimeSec+e.durationSec)},onError:()=>{u(`Failed to load ${e.id}. Retry by resuming playback.`)}},e.id),s.jsxs("div",{className:"video-stage__meta",children:[s.jsx("span",{children:e.id}),s.jsxs("span",{children:[Math.min(d.current,e.durationSec).toFixed(1)," /"," ",e.durationSec.toFixed(1),"s"]})]})]}),s.jsxs("div",{className:"video-stage__next",children:[s.jsx("span",{children:"Up next"}),s.jsx("strong",{children:(t==null?void 0:t.id)??"End of lecture"})]})]}):s.jsx("div",{className:`video-stage video-stage--${i}`,children:s.jsxs("div",{className:"video-stage__placeholder",children:[s.jsx("p",{className:"eyebrow",children:"Video pending"}),s.jsx("p",{children:"No active segment is available at this lecture time."})]})})}function vt(e,t){console.log("[player-event]",t),e==null||e(t)}const Tu=new Set;function Zo(e){if(typeof document>"u"||Tu.has(e.id))return;const t=document.createElement("video");t.preload="metadata",t.src=e.src,Tu.add(e.id)}function cv(e){e.forEach(t=>{Zo(t)})}function Iu(e){var t;if(typeof navigator>"u")return{viewportMode:e,userAgent:"server",platform:"server"};const n=navigator;return{viewportMode:e,userAgent:navigator.userAgent,platform:((t=n.userAgentData)==null?void 0:t.platform)??navigator.platform}}const dv=220,fv=1600;function Ji(e,t){return`${e}:${t}`}function Lu(e,t){return e<=900?t>=e?"mobile-portrait":"mobile-landscape":"desktop"}function Ru(e,t,n){const r=uf(e,t,n);return!r||r.startTimeSec==null?0:r.startTimeSec}function uf(e,t,n){return t?e.slides.find(r=>r.id===t)??null:typeof n=="number"&&n>=0&&nRu(a,r,l)),[d,p]=h.useState(n==="slide-preview"),[y,x]=h.useState({}),[S,N]=h.useState(null),[v,f]=h.useState(!1),[g,_]=h.useState(null),[P,I]=h.useState(!1),[E,z]=h.useState(!1),[G,F]=h.useState(!1),[Q,xe]=h.useState(null),[L,H]=h.useState(()=>typeof window>"u"||typeof document>"u"?"desktop":Lu(document.documentElement.clientWidth,document.documentElement.clientHeight)),[K]=h.useState(()=>u??`sess-${Math.random().toString(36).slice(2,10)}`),[V,ee]=h.useState({isScrubbing:!1,previewTimeSec:0,resumeWasManuallyPaused:!1}),[w,R]=h.useState({pointerId:null,startX:0,startY:0,dragSpan:320,dragOffsetPx:0,isSettling:!1,resumeWasManuallyPaused:!1,baselineGlitchSlideId:null,previewGlitchSlideId:null}),[U,Y]=h.useState(!0),J=h.useRef(null),Ae=h.useRef(null),D=h.useRef(null),Z=h.useRef(!1),B=h.useRef(null),de=h.useRef(null),be=lv(a.segments,c),Pt=be?iv(a.segments,be.id):null,A=(n==="slide-preview"?uf(a,r,l):null)??Xo(a.slides,c,a.durationSec),Qe=A?na(A,L):[],xi=A?y[Ji(A.id,L)]:void 0,Ce=A?ra(A,L,xi):null,ue=(A?Qe.find(k=>k.id===w.previewGlitchSlideId)??null:null)??Ce,ct=d?"full-paused":V.isScrubbing||E||w.isSettling||G?"soft-paused":"playing",vn=V.isScrubbing?V.previewTimeSec:c,Kr=Xo(a.slides,vn,a.durationSec),Qr=E||w.isSettling,Si=d||V.isScrubbing||E||w.isSettling||U,Yr=(A==null?void 0:A.displayMode)==="fullscreen",gn=(A==null?void 0:A.displayMode)==="square"&&ue&&(ue.componentKey==="SquareYellow"||ue.componentKey==="SquareVideo")&&typeof ue.props.header=="string"?ue.props.header:null;A&&y[Ji(A.id,L)],h.useEffect(()=>{const k=J.current;if(!k||typeof ResizeObserver>"u")return;const T=new ResizeObserver(b=>{const te=b[0];te&&H(Lu(te.contentRect.width,te.contentRect.height))});return T.observe(k),()=>{T.disconnect()}},[]),h.useEffect(()=>{const k=Ru(a,r,l);m(k),p(n==="slide-preview"),f(!1),_(null),N(null),F(!1)},[a.id,a.slides,n,r,l]),h.useEffect(()=>{F(!1)},[A==null?void 0:A.id,ue==null?void 0:ue.id]),h.useEffect(()=>{vt(i,{type:"lecture_loaded",lectureId:a.id})},[a.id,i]),h.useEffect(()=>{be&&(Zo(be),Pt&&Zo(Pt))},[be,Pt]),h.useEffect(()=>{cv(a.segments.slice(0,2))},[a.segments]),h.useEffect(()=>{if(!A)return;Cu(t,[A]);const k=av(a.slides,c,a.durationSec,2);Cu(t,k)},[A,c,a.durationSec,a.slides,t]),h.useEffect(()=>{if(!be){Ae.current=null;return}Ae.current!==be.id&&(Ae.current=be.id,vt(i,{type:"segment_changed",lectureId:a.id,segmentId:be.id,atSec:Number(c.toFixed(2))}))},[be,c,a.id,i]),h.useEffect(()=>{const k=A&&ue?`${A.id}:${ue.id}`:null;if(!k){D.current=null;return}D.current!==k&&(A&&ue&&vt(i,{type:"slide_activated",lectureId:a.id,slideId:A.id,glitchSlideId:ue.id,atSec:Number(c.toFixed(2))}),D.current=k)},[ue,A,c,a.id,i]),h.useEffect(()=>{R(k=>({...k,dragOffsetPx:0,isSettling:!1,baselineGlitchSlideId:(Ce==null?void 0:Ce.id)??null,previewGlitchSlideId:null})),z(!1)},[A==null?void 0:A.id]),h.useEffect(()=>{w.pointerId!==null||w.isSettling||E||R(k=>({...k,baselineGlitchSlideId:(Ce==null?void 0:Ce.id)??null,previewGlitchSlideId:null}))},[Ce==null?void 0:Ce.id,w.pointerId,w.isSettling,E]),h.useEffect(()=>{const k=T=>{if(T.key!==" "&&T.key.toLowerCase()!=="k")return;const b=document.activeElement;b&&["INPUT","TEXTAREA","BUTTON"].includes(b.tagName)||(T.preventDefault(),ct==="playing"?p(!0):xn())};return window.addEventListener("keydown",k),()=>{window.removeEventListener("keydown",k)}},[ct,S,A,ue,c]),h.useEffect(()=>()=>{B.current!==null&&window.clearTimeout(B.current),de.current!==null&&window.clearTimeout(de.current)},[]);function nt(){Y(!0),de.current!==null&&(window.clearTimeout(de.current),de.current=null),!(d||V.isScrubbing||E||w.isSettling)&&(de.current=window.setTimeout(()=>{Y(!1),de.current=null},fv))}h.useEffect(()=>{nt()},[d,V.isScrubbing,E,w.isSettling]);function Tt(k){m(Eu(k,a.durationSec))}function Jr(){nt(),f(!1),p(!0),ee({isScrubbing:!0,previewTimeSec:c,resumeWasManuallyPaused:d})}function wi(k){const T=Eu(Number(k),a.durationSec);ee(b=>({...b,previewTimeSec:T})),Tt(T)}function yn(){ee(k=>({...k,isScrubbing:!1}))}function Xr(k){nt(),f(!1),p(!0),B.current!==null&&(window.clearTimeout(B.current),B.current=null),z(!1),ee(T=>({...T,isScrubbing:!1,previewTimeSec:k})),R(T=>({...T,pointerId:null,dragOffsetPx:0,isSettling:!1,previewGlitchSlideId:null})),Tt(k)}function It(){B.current!==null&&(window.clearTimeout(B.current),B.current=null),R(k=>({...k,pointerId:null,dragOffsetPx:0,isSettling:!1,previewGlitchSlideId:null})),z(!1)}function er(k,T){B.current!==null&&window.clearTimeout(B.current),z(!1),R(b=>({...b,pointerId:null,dragOffsetPx:k,isSettling:!0})),B.current=window.setTimeout(()=>{B.current=null,T()},dv)}function Zr(k){if(!A||!Ce)return;nt(),f(!1);const T=k.currentTarget.getBoundingClientRect();typeof k.currentTarget.setPointerCapture=="function"&&k.currentTarget.setPointerCapture(k.pointerId);const b=Yo(L);R({pointerId:k.pointerId,startX:k.clientX,startY:k.clientY,dragSpan:Math.max(b==="horizontal"?T.width:T.height,240),dragOffsetPx:0,isSettling:!1,resumeWasManuallyPaused:d,baselineGlitchSlideId:Ce.id,previewGlitchSlideId:null})}function _i(k){if(!A||w.pointerId!==k.pointerId)return;const T=Yo(L),b=k.clientX-w.startX,te=k.clientY-w.startY,he=T==="horizontal"?b:te;if(!E&&Math.abs(he)<24)return;nt(),E||(z(!0),w.resumeWasManuallyPaused||vt(i,{type:"soft_pause_started",lectureId:a.id,slideId:A.id,atSec:Number(c.toFixed(2))}));const ve=Qe.findIndex(ki=>ki.id===w.baselineGlitchSlideId),Sn=Math.min(Math.max(he,-(Qe.length-1-Math.max(ve,0))*w.dragSpan),Math.max(ve,0)*w.dragSpan),el=Xm({baselineIndex:ve===-1?0:ve,dragDistance:-Sn,totalCandidates:Qe.length,dragSpan:w.dragSpan}),Be=Qe[el];Be&&Be.id!==w.previewGlitchSlideId&&Be.id!==w.baselineGlitchSlideId&&vt(i,{type:"glitch_slide_changed",lectureId:a.id,slideId:A.id,from:w.previewGlitchSlideId??w.baselineGlitchSlideId??Be.id,to:Be.id,atSec:Number(c.toFixed(2))}),R(ki=>({...ki,dragOffsetPx:Sn,previewGlitchSlideId:(Be==null?void 0:Be.id)??null}))}function _e(k){if(!A||w.pointerId!==k){It();return}const T=w.previewGlitchSlideId??w.baselineGlitchSlideId??(Ce==null?void 0:Ce.id)??null,b=w.baselineGlitchSlideId??(Ce==null?void 0:Ce.id)??null,te=Zm(b,T);if(!E){if(A.displayMode==="fullscreen"){It(),nr();return}It();return}if(!te){const he=w.resumeWasManuallyPaused;er(0,()=>{he||vt(i,{type:"soft_pause_ended",lectureId:a.id,slideId:A.id,atSec:Number(c.toFixed(2))}),he||N(null),It()});return}if(b&&T){x(Be=>({...Be,[Ji(A.id,L)]:T}));const he=Qe.findIndex(Be=>Be.id===b),ve=Qe.findIndex(Be=>Be.id===T),Sn=he===-1||ve===-1?0:(he-ve)*w.dragSpan,el=w.resumeWasManuallyPaused;er(Sn,()=>{el||vt(i,{type:"soft_pause_ended",lectureId:a.id,slideId:A.id,atSec:Number(c.toFixed(2))}),el||N(null),It()})}}async function xn(){if(f(!1),S){const k={lectureId:S.lectureId,slideId:S.slideId,previousGlitchSlideId:S.previousGlitchSlideId,selectedGlitchSlideId:S.selectedGlitchSlideId,sessionId:K,timestamp:new Date().toISOString(),deviceContext:Iu(L)};await(o==null?void 0:o(k)),vt(i,{type:"vote_committed",lectureId:k.lectureId,slideId:k.slideId,selectedGlitchSlideId:k.selectedGlitchSlideId,previousGlitchSlideId:k.previousGlitchSlideId,atSec:Number(c.toFixed(2))}),N(null)}p(!1)}async function tr(k){if(!A||!ue||P)return;I(!0),_(k);const T={lectureId:a.id,slideId:A.id,previousGlitchSlideId:ue.id,selectedGlitchSlideId:ue.id,voteDirection:k,sessionId:K,timestamp:new Date().toISOString(),deviceContext:Iu(L)};try{await(o==null?void 0:o(T)),vt(i,{type:"vote_committed",lectureId:T.lectureId,slideId:T.slideId,selectedGlitchSlideId:T.selectedGlitchSlideId,previousGlitchSlideId:T.previousGlitchSlideId,voteDirection:k,atSec:Number(c.toFixed(2))})}finally{I(!1)}}function nr(){if(nt(),ct==="playing"){p(!0),_(null),f(!0);return}d&&xn()}function j(k){return!v||!A||!ue||A.displayMode!==k?null:s.jsx("div",{className:`lecture-player__vote-overlay lecture-player__vote-overlay--${k}`,role:"dialog","aria-label":"Vote on slide",onClick:T=>T.stopPropagation(),children:s.jsxs("div",{className:"lecture-player__vote-panel",children:[s.jsx("p",{className:"lecture-player__vote-label",children:"Rate This Slide"}),s.jsxs("div",{className:"lecture-player__vote-actions",children:[s.jsx("button",{type:"button",className:`lecture-player__vote-button ${g==="up"?"lecture-player__vote-button--active":""}`,onClick:T=>{T.stopPropagation(),tr("up")},disabled:P,children:"Upvote"}),s.jsx("button",{type:"button",className:`lecture-player__vote-button ${g==="down"?"lecture-player__vote-button--active":""}`,onClick:T=>{T.stopPropagation(),tr("down")},disabled:P,children:"Downvote"})]})]})})}function $(k){return!A||!ue?k==="fullscreen"?null:s.jsxs("div",{className:"lecture-player__empty",children:[s.jsx("p",{className:"eyebrow",children:"No slide available"}),s.jsx("p",{children:"Enroll at glitch.university, and help make this slide!."})]}):A.displayMode!==k?k==="fullscreen"?null:s.jsx("div",{className:"lecture-player__empty lecture-player__empty--muted","aria-hidden":"true"}):s.jsxs("div",{className:"lecture-player__gesture-layer",onPointerDown:Zr,onPointerMove:_i,onPointerUp:T=>_e(T.pointerId),onPointerCancel:T=>_e(T.pointerId),onPointerLeave:T=>{E&&_e(T.pointerId)},children:[s.jsx(rv,{lectureId:a.id,slide:A,glitchSlide:ue,candidates:Qe,slideRegistry:t,paused:ct!=="playing",isInspecting:Qr,isSettling:w.isSettling,viewportMode:L,dragBaselineGlitchSlideId:w.baselineGlitchSlideId,dragOffsetPx:w.dragOffsetPx,onMediaLoadingChange:F}),s.jsx(ev,{candidates:Qe,displayMode:A.displayMode,activeGlitchSlide:ue,isInspecting:Qr,isDragging:E,viewportMode:L})]})}return s.jsx("div",{ref:J,className:`lecture-player lecture-player--${L} ${(A==null?void 0:A.displayMode)==="fullscreen"?"lecture-player--fullscreen":""}`,"data-testid":"lecture-player",children:s.jsx("div",{className:"lecture-player__stage",children:s.jsxs("div",{className:"lecture-player__stage-frame",onPointerMove:()=>{!E&&!V.isScrubbing&&nt()},onPointerDown:()=>nt(),children:[s.jsx(uv,{segment:be,nextSegment:Pt,globalTimeSec:c,lectureDurationSec:a.durationSec,pauseMode:ct,viewportMode:L,onTogglePlayback:nr,onAutoplayBlocked:()=>{Z.current||(Z.current=!0,p(!0))},onSegmentError:k=>xe(k),onGlobalTimeChange:Tt}),gn?s.jsx("div",{className:"lecture-player__square-header","aria-live":"polite",children:gn}):null,s.jsxs("div",{className:"lecture-player__slide-shell",children:[$("square"),j("square")]}),Yr?s.jsxs("div",{className:"lecture-player__fullscreen-layer",children:[$("fullscreen"),j("fullscreen")]}):null,ct!=="playing"?s.jsx("div",{className:"lecture-player__overlay-control",children:s.jsx(tv,{pauseMode:ct,pendingVote:S,onResume:()=>{xn()},onPause:()=>p(!0)})}):null,Si?s.jsxs("div",{className:"lecture-player__scrubber",style:{"--scrub-progress":`${a.durationSec>0?vn/a.durationSec*100:0}%`},children:[s.jsx("div",{className:"lecture-player__scrubber-markers","aria-label":"Slide markers",children:a.slides.map((k,T)=>{const b=k.startTimeSec;if(b==null)return null;const te=a.durationSec>0?b/a.durationSec*100:0,he=(Kr==null?void 0:Kr.id)===k.id;return s.jsx("button",{type:"button",className:`lecture-player__scrubber-marker ${he?"lecture-player__scrubber-marker--active":""}`,style:{"--marker-progress":`${te}%`},"aria-label":`S${T+1}`,onPointerDown:ve=>{ve.preventDefault(),ve.stopPropagation(),Xr(b)},onPointerUp:ve=>{ve.preventDefault(),ve.stopPropagation()},onClick:ve=>{ve.preventDefault(),ve.stopPropagation(),Xr(b)},children:s.jsxs("span",{className:"lecture-player__scrubber-marker-label",children:["S",T+1]})},k.id)})}),s.jsx("input",{type:"range",min:0,max:a.durationSec,step:.01,value:vn,className:"lecture-player__scrubber-input","aria-label":"Lecture timeline",onPointerDown:k=>{k.stopPropagation(),Jr()},onChange:k=>wi(k.currentTarget.value),onPointerUp:()=>yn(),onPointerCancel:()=>yn(),onBlur:()=>{V.isScrubbing&&yn()},onKeyDown:()=>{V.isScrubbing||Jr()},onKeyUp:()=>yn()})]}):null,Q?s.jsxs("div",{className:"lecture-player__alert lecture-player__alert--overlay",role:"alert",children:[s.jsx("strong",{children:"Segment error:"})," ",Q]}):null]})})})}function hv({presentationId:e,slide:t,slideRegistry:n,viewportMode:r="desktop",preferredGlitchSlideId:l,paused:i=!0,className:o}){const u=na(t,r),a=ra(t,r,l);return!a||u.length===0?s.jsx("div",{className:["glitch-slide-renderer",`glitch-slide-renderer--${r}`,o].filter(Boolean).join(" "),children:s.jsx("div",{className:`slide-host slide-host--${t.displayMode}`,children:s.jsx(Il,{reason:"No compatible slide variant available."})})}):s.jsx("div",{className:["glitch-slide-renderer",`glitch-slide-renderer--${r}`,`lecture-player--${r}`,o].filter(Boolean).join(" "),"data-testid":`glitch-slide-renderer-${t.displayMode}`,children:s.jsx("div",{className:`slide-host slide-host--${t.displayMode}`,children:s.jsx(Jo,{lectureId:e,slide:t,glitchSlide:a,slideRegistry:n,paused:i})})})}function mv({presentationId:e,slide:t,slideRegistry:n,viewportMode:r="desktop",preferredGlitchSlideId:l,className:i,showSquareHeader:o=!0}){const u=ra(t,r,l),a=o&&t.displayMode==="square"&&(u==null?void 0:u.componentKey)==="SquareYellow"&&typeof u.props.header=="string"?String(u.props.header):null;return s.jsxs("div",{className:["glitch-slide-thumbnail",`glitch-slide-thumbnail--${t.displayMode}`,`glitch-slide-thumbnail--${r}`,i].filter(Boolean).join(" "),children:[a?s.jsx("div",{className:"glitch-slide-thumbnail__header",children:a}):null,s.jsx("div",{className:"glitch-slide-thumbnail__surface",children:s.jsx(hv,{presentationId:e,slide:t,slideRegistry:n,viewportMode:r,preferredGlitchSlideId:l,paused:!0})})]})}var vv={header:"",imageSrc:"",imageAlt:""},gv={header:"",videoSrc:"",posterSrc:""},yv={eyebrow:"",title:"",body:"",imageSrc:"",imageAlt:"",imagePosition:"left"},xv={header:"",videoSrc:"",posterSrc:"",caption:""},Sv={title:"No need to be discrete",videoSrc:"",posterSrc:""},wv={caption:"",videoSrc:"",posterSrc:""},_v={header:"",eyebrow:"",title:"",annotation:""},kv={eyebrow:"",quote:"",attribution:"",imageSrc:"",imageAlt:"",imagePosition:"left"},jv={header:"",eyebrow:"",title:"",body:"",points:[]},Nv={eyebrow:"",title:"",steps:[]},Cv={header:"",eyebrow:"",term:"",definition:"",example:""},Ev={header:"",componentId:"",componentUrl:"",caption:""},cf={SquareYellow:{componentKey:"SquareYellow",label:"Square image + header",description:"Square image with a short external header.",displayMode:"square",fields:[{name:"header",type:"text",label:"Header",placeholder:"Short headline",required:!0},{name:"imageSrc",type:"image",label:"Image",placeholder:"https://...",required:!0},{name:"imageAlt",type:"text",label:"Alt text",placeholder:"Describe the image",required:!0}]},SquareVideo:{componentKey:"SquareVideo",label:"Square video + header",description:"Square video inside a framed square slide with a short header.",displayMode:"square",fields:[{name:"header",type:"text",label:"Header",placeholder:"Short headline",required:!0},{name:"videoSrc",type:"video",label:"Video",placeholder:"https://...",required:!0},{name:"posterSrc",type:"image",label:"Poster image",placeholder:"https://..."}]},FullscreenSplit:{componentKey:"FullscreenSplit",label:"Fullscreen split",description:"Two-panel fullscreen slide with image and text.",displayMode:"fullscreen",fields:[{name:"header",type:"text",label:"Header",placeholder:"Short header"},{name:"title",type:"text",label:"Title",placeholder:"Main title",required:!0},{name:"body",type:"textarea",label:"Body",placeholder:"Short supporting text",required:!0},{name:"imageSrc",type:"image",label:"Image",placeholder:"https://...",required:!0},{name:"imageAlt",type:"text",label:"Alt text",placeholder:"Describe the image",required:!0},{name:"imagePosition",type:"text",label:"Image position",placeholder:"left or right"}]},FullscreenVideo:{componentKey:"FullscreenVideo",label:"Fullscreen video",description:"Full-bleed video slide with optional overlay text.",displayMode:"fullscreen",fields:[{name:"header",type:"text",label:"Header",placeholder:"Short header"},{name:"videoSrc",type:"video",label:"Video",placeholder:"https://...",required:!0},{name:"posterSrc",type:"image",label:"Poster image",placeholder:"https://..."},{name:"caption",type:"textarea",label:"Caption",placeholder:"Short framing note"}]},FullscreenVideoTitle:{componentKey:"FullscreenVideoTitle",label:"Fullscreen video + title",description:"Full-bleed video with one oversized overlaid title.",displayMode:"fullscreen",fields:[{name:"title",type:"text",label:"Title",placeholder:"No need to be discrete"},{name:"videoSrc",type:"video",label:"Video",placeholder:"https://...",required:!0},{name:"posterSrc",type:"image",label:"Poster image",placeholder:"https://..."}]},FullscreenVideoCenterCaption:{componentKey:"FullscreenVideoCenterCaption",label:"Fullscreen video + centered caption",description:"Full-bleed video with one oversized centered caption.",displayMode:"fullscreen",fields:[{name:"caption",type:"text",label:"Caption",placeholder:"Short centered statement"},{name:"videoSrc",type:"video",label:"Video",placeholder:"https://...",required:!0},{name:"posterSrc",type:"image",label:"Poster image",placeholder:"https://..."}]},EquationFocus:{componentKey:"EquationFocus",label:"Equation focus",description:"One display equation with a short annotation.",displayMode:"fullscreen",supportedDisplayModes:["square","fullscreen"],fields:[{name:"header",type:"text",label:"Header",placeholder:"Short header"},{name:"title",type:"text",label:"Title",placeholder:"What does the equation show?",required:!0},{name:"latexString",type:"latex",label:"LaTeX equation",placeholder:"\\bar{x} = \\frac{1}{N}\\sum_{i=0}^{N} x_i",required:!0},{name:"annotation",type:"textarea",label:"Annotation",placeholder:"One short explanation"}]},QuoteImage:{componentKey:"QuoteImage",label:"Quote + image",description:"Strong quote paired with one image.",displayMode:"fullscreen",fields:[{name:"eyebrow",type:"text",label:"Eyebrow",placeholder:"Optional eyebrow"},{name:"quote",type:"textarea",label:"Quote",placeholder:"Short quote",required:!0},{name:"attribution",type:"text",label:"Attribution",placeholder:"Person or source"},{name:"imageSrc",type:"image",label:"Image",placeholder:"https://...",required:!0},{name:"imageAlt",type:"text",label:"Alt text",placeholder:"Describe the image",required:!0},{name:"imagePosition",type:"text",label:"Image position",placeholder:"left or right"}]},ChartSingle:{componentKey:"ChartSingle",label:"Single chart",description:"One compact chart with a short framing line.",displayMode:"fullscreen",fields:[{name:"header",type:"text",label:"Header",placeholder:"Short header"},{name:"title",type:"text",label:"Title",placeholder:"Chart title",required:!0},{name:"body",type:"textarea",label:"Body",placeholder:"Short interpretation"},{name:"points",type:"lines",label:"Data points",placeholder:"Label: value",description:"One point per line. Format each line as label: value."}]},ProcessFlow:{componentKey:"ProcessFlow",label:"Process flow",description:"Short pipeline with 3 to 5 steps.",displayMode:"fullscreen",fields:[{name:"eyebrow",type:"text",label:"Eyebrow",placeholder:"Optional eyebrow"},{name:"title",type:"text",label:"Title",placeholder:"Process title",required:!0},{name:"steps",type:"lines",label:"Steps",placeholder:"One step per line",required:!0}]},DefinitionCard:{componentKey:"DefinitionCard",label:"Definition card",description:"Term, definition, and optional example.",displayMode:"fullscreen",fields:[{name:"header",type:"text",label:"Header",placeholder:"Short header"},{name:"term",type:"text",label:"Term",placeholder:"Key term",required:!0},{name:"definition",type:"textarea",label:"Definition",placeholder:"Short definition",required:!0},{name:"example",type:"textarea",label:"Example",placeholder:"Optional example"}]},GlitchComponentFrame:{componentKey:"GlitchComponentFrame",label:"Interactive Glitch component",description:"Hosted Glitch component embedded inside the slide surface.",displayMode:"fullscreen",fields:[{name:"header",type:"text",label:"Header",placeholder:"Short header"},{name:"componentId",type:"text",label:"Component id",placeholder:"lightlane",required:!0},{name:"componentUrl",type:"text",label:"Component URL",placeholder:"Optional hosted URL",description:"Optional URL for iframe-hosted components. Leave empty for known local component ids."},{name:"caption",type:"textarea",label:"Caption",placeholder:"Short framing note"}]}},Pv=Object.values(cf),es=Pv.flatMap(function(e){var t,n=(t=e.supportedDisplayModes)!==null&&t!==void 0?t:[e.displayMode];return n.map(function(r){return{componentKey:e.componentKey,label:e.label,description:e.description,displayMode:r,fields:e.fields}})});es.filter(function(e){return e.displayMode==="square"}),es.filter(function(e){return e.displayMode==="fullscreen"});var Tv={SquareYellow:{props:vv},SquareVideo:{props:gv},FullscreenSplit:{props:yv},FullscreenVideo:{props:xv},FullscreenVideoTitle:{props:Sv},FullscreenVideoCenterCaption:{props:wv},EquationFocus:{props:_v,latexString:""},QuoteImage:{props:kv},ChartSingle:{props:jv},ProcessFlow:{props:Nv},DefinitionCard:{props:Cv},GlitchComponentFrame:{props:Ev}};function Iv(e){if(!Array.isArray(e)||e.length===0)return[{label:"Security",value:72,color:"#111"},{label:"Trust",value:58,color:"rgba(17, 17, 17, 0.72)"},{label:"Growth",value:44,color:"rgba(17, 17, 17, 0.52)"}];const t=[];return e.forEach((n,r)=>{if(!n||typeof n!="object")return;const l=n,i=Number(l.value);t.push({label:String(l.label??`Series ${r+1}`),value:Number.isFinite(i)?Math.max(0,i):0,color:typeof l.color=="string"?l.color:void 0})}),t.length>0?t:[{label:"Security",value:72,color:"#111"},{label:"Trust",value:58,color:"rgba(17, 17, 17, 0.72)"},{label:"Growth",value:44,color:"rgba(17, 17, 17, 0.52)"}]}function Lv({props:e,paused:t}){const n=e,r=String(n.header??n.eyebrow??"Chart single"),l=String(n.title??"One chart, one comparison"),i=String(n.body??"Use one chart for one contrast."),o=Iv(n.points),u=Math.max(...o.map(a=>a.value),1);return s.jsx("article",{className:`chart-single ${t?"chart-single--paused":""}`,children:s.jsxs("div",{className:"chart-single__content",children:[s.jsxs("div",{className:"chart-single__copy",children:[s.jsx("p",{className:"chart-single__eyebrow",children:r}),s.jsx("h2",{className:"chart-single__title",children:l}),s.jsx("p",{className:"chart-single__body",children:i})]}),s.jsx("div",{className:"chart-single__plot",role:"img","aria-label":l,children:o.map(a=>s.jsxs("div",{className:"chart-single__row",children:[s.jsx("span",{className:"chart-single__label",children:a.label}),s.jsx("div",{className:"chart-single__bar-track",children:s.jsx("div",{className:"chart-single__bar-fill",style:{width:`${a.value/u*100}%`,background:a.color??"#111"}})}),s.jsx("span",{className:"chart-single__value",children:a.value})]},a.label))})]})})}const Rv=Object.freeze(Object.defineProperty({__proto__:null,default:Lv},Symbol.toStringTag,{value:"Module"}));function Mv({props:e,paused:t}){const n=e,r=String(n.header??n.eyebrow??"Definition"),l=String(n.term??"Crystallization"),i=String(n.definition??"An interactive talk becomes a fixed video."),o=String(n.example??"Same source. Cleaner final cut.");return s.jsx("article",{className:`definition-card ${t?"definition-card--paused":""}`,children:s.jsxs("div",{className:"definition-card__content",children:[s.jsx("p",{className:"definition-card__eyebrow",children:r}),s.jsx("h2",{className:"definition-card__term",children:l}),s.jsx("p",{className:"definition-card__definition",children:i}),s.jsx("p",{className:"definition-card__example",children:o})]})})}const Ov=Object.freeze(Object.defineProperty({__proto__:null,default:Mv},Symbol.toStringTag,{value:"Module"})),Mu="glitch-player-mathjax",zv="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js";let Xi=null;function Dv(){var e;return typeof window>"u"||typeof document>"u"||(e=window.MathJax)!=null&&e.typesetPromise?Promise.resolve():Xi||(Xi=new Promise((t,n)=>{var r;window.MathJax=window.MathJax??{};const l=document.getElementById(Mu),i=()=>{var u,a;l&&(l.dataset.loaded="true");const c=(a=(u=window.MathJax)==null?void 0:u.startup)==null?void 0:a.promise;if(c){c.then(()=>t()).catch(n);return}t()};if(l){if(l.dataset.loaded==="true"||(r=window.MathJax)!=null&&r.typesetPromise){i();return}l.addEventListener("load",i,{once:!0}),l.addEventListener("error",()=>n(new Error("Failed to load MathJax.")),{once:!0});return}const o=document.createElement("script");o.id=Mu,o.async=!0,o.src=zv,o.addEventListener("load",()=>{o.dataset.loaded="true",i()},{once:!0}),o.addEventListener("error",()=>n(new Error("Failed to load MathJax.")),{once:!0}),document.head.appendChild(o)}),Xi)}function Fv({props:e,latexString:t,displayMode:n,paused:r}){const l=e,i=String(l.header??l.eyebrow??"Equation focus"),o=String(l.title??"Definition of the mean"),u=String(l.annotation??"The mean is the total of all observations divided by the number of observations."),a=h.useRef(null),[c,m]=h.useState("loading");return h.useEffect(()=>{const d=a.current,p=t??String.raw`\bar{x} = \frac{1}{N}\sum_{i=0}^{N} x_i`;if(!d)return;let y=!1;return m("loading"),Dv().then(async()=>{var x,S,N,v;if(y||!a.current)return;const f=a.current;f.textContent=`\\[${p}\\]`,(S=(x=window.MathJax)==null?void 0:x.typesetClear)==null||S.call(x,[f]),await((v=(N=window.MathJax)==null?void 0:N.typesetPromise)==null?void 0:v.call(N,[f])),y||m("ready")}).catch(()=>{!y&&a.current&&(a.current.textContent=p,m("error"))}),()=>{var x,S;y=!0,a.current&&((S=(x=window.MathJax)==null?void 0:x.typesetClear)==null||S.call(x,[a.current]))}},[t]),s.jsx("article",{className:`equation-focus equation-focus--${n} ${r?"equation-focus--paused":""}`,children:s.jsxs("div",{className:"equation-focus__content",children:[s.jsx("p",{className:"equation-focus__eyebrow",children:i}),s.jsx("h2",{className:"equation-focus__title",children:o}),s.jsx("div",{className:"equation-focus__equation-frame",children:s.jsx("div",{ref:a,className:`equation-focus__equation equation-focus__equation--mathjax ${c==="loading"?"equation-focus__equation--loading":""} ${c==="error"?"equation-focus__equation--error":""}`,"aria-live":"polite"})}),s.jsx("p",{className:"equation-focus__annotation",children:u})]})})}const $v=Object.freeze(Object.defineProperty({__proto__:null,default:Fv},Symbol.toStringTag,{value:"Module"}));function Uv({props:e,paused:t}){const n=e,r=String(n.eyebrow??"Fullscreen split"),l=String(n.title??"One image. One idea."),i=String(n.body??"Fullscreen keeps the seam invisible."),o=String(n.imageSrc??"https://images.unsplash.com/photo-1516321318423-f06f85e504b3?auto=format&fit=crop&w=1200&q=80"),u=String(n.imageAlt??l),a=n.imagePosition==="right"?"right":"left";return s.jsxs("article",{className:`fullscreen-split ${t?"fullscreen-split--paused":""} fullscreen-split--image-${a}`,children:[s.jsx("div",{className:"fullscreen-split__panel fullscreen-split__panel--image",children:s.jsx("img",{className:"fullscreen-split__image",src:o,alt:u})}),s.jsx("div",{className:"fullscreen-split__panel fullscreen-split__panel--text",children:s.jsxs("div",{className:"fullscreen-split__text",children:[s.jsx("p",{className:"fullscreen-split__eyebrow",children:r}),s.jsx("h2",{className:"fullscreen-split__title",children:l}),s.jsx("p",{className:"fullscreen-split__body",children:i})]})})]})}const Av=Object.freeze(Object.defineProperty({__proto__:null,default:Uv},Symbol.toStringTag,{value:"Module"}));function bv({props:e,paused:t,onMediaLoadingChange:n}){const r=e,l=String(r.header??"").trim(),i=String(r.caption??"").trim(),o=String(r.videoSrc??"").trim(),u=String(r.posterSrc??"").trim(),a=h.useRef(null);return h.useEffect(()=>{const c=a.current;if(!c)return;if(t){c.pause();return}const m=c.play();m&&typeof m.catch=="function"&&m.catch(()=>{})},[t,o]),h.useEffect(()=>{if(!o){n==null||n(!1);return}return n==null||n(!0),()=>{n==null||n(!1);const c=a.current;c&&(c.pause(),c.currentTime=0)}},[n,o]),s.jsxs("article",{className:`fullscreen-video ${t?"fullscreen-video--paused":""}`,children:[s.jsx("video",{ref:a,className:"fullscreen-video__media",src:o,poster:u||void 0,autoPlay:!0,playsInline:!0,preload:"metadata",controls:!1,onLoadedData:()=>n==null?void 0:n(!1),onCanPlay:()=>n==null?void 0:n(!1),onPlaying:()=>n==null?void 0:n(!1),onLoadStart:()=>n==null?void 0:n(!0),onWaiting:()=>n==null?void 0:n(!0),onStalled:()=>n==null?void 0:n(!0),onSuspend:()=>n==null?void 0:n(!1),onEnded:()=>n==null?void 0:n(!1),onError:()=>n==null?void 0:n(!1)}),l?s.jsx("div",{className:"fullscreen-video__chrome",children:s.jsx("p",{className:"fullscreen-video__header",children:l})}):null,i?s.jsx("p",{className:"fullscreen-video__caption",children:i}):null]})}const Bv=Object.freeze(Object.defineProperty({__proto__:null,default:bv},Symbol.toStringTag,{value:"Module"}));function Wv({props:e,paused:t,onMediaLoadingChange:n}){const r=e,l=String(r.caption??"").trim(),i=String(r.videoSrc??"").trim(),o=String(r.posterSrc??"").trim(),u=h.useRef(null);return h.useEffect(()=>{const a=u.current;if(!a)return;if(t){a.pause();return}const c=a.play();c&&typeof c.catch=="function"&&c.catch(()=>{})},[t,i]),h.useEffect(()=>{if(!i){n==null||n(!1);return}return n==null||n(!0),()=>{n==null||n(!1);const a=u.current;a&&(a.pause(),a.currentTime=0)}},[n,i]),s.jsxs("article",{className:`fullscreen-video-center-caption ${t?"fullscreen-video-center-caption--paused":""}`,children:[s.jsx("video",{ref:u,className:"fullscreen-video-center-caption__media",src:i,poster:o||void 0,autoPlay:!0,playsInline:!0,preload:"metadata",controls:!1,onLoadedData:()=>n==null?void 0:n(!1),onCanPlay:()=>n==null?void 0:n(!1),onPlaying:()=>n==null?void 0:n(!1),onLoadStart:()=>n==null?void 0:n(!0),onWaiting:()=>n==null?void 0:n(!0),onStalled:()=>n==null?void 0:n(!0),onSuspend:()=>n==null?void 0:n(!1),onEnded:()=>n==null?void 0:n(!1),onError:()=>n==null?void 0:n(!1)}),l?s.jsx("div",{className:"fullscreen-video-center-caption__overlay",children:s.jsx("p",{className:"fullscreen-video-center-caption__caption",children:l})}):null]})}const Vv=Object.freeze(Object.defineProperty({__proto__:null,default:Wv},Symbol.toStringTag,{value:"Module"})),Hv="No need to be discrete";function qv({props:e,paused:t,onMediaLoadingChange:n}){const r=e,l=String(r.title??"").trim()||Hv,i=String(r.videoSrc??"").trim(),o=String(r.posterSrc??"").trim(),u=h.useRef(null);return h.useEffect(()=>{const a=u.current;if(!a)return;if(t){a.pause();return}const c=a.play();c&&typeof c.catch=="function"&&c.catch(()=>{})},[t,i]),h.useEffect(()=>{if(!i){n==null||n(!1);return}return n==null||n(!0),()=>{n==null||n(!1);const a=u.current;a&&(a.pause(),a.currentTime=0)}},[n,i]),s.jsxs("article",{className:`fullscreen-video-title ${t?"fullscreen-video-title--paused":""}`,children:[s.jsx("video",{ref:u,className:"fullscreen-video-title__media",src:i,poster:o||void 0,autoPlay:!0,playsInline:!0,preload:"metadata",controls:!1,onLoadedData:()=>n==null?void 0:n(!1),onCanPlay:()=>n==null?void 0:n(!1),onPlaying:()=>n==null?void 0:n(!1),onLoadStart:()=>n==null?void 0:n(!0),onWaiting:()=>n==null?void 0:n(!0),onStalled:()=>n==null?void 0:n(!0),onSuspend:()=>n==null?void 0:n(!1),onEnded:()=>n==null?void 0:n(!1),onError:()=>n==null?void 0:n(!1)}),s.jsx("div",{className:"fullscreen-video-title__overlay",children:s.jsx("h2",{className:"fullscreen-video-title__title",children:l})})]})}const Gv=Object.freeze(Object.defineProperty({__proto__:null,default:qv},Symbol.toStringTag,{value:"Module"}));function Kv(e){return e.replace(/\/+$/,"")}function Qv(){return Kv("/glitch")}function Yv(e){return`glitch_${e.replace(/-/g,"_")}`}function Jv(e,t){const n=t==null?void 0:t.trim();if(n)return n;const r=Qv(),l=Yv(e);return`${r}/${l}/index.html`}function Xv({props:e,displayMode:t,paused:n}){const r=e,l=String(r.header??"Interactive component"),i=String(r.componentId??"glitch-component"),o=Jv(i,String(r.componentUrl??"").trim()),u=String(r.caption??"Explore the model directly inside the slide.");return s.jsxs("article",{className:`glitch-component-frame glitch-component-frame--${t} ${n?"glitch-component-frame--paused":""}`,children:[s.jsxs("div",{className:"glitch-component-frame__chrome",children:[s.jsx("p",{className:"glitch-component-frame__eyebrow",children:l}),s.jsx("p",{className:"glitch-component-frame__id",children:i})]}),s.jsx("div",{className:"glitch-component-frame__viewport",children:s.jsx("iframe",{className:"glitch-component-frame__iframe",src:o,title:l||i,loading:"lazy",allow:"fullscreen; autoplay; xr-spatial-tracking",sandbox:"allow-scripts allow-same-origin allow-pointer-lock allow-popups allow-forms"})}),s.jsx("p",{className:"glitch-component-frame__caption",children:u})]})}const Zv=Object.freeze(Object.defineProperty({__proto__:null,default:Xv},Symbol.toStringTag,{value:"Module"}));function eg(e){return!Array.isArray(e)||e.length===0?["Record talking-head segments","Align transcript to timeline","Generate slide variants","Play, compare, and refine"]:e.map(t=>String(t))}function tg({props:e,paused:t}){const n=e,r=String(n.eyebrow??"Process flow"),l=String(n.title??"How it becomes a video"),i=eg(n.steps);return s.jsx("article",{className:`process-flow ${t?"process-flow--paused":""}`,children:s.jsxs("div",{className:"process-flow__content",children:[s.jsx("p",{className:"process-flow__eyebrow",children:r}),s.jsx("h2",{className:"process-flow__title",children:l}),s.jsx("div",{className:"process-flow__steps",children:i.map((o,u)=>s.jsxs("div",{className:"process-flow__step",children:[s.jsx("span",{className:"process-flow__index",children:u+1}),s.jsx("p",{className:"process-flow__label",children:o})]},`${u}-${o}`))})]})})}const ng=Object.freeze(Object.defineProperty({__proto__:null,default:tg},Symbol.toStringTag,{value:"Module"}));function rg({props:e,paused:t}){const n=e,r=String(n.eyebrow??"Quote image"),l=String(n.quote??"Good explanation makes hard ideas feel graspable."),i=String(n.attribution??"Glitch University"),o=String(n.imageSrc??"https://images.unsplash.com/photo-1516321318423-f06f85e504b3?auto=format&fit=crop&w=1200&q=80"),u=String(n.imageAlt??l),a=n.imagePosition==="right"?"right":"left";return s.jsxs("article",{className:`quote-image ${t?"quote-image--paused":""} quote-image--image-${a}`,children:[s.jsx("div",{className:"quote-image__panel quote-image__panel--image",children:s.jsx("img",{className:"quote-image__image",src:o,alt:u})}),s.jsx("div",{className:"quote-image__panel quote-image__panel--quote",children:s.jsxs("div",{className:"quote-image__content",children:[s.jsx("p",{className:"quote-image__eyebrow",children:r}),s.jsxs("blockquote",{className:"quote-image__quote",children:['"',l,'"']}),s.jsx("p",{className:"quote-image__attribution",children:i})]})})]})}const lg=Object.freeze(Object.defineProperty({__proto__:null,default:rg},Symbol.toStringTag,{value:"Module"}));function ig({props:e,paused:t,onMediaLoadingChange:n}){const r=e,l=String(r.videoSrc??"").trim(),i=String(r.posterSrc??"").trim(),o=h.useRef(null);return h.useEffect(()=>{const u=o.current;if(!u)return;if(t){u.pause();return}const a=u.play();a&&typeof a.catch=="function"&&a.catch(()=>{})},[t,l]),h.useEffect(()=>{if(!l){n==null||n(!1);return}return n==null||n(!0),()=>{n==null||n(!1);const u=o.current;u&&(u.pause(),u.currentTime=0)}},[n,l]),s.jsx("article",{className:`square-video ${t?"square-video--paused":""}`,children:s.jsx("div",{className:"square-video__frame",children:s.jsx("video",{ref:o,className:"square-video__media",src:l,poster:i||void 0,autoPlay:!0,preload:"metadata",playsInline:!0,controls:!1,onLoadedData:()=>n==null?void 0:n(!1),onCanPlay:()=>n==null?void 0:n(!1),onPlaying:()=>n==null?void 0:n(!1),onLoadStart:()=>n==null?void 0:n(!0),onWaiting:()=>n==null?void 0:n(!0),onStalled:()=>n==null?void 0:n(!0),onSuspend:()=>n==null?void 0:n(!1),onEnded:()=>n==null?void 0:n(!1),onError:()=>n==null?void 0:n(!1)})})})}const og=Object.freeze(Object.defineProperty({__proto__:null,default:ig},Symbol.toStringTag,{value:"Module"}));function sg({props:e,paused:t}){const n=e,r=String(n.header??"Square yellow"),l=String(n.imageSrc??"https://images.unsplash.com/photo-1516321318423-f06f85e504b3?auto=format&fit=crop&w=1200&q=80"),i=String(n.imageAlt??r);return s.jsx("article",{className:`square-slide square-slide--yellow ${t?"square-slide--paused":""}`,children:s.jsx("div",{className:"square-slide__image-frame",children:s.jsx("img",{className:"square-slide__image",src:l,alt:i})})})}const ag=Object.freeze(Object.defineProperty({__proto__:null,default:sg},Symbol.toStringTag,{value:"Module"})),ug=es,cg=Tv;function dg(e){return cf[e]??null}const df={SquareYellow:{header:"",imageSrc:"",imageAlt:""},FullscreenSplit:{header:"",eyebrow:"",title:"Section Title",body:"Supporting explanation text goes here.",imageSrc:"",imageAlt:"",imagePosition:"left"},EquationFocus:{header:"",eyebrow:"",title:"Euler's Formula",latexString:"e^{i\\pi} + 1 = 0",annotation:"Where e is Euler's number, i is the imaginary unit, and π is pi."},QuoteImage:{eyebrow:"",quote:"A meaningful quote that illustrates the concept at hand.",attribution:"— Author Name",imageSrc:"",imageAlt:"",imagePosition:"left"},ChartSingle:{header:"",eyebrow:"",title:"Key Metrics",body:"Overview of the most important data points.",points:["Category A: 42","Category B: 28","Category C: 15","Category D: 10"]},ProcessFlow:{eyebrow:"",title:"How It Works",steps:["Step 1: Begin the process","Step 2: Apply the method","Step 3: Achieve the result"]},DefinitionCard:{header:"",term:"Key Term",definition:"A clear and concise explanation of what this term means in context.",example:"For example: this concept applies when…"},GlitchComponentFrame:{header:"",componentId:"demo",componentUrl:"",caption:"Interactive component"}};function fg({videoId:e,targetSlideId:t,viewportMode:n="desktop",refreshKey:r}){const[l,i]=h.useState(null),[o,u]=h.useState(null),[a,c]=h.useState(0);if(h.useEffect(()=>{e&&(i(null),u(null))},[e]),h.useEffect(()=>{if(!e)return;let y=!1;return fetch(`/api/videos/${e}/export`).then(x=>{if(!x.ok)throw new Error(`Export failed: ${x.status}`);return x.json()}).then(x=>{y||(i(x),u(null))}).catch(x=>{y||u(String(x))}),()=>{y=!0}},[e,r,a]),!e)return null;if(o)return s.jsxs("div",{className:"player-status player-status--error",children:[s.jsx("span",{children:"LOAD FAILED"}),s.jsx("button",{className:"error-boundary__retry",style:{marginLeft:12},onClick:()=>{u(null),c(y=>y+1)},children:"RETRY"})]});if(!l)return s.jsx("div",{className:"player-status",children:"LOADING PLAYER..."});const m=n==="mobile-portrait"?"player-preview-host--portrait":"player-preview-host--landscape",d=l.slides??[],p=t?Math.max(0,d.findIndex(y=>y.id===t)):0;return s.jsx("div",{className:`gnommo-player-host ${m}`,children:s.jsx(pv,{presentation:l,slideRegistry:sf,mode:"slide-preview",targetSlideIndex:p,initialSessionId:`editor-preview-${l.id}-v${r}`},`editor-preview-${l.id}-v${r}`)})}class ts extends h.Component{constructor(t){super(t),this.state={error:null}}static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t,n){console.error("[ErrorBoundary]",this.props.label??"",t,n)}reset(){this.setState({error:null})}render(){return this.state.error?s.jsxs("div",{className:"error-boundary",children:[s.jsx("span",{className:"error-boundary__msg",children:this.props.label?`Error in ${this.props.label}`:"Something went wrong"}),s.jsx("button",{className:"error-boundary__retry",onClick:()=>this.reset(),children:"RETRY"})]}):this.props.children}}function la({videoId:e,slide:t,viewportMode:n="desktop"}){var o;if(!(t!=null&&t.component_key))return null;const r=t.gnommo_slide_id||t.id,l={id:r,startTimeSec:t.start_time_sec??0,endTimeSec:t.end_time_sec??void 0,displayMode:t.display_mode||"square",glitchSlides:[{id:`${r}:default`,score:1,componentKey:t.component_key,props:t.props||{},latexString:(o=t.props)==null?void 0:o.latexString}]},i=n==="mobile-portrait"?"slide-thumbnail-host--portrait":"slide-thumbnail-host--landscape";return s.jsx("div",{className:`gnommo-player-host slide-thumbnail-host ${i}`,children:s.jsx(mv,{presentationId:e,slide:l,slideRegistry:sf,viewportMode:n})})}function ff(e){if(!e)return[];const t=[],n=/\[S(\d+)\]/g;let r;for(;(r=n.exec(e))!==null;)t.push(parseInt(r[1],10));return[...new Set(t)].sort((l,i)=>l-i).map(l=>`S${l}`)}function pg(e,t,n){const r=[...e],[l]=r.splice(t,1);return r.splice(n,0,l),r}function Zi(e){try{const t=e.split(".")[1];return JSON.parse(atob(t.replace(/-/g,"+").replace(/_/g,"/")))}catch{return null}}const hg=[{label:"SQUARE (1:1 inset)",mode:"square"},{label:"FULLSCREEN (16:9 / 1:2)",mode:"fullscreen"}];function mg({onPick:e,onClose:t,title:n="Choose a Slide Template",videoId:r,initialHeader:l=""}){const[i,o]=h.useState(l);h.useEffect(()=>{const a=c=>{c.key==="Escape"&&t()};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[t]);function u(a){const c=df[a.componentKey]||{},m={...c},d=i.trim()||"Header";return"header"in c?m.header=d:"eyebrow"in c&&(m.eyebrow=d),"title"in c&&(m.title=d),{id:`preview-${a.componentKey}-${a.displayMode}`,display_mode:a.displayMode,component_key:a.componentKey,props:m}}return s.jsx("div",{className:"overlay",onClick:t,children:s.jsxs("div",{className:"modal modal-xl",onClick:a=>a.stopPropagation(),children:[s.jsxs("div",{className:"modal-header",children:[s.jsx("span",{className:"modal-title",children:n}),s.jsx("button",{onClick:t,className:"btn-icon",children:"✕"})]}),s.jsxs("div",{className:"tmpl-preview-bar",children:[s.jsx("label",{className:"tmpl-preview-label",children:"Header"}),s.jsx("input",{className:"field-input tmpl-preview-input",placeholder:"Type a heading to preview across all styles…",value:i,onChange:a=>o(a.target.value),autoFocus:!0})]}),s.jsx("div",{className:"modal-scroll-body",children:hg.map(a=>{const c=ug.filter(m=>m.displayMode===a.mode);return c.length===0?null:s.jsxs("div",{className:"template-group",children:[s.jsx("div",{className:"template-group-label",children:a.label}),s.jsx("div",{className:`template-grid template-grid--${a.mode}`,children:c.map(m=>s.jsxs("div",{onClick:()=>e(m,i),className:"template-card",children:[s.jsx("div",{className:`tmpl-thumbnail tmpl-thumbnail--${m.displayMode}`,children:s.jsx(la,{videoId:r||"preview",slide:u(m),viewportMode:"desktop"})}),s.jsx("div",{className:"tmpl-label",children:m.label}),s.jsx("div",{className:"tmpl-desc",children:m.description})]},`${m.componentKey}:${m.displayMode}`))})]},a.mode)})})]})})}function pf({type:e,onPick:t,onPickMultiple:n,onClose:r,multiSelect:l=!1}){const[i,o]=h.useState([]),[u,a]=h.useState(!0),[c,m]=h.useState(""),[d,p]=h.useState(new Set);h.useEffect(()=>{a(!0),fetch(`/api/assets?type=${e}${c?`&q=${encodeURIComponent(c)}`:""}`).then(S=>S.json()).then(S=>o(S.assets||[])).catch(()=>o([])).finally(()=>a(!1))},[e,c]),h.useEffect(()=>{const S=N=>{N.key==="Escape"&&r()};return window.addEventListener("keydown",S),()=>window.removeEventListener("keydown",S)},[r]);function y(S){p(N=>{const v=new Set(N);return v.has(S)?v.delete(S):v.add(S),v})}function x(){const S=i.filter(N=>d.has(N.id)).sort((N,v)=>N.original_filename.localeCompare(v.original_filename));n(S)}return s.jsx("div",{className:"overlay",onClick:r,children:s.jsxs("div",{className:"modal",onClick:S=>S.stopPropagation(),children:[s.jsxs("div",{className:"modal-header",children:[s.jsx("span",{className:"modal-title",children:l?`Select ${e} files`:`Pick a ${e}`}),s.jsx("input",{placeholder:"Search…",value:c,onChange:S=>m(S.target.value),className:"field-input",style:{flex:1,maxWidth:240},autoFocus:!0}),s.jsx("button",{onClick:r,className:"btn-icon",children:"✕"})]}),u&&s.jsx("p",{className:"muted",children:"Loading…"}),!u&&i.length===0&&s.jsxs("p",{className:"muted",children:["No ",e," assets. Upload some on the Assets page first."]}),!u&&i.length>0&&s.jsx("div",{className:"asset-grid",children:i.map(S=>s.jsxs("div",{className:`asset-card${d.has(S.id)?" selected":""}`,onClick:()=>l?y(S.id):t(S),title:S.original_filename,children:[l&&d.has(S.id)&&s.jsx("div",{className:"check-badge",children:"✓"}),S.asset_type==="image"&&s.jsx("img",{src:S.url,alt:"",className:"asset-thumb"}),S.asset_type==="video"&&s.jsx("video",{src:S.url,className:"asset-thumb",muted:!0,playsInline:!0}),s.jsx("div",{className:"asset-name",children:S.original_filename}),S.duration_seconds!=null&&s.jsxs("div",{className:"asset-meta",children:[Number(S.duration_seconds).toFixed(1),"s"]})]},S.id))}),l&&s.jsxs("div",{style:{marginTop:14,display:"flex",justifyContent:"flex-end",gap:8},children:[d.size>0&&s.jsxs("span",{className:"muted",style:{alignSelf:"center"},children:[d.size," selected — will be sorted by filename"]}),s.jsx("button",{onClick:r,className:"btn-ghost",children:"Cancel"}),s.jsxs("button",{onClick:x,disabled:d.size===0,className:"btn-primary",children:["Add ",d.size>0?d.size:""," selected"]})]})]})})}function Ou({field:e,value:t,onChange:n,onRequestImagePick:r}){const l=d=>e.type==="lines"&&Array.isArray(d)?d.join(` `):d??"",[i,o]=h.useState(l(t)),u=h.useRef(null);h.useEffect(()=>{o(l(t))},[JSON.stringify(t)]);function a(d){u.current&&clearTimeout(u.current),u.current=setTimeout(()=>{n(e.type==="lines"?d.split(` `).filter(p=>p.trim()):d)},500)}function c(d){o(d.target.value),a(d.target.value)}function m(){u.current&&(clearTimeout(u.current),u.current=null),n(e.type==="lines"?i.split(` `).filter(d=>d.trim()):i)}return e.type==="image"?s.jsxs("div",{className:"field-row",children:[s.jsx("label",{className:"field-label",children:e.label}),s.jsxs("div",{style:{display:"flex",gap:6,flex:1},children:[s.jsx("input",{value:i,onChange:c,onBlur:m,placeholder:e.placeholder||"https://…",className:"field-input",style:{flex:1}}),s.jsx("button",{onClick:r,className:"btn-pick",children:"Pick from library"})]})]}):e.type==="latex"?s.jsxs("div",{className:"field-row",children:[s.jsx("label",{className:"field-label",children:e.label}),s.jsxs("div",{style:{flex:1},children:[s.jsx("textarea",{value:i,onChange:c,onBlur:m,placeholder:e.placeholder,rows:3,className:"field-input full resize-v mono"}),e.description&&s.jsx("div",{className:"muted",style:{marginTop:4},children:e.description})]})]}):e.type==="textarea"||e.type==="lines"?s.jsxs("div",{className:"field-row",children:[s.jsx("label",{className:"field-label",children:e.label}),s.jsxs("div",{style:{flex:1},children:[s.jsx("textarea",{value:i,onChange:c,onBlur:m,placeholder:e.placeholder,rows:e.type==="lines"?5:3,className:"field-input full resize-v"}),e.description&&s.jsx("div",{className:"muted",style:{marginTop:4},children:e.description})]})]}):s.jsxs("div",{className:"field-row",children:[s.jsx("label",{className:"field-label",children:e.label}),s.jsx("input",{value:i,onChange:c,onBlur:m,placeholder:e.placeholder,className:"field-input",type:e.type==="number"?"number":"text"})]})}function vg({videoId:e,slide:t,selected:n,onSelect:r,onDelete:l}){const[i,o]=h.useState(!1);function u(m){m.stopPropagation(),o(!0)}function a(m){m.stopPropagation(),l(t.id)}function c(m){m.stopPropagation(),o(!1)}return s.jsxs("div",{className:`strip-item${n?" strip-item--selected":""}`,onClick:r,children:[s.jsx(la,{videoId:e,slide:t,viewportMode:"desktop"}),s.jsxs("div",{className:"strip-info",children:[s.jsx("span",{className:"strip-num",children:t.slide_order}),s.jsx("span",{className:"strip-id",children:t.gnommo_slide_id}),s.jsx("span",{className:"strip-type",children:t.component_key||"—"}),i?s.jsxs("span",{className:"strip-confirm",children:[s.jsx("button",{className:"strip-confirm-yes",onClick:a,children:"DEL"}),s.jsx("button",{className:"strip-confirm-no",onClick:c,children:"NO"})]}):s.jsx("button",{className:"strip-delete",onClick:u,title:"Delete slide",children:"✕"})]})]})}function gg({candidate:e,slide:t,authUser:n,onDelete:r,onPromote:l}){const[i,o]=h.useState(!1),u=n&&n.sub===e.proposed_by,a=n&&["editor","admin"].includes(n.role),c={id:`proposal-${e.id}`,display_mode:e.display_mode||t.display_mode,component_key:e.component_key,props:e.props||{}};return s.jsxs("div",{className:"proposal-card",children:[s.jsx("div",{className:"proposal-card__thumb",children:s.jsx(la,{videoId:t.video_id,slide:c,viewportMode:"desktop"})}),s.jsx("div",{className:"proposal-card__meta",children:s.jsx("div",{className:"proposal-card__by",children:e.proposed_by_name||e.proposed_by})}),s.jsxs("div",{className:"proposal-card__actions",children:[a&&s.jsx("button",{className:"btn-primary",style:{fontSize:7,padding:"3px 8px"},onClick:()=>l(e.id),children:"Promote"}),(u||a)&&!i&&s.jsx("button",{className:"btn-delete",onClick:()=>o(!0),children:"✕"}),i&&s.jsxs("span",{className:"confirm-row",children:[s.jsx("button",{className:"btn-confirm-yes",onClick:()=>r(e.id),children:"Del"}),s.jsx("button",{className:"btn-confirm-no",onClick:()=>o(!1),children:"No"})]})]})]})}function yg({slide:e,onDelete:t,onSave:n,onPickImage:r,imagePickResult:l,onOpenTypePicker:i,candidates:o,authToken:u,authUser:a,onPropose:c,onUpdateCandidate:m,onDeleteCandidate:d,onPromoteCandidate:p}){const y=dg(e.component_key),[x,S]=h.useState(e.props||{}),[N,v]=h.useState(e.presenter_notes??""),[f,g]=h.useState(e.start_time_sec??""),[_,P]=h.useState(e.end_time_sec??""),[I,E]=h.useState("idle"),[z,G]=h.useState(!1),[F,Q]=h.useState(!1),[xe,L]=h.useState({}),[H,K]=h.useState("idle"),V=o==null?void 0:o.find(D=>a&&D.proposed_by===a.sub);h.useEffect(()=>{F&&L(V?V.props||{}:e.props||{})},[F,e.id]);const ee=h.useRef({}),w=h.useRef(null),R=h.useRef(null);h.useEffect(()=>{v(e.presenter_notes??"")},[e.presenter_notes]),h.useEffect(()=>{S(e.props||{}),ee.current={}},[e.id]),h.useEffect(()=>{if((l==null?void 0:l.slideId)===e.id){const{fieldName:D,url:Z}=l;S(B=>{const de={...B,[D]:Z};return U({props:de}),de})}},[l]);function U(D){ee.current={...ee.current,...D},w.current&&clearTimeout(w.current),w.current=setTimeout(Y,400)}async function Y(){const D=ee.current;if(ee.current={},Object.keys(D).length===0)return;R.current&&R.current.abort();const Z=new AbortController;R.current=Z,E("saving");try{await n(e.id,D,Z.signal),E("saved"),setTimeout(()=>E("idle"),1800)}catch(B){if(B.name==="AbortError")return;E("error")}}async function J(D={}){w.current&&(clearTimeout(w.current),w.current=null);const Z={...ee.current,...D};if(ee.current={},Object.keys(Z).length===0)return;R.current&&R.current.abort();const B=new AbortController;R.current=B,E("saving");try{await n(e.id,Z,B.signal),E("saved"),setTimeout(()=>E("idle"),1800)}catch(de){if(de.name==="AbortError")return;E("error")}}function Ae(D,Z){const B={...x,[D]:Z};S(B),U({props:B})}return s.jsxs("div",{className:"slide-editor-panel",children:[s.jsxs("div",{className:"slide-editor-title",children:[s.jsx("span",{className:"slide-num",children:e.slide_order}),s.jsx("span",{className:"slide-badge",children:e.gnommo_slide_id}),s.jsx("span",{className:"slide-badge",children:e.component_key||"?"}),s.jsx("div",{style:{flex:1}}),I==="saving"&&s.jsx("span",{className:"saving-dot",children:"saving…"}),I==="saved"&&s.jsx("span",{className:"saved-dot",children:"✓"}),I==="error"&&s.jsx("button",{className:"save-error-btn",onClick:()=>J(),children:"SAVE FAILED — retry"}),z?s.jsxs("span",{className:"confirm-row",children:[s.jsx("span",{className:"confirm-text",children:"Delete?"}),s.jsx("button",{className:"btn-confirm-yes",onClick:()=>t(e.id),children:"Yes"}),s.jsx("button",{className:"btn-confirm-no",onClick:()=>G(!1),children:"No"})]}):s.jsx("button",{className:"btn-delete",onClick:()=>G(!0),children:"✕"})]}),s.jsxs("div",{className:"field-row",style:{marginBottom:8},children:[s.jsx("label",{className:"field-label",children:"Type"}),s.jsxs("button",{className:"btn-change-type",onClick:i,children:[(y==null?void 0:y.label)??e.component_key??"?"," · Change"]})]}),s.jsx("hr",{className:"divider"}),s.jsxs("div",{className:"field-row",children:[s.jsx("label",{className:"field-label",children:"Narration"}),s.jsx("textarea",{value:N,onChange:D=>{v(D.target.value),U({presenter_notes:D.target.value})},onBlur:D=>J({presenter_notes:D.target.value}),placeholder:"Spoken narration for this slide…",rows:4,className:"field-input full resize-v"})]}),(y==null?void 0:y.fields.length)>0&&s.jsxs(s.Fragment,{children:[s.jsx("hr",{className:"divider"}),y.fields.map(D=>s.jsx(Ou,{field:D,value:x[D.name]??"",onChange:Z=>Ae(D.name,Z),onRequestImagePick:D.type==="image"?()=>r(e.id,D.name):void 0},D.name))]}),s.jsx("hr",{className:"divider"}),s.jsxs("div",{style:{display:"flex",gap:16,alignItems:"center",marginBottom:14},children:[s.jsx("label",{className:"field-label inline",children:"Timing"}),s.jsx("input",{type:"number",step:"0.1",min:"0",value:f,onChange:D=>g(D.target.value),onBlur:D=>J({start_time_sec:D.target.value===""?null:parseFloat(D.target.value)}),className:"field-input",style:{width:82},placeholder:"Start"}),s.jsx("span",{className:"muted",children:"→"}),s.jsx("input",{type:"number",step:"0.1",min:"0",value:_,onChange:D=>P(D.target.value),onBlur:D=>J({end_time_sec:D.target.value===""?null:parseFloat(D.target.value)}),className:"field-input",style:{width:82},placeholder:"End"}),s.jsx("span",{className:"muted",children:"seconds"})]}),s.jsx("hr",{className:"divider"}),s.jsxs("div",{className:"proposals-section",children:[s.jsx("div",{className:"proposals-header",children:s.jsxs("span",{className:"sub-label",children:["PROPOSALS (",(o==null?void 0:o.length)??0,")"]})}),(o==null?void 0:o.length)>0&&s.jsx("div",{className:"proposals-grid",children:o.map(D=>s.jsx(gg,{candidate:D,slide:e,authUser:a,onDelete:Z=>d(e.id,Z),onPromote:Z=>p(e.id,Z)},D.id))}),a&&!V&&!F&&s.jsx("button",{className:"btn-add",style:{marginTop:8},onClick:()=>Q(!0),children:"+ Propose Alternate"}),a&&V&&!F&&s.jsx("button",{className:"btn-ghost-sm",style:{marginTop:8},onClick:()=>Q(!0),children:"✎ Edit My Proposal"}),F&&y&&s.jsxs("div",{className:"proposal-form",children:[s.jsx("div",{className:"proposal-form__title",children:V?"Edit My Proposal":"Propose Alternate"}),y.fields.map(D=>s.jsx(Ou,{field:D,value:xe[D.name]??"",onChange:Z=>L(B=>({...B,[D.name]:Z})),onRequestImagePick:void 0},D.name)),H==="error"&&s.jsx("div",{className:"error-text",style:{marginTop:4},children:"Save failed — try again"}),s.jsxs("div",{style:{display:"flex",gap:8,marginTop:10},children:[s.jsx("button",{className:"btn-primary",disabled:H==="saving",onClick:async()=>{K("saving");try{V?await m(e.id,V.id,{component_key:e.component_key,display_mode:e.display_mode,props:xe}):await c(e.id,{component_key:e.component_key,display_mode:e.display_mode,props:xe}),K("idle"),Q(!1)}catch{K("error")}},children:H==="saving"?"Saving…":"Submit"}),s.jsx("button",{className:"btn-ghost",onClick:()=>{Q(!1),K("idle")},children:"Cancel"})]})]})]})]})}function zu({label:e,segmentType:t,segments:n,videoId:r,onAddSegments:l,onDelete:i,onMove:o}){const[u,a]=h.useState(null),[c,m]=h.useState(!1);async function d(p){if(m(!1),p.length===0)return;const y=[...p].sort((x,S)=>x.original_filename.localeCompare(S.original_filename));await l(y.map(x=>x.id),t)}return s.jsxs("div",{style:{marginBottom:20},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:8},children:[s.jsx("span",{className:"sub-label",children:e}),s.jsx("button",{className:"btn-add",onClick:()=>m(!0),children:"+ Add Videos"})]}),n.length===0&&s.jsxs("p",{className:"muted",style:{paddingLeft:4},children:["No ",e.toLowerCase()," yet."]}),n.map((p,y)=>s.jsxs("div",{className:"segment-row",children:[s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2,flexShrink:0},children:[s.jsx("button",{className:"btn-arrow",disabled:y===0,onClick:()=>o(t,y,y-1),children:"▲"}),s.jsx("button",{className:"btn-arrow",disabled:y===n.length-1,onClick:()=>o(t,y,y+1),children:"▼"})]}),p.url&&s.jsx("video",{src:p.url,className:"segment-thumb",muted:!0,playsInline:!0}),s.jsxs("div",{style:{flex:1,minWidth:0},children:[s.jsx("div",{className:"segment-name",children:p.asset_name||p.source_file||p.segment_key}),s.jsxs("div",{className:"muted",children:[p.segment_key,p.asset_duration!=null&&` · ${Number(p.asset_duration).toFixed(1)}s`]})]}),u!==p.id?s.jsx("button",{className:"btn-delete",onClick:()=>a(p.id),title:"Remove",children:"✕"}):s.jsxs("span",{className:"confirm-row",children:[s.jsx("span",{className:"confirm-text",children:"Remove?"}),s.jsx("button",{className:"btn-confirm-yes",onClick:()=>{i(p.id),a(null)},children:"Yes"}),s.jsx("button",{className:"btn-confirm-no",onClick:()=>a(null),children:"No"})]})]},p.id)),c&&s.jsx(pf,{type:"video",multiSelect:!0,onPickMultiple:d,onClose:()=>m(!1)})]})}function xg({slideCount:e,onImport:t}){const[n,r]=h.useState(""),[l,i]=h.useState(!0),o=ff(n);return h.useEffect(()=>{e>0&&i(!1)},[e>0]),s.jsxs("section",{className:"section",children:[s.jsxs("div",{className:"section-header",children:[s.jsx("h2",{className:"section-title",children:"Manuscript"}),s.jsx("button",{className:"btn-ghost-sm",onClick:()=>i(u=>!u),children:l?"▲ collapse":"▼ expand"})]}),l&&s.jsxs(s.Fragment,{children:[s.jsx("textarea",{value:n,onChange:u=>r(u.target.value),rows:10,placeholder:`Paste your narration script here. Mark slide transitions with [S1], [S2], [S3]… Example: [S1] Welcome to this course. Today we'll cover… [S2] Let's start with the fundamentals of…`,className:"field-input full resize-v mono"}),s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14,marginTop:10},children:[n.trim()&&o.length===0&&s.jsx("span",{className:"muted",children:"No [S1]/[S2]… markers found yet."}),o.length>0&&s.jsxs(s.Fragment,{children:[s.jsxs("span",{style:{color:"#00ffff",fontSize:8},children:["Found ",o.length," slide",o.length!==1?"s":"",": ",o.join(" · ")]}),s.jsxs("button",{className:"btn-primary",onClick:()=>t(n,o),children:["Create ",o.length," slides →"]})]})]})]})]})}function Sg(){var xn,tr,nr;const{id:e}=ef(),t=mn(),[n,r]=h.useState(null),[l,i]=h.useState([]),[o,u]=h.useState([]),[a,c]=h.useState([]),[m,d]=h.useState(!0),[p,y]=h.useState(null),[x,S]=h.useState(!1),[N,v]=h.useState(!1),[f,g]=h.useState(null),[_,P]=h.useState(null),[I,E]=h.useState("desktop"),[z,G]=h.useState(0),[F,Q]=h.useState(null),[xe,L]=h.useState(null),[H,K]=h.useState(null),[V,ee]=h.useState(null),[w,R]=h.useState(""),[U,Y]=h.useState("draft"),[J,Ae]=h.useState(""),[D,Z]=h.useState(()=>localStorage.getItem("gnommoeditor_token")),[B,de]=h.useState(()=>{const j=localStorage.getItem("gnommoeditor_token");return j?Zi(j):null}),[be,Pt]=h.useState(!1),[A,Qe]=h.useState(""),[xi,Ce]=h.useState(new Map);h.useEffect(()=>{const $=new URLSearchParams(t.search).get("token");$&&(localStorage.setItem("gnommoeditor_token",$),Z($),de(Zi($)))},[]);function ue(j){u(j.filter($=>($.segment_type??"raw")==="raw")),c(j.filter($=>$.segment_type==="final"))}const ct=h.useCallback(()=>{d(!0),y(null),fetch(`/api/videos/${e}`).then(j=>j.ok?j.json():j.json().then($=>Promise.reject($.error))).then(j=>{r(j.video),i(j.slides||[]),ue(j.narrationSegments||[]),R(j.video.title||""),Y(j.video.status||"draft"),Ae(j.video.course_code||"")}).catch(j=>y(String(j))).finally(()=>d(!1))},[e]);h.useEffect(()=>{ct()},[ct]);async function vn(){S(!0),v(!1);try{(await fetch(`/api/videos/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:w,status:U,course_code:J})})).ok&&(v(!0),setTimeout(()=>v(!1),2e3))}finally{S(!1)}}async function Kr(j,$=""){Q(null);const k=cg[j.componentKey],T=k?{...k.props,...k.latexString!==void 0?{latexString:k.latexString}:{}}:{},b=df[j.componentKey]||{},te={...T,...b};$.trim()&&("header"in b?te.header=$.trim():"eyebrow"in b&&(te.eyebrow=$.trim()));const he=await fetch(`/api/videos/${e}/slides`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({component_key:j.componentKey,display_mode:j.displayMode||"fullscreen",props:te})});if(he.ok){const ve=await he.json();i(Sn=>[...Sn,ve.slide]),nt(ve.slide)}}async function Qr(j){if(!xe)return;Q(null);const $=await fetch(`/api/videos/${e}/import-manuscript`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({manuscript:xe,component_key:j.componentKey,display_mode:j.displayMode||"fullscreen"})});if($.ok){const k=await $.json();i(k.slides),L(null)}}function Si(j,$=""){F==="add-single"&&Kr(j,$),F==="import"&&Qr(j),F==="change-type"&&(Q(null),gn(f,{component_key:j.componentKey,display_mode:j.displayMode}))}async function Yr(j){await fetch(`/api/slides/${j}`,{method:"DELETE"}),i($=>$.filter(k=>k.id!==j)),f===j&&g(null)}async function gn(j,$,k){const T=await fetch(`/api/slides/${j}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify($),signal:k});if(!T.ok)throw new Error(`Save failed (${T.status})`);const b=await T.json();i(te=>te.map(he=>he.id===j?b.slide:he)),G(te=>te+1)}function nt(j){g(j.id),P(j.gnommo_slide_id||j.id),Tt(j.id)}async function Tt(j){try{const $=await fetch(`/api/slides/${j}/candidates`);if(!$.ok)return;const k=await $.json();Ce(T=>new Map(T).set(j,k.candidates||[]))}catch{}}async function Jr(j,$){const k=await fetch(`/api/slides/${j}/candidates`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${D}`},body:JSON.stringify($)});if(!k.ok){const T=await k.json().catch(()=>({}));throw new Error(T.error||`HTTP ${k.status}`)}await Tt(j)}async function wi(j,$,k){const T=await fetch(`/api/slides/${j}/candidates/${$}`,{method:"PUT",headers:{"Content-Type":"application/json",Authorization:`Bearer ${D}`},body:JSON.stringify(k)});if(!T.ok){const b=await T.json().catch(()=>({}));throw new Error(b.error||`HTTP ${T.status}`)}await Tt(j)}async function yn(j,$){(await fetch(`/api/slides/${j}/candidates/${$}`,{method:"DELETE",headers:{Authorization:`Bearer ${D}`}})).ok&&Ce(T=>{const b=new Map(T),te=(b.get(j)||[]).filter(he=>he.id!==$);return b.set(j,te),b})}async function Xr(j,$){const k=await fetch(`/api/slides/${j}/candidates/${$}/promote`,{method:"POST",headers:{Authorization:`Bearer ${D}`}});if(!k.ok)return;const T=await k.json();i(b=>b.map(te=>te.id===j?T.slide:te)),G(b=>b+1),await Tt(j)}async function It(j,$){const k=await fetch(`/api/videos/${e}/narration-segments`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({asset_ids:j,segment_type:$})});if(k.ok){const T=await k.json();$==="final"?c(b=>[...b,...T.segments]):u(b=>[...b,...T.segments])}}async function er(j){await fetch(`/api/videos/${e}/narration-segments/${j}`,{method:"DELETE"}),u($=>$.filter(k=>k.id!==j)),c($=>$.filter(k=>k.id!==j))}async function Zr(j,$,k){const T=j==="final"?c:u,te=pg(j==="final"?a:o,$,k);T(te),await fetch(`/api/videos/${e}/narration-segments/reorder`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:te.map(he=>he.id)})})}async function _i(j){if(!H)return;const{slideId:$,fieldName:k}=H;K(null),ee({slideId:$,fieldName:k,url:j.url});const T=l.find(te=>te.id===$),b={...(T==null?void 0:T.props)||{},[k]:j.url};await gn($,{props:b})}if(m)return s.jsx("div",{className:"editor-page",children:s.jsx("p",{className:"muted",children:"Loading…"})});if(p)return s.jsx("div",{className:"editor-page",children:s.jsxs("p",{className:"error-text",children:["Error: ",p]})});if(!n)return null;const _e=l.find(j=>j.id===f)??null;return s.jsxs("div",{className:"editor-page",children:[s.jsxs("div",{className:"editor-header",children:[s.jsx(bn,{to:"/",className:"back-link",children:"← Videos"}),s.jsx("input",{value:w,onChange:j=>R(j.target.value),onKeyDown:j=>j.key==="Enter"&&vn(),className:"title-input",placeholder:"Presentation title…"}),s.jsxs("select",{value:U,onChange:j=>Y(j.target.value),className:"field-select",children:[s.jsx("option",{value:"draft",children:"draft"}),s.jsx("option",{value:"scripted",children:"scripted"}),s.jsx("option",{value:"complete",children:"complete"})]}),s.jsx("input",{value:J,onChange:j=>Ae(j.target.value),className:"field-input",style:{width:150},placeholder:"Course code"}),s.jsx("button",{onClick:vn,disabled:x,className:"btn-primary",children:x?"Saving…":N?"Saved ✓":"Save"}),s.jsx("a",{href:`/api/videos/${e}/export`,target:"_blank",rel:"noreferrer",className:"export-link",children:"Export ↗"}),s.jsx("div",{className:"auth-indicator",onClick:()=>{Pt(j=>!j),Qe("")},children:B?s.jsxs("span",{className:"auth-indicator__name",children:["⬤ ",B.name||B.email||B.sub]}):s.jsx("span",{className:"auth-indicator__guest",children:"Not logged in"})}),be&&s.jsxs("div",{className:"auth-token-popup",children:[s.jsx("input",{className:"field-input",style:{width:260,fontSize:8},placeholder:"Paste JWT token…",value:A,onChange:j=>Qe(j.target.value),autoFocus:!0}),s.jsx("button",{className:"btn-primary",style:{fontSize:7},onClick:()=>{const j=A.trim();j&&(localStorage.setItem("gnommoeditor_token",j),Z(j),de(Zi(j)),Pt(!1))},children:"Set"}),D&&s.jsx("button",{className:"btn-ghost-sm",onClick:()=>{localStorage.removeItem("gnommoeditor_token"),Z(null),de(null),Pt(!1)},children:"Log out"})]})]}),s.jsx(xg,{slideCount:l.length,onImport:(j,$)=>{L(j),Q("import")}}),s.jsxs("section",{className:"section",children:[s.jsx("div",{className:"section-header",style:{marginBottom:16},children:s.jsx("h2",{className:"section-title",children:"Narration"})}),s.jsx(zu,{label:"Raw Footage",segmentType:"raw",segments:o,videoId:e,onAddSegments:It,onDelete:er,onMove:Zr}),s.jsx("hr",{className:"divider"}),s.jsx(zu,{label:"Final (for player)",segmentType:"final",segments:a,videoId:e,onAddSegments:It,onDelete:er,onMove:Zr})]}),s.jsxs("section",{className:"section",children:[s.jsxs("div",{className:"section-header",children:[s.jsxs("h2",{className:"section-title",children:["Slides (",l.length,")"]}),s.jsx("button",{onClick:()=>Q("add-single"),className:"btn-add",children:"+ Add Slide"})]}),l.length===0&&s.jsx("p",{className:"muted",children:'Paste a manuscript above to create slides, or click "+ Add Slide".'}),l.length>0&&s.jsxs("div",{className:"slides-pane",children:[s.jsxs("div",{className:"slides-filmstrip",children:[l.map(j=>s.jsx(vg,{videoId:e,slide:j,selected:f===j.id,onSelect:()=>nt(j),onDelete:Yr},j.id)),s.jsx("div",{className:"strip-add",children:s.jsx("button",{onClick:()=>Q("add-single"),className:"btn-add",children:"+ Add"})})]}),s.jsxs("div",{className:"slides-editor",children:[s.jsxs("div",{className:"slide-editor-player-host",children:[s.jsxs("div",{className:"slide-editor-player-controls",children:[s.jsx("span",{className:"muted",children:_e?`${_e.gnommo_slide_id} · ${_e.component_key||"?"}`:"Select a slide"}),s.jsxs("div",{style:{display:"flex",gap:4},children:[s.jsx("button",{className:I==="desktop"?"btn-confirm-yes":"btn-confirm-no",onClick:()=>E("desktop"),children:"16:9"}),s.jsx("button",{className:I==="mobile-portrait"?"btn-confirm-yes":"btn-confirm-no",onClick:()=>E("mobile-portrait"),children:"1:2"})]})]}),s.jsx(ts,{label:"player preview",children:s.jsx(fg,{videoId:e,targetSlideId:_??((xn=l[0])==null?void 0:xn.gnommo_slide_id),viewportMode:I,refreshKey:z})})]}),_e?s.jsx(yg,{slide:_e,onDelete:Yr,onSave:gn,onPickImage:(j,$)=>K({slideId:j,fieldName:$}),imagePickResult:V,onOpenTypePicker:()=>Q("change-type"),candidates:xi.get(_e.id)||[],authToken:D,authUser:B,onPropose:Jr,onUpdateCandidate:wi,onDeleteCandidate:yn,onPromoteCandidate:Xr},_e.id):s.jsx("p",{className:"slide-editor-empty",children:"Select a slide to edit."})]})]})]}),F&&s.jsx(mg,{onPick:Si,onClose:()=>{Q(null),L(null)},title:F==="import"?`Choose template for ${xe?ff(xe).length:""} imported slides`:F==="change-type"?"Change Slide Type":"Choose a Slide Template",videoId:e,initialHeader:F==="change-type"&&(((tr=_e==null?void 0:_e.props)==null?void 0:tr.header)||((nr=_e==null?void 0:_e.props)==null?void 0:nr.eyebrow))||""}),H&&s.jsx(pf,{type:"image",onPick:_i,onClose:()=>K(null)})]})}function wg(e){return new Promise(t=>{const n=URL.createObjectURL(e),r=l=>{URL.revokeObjectURL(n),t(l)};if(e.type.startsWith("image/")){const l=new Image;l.onload=()=>r({width:l.naturalWidth,height:l.naturalHeight,duration:null}),l.onerror=()=>r({width:null,height:null,duration:null}),l.src=n}else if(e.type.startsWith("video/")){const l=document.createElement("video");l.preload="metadata",l.onloadedmetadata=()=>r({width:l.videoWidth,height:l.videoHeight,duration:l.duration}),l.onerror=()=>r({width:null,height:null,duration:null}),l.src=n}else if(e.type.startsWith("audio/")){const l=document.createElement("audio");l.preload="metadata",l.onloadedmetadata=()=>r({width:null,height:null,duration:l.duration}),l.onerror=()=>r({width:null,height:null,duration:null}),l.src=n}else r({width:null,height:null,duration:null})})}function _g(e){return new Promise(t=>{const n=URL.createObjectURL(e),r=document.createElement("video"),l=document.createElement("canvas");r.muted=!0,r.preload="metadata",r.onloadeddata=()=>{r.currentTime=.5},r.onseeked=()=>{l.width=Math.min(r.videoWidth,400),l.height=Math.round(l.width*(r.videoHeight/r.videoWidth)),l.getContext("2d").drawImage(r,0,0,l.width,l.height),URL.revokeObjectURL(n),t(l.toDataURL("image/jpeg",.7))},r.onerror=()=>{URL.revokeObjectURL(n),t(null)},r.src=n})}function ia(e){return e?e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/1024/1024).toFixed(1)} MB`:`${(e/1024/1024/1024).toFixed(2)} GB`:"—"}function oa(e){if(!e)return null;const t=Math.floor(e/60),n=Math.floor(e%60);return`${t}:${String(n).padStart(2,"0")}`}const hf={image:"#4a9eff",video:"#e06c4a",audio:"#6cb86e",other:"#999"};function kg({asset:e,onClose:t}){h.useLayoutEffect(()=>{function a(c){c.key==="Escape"&&t()}return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[t]);const[n,r]=h.useState(!1);function l(){navigator.clipboard.writeText(e.url),r(!0),setTimeout(()=>r(!1),1500)}const i=e.width&&e.height?`${e.width}×${e.height}`:null,o=oa(e.duration_seconds),u=ia(e.file_size_bytes);return s.jsx("div",{style:M.modalOverlay,onClick:t,children:s.jsxs("div",{style:M.modalBox,onClick:a=>a.stopPropagation(),children:[s.jsx("button",{style:M.modalClose,onClick:t,children:"✕"}),s.jsxs("div",{style:M.modalMedia,children:[e.asset_type==="video"&&s.jsx("video",{src:e.url,controls:!0,autoPlay:!0,style:M.modalVideo}),e.asset_type==="image"&&s.jsx("img",{src:e.url,alt:"",style:M.modalImage}),e.asset_type==="audio"&&s.jsxs("div",{style:M.modalAudioWrap,children:[s.jsx("div",{style:M.modalAudioIcon,children:"♫"}),s.jsx("audio",{src:e.url,controls:!0,style:{width:"100%"},autoPlay:!0})]})]}),s.jsxs("div",{style:M.modalInfo,children:[s.jsx("div",{style:M.modalFilename,children:e.original_filename||e.filename}),s.jsxs("div",{style:M.meta,children:[s.jsx("span",{style:{...M.typeBadge,position:"static",background:hf[e.asset_type]},children:e.asset_type}),i&&s.jsx("span",{children:i}),o&&s.jsx("span",{children:o}),u&&s.jsx("span",{children:u})]}),s.jsx("button",{style:{...M.btn,maxWidth:120,marginTop:8},onClick:l,children:n?"✓ Copied":"Copy URL"})]})]})})}function jg({asset:e,onDelete:t,onPreview:n}){const[r,l]=h.useState(!1),[i,o]=h.useState(!1),[u,a]=h.useState(!1);function c(){navigator.clipboard.writeText(e.url),l(!0),setTimeout(()=>l(!1),1500)}async function m(){if(!i){o(!0);return}await fetch(`/api/assets/${e.id}`,{method:"DELETE"}),t(e.id)}const d=e.width&&e.height?`${e.width}×${e.height}`:null,p=oa(e.duration_seconds),y=ia(e.file_size_bytes),x=e.url&&["video","image","audio"].includes(e.asset_type);return s.jsxs("div",{style:M.card,onMouseLeave:()=>{o(!1),a(!1)},children:[s.jsxs("div",{style:{...M.thumb,cursor:x?"pointer":"default"},onClick:()=>x&&n(e),onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:[e.asset_type==="image"&&e.url?s.jsx("img",{src:e.url,alt:"",style:M.thumbImg}):e.asset_type==="video"?s.jsx("video",{src:e.url,preload:"metadata",muted:!0,style:{...M.thumbImg,pointerEvents:"none"}}):e.asset_type==="audio"?s.jsx("div",{style:{...M.thumbPlaceholder,background:"#1a2e1a"},children:s.jsx("span",{style:M.typeIcon,children:"♫"})}):s.jsx("div",{style:{...M.thumbPlaceholder,background:"#2a2a2a"},children:s.jsx("span",{style:M.typeIcon,children:"📄"})}),x&&u&&s.jsx("div",{style:M.thumbHover,children:s.jsx("span",{style:M.thumbHoverIcon,children:e.asset_type==="audio"?"▶":"⛶"})}),s.jsx("span",{style:{...M.typeBadge,background:hf[e.asset_type]},children:e.asset_type})]}),s.jsxs("div",{style:M.cardBody,children:[s.jsx("div",{style:M.filename,title:e.original_filename,children:e.original_filename||e.filename}),s.jsxs("div",{style:M.meta,children:[d&&s.jsx("span",{children:d}),p&&s.jsx("span",{children:p}),y&&s.jsx("span",{children:y})]}),e.description&&s.jsx("div",{style:M.desc,children:e.description})]}),s.jsxs("div",{style:M.actions,children:[s.jsx("button",{style:M.btn,onClick:c,children:r?"✓ Copied":"Copy URL"}),s.jsx("button",{style:{...M.btn,...i?M.btnDanger:{}},onClick:m,children:i?"Confirm?":"Delete"})]})]})}function Ng({item:e}){return s.jsxs("div",{style:{...M.card,opacity:.7,border:"1px dashed #555"},children:[s.jsxs("div",{style:M.thumb,children:[e.preview?s.jsx("img",{src:e.preview,alt:"",style:M.thumbImg}):e.videoThumb?s.jsx("img",{src:e.videoThumb,alt:"",style:M.thumbImg}):s.jsx("div",{style:{...M.thumbPlaceholder,background:"#1a1a2a"},children:s.jsx("span",{style:M.typeIcon,children:e.file.type.startsWith("video/")?"▶":e.file.type.startsWith("audio/")?"♫":"📄"})}),e.uploading&&s.jsx("div",{style:M.uploadOverlay,children:"Uploading…"})]}),s.jsxs("div",{style:M.cardBody,children:[s.jsx("div",{style:M.filename,children:e.file.name}),s.jsxs("div",{style:M.meta,children:[e.meta.width&&e.meta.height&&s.jsxs("span",{children:[e.meta.width,"×",e.meta.height]}),e.meta.duration&&s.jsx("span",{children:oa(e.meta.duration)}),s.jsx("span",{children:ia(e.file.size)})]})]})]})}function Cg(){const[e,t]=h.useState([]),[n,r]=h.useState("all"),[l,i]=h.useState(""),[o,u]=h.useState(!0),[a,c]=h.useState(null),[m,d]=h.useState([]),[p,y]=h.useState([]),[x,S]=h.useState(!1),[N,v]=h.useState(!1),[f,g]=h.useState(null),_=h.useRef(),P=h.useCallback(async()=>{c(null);try{const L=new URLSearchParams;n!=="all"&&L.set("type",n),l&&L.set("q",l);const H=await fetch(`/api/assets?${L}`);if(!H.ok)throw new Error(`Server error ${H.status}`);const K=await H.json();t(K.assets||[])}catch(L){c(L.message)}finally{u(!1)}},[n,l]);h.useEffect(()=>{P()},[P]);async function I(L){const H=Array.from(L),K=await Promise.all(H.map(async V=>{const ee=await wg(V),w=V.type.startsWith("image/")?URL.createObjectURL(V):null,R=V.type.startsWith("video/")?await _g(V):null;return{file:V,meta:ee,preview:w,videoThumb:R,uploading:!1}}));y(V=>[...V,...K])}function E(L){I(L.target.files),L.target.value=""}function z(L){L.preventDefault(),v(!1),I(L.dataTransfer.files)}async function G(){if(x||!p.length)return;S(!0),d([]);const L=[],H=[];for(let K=0;Kw.map((R,U)=>U===K?{...R,uploading:!0}:R));try{const w=new FormData;w.append("file",V),ee.width!=null&&w.append("width",ee.width),ee.height!=null&&w.append("height",ee.height),ee.duration!=null&&w.append("duration",ee.duration);const R=await fetch("/api/assets/upload",{method:"POST",body:w}),U=await R.json();R.ok?L.push(U.asset):H.push(`${V.name}: ${U.error||R.status}`)}catch(w){H.push(`${V.name}: ${w.message}`)}}t(K=>[...L,...K]),y([]),d(H),S(!1)}function F(L){y(H=>{const K=[...H];return K[L].preview&&URL.revokeObjectURL(K[L].preview),K.splice(L,1),K})}function Q(L){t(H=>H.filter(K=>K.id!==L))}const xe=["all","image","video","audio"];return s.jsxs("div",{style:M.page,children:[s.jsxs("div",{style:M.header,children:[s.jsx("h1",{style:M.title,children:"Asset Library"}),s.jsx("button",{style:M.uploadBtn,onClick:()=>_.current.click(),children:"+ Upload Files"}),s.jsx("input",{ref:_,type:"file",multiple:!0,accept:"image/*,video/*,audio/*",style:{display:"none"},onChange:E})]}),s.jsx("div",{style:{...M.dropZone,...N?M.dropZoneActive:{}},onDragOver:L=>{L.preventDefault(),v(!0)},onDragLeave:()=>v(!1),onDrop:z,onClick:()=>!p.length&&_.current.click(),children:N?"Drop to stage files":"Drag & drop images, videos, or audio here"}),p.length>0&&s.jsxs("div",{style:M.section,children:[s.jsxs("div",{style:M.sectionHeader,children:[s.jsxs("span",{style:M.sectionTitle,children:["Staged — ",p.length," file",p.length>1?"s":""]}),s.jsxs("div",{style:{display:"flex",gap:8},children:[s.jsx("button",{style:M.btn,onClick:()=>y([]),children:"Clear"}),s.jsx("button",{style:{...M.btn,...M.uploadBtn},onClick:G,disabled:x,children:x?"Uploading…":`Upload ${p.length} file${p.length>1?"s":""}`})]})]}),s.jsx("div",{style:M.grid,children:p.map((L,H)=>s.jsxs("div",{style:{position:"relative"},children:[s.jsx(Ng,{item:L}),!L.uploading&&s.jsx("button",{style:M.removeBtn,onClick:()=>F(H),title:"Remove",children:"×"})]},H))})]}),s.jsxs("div",{style:M.toolbar,children:[s.jsx("div",{style:M.tabs,children:xe.map(L=>s.jsxs("button",{style:{...M.tab,...n===L?M.tabActive:{}},onClick:()=>r(L),children:[L.charAt(0).toUpperCase()+L.slice(1),L!=="all"&&s.jsx("span",{style:M.tabCount,children:e.filter(H=>H.asset_type===L).length||""})]},L))}),s.jsx("input",{style:M.searchInput,placeholder:"Search by filename…",value:l,onChange:L=>i(L.target.value)})]}),m.length>0&&s.jsxs("div",{style:M.errorBox,children:[s.jsx("strong",{children:"Upload failed:"}),s.jsx("ul",{style:{margin:"4px 0 0 0",paddingLeft:20},children:m.map((L,H)=>s.jsx("li",{children:L},H))}),s.jsx("button",{style:M.errorDismiss,onClick:()=>d([]),children:"✕"})]}),o?s.jsx("p",{style:{color:"#888"},children:"Loading…"}):a?s.jsxs("div",{style:M.errorBox,children:["Backend unavailable: ",a,s.jsx("button",{style:M.errorDismiss,onClick:P,children:"Retry"})]}):e.length===0?s.jsx("p",{style:{color:"#888"},children:l||n!=="all"?"No assets match.":"No assets yet. Upload some files above."}):s.jsx("div",{style:M.grid,children:e.map(L=>s.jsx(jg,{asset:L,onDelete:Q,onPreview:g},L.id))}),f&&s.jsx(kg,{asset:f,onClose:()=>g(null)})]})}const M={page:{fontFamily:"sans-serif",maxWidth:1200,margin:"0 auto",padding:"2rem 1rem",background:"#0f0f17",minHeight:"100vh",color:"#e0e0e0"},header:{display:"flex",alignItems:"center",gap:16,marginBottom:"1.5rem"},title:{margin:0,fontSize:24,fontWeight:700},uploadBtn:{marginLeft:"auto",padding:"8px 18px",background:"#4a9eff",color:"#fff",border:"none",borderRadius:6,cursor:"pointer",fontWeight:600,fontSize:14},dropZone:{border:"2px dashed #333",borderRadius:10,padding:"2rem",textAlign:"center",color:"#555",cursor:"pointer",marginBottom:"1.5rem",transition:"all 0.15s",fontSize:14},dropZoneActive:{borderColor:"#4a9eff",background:"#0a1a2e",color:"#4a9eff"},section:{marginBottom:"2rem"},sectionHeader:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12},sectionTitle:{fontWeight:600,fontSize:14,color:"#aaa"},toolbar:{display:"flex",alignItems:"center",gap:12,marginBottom:"1.5rem",flexWrap:"wrap"},tabs:{display:"flex",gap:4},tab:{padding:"6px 14px",background:"transparent",border:"1px solid #333",borderRadius:20,cursor:"pointer",color:"#888",fontSize:13,display:"flex",alignItems:"center",gap:6},tabActive:{background:"#1e2a3a",borderColor:"#4a9eff",color:"#4a9eff"},tabCount:{background:"#333",borderRadius:10,padding:"1px 6px",fontSize:11},searchInput:{padding:"6px 12px",background:"#1a1a2a",border:"1px solid #333",borderRadius:6,color:"#e0e0e0",fontSize:13,width:220,outline:"none"},grid:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gap:16},card:{background:"#16161f",border:"1px solid #2a2a3a",borderRadius:10,overflow:"hidden",display:"flex",flexDirection:"column"},thumb:{position:"relative",height:140,background:"#0a0a12",flexShrink:0},thumbImg:{width:"100%",height:"100%",objectFit:"cover",display:"block"},thumbPlaceholder:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},typeIcon:{fontSize:36,opacity:.5},typeBadge:{position:"absolute",top:8,right:8,padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,color:"#fff"},uploadOverlay:{position:"absolute",inset:0,background:"rgba(0,0,0,0.6)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:13,color:"#fff"},cardBody:{padding:"10px 12px",flex:1},filename:{fontSize:13,fontWeight:500,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",marginBottom:4},meta:{display:"flex",gap:8,flexWrap:"wrap",fontSize:11,color:"#666"},desc:{fontSize:11,color:"#888",marginTop:4,overflow:"hidden",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"},actions:{display:"flex",borderTop:"1px solid #2a2a3a",padding:"8px 10px",gap:6},btn:{flex:1,padding:"5px 0",background:"#1e1e2e",border:"1px solid #333",borderRadius:5,color:"#aaa",cursor:"pointer",fontSize:12},btnDanger:{background:"#3a1a1a",borderColor:"#7a3030",color:"#e06c4a"},removeBtn:{position:"absolute",top:6,left:6,width:22,height:22,background:"rgba(0,0,0,0.7)",border:"none",borderRadius:"50%",color:"#fff",cursor:"pointer",fontSize:14,display:"flex",alignItems:"center",justifyContent:"center",lineHeight:1},errorBox:{position:"relative",background:"#2a1010",border:"1px solid #7a3030",borderRadius:8,padding:"10px 40px 10px 14px",marginBottom:16,color:"#e06c4a",fontSize:13},errorDismiss:{position:"absolute",top:8,right:10,background:"none",border:"none",color:"#e06c4a",cursor:"pointer",fontSize:16},thumbHover:{position:"absolute",inset:0,background:"rgba(0,0,0,0.45)",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:0},thumbHoverIcon:{fontSize:32,color:"#fff",textShadow:"0 2px 8px rgba(0,0,0,0.8)"},modalOverlay:{position:"fixed",inset:0,background:"rgba(0,0,0,0.85)",zIndex:1e3,display:"flex",alignItems:"center",justifyContent:"center",padding:"2rem"},modalBox:{position:"relative",background:"#16161f",borderRadius:12,overflow:"hidden",maxWidth:"90vw",maxHeight:"90vh",display:"flex",flexDirection:"column",boxShadow:"0 24px 80px rgba(0,0,0,0.8)"},modalClose:{position:"absolute",top:12,right:14,zIndex:10,background:"rgba(0,0,0,0.6)",border:"none",color:"#fff",width:32,height:32,borderRadius:"50%",cursor:"pointer",fontSize:16,display:"flex",alignItems:"center",justifyContent:"center"},modalMedia:{flex:1,overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center",background:"#0a0a12",minHeight:200},modalVideo:{maxWidth:"90vw",maxHeight:"75vh",display:"block"},modalImage:{maxWidth:"90vw",maxHeight:"75vh",objectFit:"contain",display:"block"},modalAudioWrap:{display:"flex",flexDirection:"column",alignItems:"center",gap:20,padding:"3rem 4rem"},modalAudioIcon:{fontSize:64,opacity:.3},modalInfo:{padding:"14px 18px",borderTop:"1px solid #2a2a3a",display:"flex",flexDirection:"column",gap:6},modalFilename:{fontWeight:600,fontSize:15,color:"#e0e0e0",wordBreak:"break-all"}};function Eg(){const{id:e}=ef();return s.jsx(of,{to:`/videos/${e}/edit`,replace:!0})}function Pg(){const{pathname:e}=mn();return s.jsxs("nav",{className:"nav",children:[s.jsx(bn,{to:"/",className:"nav-logo",children:"GNOMMO EDITOR"}),s.jsx("div",{className:"nav-spacer"}),s.jsx(bn,{to:"/",className:`nav-link${e==="/"?" active":""}`,children:"VIDEOS"}),s.jsx(bn,{to:"/assets",className:`nav-link${e.startsWith("/assets")?" active":""}`,children:"ASSETS"})]})}function Tg(){return s.jsxs(Wm,{children:[s.jsx(Pg,{}),s.jsxs(Dm,{children:[s.jsx(_n,{path:"/",element:s.jsx(Km,{})}),s.jsx(_n,{path:"/videos/:id",element:s.jsx(Eg,{})}),s.jsx(_n,{path:"/videos/:id/edit",element:s.jsx(ts,{label:"video editor",children:s.jsx(Sg,{})})}),s.jsx(_n,{path:"/assets",element:s.jsx(ts,{label:"assets page",children:s.jsx(Cg,{})})}),s.jsx(_n,{path:"*",element:s.jsx(of,{to:"/",replace:!0})})]})]})}Kd(document.getElementById("root")).render(s.jsx(h.StrictMode,{children:s.jsx(Tg,{})}));